Documentation index for AI agents

GS2-Chat SDK API 레퍼런스

각종 프로그래밍 언어용 GS2-Chat SDK의 모델 사양과 API 레퍼런스

모델

Namespace

네임스페이스

네임스페이스는 하나의 프로젝트 내에서 동일한 서비스를 서로 다른 용도로 여러 개 이용하기 위한 엔티티입니다.
GS2의 각 서비스는 네임스페이스 단위로 관리됩니다. 네임스페이스가 다르면 동일한 서비스라도 완전히 독립된 데이터 공간으로 취급됩니다.

따라서 각 서비스의 이용을 시작하려면 먼저 네임스페이스를 생성해야 합니다.

상세
타입활성화 조건필수기본값값 제한설명
namespaceIdstring
~ 1024자네임스페이스 GRN
※ 서버가 자동으로 설정
namestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
descriptionstring~ 1024자설명문
transactionSettingTransactionSetting트랜잭션 설정
채팅 서비스 내에서 트랜잭션 처리 방법을 제어하기 위한 설정입니다.
allowCreateRoombooltrue게임 플레이어에 의한 룸 생성을 허용할지 여부
게임 운영 측이 미리 룸을 생성해 두고 게임 플레이어는 그 룸을 구독하는 형식인 경우에는 “false"를 지정합니다.
반대로, 게임 플레이어가 자유롭게 룸을 생성하여 다른 플레이어를 초대해 플레이하는 형식인 경우에는 “true"를 지정합니다.
messageLifeTimeDaysint11 ~ 30메시지 보관 기간(일수)
룸 내의 메시지를 보관하는 일수입니다.
postMessageScriptScriptSetting메시지를 게시했을 때 실행할 스크립트 설정
Script 트리거 레퍼런스 - postMessage
createRoomScriptScriptSetting룸을 생성했을 때 실행할 스크립트 설정
Script 트리거 레퍼런스 - createRoom
deleteRoomScriptScriptSetting룸을 삭제했을 때 실행할 스크립트 설정
Script 트리거 레퍼런스 - deleteRoom
subscribeRoomScriptScriptSetting룸을 구독했을 때 실행할 스크립트 설정
Script 트리거 레퍼런스 - subscribeRoom
unsubscribeRoomScriptScriptSetting룸 구독을 해제했을 때 실행할 스크립트 설정
Script 트리거 레퍼런스 - unsubscribeRoom
postNotificationNotificationSetting
구독 중인 룸에 새 게시물이 등록되었을 때의 푸시 알림
구독 중인 룸에 새로운 메시지가 게시되었을 때 GS2-Gateway를 통해 푸시 알림을 전송하기 위한 설정입니다. 이 설정이 없으면, 클라이언트는 새로운 메시지를 감지하기 위해 룸을 폴링해야 합니다.
logSettingLogSetting로그 출력 설정
로그 출력 설정을 관리합니다. 이 타입은 로그 데이터를 출력하는 데 사용되는 GS2-Log의 네임스페이스 정보를 보유합니다.
createdAtlong
현재 시각생성일시
UNIX 시간·밀리초
※ 서버가 자동으로 설정
updatedAtlong
현재 시각최종 갱신일시
UNIX 시간·밀리초
※ 서버가 자동으로 설정
revisionlong00 ~ 9223372036854775805리비전

TransactionSetting

트랜잭션 설정

트랜잭션 설정은 트랜잭션의 실행 방법·정합성·비동기 처리·충돌 회피 메커니즘을 제어하는 설정입니다.
자동 실행(AutoRun), 원자적 실행(AtomicCommit), GS2-Distributor를 이용한 비동기 실행, 스크립트 결과의 일괄 적용, GS2-JobQueue를 통한 입수 액션의 비동기화 등을 조합하여 게임 로직에 맞는 견고한 트랜잭션 관리를 가능하게 합니다.

상세
타입활성화 조건필수기본값값 제한설명
enableAutoRunboolfalse발행한 트랜잭션을 서버 사이드에서 자동으로 실행할지 여부
enableAtomicCommitbool{enableAutoRun} == truefalse트랜잭션의 실행을 원자적으로 커밋할지 여부
※ enableAutoRun이(가) true 이면 활성화
transactionUseDistributorbool{enableAtomicCommit} == truefalse트랜잭션을 비동기 처리로 실행할지 여부
※ enableAtomicCommit이(가) true 이면 활성화
commitScriptResultInUseDistributorbool{transactionUseDistributor} == truefalse스크립트의 결과 커밋 처리를 비동기 처리로 실행할지 여부
※ transactionUseDistributor이(가) true 이면 활성화
acquireActionUseJobQueuebool{enableAtomicCommit} == truefalse입수 액션을 실행할 때 GS2-JobQueue를 사용할지 여부
※ enableAtomicCommit이(가) true 이면 활성화
distributorNamespaceIdstring“grn:gs2:{region}:{ownerId}:distributor:default”~ 1024자트랜잭션 실행에 사용하는 GS2-Distributor 네임스페이스 GRN
queueNamespaceIdstring“grn:gs2:{region}:{ownerId}:queue:default”~ 1024자트랜잭션 실행에 사용하는 GS2-JobQueue의 네임스페이스 GRN

ScriptSetting

스크립트 설정

GS2에서는 마이크로서비스의 이벤트에 연결하여 커스텀 스크립트를 실행할 수 있습니다.
이 모델은 스크립트 실행을 트리거하기 위한 설정을 보유합니다.

스크립트 실행 방식은 크게 두 가지로, 바로 “동기 실행"과 “비동기 실행"입니다.
동기 실행은 스크립트 실행이 완료될 때까지 처리가 블록됩니다.
대신 스크립트 실행 결과를 이용하여 API 실행을 중단시키거나 API 응답 내용을 제어할 수 있습니다.

한편, 비동기 실행에서는 스크립트 완료를 기다리기 위해 처리가 블록되는 일이 없습니다.
다만 스크립트 실행 결과를 이용하여 API 실행을 중단하거나 API 응답 내용을 변경할 수는 없습니다.
비동기 실행은 API의 응답 흐름에 영향을 주지 않으므로 원칙적으로 비동기 실행을 권장합니다.

비동기 실행에는 실행 방식이 두 가지 있으며, GS2-Script와 Amazon EventBridge가 있습니다.
Amazon EventBridge를 사용함으로써 Lua 이외의 언어로 처리를 작성할 수 있습니다.

상세
타입활성화 조건필수기본값값 제한설명
triggerScriptIdstring~ 1024자API 실행 시 동기적으로 실행되는 GS2-Script의 스크립트 GRN
“grn:gs2:“로 시작하는 GRN 형식의 ID로 지정해야 합니다.
doneTriggerTargetType문자열 열거형
enum {
  “none”,
  “gs2_script”,
  “aws”
}
“none”비동기 스크립트의 실행 방법
비동기 실행에서 사용할 스크립트의 종류를 지정합니다.
“비동기 실행의 스크립트를 사용하지 않음(none)”, “GS2-Script를 사용함(gs2_script)”, “Amazon EventBridge를 사용함(aws)” 중에서 선택할 수 있습니다.
정의설명
none없음
gs2_scriptGS2-Script
awsAmazon EventBridge
doneTriggerScriptIdstring{doneTriggerTargetType} == “gs2_script”~ 1024자비동기 실행할 GS2-Script 스크립트 GRN
“grn:gs2:“로 시작하는 GRN 형식의 ID로 지정해야 합니다.
※ doneTriggerTargetType이(가) “gs2_script” 이면 활성화
doneTriggerQueueNamespaceIdstring{doneTriggerTargetType} == “gs2_script”~ 1024자비동기 실행 스크립트를 실행하는 GS2-JobQueue 네임스페이스 GRN
비동기 실행 스크립트를 직접 실행하지 않고 GS2-JobQueue를 경유하는 경우 GS2-JobQueue의 네임스페이스GRN을 지정합니다.
GS2-JobQueue를 이용해야 할 이유는 많지 않으므로, 특별한 이유가 없다면 지정할 필요는 없습니다.
※ doneTriggerTargetType이(가) “gs2_script” 이면 활성화

NotificationSetting

푸시 통지에 관한 설정

GS2의 마이크로서비스 내에서 어떠한 이벤트가 발생했을 때, 푸시 통지를 전송하기 위한 설정입니다.
여기서 말하는 푸시 통지란 GS2-Gateway가 제공하는 WebSocket 인터페이스를 경유하는 처리이며, 스마트폰의 푸시 통지와는 성질이 다릅니다.
예를 들어 매치메이킹이 완료되었을 때나 친구 요청이 도착했을 때 등, 게임 클라이언트의 조작과는 관계없이 상태가 변화했을 때 GS2-Gateway를 경유하여 푸시 통지를 함으로써, 게임 클라이언트는 상태 변화를 감지할 수 있습니다.

GS2-Gateway의 푸시 통지는 통지 대상 디바이스가 오프라인이었을 때 추가 처리로 모바일 푸시 통지를 전송할 수 있습니다.
모바일 푸시 통지를 잘 활용하면, 매치메이킹 중에 게임을 종료하더라도 모바일 푸시 통지를 사용하여 플레이어에게 알리고, 게임으로 복귀하도록 하는 흐름을 구현할 수 있을 가능성이 있습니다.

상세
타입활성화 조건필수기본값값 제한설명
gatewayNamespaceIdstring“grn:gs2:{region}:{ownerId}:gateway:default”~ 1024자푸시 통지에 사용할 GS2-Gateway의 네임스페이스
“grn:gs2:“로 시작하는 GRN 형식으로 GS2-Gateway의 네임스페이스 ID를 지정합니다.
enableTransferMobileNotificationbool?false모바일 푸시 통지로 전달할지 여부
이 통지를 전송하려 할 때, 통지 대상 디바이스가 오프라인일 경우 모바일 푸시 통지로 전달할지 여부를 지정합니다.
soundstring{enableTransferMobileNotification} == true~ 1024자모바일 푸시 통지에서 사용할 사운드 파일명
여기서 지정한 사운드 파일명은 모바일 푸시 통지를 전송할 때 사용되며, 특별한 사운드로 통지를 출력할 수 있습니다.
※ enableTransferMobileNotification이(가) true 이면 활성화
enable문자열 열거형
enum {
  “Enabled”,
  “Disabled”
}
“Enabled”푸시 통지를 활성화할지 여부
정의설명
Enabled활성화
Disabled비활성화

LogSetting

로그 출력 설정

로그 데이터의 출력 설정을 관리합니다. 이 타입은 로그 데이터를 기록하는 데 사용되는 GS2-Log 네임스페이스의 식별자(Namespace ID)를 보유합니다.
로그 네임스페이스ID(loggingNamespaceId)에는 로그 데이터를 수집하여 저장하는 GS2-Log의 네임스페이스를 GRN 형식으로 지정합니다.
이 설정을 하면 설정된 네임스페이스 내에서 발생한 API 요청·응답의 로그 데이터가 대상 GS2-Log 네임스페이스 쪽으로 출력됩니다.
GS2-Log에서는 실시간으로 로그가 제공되어 시스템 모니터링, 분석, 디버깅 등에 이용할 수 있습니다.

상세
타입활성화 조건필수기본값값 제한설명
loggingNamespaceIdstring
~ 1024자로그를 출력할 GS2-Log의 네임스페이스 GRN
“grn:gs2:“로 시작하는 GRN 형식의 ID로 지정해야 합니다.

GitHubCheckoutSetting

GitHub에서 마스터 데이터를 체크아웃하는 설정

상세
타입활성화 조건필수기본값값 제한설명
apiKeyIdstring
~ 1024자GitHub API 키의 GRN
repositoryNamestring
~ 1024자리포지토리 이름
sourcePathstring
~ 1024자마스터 데이터(JSON) 파일 경로
referenceType문자열 열거형
enum {
  “commit_hash”,
  “branch”,
  “tag”
}
코드 출처
정의설명
commit_hash커밋 해시
branch브랜치
tag태그
commitHashstring{referenceType} == “commit_hash”
✓※
~ 1024자커밋 해시
※ referenceType이(가) “commit_hash” 이면 필수
branchNamestring{referenceType} == “branch”
✓※
~ 1024자브랜치 이름
※ referenceType이(가) “branch” 이면 필수
tagNamestring{referenceType} == “tag”
✓※
~ 1024자태그 이름
※ referenceType이(가) “tag” 이면 필수

Room


룸은 채팅 메시지를 전달할 수 있는 범위를 나타냅니다.
GS2-Chat의 룸에는 참가라는 개념이 없습니다.
따라서 메시지를 수신하려면 룸의 이름만 알고 있으면 되며, 룸에 참가하거나 멤버로 등록할 필요가 없습니다.

룸의 메시지를 열람할 수 있는 게임 플레이어를 제한하고 싶은 경우 두 가지 방법이 있습니다.
첫 번째는 룸에 비밀번호를 설정하는 것입니다.
두 번째는 룸에 설정 가능한 화이트리스트에 게임 플레이어의 사용자 ID를 설정하여 제한하는 것입니다.

비밀번호를 설정한 경우, 비밀번호를 모르면 게임 관리자라도 메시지를 가져올 수 없게 된다는 점에 주의하십시오.
이는 일본국 헌법에서 정한 통신의 비밀에 해당할 가능성이 있기 때문입니다.

룸을 구독하면, 룸에 새로운 메시지가 전송되었을 때 GS2-Gateway의 푸시 알림을 받을 수 있습니다.
이 알림 기능을 이용함으로써, 룸에 대해 폴링하지 않고도 새로운 메시지의 유무를 알 수 있게 됩니다.

상세
타입활성화 조건필수기본값값 제한설명
roomIdstring
~ 1024자GRN
※ 서버가 자동으로 설정
namestring
UUID~ 128자룸 이름
룸 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
userIdstring~ 128자오너 사용자 ID
룸 오너의 사용자 ID입니다. 설정하면, 오너만 룸을 삭제할 수 있게 됩니다. 오너 설정은 선택 사항입니다.
metadatastring~ 1024자메타데이터
메타데이터에는 임의의 값을 설정할 수 있습니다.
이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다.
passwordstring~ 128자룸에 액세스하기 위해 필요한 비밀번호
설정하면, 메시지를 가져오거나 게시할 때 비밀번호 입력이 필요해집니다. 설정한 비밀번호는 다시 확인할 수 없습니다. 통신의 비밀에 해당할 가능성이 있어, 게임 관리자라도 비밀번호를 모르면 메시지에 액세스할 수 없게 됩니다.
whiteListUserIdsList<string>[]0 ~ 1000 items룸에 액세스 가능한 사용자 ID 리스트
설정하면, 리스트에 포함된 사용자만 룸의 메시지를 가져오거나 게시할 수 있게 됩니다. 비어 있는 경우, 사용자 ID에 의한 액세스 제한은 적용되지 않습니다(단, 비밀번호가 별도로 필요할 수 있습니다).
createdAtlong
현재 시각생성일시
UNIX 시간·밀리초
※ 서버가 자동으로 설정
updatedAtlong
현재 시각최종 갱신일시
UNIX 시간·밀리초
※ 서버가 자동으로 설정
revisionlong00 ~ 9223372036854775805리비전

Message

메시지

메시지는 룸에 게시된 데이터입니다.

카테고리라는 필드를 가지고 있어 메시지를 분류할 수 있습니다.
예를 들어, 카테고리가 0인 경우는 일반적인 텍스트 메시지로 해석하고, 1인 경우는 스탬프(스티커)로 처리하도록 클라이언트를 구현할 수 있습니다.

게시된 메시지는 게시 후, Chat Namespace의 messageLifeTimeDays에서 설정한 메시지 보관 기간이 경과하면 자동으로 삭제됩니다.

상세
타입활성화 조건필수기본값값 제한설명
messageIdstring
~ 1024자메시지 GRN
※ 서버가 자동으로 설정
roomNamestring
UUID~ 128자룸 이름
룸 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
namestring
UUID~ 36자메시지 이름
메시지의 고유한 이름을 유지합니다.
이름은 UUID(Universally Unique Identifier) 형식으로 자동 생성되며, 각 메시지를 식별하는 데 사용됩니다.
userIdstring
~ 128자사용자ID
categoryint00 ~ 2147483645메시지 분류용 카테고리 번호
메시지를 분류하기 위한 숫자 값입니다. 예를 들어, 0은 텍스트 메시지, 1은 스탬프(스티커), 그 외의 값은 커스텀 메시지 타입으로 사용할 수 있습니다. 카테고리에 따라 메시지에 적용되는 CategoryModel의 규칙이 결정됩니다.
metadatastring
~ 1024자메타데이터
메타데이터에는 임의의 값을 설정할 수 있습니다.
이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다.
createdAtlong
현재 시각생성일시
UNIX 시간·밀리초
※ 서버가 자동으로 설정
revisionlong00 ~ 9223372036854775805리비전

Subscribe

룸 구독

룸을 구독하면 해당 룸에 대한 신규 메시지의 존재를 즉시 알 수 있게 됩니다.
구독할 때 메시지의 카테고리를 지정할 수 있습니다.
이 기능을 잘 활용하면 중요도가 높은 메시지만 수신하는 설정도 가능합니다.

상세
타입활성화 조건필수기본값값 제한설명
subscribeIdstring
~ 1024자구독 GRN
※ 서버가 자동으로 설정
userIdstring
~ 128자사용자ID
roomNamestring
~ 128자구독할 룸 이름
구독할 채팅 룸의 이름입니다. 구독하면, 이 룸에 새로운 메시지가 게시될 때마다 GS2-Gateway를 통해 푸시 알림이 전송됩니다.
notificationTypesList<NotificationType>[]0 ~ 100 items신규 메시지 알림을 받을 카테고리 리스트
푸시 알림을 트리거하는 메시지 카테고리를 필터링합니다. 비어 있는 경우, 모든 카테고리에 대해 알림이 전송됩니다. 각 항목은 카테고리 번호와 선택적인 모바일 푸시 알림 전달 여부를 지정합니다.
createdAtlong
현재 시각생성일시
UNIX 시간·밀리초
※ 서버가 자동으로 설정
revisionlong00 ~ 9223372036854775805리비전

CategoryModel

메시지 카테고리 모델

메시지 카테고리 모델은 채팅 룸에 게시되는 메시지를 분류하기 위한 카테고리를 정의합니다.
각 카테고리는 숫자로 식별되며, 카테고리별로 플레이어의 액세스 토큰을 사용한 게시를 허용할지 거부할지 설정할 수 있습니다.
이를 통해 서버만 게시할 수 있는 시스템 안내 카테고리 등의 사용 사례를 구현할 수 있습니다.

상세
타입활성화 조건필수기본값값 제한설명
categoryModelIdstring
~ 1024자메시지 카테고리 모델 GRN
※ 서버가 자동으로 설정
categoryint
0 ~ 2147483645카테고리
메시지 카테고리의 숫자 식별자입니다. 이 카테고리 번호로 게시된 메시지는, 플레이어의 게시를 허용할지 여부 등 이 모델에서 정의된 규칙을 따릅니다.
rejectAccessTokenPost문자열 열거형
enum {
  “Enabled”,
  “Disabled”
}
플레이어의 액세스 토큰을 이용한 게시를 거부한다
활성화하면, 이 카테고리에서는 서버 사이드 API 호출(사용자 ID 지정)만으로 메시지를 게시할 수 있습니다. 플레이어가 직접 게시해서는 안 되는 시스템 안내나 서버 생성 메시지에 유용합니다.
정의설명
Enabled액세스 토큰을 이용한 게시를 거부한다
Disabled액세스 토큰을 이용한 게시를 허용한다

NotificationType

알림 타입

신규 메시지 알림을 받을 카테고리 설정

상세
타입활성화 조건필수기본값값 제한설명
categoryint00 ~ 2147483646신규 메시지 알림을 받을 카테고리
알림을 필터링하기 위한 카테고리의 숫자 식별자입니다. 이 카테고리와 일치하는 메시지만 구독에 대한 푸시 알림을 트리거합니다.
enableTransferMobilePushNotificationboolfalse오프라인 상태였을 때 모바일 푸시 알림으로 전달할지 여부
활성화하면, 알림 시점에 수신 대상 기기가 오프라인 상태였던 경우 모바일 푸시 알림 서비스로 전달됩니다. 이를 통해 게임이 실행되고 있지 않은 상태에서도 플레이어에게 신규 메시지를 알릴 수 있습니다.

CurrentModelMaster

현재 활성화된 메시지 카테고리 모델 마스터 데이터

현재 네임스페이스 내에서 유효한 메시지 카테고리 모델의 정의를 기술한 마스터 데이터입니다.
GS2에서는 마스터 데이터 관리에 JSON 형식의 파일을 사용합니다.
파일을 업로드함으로써 실제로 서버에 설정을 반영할 수 있습니다.

JSON 파일을 작성하는 방법으로, 매니지먼트 콘솔 내에 마스터 데이터 에디터를 제공하고 있습니다.
또한, 게임 운영에 더 적합한 도구를 제작하여 적절한 포맷의 JSON 파일을 출력함으로써도 서비스를 이용할 수 있습니다.

상세
타입활성화 조건필수기본값값 제한설명
namespaceIdstring
~ 1024자네임스페이스 GRN
※ 서버가 자동으로 설정
settingsstring
~ 5242880 바이트 (5MB)마스터 데이터

CategoryModelMaster

메시지 카테고리 모델 마스터

메시지 카테고리 모델 마스터는 게임 내에서 사용되는 메시지 카테고리 모델을 편집 및 관리하기 위한 데이터로, 매니지먼트 콘솔의 마스터 데이터 에디터에 임시로 보관됩니다.
임포트·업데이트 처리를 수행함으로써 실제로 게임에서 참조되는 메시지 카테고리 모델로 반영됩니다.

메시지 카테고리 모델이란 룸에 게시하는 카테고리에 관한 설정입니다.

상세
타입활성화 조건필수기본값값 제한설명
categoryModelIdstring
~ 1024자메시지 카테고리 모델 마스터 GRN
※ 서버가 자동으로 설정
categoryint
0 ~ 2147483645카테고리
메시지 카테고리의 숫자 식별자입니다. 이 카테고리 번호로 게시된 메시지는, 플레이어의 게시를 허용할지 여부 등 이 모델에서 정의된 규칙을 따릅니다.
descriptionstring~ 1024자설명문
rejectAccessTokenPost문자열 열거형
enum {
  “Enabled”,
  “Disabled”
}
플레이어의 액세스 토큰을 이용한 게시를 거부한다
활성화하면, 이 카테고리에서는 서버 사이드 API 호출(사용자 ID 지정)만으로 메시지를 게시할 수 있습니다. 플레이어가 직접 게시해서는 안 되는 시스템 안내나 서버 생성 메시지에 유용합니다.
정의설명
Enabled플레이어의 액세스 토큰을 이용한 게시를 거부한다
Disabled플레이어의 액세스 토큰을 이용한 게시를 허용한다
createdAtlong
현재 시각생성일시
UNIX 시간·밀리초
※ 서버가 자동으로 설정
updatedAtlong
현재 시각최종 갱신일시
UNIX 시간·밀리초
※ 서버가 자동으로 설정
revisionlong00 ~ 9223372036854775805리비전

메서드

describeNamespaces

네임스페이스 목록 조회

프로젝트 내에서 서비스 단위로 생성된 네임스페이스의 목록을 조회합니다.
옵션인 페이지 토큰을 사용하여 목록의 특정 위치부터 데이터 조회를 시작할 수 있습니다.
또한 조회할 네임스페이스의 수를 제한하는 것도 가능합니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namePrefixstring~ 64자네임스페이스 이름의 필터 접두사
pageTokenstring~ 1024자데이터 취득을 시작할 위치를 지정하는 토큰
limitint301 ~ 1000취득할 데이터 건수

Result

타입설명
itemsList<Namespace>네임스페이스 목록
nextPageTokenstring목록의 나머지를 취득하기 위한 페이지 토큰

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.DescribeNamespaces(
    &chat.DescribeNamespacesRequest {
        NamePrefix: nil,
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\DescribeNamespacesRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->describeNamespaces(
        (new DescribeNamespacesRequest())
            ->withNamePrefix(null)
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.DescribeNamespacesRequest;
import io.gs2.chat.result.DescribeNamespacesResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    DescribeNamespacesResult result = client.describeNamespaces(
        new DescribeNamespacesRequest()
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    List<Namespace> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
    new Gs2.Gs2Chat.Request.DescribeNamespacesRequest()
        .WithNamePrefix(null)
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.describeNamespaces(
        new Gs2Chat.DescribeNamespacesRequest()
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.describe_namespaces(
        chat.DescribeNamespacesRequest()
            .with_name_prefix(None)
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.describe_namespaces({
    namePrefix=nil,
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('chat')

api_result_handler = client.describe_namespaces_async({
    namePrefix=nil,
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

createNamespace

네임스페이스 신규 생성

네임스페이스의 이름, 설명 및 각종 설정을 포함한 상세 정보를 지정해야 합니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
descriptionstring~ 1024자설명문
transactionSettingTransactionSetting트랜잭션 설정
채팅 서비스 내에서 트랜잭션 처리 방법을 제어하기 위한 설정입니다.
allowCreateRoombooltrue게임 플레이어에 의한 룸 생성을 허용할지 여부
게임 운영 측이 미리 룸을 생성해 두고 게임 플레이어는 그 룸을 구독하는 형식인 경우에는 “false"를 지정합니다.
반대로, 게임 플레이어가 자유롭게 룸을 생성하여 다른 플레이어를 초대해 플레이하는 형식인 경우에는 “true"를 지정합니다.
messageLifeTimeDaysint11 ~ 30메시지 보관 기간(일수)
룸 내의 메시지를 보관하는 일수입니다.
postMessageScriptScriptSetting메시지를 게시했을 때 실행할 스크립트 설정
Script 트리거 레퍼런스 - postMessage
createRoomScriptScriptSetting룸을 생성했을 때 실행할 스크립트 설정
Script 트리거 레퍼런스 - createRoom
deleteRoomScriptScriptSetting룸을 삭제했을 때 실행할 스크립트 설정
Script 트리거 레퍼런스 - deleteRoom
subscribeRoomScriptScriptSetting룸을 구독했을 때 실행할 스크립트 설정
Script 트리거 레퍼런스 - subscribeRoom
unsubscribeRoomScriptScriptSetting룸 구독을 해제했을 때 실행할 스크립트 설정
Script 트리거 레퍼런스 - unsubscribeRoom
postNotificationNotificationSetting
구독 중인 룸에 새 게시물이 등록되었을 때의 푸시 알림
구독 중인 룸에 새로운 메시지가 게시되었을 때 GS2-Gateway를 통해 푸시 알림을 전송하기 위한 설정입니다. 이 설정이 없으면, 클라이언트는 새로운 메시지를 감지하기 위해 룸을 폴링해야 합니다.
logSettingLogSetting로그 출력 설정
로그 출력 설정을 관리합니다. 이 타입은 로그 데이터를 출력하는 데 사용되는 GS2-Log의 네임스페이스 정보를 보유합니다.

Result

타입설명
itemNamespace생성한 네임스페이스

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.CreateNamespace(
    &chat.CreateNamespaceRequest {
        Name: pointy.String("namespace-0001"),
        Description: nil,
        TransactionSetting: nil,
        AllowCreateRoom: nil,
        MessageLifeTimeDays: nil,
        PostMessageScript: nil,
        CreateRoomScript: nil,
        DeleteRoomScript: nil,
        SubscribeRoomScript: nil,
        UnsubscribeRoomScript: nil,
        PostNotification: nil,
        LogSetting: &chat.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\CreateNamespaceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->createNamespace(
        (new CreateNamespaceRequest())
            ->withName("namespace-0001")
            ->withDescription(null)
            ->withTransactionSetting(null)
            ->withAllowCreateRoom(null)
            ->withMessageLifeTimeDays(null)
            ->withPostMessageScript(null)
            ->withCreateRoomScript(null)
            ->withDeleteRoomScript(null)
            ->withSubscribeRoomScript(null)
            ->withUnsubscribeRoomScript(null)
            ->withPostNotification(null)
            ->withLogSetting((new \Gs2\Chat\Model\LogSetting())
                ->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.CreateNamespaceRequest;
import io.gs2.chat.result.CreateNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    CreateNamespaceResult result = client.createNamespace(
        new CreateNamespaceRequest()
            .withName("namespace-0001")
            .withDescription(null)
            .withTransactionSetting(null)
            .withAllowCreateRoom(null)
            .withMessageLifeTimeDays(null)
            .withPostMessageScript(null)
            .withCreateRoomScript(null)
            .withDeleteRoomScript(null)
            .withSubscribeRoomScript(null)
            .withUnsubscribeRoomScript(null)
            .withPostNotification(null)
            .withLogSetting(new io.gs2.chat.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
    new Gs2.Gs2Chat.Request.CreateNamespaceRequest()
        .WithName("namespace-0001")
        .WithDescription(null)
        .WithTransactionSetting(null)
        .WithAllowCreateRoom(null)
        .WithMessageLifeTimeDays(null)
        .WithPostMessageScript(null)
        .WithCreateRoomScript(null)
        .WithDeleteRoomScript(null)
        .WithSubscribeRoomScript(null)
        .WithUnsubscribeRoomScript(null)
        .WithPostNotification(null)
        .WithLogSetting(new Gs2.Gs2Chat.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001")),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.createNamespace(
        new Gs2Chat.CreateNamespaceRequest()
            .withName("namespace-0001")
            .withDescription(null)
            .withTransactionSetting(null)
            .withAllowCreateRoom(null)
            .withMessageLifeTimeDays(null)
            .withPostMessageScript(null)
            .withCreateRoomScript(null)
            .withDeleteRoomScript(null)
            .withSubscribeRoomScript(null)
            .withUnsubscribeRoomScript(null)
            .withPostNotification(null)
            .withLogSetting(new Gs2Chat.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.create_namespace(
        chat.CreateNamespaceRequest()
            .with_name('namespace-0001')
            .with_description(None)
            .with_transaction_setting(None)
            .with_allow_create_room(None)
            .with_message_life_time_days(None)
            .with_post_message_script(None)
            .with_create_room_script(None)
            .with_delete_room_script(None)
            .with_subscribe_room_script(None)
            .with_unsubscribe_room_script(None)
            .with_post_notification(None)
            .with_log_setting(
                chat.LogSetting()
                    .with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.create_namespace({
    name="namespace-0001",
    description=nil,
    transactionSetting=nil,
    allowCreateRoom=nil,
    messageLifeTimeDays=nil,
    postMessageScript=nil,
    createRoomScript=nil,
    deleteRoomScript=nil,
    subscribeRoomScript=nil,
    unsubscribeRoomScript=nil,
    postNotification=nil,
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
    },
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.create_namespace_async({
    name="namespace-0001",
    description=nil,
    transactionSetting=nil,
    allowCreateRoom=nil,
    messageLifeTimeDays=nil,
    postMessageScript=nil,
    createRoomScript=nil,
    deleteRoomScript=nil,
    subscribeRoomScript=nil,
    unsubscribeRoomScript=nil,
    postNotification=nil,
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
    },
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

getNamespaceStatus

네임스페이스의 상태 조회

지정된 네임스페이스의 현재 상태를 조회합니다.
상태에는 네임스페이스가 활성 상태인지, 삭제되었는지가 포함됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.

Result

타입설명
statusstring네임스페이스의 상태
정의설명
ACTIVE유효
DELETED삭제됨

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.GetNamespaceStatus(
    &chat.GetNamespaceStatusRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
status := result.Status
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\GetNamespaceStatusRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->getNamespaceStatus(
        (new GetNamespaceStatusRequest())
            ->withNamespaceName("namespace-0001")
    );
    $status = $result->getStatus();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.GetNamespaceStatusRequest;
import io.gs2.chat.result.GetNamespaceStatusResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    GetNamespaceStatusResult result = client.getNamespaceStatus(
        new GetNamespaceStatusRequest()
            .withNamespaceName("namespace-0001")
    );
    String status = result.getStatus();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
    new Gs2.Gs2Chat.Request.GetNamespaceStatusRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.getNamespaceStatus(
        new Gs2Chat.GetNamespaceStatusRequest()
            .withNamespaceName("namespace-0001")
    );
    const status = result.getStatus();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.get_namespace_status(
        chat.GetNamespaceStatusRequest()
            .with_namespace_name('namespace-0001')
    )
    status = result.status
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.get_namespace_status({
    namespaceName="namespace-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
status = result.status;
client = gs2('chat')

api_result_handler = client.get_namespace_status_async({
    namespaceName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
status = result.status;

getNamespace

네임스페이스 조회

지정된 네임스페이스의 상세 정보를 조회합니다.
여기에는 네임스페이스의 이름, 설명 및 기타 설정 정보가 포함됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.

Result

타입설명
itemNamespace네임스페이스

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.GetNamespace(
    &chat.GetNamespaceRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\GetNamespaceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->getNamespace(
        (new GetNamespaceRequest())
            ->withNamespaceName("namespace-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.GetNamespaceRequest;
import io.gs2.chat.result.GetNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    GetNamespaceResult result = client.getNamespace(
        new GetNamespaceRequest()
            .withNamespaceName("namespace-0001")
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
    new Gs2.Gs2Chat.Request.GetNamespaceRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.getNamespace(
        new Gs2Chat.GetNamespaceRequest()
            .withNamespaceName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.get_namespace(
        chat.GetNamespaceRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.get_namespace({
    namespaceName="namespace-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.get_namespace_async({
    namespaceName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

updateNamespace

네임스페이스 갱신

지정된 네임스페이스의 설정을 갱신합니다.
네임스페이스의 설명이나 특정 설정을 변경할 수 있습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
descriptionstring~ 1024자설명문
transactionSettingTransactionSetting트랜잭션 설정
채팅 서비스 내에서 트랜잭션 처리 방법을 제어하기 위한 설정입니다.
allowCreateRoombooltrue게임 플레이어에 의한 룸 생성을 허용할지 여부
게임 운영 측이 미리 룸을 생성해 두고 게임 플레이어는 그 룸을 구독하는 형식인 경우에는 “false"를 지정합니다.
반대로, 게임 플레이어가 자유롭게 룸을 생성하여 다른 플레이어를 초대해 플레이하는 형식인 경우에는 “true"를 지정합니다.
messageLifeTimeDaysint11 ~ 30메시지 보관 기간(일수)
룸 내의 메시지를 보관하는 일수입니다.
postMessageScriptScriptSetting메시지를 게시했을 때 실행할 스크립트 설정
Script 트리거 레퍼런스 - postMessage
createRoomScriptScriptSetting룸을 생성했을 때 실행할 스크립트 설정
Script 트리거 레퍼런스 - createRoom
deleteRoomScriptScriptSetting룸을 삭제했을 때 실행할 스크립트 설정
Script 트리거 레퍼런스 - deleteRoom
subscribeRoomScriptScriptSetting룸을 구독했을 때 실행할 스크립트 설정
Script 트리거 레퍼런스 - subscribeRoom
unsubscribeRoomScriptScriptSetting룸 구독을 해제했을 때 실행할 스크립트 설정
Script 트리거 레퍼런스 - unsubscribeRoom
postNotificationNotificationSetting
구독 중인 룸에 새 게시물이 등록되었을 때의 푸시 알림
구독 중인 룸에 새로운 메시지가 게시되었을 때 GS2-Gateway를 통해 푸시 알림을 전송하기 위한 설정입니다. 이 설정이 없으면, 클라이언트는 새로운 메시지를 감지하기 위해 룸을 폴링해야 합니다.
logSettingLogSetting로그 출력 설정
로그 출력 설정을 관리합니다. 이 타입은 로그 데이터를 출력하는 데 사용되는 GS2-Log의 네임스페이스 정보를 보유합니다.

Result

타입설명
itemNamespace갱신한 네임스페이스

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.UpdateNamespace(
    &chat.UpdateNamespaceRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Description: pointy.String("description1"),
        TransactionSetting: nil,
        AllowCreateRoom: pointy.Bool(false),
        MessageLifeTimeDays: nil,
        PostMessageScript: nil,
        CreateRoomScript: nil,
        DeleteRoomScript: nil,
        SubscribeRoomScript: nil,
        UnsubscribeRoomScript: nil,
        PostNotification: nil,
        LogSetting: &chat.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\UpdateNamespaceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->updateNamespace(
        (new UpdateNamespaceRequest())
            ->withNamespaceName("namespace-0001")
            ->withDescription("description1")
            ->withTransactionSetting(null)
            ->withAllowCreateRoom(false)
            ->withMessageLifeTimeDays(null)
            ->withPostMessageScript(null)
            ->withCreateRoomScript(null)
            ->withDeleteRoomScript(null)
            ->withSubscribeRoomScript(null)
            ->withUnsubscribeRoomScript(null)
            ->withPostNotification(null)
            ->withLogSetting((new \Gs2\Chat\Model\LogSetting())
                ->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.UpdateNamespaceRequest;
import io.gs2.chat.result.UpdateNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    UpdateNamespaceResult result = client.updateNamespace(
        new UpdateNamespaceRequest()
            .withNamespaceName("namespace-0001")
            .withDescription("description1")
            .withTransactionSetting(null)
            .withAllowCreateRoom(false)
            .withMessageLifeTimeDays(null)
            .withPostMessageScript(null)
            .withCreateRoomScript(null)
            .withDeleteRoomScript(null)
            .withSubscribeRoomScript(null)
            .withUnsubscribeRoomScript(null)
            .withPostNotification(null)
            .withLogSetting(new io.gs2.chat.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
    new Gs2.Gs2Chat.Request.UpdateNamespaceRequest()
        .WithNamespaceName("namespace-0001")
        .WithDescription("description1")
        .WithTransactionSetting(null)
        .WithAllowCreateRoom(false)
        .WithMessageLifeTimeDays(null)
        .WithPostMessageScript(null)
        .WithCreateRoomScript(null)
        .WithDeleteRoomScript(null)
        .WithSubscribeRoomScript(null)
        .WithUnsubscribeRoomScript(null)
        .WithPostNotification(null)
        .WithLogSetting(new Gs2.Gs2Chat.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001")),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.updateNamespace(
        new Gs2Chat.UpdateNamespaceRequest()
            .withNamespaceName("namespace-0001")
            .withDescription("description1")
            .withTransactionSetting(null)
            .withAllowCreateRoom(false)
            .withMessageLifeTimeDays(null)
            .withPostMessageScript(null)
            .withCreateRoomScript(null)
            .withDeleteRoomScript(null)
            .withSubscribeRoomScript(null)
            .withUnsubscribeRoomScript(null)
            .withPostNotification(null)
            .withLogSetting(new Gs2Chat.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.update_namespace(
        chat.UpdateNamespaceRequest()
            .with_namespace_name('namespace-0001')
            .with_description('description1')
            .with_transaction_setting(None)
            .with_allow_create_room(False)
            .with_message_life_time_days(None)
            .with_post_message_script(None)
            .with_create_room_script(None)
            .with_delete_room_script(None)
            .with_subscribe_room_script(None)
            .with_unsubscribe_room_script(None)
            .with_post_notification(None)
            .with_log_setting(
                chat.LogSetting()
                    .with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.update_namespace({
    namespaceName="namespace-0001",
    description="description1",
    transactionSetting=nil,
    allowCreateRoom=false,
    messageLifeTimeDays=nil,
    postMessageScript=nil,
    createRoomScript=nil,
    deleteRoomScript=nil,
    subscribeRoomScript=nil,
    unsubscribeRoomScript=nil,
    postNotification=nil,
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
    },
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.update_namespace_async({
    namespaceName="namespace-0001",
    description="description1",
    transactionSetting=nil,
    allowCreateRoom=false,
    messageLifeTimeDays=nil,
    postMessageScript=nil,
    createRoomScript=nil,
    deleteRoomScript=nil,
    subscribeRoomScript=nil,
    unsubscribeRoomScript=nil,
    postNotification=nil,
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
    },
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

deleteNamespace

네임스페이스 삭제

지정된 네임스페이스를 삭제합니다.
이 작업은 되돌릴 수 없으며, 삭제된 네임스페이스와 관련된 모든 데이터는 복구할 수 없게 됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.

Result

타입설명
itemNamespace삭제한 네임스페이스

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.DeleteNamespace(
    &chat.DeleteNamespaceRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\DeleteNamespaceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->deleteNamespace(
        (new DeleteNamespaceRequest())
            ->withNamespaceName("namespace-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.DeleteNamespaceRequest;
import io.gs2.chat.result.DeleteNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    DeleteNamespaceResult result = client.deleteNamespace(
        new DeleteNamespaceRequest()
            .withNamespaceName("namespace-0001")
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
    new Gs2.Gs2Chat.Request.DeleteNamespaceRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.deleteNamespace(
        new Gs2Chat.DeleteNamespaceRequest()
            .withNamespaceName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.delete_namespace(
        chat.DeleteNamespaceRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.delete_namespace({
    namespaceName="namespace-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.delete_namespace_async({
    namespaceName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

getServiceVersion

마이크로서비스 버전 조회

상세

Request

요청 파라미터: 없음

Result

타입설명
itemstring버전

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.GetServiceVersion(
    &chat.GetServiceVersionRequest {
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\GetServiceVersionRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->getServiceVersion(
        (new GetServiceVersionRequest())
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.GetServiceVersionRequest;
import io.gs2.chat.result.GetServiceVersionResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    GetServiceVersionResult result = client.getServiceVersion(
        new GetServiceVersionRequest()
    );
    String item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.GetServiceVersionResult> asyncResult = null;
yield return client.GetServiceVersion(
    new Gs2.Gs2Chat.Request.GetServiceVersionRequest(),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.getServiceVersion(
        new Gs2Chat.GetServiceVersionRequest()
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.get_service_version(
        chat.GetServiceVersionRequest()
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.get_service_version({
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.get_service_version_async({
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

dumpUserDataByUserId

지정한 사용자 ID에 연결된 데이터의 덤프 취득

개인정보 보호에 관한 법적 요건을 충족시키기 위해 사용하거나, 데이터의 백업 및 이관에 사용할 수 있습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
userIdstring
~ 128자사용자ID
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

반환값: 없음

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.DumpUserDataByUserId(
    &chat.DumpUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\DumpUserDataByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->dumpUserDataByUserId(
        (new DumpUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.DumpUserDataByUserIdRequest;
import io.gs2.chat.result.DumpUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    DumpUserDataByUserIdResult result = client.dumpUserDataByUserId(
        new DumpUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.DumpUserDataByUserIdResult> asyncResult = null;
yield return client.DumpUserDataByUserId(
    new Gs2.Gs2Chat.Request.DumpUserDataByUserIdRequest()
        .WithUserId("user-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.dumpUserDataByUserId(
        new Gs2Chat.DumpUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.dump_user_data_by_user_id(
        chat.DumpUserDataByUserIdRequest()
            .with_user_id('user-0001')
            .with_time_offset_token(None)
    )
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.dump_user_data_by_user_id({
    userId="user-0001",
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
client = gs2('chat')

api_result_handler = client.dump_user_data_by_user_id_async({
    userId="user-0001",
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result

checkDumpUserDataByUserId

지정한 사용자 ID에 연결된 데이터의 덤프가 완료되었는지 확인

상세

Request

타입활성화 조건필수기본값값 제한설명
userIdstring
~ 128자사용자ID
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
urlstring출력 데이터의 URL

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.CheckDumpUserDataByUserId(
    &chat.CheckDumpUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
url := result.Url
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\CheckDumpUserDataByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->checkDumpUserDataByUserId(
        (new CheckDumpUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
    $url = $result->getUrl();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.CheckDumpUserDataByUserIdRequest;
import io.gs2.chat.result.CheckDumpUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    CheckDumpUserDataByUserIdResult result = client.checkDumpUserDataByUserId(
        new CheckDumpUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    String url = result.getUrl();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.CheckDumpUserDataByUserIdResult> asyncResult = null;
yield return client.CheckDumpUserDataByUserId(
    new Gs2.Gs2Chat.Request.CheckDumpUserDataByUserIdRequest()
        .WithUserId("user-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var url = result.Url;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.checkDumpUserDataByUserId(
        new Gs2Chat.CheckDumpUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    const url = result.getUrl();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.check_dump_user_data_by_user_id(
        chat.CheckDumpUserDataByUserIdRequest()
            .with_user_id('user-0001')
            .with_time_offset_token(None)
    )
    url = result.url
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.check_dump_user_data_by_user_id({
    userId="user-0001",
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
url = result.url;
client = gs2('chat')

api_result_handler = client.check_dump_user_data_by_user_id_async({
    userId="user-0001",
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
url = result.url;

cleanUserDataByUserId

사용자 데이터 완전 삭제

지정된 사용자 ID에 연결된 데이터의 클리닝을 실행합니다.
이를 통해 특정 사용자 데이터를 프로젝트에서 안전하게 삭제할 수 있습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
userIdstring
~ 128자사용자ID
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

반환값: 없음

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.CleanUserDataByUserId(
    &chat.CleanUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\CleanUserDataByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->cleanUserDataByUserId(
        (new CleanUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.CleanUserDataByUserIdRequest;
import io.gs2.chat.result.CleanUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    CleanUserDataByUserIdResult result = client.cleanUserDataByUserId(
        new CleanUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.CleanUserDataByUserIdResult> asyncResult = null;
yield return client.CleanUserDataByUserId(
    new Gs2.Gs2Chat.Request.CleanUserDataByUserIdRequest()
        .WithUserId("user-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.cleanUserDataByUserId(
        new Gs2Chat.CleanUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.clean_user_data_by_user_id(
        chat.CleanUserDataByUserIdRequest()
            .with_user_id('user-0001')
            .with_time_offset_token(None)
    )
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.clean_user_data_by_user_id({
    userId="user-0001",
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
client = gs2('chat')

api_result_handler = client.clean_user_data_by_user_id_async({
    userId="user-0001",
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result

checkCleanUserDataByUserId

지정한 사용자 ID의 사용자 데이터 완전 삭제가 완료되었는지 확인

상세

Request

타입활성화 조건필수기본값값 제한설명
userIdstring
~ 128자사용자ID
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

반환값: 없음

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.CheckCleanUserDataByUserId(
    &chat.CheckCleanUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\CheckCleanUserDataByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->checkCleanUserDataByUserId(
        (new CheckCleanUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.CheckCleanUserDataByUserIdRequest;
import io.gs2.chat.result.CheckCleanUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    CheckCleanUserDataByUserIdResult result = client.checkCleanUserDataByUserId(
        new CheckCleanUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.CheckCleanUserDataByUserIdResult> asyncResult = null;
yield return client.CheckCleanUserDataByUserId(
    new Gs2.Gs2Chat.Request.CheckCleanUserDataByUserIdRequest()
        .WithUserId("user-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.checkCleanUserDataByUserId(
        new Gs2Chat.CheckCleanUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.check_clean_user_data_by_user_id(
        chat.CheckCleanUserDataByUserIdRequest()
            .with_user_id('user-0001')
            .with_time_offset_token(None)
    )
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.check_clean_user_data_by_user_id({
    userId="user-0001",
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
client = gs2('chat')

api_result_handler = client.check_clean_user_data_by_user_id_async({
    userId="user-0001",
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result

prepareImportUserDataByUserId

지정한 사용자 ID에 연결된 데이터의 임포트 준비

임포트에 사용할 수 있는 데이터는 GS2 를 통해 익스포트하여 취득한 데이터로 한정되며, 오래된 데이터는 임포트에 실패할 수 있습니다.
익스포트한 사용자 ID와 다른 사용자 ID로 임포트할 수 있지만, 사용자 데이터의 페이로드 내에 사용자 ID가 포함되어 있는 경우에는 그렇지 않을 수 있습니다.

이 API의 반환값으로 응답된 URL에 익스포트한 zip 파일을 업로드하고 importUserDataByUserId 를 호출함으로써 실제 임포트 처리를 시작할 수 있습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
userIdstring
~ 128자사용자ID
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
uploadTokenstring업로드 후 결과를 반영할 때 사용하는 토큰
uploadUrlstring사용자 데이터 업로드 처리 실행에 사용하는 URL

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.PrepareImportUserDataByUserId(
    &chat.PrepareImportUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
uploadToken := result.UploadToken
uploadUrl := result.UploadUrl
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\PrepareImportUserDataByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->prepareImportUserDataByUserId(
        (new PrepareImportUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
    $uploadToken = $result->getUploadToken();
    $uploadUrl = $result->getUploadUrl();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.PrepareImportUserDataByUserIdRequest;
import io.gs2.chat.result.PrepareImportUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    PrepareImportUserDataByUserIdResult result = client.prepareImportUserDataByUserId(
        new PrepareImportUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    String uploadToken = result.getUploadToken();
    String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.PrepareImportUserDataByUserIdResult> asyncResult = null;
yield return client.PrepareImportUserDataByUserId(
    new Gs2.Gs2Chat.Request.PrepareImportUserDataByUserIdRequest()
        .WithUserId("user-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var uploadToken = result.UploadToken;
var uploadUrl = result.UploadUrl;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.prepareImportUserDataByUserId(
        new Gs2Chat.PrepareImportUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    const uploadToken = result.getUploadToken();
    const uploadUrl = result.getUploadUrl();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.prepare_import_user_data_by_user_id(
        chat.PrepareImportUserDataByUserIdRequest()
            .with_user_id('user-0001')
            .with_time_offset_token(None)
    )
    upload_token = result.upload_token
    upload_url = result.upload_url
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.prepare_import_user_data_by_user_id({
    userId="user-0001",
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;
client = gs2('chat')

api_result_handler = client.prepare_import_user_data_by_user_id_async({
    userId="user-0001",
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;

importUserDataByUserId

지정한 사용자 ID에 연결된 데이터의 임포트 실행

임포트에 사용할 수 있는 데이터는 GS2 를 통해 익스포트하여 취득한 데이터로 한정되며, 오래된 데이터는 임포트에 실패할 수 있습니다.
익스포트한 사용자 ID와 다른 사용자 ID로 임포트할 수 있지만, 사용자 데이터의 페이로드 내에 사용자 ID가 포함되어 있는 경우에는 그렇지 않을 수 있습니다.

이 API를 호출하기 전에 prepareImportUserDataByUserId 를 호출하여 업로드 준비를 완료해야 합니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
userIdstring
~ 128자사용자ID
uploadTokenstring
~ 1024자업로드 준비 시 수신한 토큰
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

반환값: 없음

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.ImportUserDataByUserId(
    &chat.ImportUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
        UploadToken: pointy.String("upload-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\ImportUserDataByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->importUserDataByUserId(
        (new ImportUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withUploadToken("upload-0001")
            ->withTimeOffsetToken(null)
    );
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.ImportUserDataByUserIdRequest;
import io.gs2.chat.result.ImportUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    ImportUserDataByUserIdResult result = client.importUserDataByUserId(
        new ImportUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withUploadToken("upload-0001")
            .withTimeOffsetToken(null)
    );
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.ImportUserDataByUserIdResult> asyncResult = null;
yield return client.ImportUserDataByUserId(
    new Gs2.Gs2Chat.Request.ImportUserDataByUserIdRequest()
        .WithUserId("user-0001")
        .WithUploadToken("upload-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.importUserDataByUserId(
        new Gs2Chat.ImportUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withUploadToken("upload-0001")
            .withTimeOffsetToken(null)
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.import_user_data_by_user_id(
        chat.ImportUserDataByUserIdRequest()
            .with_user_id('user-0001')
            .with_upload_token('upload-0001')
            .with_time_offset_token(None)
    )
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.import_user_data_by_user_id({
    userId="user-0001",
    uploadToken="upload-0001",
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
client = gs2('chat')

api_result_handler = client.import_user_data_by_user_id_async({
    userId="user-0001",
    uploadToken="upload-0001",
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result

checkImportUserDataByUserId

지정한 사용자 ID에 연결된 데이터의 임포트가 완료되었는지 확인

상세

Request

타입활성화 조건필수기본값값 제한설명
userIdstring
~ 128자사용자ID
uploadTokenstring
~ 1024자업로드 준비 시 수신한 토큰
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
urlstring출력 로그의 URL

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.CheckImportUserDataByUserId(
    &chat.CheckImportUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
        UploadToken: pointy.String("upload-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
url := result.Url
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\CheckImportUserDataByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->checkImportUserDataByUserId(
        (new CheckImportUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withUploadToken("upload-0001")
            ->withTimeOffsetToken(null)
    );
    $url = $result->getUrl();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.CheckImportUserDataByUserIdRequest;
import io.gs2.chat.result.CheckImportUserDataByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    CheckImportUserDataByUserIdResult result = client.checkImportUserDataByUserId(
        new CheckImportUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withUploadToken("upload-0001")
            .withTimeOffsetToken(null)
    );
    String url = result.getUrl();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.CheckImportUserDataByUserIdResult> asyncResult = null;
yield return client.CheckImportUserDataByUserId(
    new Gs2.Gs2Chat.Request.CheckImportUserDataByUserIdRequest()
        .WithUserId("user-0001")
        .WithUploadToken("upload-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var url = result.Url;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.checkImportUserDataByUserId(
        new Gs2Chat.CheckImportUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withUploadToken("upload-0001")
            .withTimeOffsetToken(null)
    );
    const url = result.getUrl();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.check_import_user_data_by_user_id(
        chat.CheckImportUserDataByUserIdRequest()
            .with_user_id('user-0001')
            .with_upload_token('upload-0001')
            .with_time_offset_token(None)
    )
    url = result.url
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.check_import_user_data_by_user_id({
    userId="user-0001",
    uploadToken="upload-0001",
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
url = result.url;
client = gs2('chat')

api_result_handler = client.check_import_user_data_by_user_id_async({
    userId="user-0001",
    uploadToken="upload-0001",
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
url = result.url;

describeRooms

룸 정보 목록 취득

페이지 토큰과 취득 건수 제한을 지정하여, 룸 정보 목록을 취득할 수 있습니다.
이를 통해 존재하는 룸의 개요를 확인할 수 있습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
namePrefixstring~ 64자룸 이름 필터 접두사
pageTokenstring~ 1024자데이터 취득을 시작할 위치를 지정하는 토큰
limitint301 ~ 1000취득할 데이터 건수

Result

타입설명
itemsList<Room>룸 정보 목록
nextPageTokenstring목록의 나머지를 취득하기 위한 페이지 토큰

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.DescribeRooms(
    &chat.DescribeRoomsRequest {
        NamespaceName: pointy.String("namespace-0001"),
        NamePrefix: nil,
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\DescribeRoomsRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->describeRooms(
        (new DescribeRoomsRequest())
            ->withNamespaceName("namespace-0001")
            ->withNamePrefix(null)
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.DescribeRoomsRequest;
import io.gs2.chat.result.DescribeRoomsResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    DescribeRoomsResult result = client.describeRooms(
        new DescribeRoomsRequest()
            .withNamespaceName("namespace-0001")
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    List<Room> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.DescribeRoomsResult> asyncResult = null;
yield return client.DescribeRooms(
    new Gs2.Gs2Chat.Request.DescribeRoomsRequest()
        .WithNamespaceName("namespace-0001")
        .WithNamePrefix(null)
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.describeRooms(
        new Gs2Chat.DescribeRoomsRequest()
            .withNamespaceName("namespace-0001")
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.describe_rooms(
        chat.DescribeRoomsRequest()
            .with_namespace_name('namespace-0001')
            .with_name_prefix(None)
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.describe_rooms({
    namespaceName="namespace-0001",
    namePrefix=nil,
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('chat')

api_result_handler = client.describe_rooms_async({
    namespaceName="namespace-0001",
    namePrefix=nil,
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

createRoom

룸 생성

룸 이름, 사용자 ID, 메타데이터, 비밀번호, 화이트리스트에 등록될 사용자 ID를 지정하여 룸을 생성할 수 있습니다.
룸 이름은 생략 가능하며, 생략한 경우 UUID(Universally Unique Identifier)가 자동으로 부여됩니다.
새로운 커뮤니케이션 공간을 마련하기 위해 사용됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
accessTokenstring
~ 128자액세스 토큰
룸 오너의 사용자 ID입니다. 설정하면, 오너만 룸을 삭제할 수 있게 됩니다. 오너 설정은 선택 사항입니다.
namestringUUID~ 128자룸 이름
룸 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
metadatastring~ 1024자메타데이터
메타데이터에는 임의의 값을 설정할 수 있습니다.
이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다.
passwordstring~ 128자룸에 액세스하기 위해 필요한 비밀번호
설정하면, 메시지를 가져오거나 게시할 때 비밀번호 입력이 필요해집니다. 설정한 비밀번호는 다시 확인할 수 없습니다. 통신의 비밀에 해당할 가능성이 있어, 게임 관리자라도 비밀번호를 모르면 메시지에 액세스할 수 없게 됩니다.
whiteListUserIdsList<string>[]0 ~ 1000 items룸에 액세스 가능한 사용자 ID 리스트
설정하면, 리스트에 포함된 사용자만 룸의 메시지를 가져오거나 게시할 수 있게 됩니다. 비어 있는 경우, 사용자 ID에 의한 액세스 제한은 적용되지 않습니다(단, 비밀번호가 별도로 필요할 수 있습니다).

Result

타입설명
itemRoom생성한 룸

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.CreateRoom(
    &chat.CreateRoomRequest {
        NamespaceName: pointy.String("namespace-0001"),
        AccessToken: pointy.String("accessToken-0001"),
        Name: pointy.String("room-0001"),
        Metadata: nil,
        Password: nil,
        WhiteListUserIds: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\CreateRoomRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->createRoom(
        (new CreateRoomRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
            ->withName("room-0001")
            ->withMetadata(null)
            ->withPassword(null)
            ->withWhiteListUserIds(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.CreateRoomRequest;
import io.gs2.chat.result.CreateRoomResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    CreateRoomResult result = client.createRoom(
        new CreateRoomRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withName("room-0001")
            .withMetadata(null)
            .withPassword(null)
            .withWhiteListUserIds(null)
    );
    Room item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.CreateRoomResult> asyncResult = null;
yield return client.CreateRoom(
    new Gs2.Gs2Chat.Request.CreateRoomRequest()
        .WithNamespaceName("namespace-0001")
        .WithAccessToken("accessToken-0001")
        .WithName("room-0001")
        .WithMetadata(null)
        .WithPassword(null)
        .WithWhiteListUserIds(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.createRoom(
        new Gs2Chat.CreateRoomRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withName("room-0001")
            .withMetadata(null)
            .withPassword(null)
            .withWhiteListUserIds(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.create_room(
        chat.CreateRoomRequest()
            .with_namespace_name('namespace-0001')
            .with_access_token('accessToken-0001')
            .with_name('room-0001')
            .with_metadata(None)
            .with_password(None)
            .with_white_list_user_ids(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.create_room({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    name="room-0001",
    metadata=nil,
    password=nil,
    whiteListUserIds=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.create_room_async({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    name="room-0001",
    metadata=nil,
    password=nil,
    whiteListUserIds=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

createRoomFromBackend

백엔드에서 룸 생성

이 API는 게임 플레이어가 호출하는 것이 아니라, 시스템 관련 처리에서 룸을 생성할 때 사용합니다.

룸 이름, 사용자 ID, 메타데이터, 비밀번호, 화이트리스트에 등록될 사용자 ID를 지정하여 룸을 생성할 수 있습니다.
룸 이름은 생략 가능하며, 생략한 경우 UUID(Universally Unique Identifier)가 자동으로 부여됩니다.
새로운 커뮤니케이션 공간을 마련하기 위해 사용됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
namestringUUID~ 128자룸 이름
룸 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
userIdstring~ 128자오너 사용자 ID
룸 오너의 사용자 ID입니다. 설정하면, 오너만 룸을 삭제할 수 있게 됩니다. 오너 설정은 선택 사항입니다.
metadatastring~ 1024자메타데이터
메타데이터에는 임의의 값을 설정할 수 있습니다.
이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다.
passwordstring~ 128자룸에 액세스하기 위해 필요한 비밀번호
설정하면, 메시지를 가져오거나 게시할 때 비밀번호 입력이 필요해집니다. 설정한 비밀번호는 다시 확인할 수 없습니다. 통신의 비밀에 해당할 가능성이 있어, 게임 관리자라도 비밀번호를 모르면 메시지에 액세스할 수 없게 됩니다.
whiteListUserIdsList<string>[]0 ~ 1000 items룸에 액세스 가능한 사용자 ID 리스트
설정하면, 리스트에 포함된 사용자만 룸의 메시지를 가져오거나 게시할 수 있게 됩니다. 비어 있는 경우, 사용자 ID에 의한 액세스 제한은 적용되지 않습니다(단, 비밀번호가 별도로 필요할 수 있습니다).
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
itemRoom생성한 룸

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.CreateRoomFromBackend(
    &chat.CreateRoomFromBackendRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Name: pointy.String("room-0001"),
        UserId: nil,
        Metadata: nil,
        Password: nil,
        WhiteListUserIds: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\CreateRoomFromBackendRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->createRoomFromBackend(
        (new CreateRoomFromBackendRequest())
            ->withNamespaceName("namespace-0001")
            ->withName("room-0001")
            ->withUserId(null)
            ->withMetadata(null)
            ->withPassword(null)
            ->withWhiteListUserIds(null)
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.CreateRoomFromBackendRequest;
import io.gs2.chat.result.CreateRoomFromBackendResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    CreateRoomFromBackendResult result = client.createRoomFromBackend(
        new CreateRoomFromBackendRequest()
            .withNamespaceName("namespace-0001")
            .withName("room-0001")
            .withUserId(null)
            .withMetadata(null)
            .withPassword(null)
            .withWhiteListUserIds(null)
            .withTimeOffsetToken(null)
    );
    Room item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.CreateRoomFromBackendResult> asyncResult = null;
yield return client.CreateRoomFromBackend(
    new Gs2.Gs2Chat.Request.CreateRoomFromBackendRequest()
        .WithNamespaceName("namespace-0001")
        .WithName("room-0001")
        .WithUserId(null)
        .WithMetadata(null)
        .WithPassword(null)
        .WithWhiteListUserIds(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.createRoomFromBackend(
        new Gs2Chat.CreateRoomFromBackendRequest()
            .withNamespaceName("namespace-0001")
            .withName("room-0001")
            .withUserId(null)
            .withMetadata(null)
            .withPassword(null)
            .withWhiteListUserIds(null)
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.create_room_from_backend(
        chat.CreateRoomFromBackendRequest()
            .with_namespace_name('namespace-0001')
            .with_name('room-0001')
            .with_user_id(None)
            .with_metadata(None)
            .with_password(None)
            .with_white_list_user_ids(None)
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.create_room_from_backend({
    namespaceName="namespace-0001",
    name="room-0001",
    userId=nil,
    metadata=nil,
    password=nil,
    whiteListUserIds=nil,
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.create_room_from_backend_async({
    namespaceName="namespace-0001",
    name="room-0001",
    userId=nil,
    metadata=nil,
    password=nil,
    whiteListUserIds=nil,
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

getRoom

룸 정보 취득

지정된 네임스페이스의 룸 이름을 지정하여, 특정 룸의 상세 정보를 취득합니다.
취득되는 정보에는 룸의 메타데이터, 작성자의 사용자 ID, 화이트리스트 설정이 포함됩니다.
이 작업에는 비밀번호 검증이 필요하지 않습니다. 비밀번호는 응답에 포함되지 않습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
UUID~ 128자룸 이름
룸 고유의 이름. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.

Result

타입설명
itemRoom

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.GetRoom(
    &chat.GetRoomRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\GetRoomRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->getRoom(
        (new GetRoomRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.GetRoomRequest;
import io.gs2.chat.result.GetRoomResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    GetRoomResult result = client.getRoom(
        new GetRoomRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
    );
    Room item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.GetRoomResult> asyncResult = null;
yield return client.GetRoom(
    new Gs2.Gs2Chat.Request.GetRoomRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.getRoom(
        new Gs2Chat.GetRoomRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.get_room(
        chat.GetRoomRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.get_room({
    namespaceName="namespace-0001",
    roomName="room-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.get_room_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

updateRoom

룸 갱신

지정된 룸의 메타데이터, 비밀번호, 화이트리스트 설정을 갱신합니다.
룸의 작성자(원래 룸을 생성한 사용자) 또는 화이트리스트에 등록된 사용자만 이 작업을 수행할 수 있습니다.
현재 로그인한 사용자에게 룸에 대한 쓰기 권한이 없는 경우, 오류가 반환됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
UUID~ 128자룸 이름
룸 고유의 이름. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
metadatastring~ 1024자메타데이터
메타데이터에는 임의의 값을 설정할 수 있습니다.
이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다.
passwordstring~ 128자룸에 액세스하기 위해 필요한 비밀번호
설정하면, 메시지를 가져오거나 게시할 때 비밀번호 입력이 필요해집니다. 설정한 비밀번호는 다시 확인할 수 없습니다. 통신의 비밀에 해당할 가능성이 있어, 게임 관리자라도 비밀번호를 모르면 메시지에 액세스할 수 없게 됩니다.
whiteListUserIdsList<string>[]0 ~ 1000 items룸에 액세스 가능한 사용자 ID 리스트
설정하면, 리스트에 포함된 사용자만 룸의 메시지를 가져오거나 게시할 수 있게 됩니다. 비어 있는 경우, 사용자 ID에 의한 액세스 제한은 적용되지 않습니다(단, 비밀번호가 별도로 필요할 수 있습니다).
accessTokenstring
~ 128자액세스 토큰
룸 오너의 사용자 ID입니다. 설정하면, 오너만 룸을 삭제할 수 있게 됩니다. 오너 설정은 선택 사항입니다.

Result

타입설명
itemRoom갱신한 룸

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.UpdateRoom(
    &chat.UpdateRoomRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        Metadata: nil,
        Password: pointy.String("password-0002"),
        WhiteListUserIds: []*string{
            pointy.String("user-0001"),
            pointy.String("user-0002"),
            pointy.String("user-0003"),
        },
        AccessToken: pointy.String("accessToken-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\UpdateRoomRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->updateRoom(
        (new UpdateRoomRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withMetadata(null)
            ->withPassword("password-0002")
            ->withWhiteListUserIds([
                "user-0001",
                "user-0002",
                "user-0003",
            ])
            ->withAccessToken("accessToken-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.UpdateRoomRequest;
import io.gs2.chat.result.UpdateRoomResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    UpdateRoomResult result = client.updateRoom(
        new UpdateRoomRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withMetadata(null)
            .withPassword("password-0002")
            .withWhiteListUserIds(Arrays.asList(
                "user-0001",
                "user-0002",
                "user-0003"
            ))
            .withAccessToken("accessToken-0001")
    );
    Room item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.UpdateRoomResult> asyncResult = null;
yield return client.UpdateRoom(
    new Gs2.Gs2Chat.Request.UpdateRoomRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithMetadata(null)
        .WithPassword("password-0002")
        .WithWhiteListUserIds(new string[] {
            "user-0001",
            "user-0002",
            "user-0003",
        })
        .WithAccessToken("accessToken-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.updateRoom(
        new Gs2Chat.UpdateRoomRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withMetadata(null)
            .withPassword("password-0002")
            .withWhiteListUserIds([
                "user-0001",
                "user-0002",
                "user-0003",
            ])
            .withAccessToken("accessToken-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.update_room(
        chat.UpdateRoomRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_metadata(None)
            .with_password('password-0002')
            .with_white_list_user_ids([
                'user-0001',
                'user-0002',
                'user-0003',
            ])
            .with_access_token('accessToken-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.update_room({
    namespaceName="namespace-0001",
    roomName="room-0001",
    metadata=nil,
    password="password-0002",
    whiteListUserIds={
        "user-0001",
        "user-0002",
        "user-0003"
    },
    accessToken="accessToken-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.update_room_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    metadata=nil,
    password="password-0002",
    whiteListUserIds={
        "user-0001",
        "user-0002",
        "user-0003"
    },
    accessToken="accessToken-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

updateRoomFromBackend

백엔드에서 룸 갱신

서버 사이드에서 지정된 룸의 메타데이터, 비밀번호, 화이트리스트 설정을 갱신합니다.
플레이어용 갱신 API와 달리, 시스템 레벨의 작업을 목적으로 하므로, 액세스 토큰에 대한 쓰기 권한 검증은 수행하지 않습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
UUID~ 128자룸 이름
룸 고유의 이름. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
metadatastring~ 1024자메타데이터
메타데이터에는 임의의 값을 설정할 수 있습니다.
이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다.
passwordstring~ 128자룸에 액세스하기 위해 필요한 비밀번호
설정하면, 메시지를 가져오거나 게시할 때 비밀번호 입력이 필요해집니다. 설정한 비밀번호는 다시 확인할 수 없습니다. 통신의 비밀에 해당할 가능성이 있어, 게임 관리자라도 비밀번호를 모르면 메시지에 액세스할 수 없게 됩니다.
whiteListUserIdsList<string>[]0 ~ 1000 items룸에 액세스 가능한 사용자 ID 리스트
설정하면, 리스트에 포함된 사용자만 룸의 메시지를 가져오거나 게시할 수 있게 됩니다. 비어 있는 경우, 사용자 ID에 의한 액세스 제한은 적용되지 않습니다(단, 비밀번호가 별도로 필요할 수 있습니다).
userIdstring~ 128자오너 사용자 ID
룸 오너의 사용자 ID입니다. 설정하면, 오너만 룸을 삭제할 수 있게 됩니다. 오너 설정은 선택 사항입니다.
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
itemRoom갱신한 룸

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.UpdateRoomFromBackend(
    &chat.UpdateRoomFromBackendRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        Metadata: pointy.String("ROOM_0001"),
        Password: pointy.String("password-0003"),
        WhiteListUserIds: []*string{
            pointy.String("user-0001"),
            pointy.String("user-0002"),
            pointy.String("user-0003"),
        },
        UserId: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\UpdateRoomFromBackendRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->updateRoomFromBackend(
        (new UpdateRoomFromBackendRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withMetadata("ROOM_0001")
            ->withPassword("password-0003")
            ->withWhiteListUserIds([
                "user-0001",
                "user-0002",
                "user-0003",
            ])
            ->withUserId(null)
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.UpdateRoomFromBackendRequest;
import io.gs2.chat.result.UpdateRoomFromBackendResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    UpdateRoomFromBackendResult result = client.updateRoomFromBackend(
        new UpdateRoomFromBackendRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withMetadata("ROOM_0001")
            .withPassword("password-0003")
            .withWhiteListUserIds(Arrays.asList(
                "user-0001",
                "user-0002",
                "user-0003"
            ))
            .withUserId(null)
            .withTimeOffsetToken(null)
    );
    Room item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.UpdateRoomFromBackendResult> asyncResult = null;
yield return client.UpdateRoomFromBackend(
    new Gs2.Gs2Chat.Request.UpdateRoomFromBackendRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithMetadata("ROOM_0001")
        .WithPassword("password-0003")
        .WithWhiteListUserIds(new string[] {
            "user-0001",
            "user-0002",
            "user-0003",
        })
        .WithUserId(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.updateRoomFromBackend(
        new Gs2Chat.UpdateRoomFromBackendRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withMetadata("ROOM_0001")
            .withPassword("password-0003")
            .withWhiteListUserIds([
                "user-0001",
                "user-0002",
                "user-0003",
            ])
            .withUserId(null)
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.update_room_from_backend(
        chat.UpdateRoomFromBackendRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_metadata('ROOM_0001')
            .with_password('password-0003')
            .with_white_list_user_ids([
                'user-0001',
                'user-0002',
                'user-0003',
            ])
            .with_user_id(None)
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.update_room_from_backend({
    namespaceName="namespace-0001",
    roomName="room-0001",
    metadata="ROOM_0001",
    password="password-0003",
    whiteListUserIds={
        "user-0001",
        "user-0002",
        "user-0003"
    },
    userId=nil,
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.update_room_from_backend_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    metadata="ROOM_0001",
    password="password-0003",
    whiteListUserIds={
        "user-0001",
        "user-0002",
        "user-0003"
    },
    userId=nil,
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

deleteRoom

룸 삭제

지정된 네임스페이스에서 룸을 삭제합니다.
룸의 작성자 또는 화이트리스트에 등록된 사용자만 이 작업을 수행할 수 있습니다.
현재 로그인한 사용자에게 룸에 대한 쓰기 권한이 없는 경우, 오류가 반환됩니다.
룸을 삭제하면, 관련된 모든 메시지와 구독 정보도 함께 삭제됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
UUID~ 128자룸 이름
룸 고유의 이름. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
accessTokenstring
~ 128자액세스 토큰
룸 오너의 사용자 ID입니다. 설정하면, 오너만 룸을 삭제할 수 있게 됩니다. 오너 설정은 선택 사항입니다.

Result

타입설명
itemRoom삭제한 룸

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.DeleteRoom(
    &chat.DeleteRoomRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        AccessToken: pointy.String("accessToken-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\DeleteRoomRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->deleteRoom(
        (new DeleteRoomRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withAccessToken("accessToken-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.DeleteRoomRequest;
import io.gs2.chat.result.DeleteRoomResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    DeleteRoomResult result = client.deleteRoom(
        new DeleteRoomRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withAccessToken("accessToken-0001")
    );
    Room item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.DeleteRoomResult> asyncResult = null;
yield return client.DeleteRoom(
    new Gs2.Gs2Chat.Request.DeleteRoomRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithAccessToken("accessToken-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.deleteRoom(
        new Gs2Chat.DeleteRoomRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withAccessToken("accessToken-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.delete_room(
        chat.DeleteRoomRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_access_token('accessToken-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.delete_room({
    namespaceName="namespace-0001",
    roomName="room-0001",
    accessToken="accessToken-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.delete_room_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    accessToken="accessToken-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

deleteRoomFromBackend

백엔드에서 룸 삭제

서버 사이드에서 지정된 룸을 삭제합니다.
플레이어용 삭제 API와 달리, 시스템 레벨의 작업을 목적으로 하므로, 액세스 토큰에 대한 쓰기 권한 검증은 수행하지 않습니다.
룸을 삭제하면, 관련된 모든 메시지와 구독 정보도 함께 삭제됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
UUID~ 128자룸 이름
룸 고유의 이름. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
userIdstring~ 128자오너 사용자 ID
룸 오너의 사용자 ID입니다. 설정하면, 오너만 룸을 삭제할 수 있게 됩니다. 오너 설정은 선택 사항입니다.
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
itemRoom삭제한 룸

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.DeleteRoomFromBackend(
    &chat.DeleteRoomFromBackendRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        UserId: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\DeleteRoomFromBackendRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->deleteRoomFromBackend(
        (new DeleteRoomFromBackendRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withUserId(null)
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.DeleteRoomFromBackendRequest;
import io.gs2.chat.result.DeleteRoomFromBackendResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    DeleteRoomFromBackendResult result = client.deleteRoomFromBackend(
        new DeleteRoomFromBackendRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withUserId(null)
            .withTimeOffsetToken(null)
    );
    Room item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.DeleteRoomFromBackendResult> asyncResult = null;
yield return client.DeleteRoomFromBackend(
    new Gs2.Gs2Chat.Request.DeleteRoomFromBackendRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithUserId(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.deleteRoomFromBackend(
        new Gs2Chat.DeleteRoomFromBackendRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withUserId(null)
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.delete_room_from_backend(
        chat.DeleteRoomFromBackendRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_user_id(None)
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.delete_room_from_backend({
    namespaceName="namespace-0001",
    roomName="room-0001",
    userId=nil,
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.delete_room_from_backend_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    userId=nil,
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

describeMessages

메시지 목록 취득

지정된 룸 내의 메시지를, 지정된 시작 시각부터 현재 시각까지 시간순으로 취득합니다.
옵션으로 카테고리 번호를 지정하여, 특정 종류의 메시지(텍스트 메시지, 스탬프 등)만 취득할 수 있습니다.
룸에 비밀번호가 설정되어 있는 경우에는, 올바른 비밀번호를 제공해야 합니다. 룸에 화이트리스트가 설정되어 있는 경우, 액세스는 목록에 있는 사용자로 제한됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
UUID~ 128자룸 이름
룸 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
passwordstring~ 128자룸에 액세스하기 위해 필요한 비밀번호
설정하면, 메시지를 가져오거나 게시할 때 비밀번호 입력이 필요해집니다. 설정한 비밀번호는 다시 확인할 수 없습니다. 통신의 비밀에 해당할 가능성이 있어, 게임 관리자라도 비밀번호를 모르면 메시지에 액세스할 수 없게 됩니다.
categoryint0 ~ 2147483645메시지 분류용 카테고리 번호
accessTokenstring
~ 128자액세스 토큰
startAtlong현재 시각으로부터 1시간 전의 절대 시각메시지 취득을 시작하는 시각
UNIX 시간·밀리초
limitint301 ~ 1000취득할 데이터 건수

Result

타입설명
itemsList<Message>메시지 목록

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.DescribeMessages(
    &chat.DescribeMessagesRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        Password: nil,
        Category: nil,
        AccessToken: pointy.String("accessToken-0001"),
        StartAt: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\DescribeMessagesRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->describeMessages(
        (new DescribeMessagesRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withPassword(null)
            ->withCategory(null)
            ->withAccessToken("accessToken-0001")
            ->withStartAt(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.DescribeMessagesRequest;
import io.gs2.chat.result.DescribeMessagesResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    DescribeMessagesResult result = client.describeMessages(
        new DescribeMessagesRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withPassword(null)
            .withCategory(null)
            .withAccessToken("accessToken-0001")
            .withStartAt(null)
            .withLimit(null)
    );
    List<Message> items = result.getItems();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.DescribeMessagesResult> asyncResult = null;
yield return client.DescribeMessages(
    new Gs2.Gs2Chat.Request.DescribeMessagesRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithPassword(null)
        .WithCategory(null)
        .WithAccessToken("accessToken-0001")
        .WithStartAt(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.describeMessages(
        new Gs2Chat.DescribeMessagesRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withPassword(null)
            .withCategory(null)
            .withAccessToken("accessToken-0001")
            .withStartAt(null)
            .withLimit(null)
    );
    const items = result.getItems();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.describe_messages(
        chat.DescribeMessagesRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_password(None)
            .with_category(None)
            .with_access_token('accessToken-0001')
            .with_start_at(None)
            .with_limit(None)
    )
    items = result.items
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.describe_messages({
    namespaceName="namespace-0001",
    roomName="room-0001",
    password=nil,
    category=nil,
    accessToken="accessToken-0001",
    startAt=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
client = gs2('chat')

api_result_handler = client.describe_messages_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    password=nil,
    category=nil,
    accessToken="accessToken-0001",
    startAt=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;

describeMessagesByUserId

사용자 ID를 지정하여 메시지 목록 취득

지정된 룸 내의 메시지를, 지정된 시작 시각부터 현재 시각까지 시간순으로 취득합니다.
옵션으로 카테고리 번호를 지정하여, 특정 종류의 메시지(텍스트 메시지, 스탬프 등)만 취득할 수 있습니다.
룸에 비밀번호가 설정되어 있는 경우에는, 올바른 비밀번호를 제공해야 합니다. 룸에 화이트리스트가 설정되어 있는 경우, 액세스는 목록에 있는 사용자로 제한됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
UUID~ 128자룸 이름
룸 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
passwordstring~ 128자룸에 액세스하기 위해 필요한 비밀번호
설정하면, 메시지를 가져오거나 게시할 때 비밀번호 입력이 필요해집니다. 설정한 비밀번호는 다시 확인할 수 없습니다. 통신의 비밀에 해당할 가능성이 있어, 게임 관리자라도 비밀번호를 모르면 메시지에 액세스할 수 없게 됩니다.
categoryint0 ~ 2147483645메시지 분류용 카테고리 번호
userIdstring
~ 128자사용자ID
startAtlong현재 시각으로부터 1시간 전의 절대 시각메시지 취득을 시작하는 시각
UNIX 시간·밀리초
limitint301 ~ 1000취득할 데이터 건수
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
itemsList<Message>메시지 목록

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.DescribeMessagesByUserId(
    &chat.DescribeMessagesByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        Password: nil,
        Category: nil,
        UserId: pointy.String("user-0002"),
        StartAt: nil,
        Limit: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\DescribeMessagesByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->describeMessagesByUserId(
        (new DescribeMessagesByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withPassword(null)
            ->withCategory(null)
            ->withUserId("user-0002")
            ->withStartAt(null)
            ->withLimit(null)
            ->withTimeOffsetToken(null)
    );
    $items = $result->getItems();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.DescribeMessagesByUserIdRequest;
import io.gs2.chat.result.DescribeMessagesByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    DescribeMessagesByUserIdResult result = client.describeMessagesByUserId(
        new DescribeMessagesByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withPassword(null)
            .withCategory(null)
            .withUserId("user-0002")
            .withStartAt(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    List<Message> items = result.getItems();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.DescribeMessagesByUserIdResult> asyncResult = null;
yield return client.DescribeMessagesByUserId(
    new Gs2.Gs2Chat.Request.DescribeMessagesByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithPassword(null)
        .WithCategory(null)
        .WithUserId("user-0002")
        .WithStartAt(null)
        .WithLimit(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.describeMessagesByUserId(
        new Gs2Chat.DescribeMessagesByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withPassword(null)
            .withCategory(null)
            .withUserId("user-0002")
            .withStartAt(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    const items = result.getItems();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.describe_messages_by_user_id(
        chat.DescribeMessagesByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_password(None)
            .with_category(None)
            .with_user_id('user-0002')
            .with_start_at(None)
            .with_limit(None)
            .with_time_offset_token(None)
    )
    items = result.items
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.describe_messages_by_user_id({
    namespaceName="namespace-0001",
    roomName="room-0001",
    password=nil,
    category=nil,
    userId="user-0002",
    startAt=nil,
    limit=nil,
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
client = gs2('chat')

api_result_handler = client.describe_messages_by_user_id_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    password=nil,
    category=nil,
    userId="user-0002",
    startAt=nil,
    limit=nil,
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;

describeLatestMessages

최신 메시지 목록 취득

지정된 룸 내의 최신 메시지를 페이지네이션과 함께, 새로운 것부터 순서대로 취득합니다.
채팅 타임라인에서 최신 메시지를 먼저 표시하는 경우에 유용합니다.
옵션으로 카테고리 번호를 지정하여, 특정 종류의 메시지만 취득할 수 있습니다.
룸에 비밀번호가 설정되어 있는 경우에는, 올바른 비밀번호를 제공해야 합니다. 룸에 화이트리스트가 설정되어 있는 경우, 액세스는 목록에 있는 사용자로 제한됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
UUID~ 128자룸 이름
룸 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
passwordstring~ 128자룸에 액세스하기 위해 필요한 비밀번호
설정하면, 메시지를 가져오거나 게시할 때 비밀번호 입력이 필요해집니다. 설정한 비밀번호는 다시 확인할 수 없습니다. 통신의 비밀에 해당할 가능성이 있어, 게임 관리자라도 비밀번호를 모르면 메시지에 액세스할 수 없게 됩니다.
categoryint0 ~ 2147483645메시지 분류용 카테고리 번호
accessTokenstring
~ 128자액세스 토큰
pageTokenstring~ 1024자데이터 취득을 시작할 위치를 지정하는 토큰
limitint301 ~ 1000취득할 데이터 건수

Result

타입설명
itemsList<Message>메시지 목록
nextPageTokenstring목록의 나머지를 취득하기 위한 페이지 토큰

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.DescribeLatestMessages(
    &chat.DescribeLatestMessagesRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        Password: nil,
        Category: nil,
        AccessToken: pointy.String("accessToken-0001"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\DescribeLatestMessagesRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->describeLatestMessages(
        (new DescribeLatestMessagesRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withPassword(null)
            ->withCategory(null)
            ->withAccessToken("accessToken-0001")
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.DescribeLatestMessagesRequest;
import io.gs2.chat.result.DescribeLatestMessagesResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    DescribeLatestMessagesResult result = client.describeLatestMessages(
        new DescribeLatestMessagesRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withPassword(null)
            .withCategory(null)
            .withAccessToken("accessToken-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Message> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.DescribeLatestMessagesResult> asyncResult = null;
yield return client.DescribeLatestMessages(
    new Gs2.Gs2Chat.Request.DescribeLatestMessagesRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithPassword(null)
        .WithCategory(null)
        .WithAccessToken("accessToken-0001")
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.describeLatestMessages(
        new Gs2Chat.DescribeLatestMessagesRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withPassword(null)
            .withCategory(null)
            .withAccessToken("accessToken-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.describe_latest_messages(
        chat.DescribeLatestMessagesRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_password(None)
            .with_category(None)
            .with_access_token('accessToken-0001')
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.describe_latest_messages({
    namespaceName="namespace-0001",
    roomName="room-0001",
    password=nil,
    category=nil,
    accessToken="accessToken-0001",
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('chat')

api_result_handler = client.describe_latest_messages_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    password=nil,
    category=nil,
    accessToken="accessToken-0001",
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

describeLatestMessagesByUserId

사용자 ID를 지정하여 최신 메시지 목록 취득

지정된 룸 내의 최신 메시지를 페이지네이션을 지원하여 새로운 순서로 취득합니다.
채팅 타임라인에서 최신 메시지를 먼저 표시할 때 유용합니다.
옵션으로 카테고리 번호를 지정하여 특정 종류의 메시지만 취득할 수 있습니다.
룸에 비밀번호가 설정되어 있는 경우 올바른 비밀번호를 제공해야 합니다. 룸에 화이트리스트가 설정되어 있는 경우 접근은 목록에 있는 사용자로 제한됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
UUID~ 128자룸 이름
룸 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
passwordstring~ 128자룸에 액세스하기 위해 필요한 비밀번호
설정하면, 메시지를 가져오거나 게시할 때 비밀번호 입력이 필요해집니다. 설정한 비밀번호는 다시 확인할 수 없습니다. 통신의 비밀에 해당할 가능성이 있어, 게임 관리자라도 비밀번호를 모르면 메시지에 액세스할 수 없게 됩니다.
categoryint0 ~ 2147483645메시지 분류용 카테고리 번호
userIdstring
~ 128자사용자ID
pageTokenstring~ 1024자데이터 취득을 시작할 위치를 지정하는 토큰
limitint301 ~ 1000취득할 데이터 건수
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
itemsList<Message>메시지 목록
nextPageTokenstring목록의 나머지를 취득하기 위한 페이지 토큰

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.DescribeLatestMessagesByUserId(
    &chat.DescribeLatestMessagesByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        Password: nil,
        Category: nil,
        UserId: pointy.String("user-0002"),
        PageToken: nil,
        Limit: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\DescribeLatestMessagesByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->describeLatestMessagesByUserId(
        (new DescribeLatestMessagesByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withPassword(null)
            ->withCategory(null)
            ->withUserId("user-0002")
            ->withPageToken(null)
            ->withLimit(null)
            ->withTimeOffsetToken(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.DescribeLatestMessagesByUserIdRequest;
import io.gs2.chat.result.DescribeLatestMessagesByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    DescribeLatestMessagesByUserIdResult result = client.describeLatestMessagesByUserId(
        new DescribeLatestMessagesByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withPassword(null)
            .withCategory(null)
            .withUserId("user-0002")
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    List<Message> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.DescribeLatestMessagesByUserIdResult> asyncResult = null;
yield return client.DescribeLatestMessagesByUserId(
    new Gs2.Gs2Chat.Request.DescribeLatestMessagesByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithPassword(null)
        .WithCategory(null)
        .WithUserId("user-0002")
        .WithPageToken(null)
        .WithLimit(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.describeLatestMessagesByUserId(
        new Gs2Chat.DescribeLatestMessagesByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withPassword(null)
            .withCategory(null)
            .withUserId("user-0002")
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.describe_latest_messages_by_user_id(
        chat.DescribeLatestMessagesByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_password(None)
            .with_category(None)
            .with_user_id('user-0002')
            .with_page_token(None)
            .with_limit(None)
            .with_time_offset_token(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.describe_latest_messages_by_user_id({
    namespaceName="namespace-0001",
    roomName="room-0001",
    password=nil,
    category=nil,
    userId="user-0002",
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('chat')

api_result_handler = client.describe_latest_messages_by_user_id_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    password=nil,
    category=nil,
    userId="user-0002",
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

post

메시지 게시

현재 로그인한 사용자로서 지정된 룸에 메시지를 게시합니다.
카테고리 번호를 지정하여 메시지의 종류(예: 0은 텍스트, 1은 스탬프/스티커)를 분류하고, 메타데이터에 메시지 내용을 포함할 수 있습니다.
메시지 카테고리 모델에서 rejectAccessTokenPost 플래그가 활성화되어 있는 경우, 액세스 토큰을 통한 게시는 거부되며 오류가 반환됩니다. 이 경우 서버 사이드의 PostByUserId API를 사용하세요.
룸에 비밀번호가 설정되어 있는 경우 올바른 비밀번호를 제공해야 합니다. 룸에 화이트리스트가 있는 경우 접근은 목록에 있는 사용자로 제한됩니다.
게시 후, 메시지의 카테고리 알림 설정과 일치하는 룸 구독 사용자 전원에게 자동으로 알림이 전송됩니다.
메시지의 TTL은 네임스페이스의 messageLifeTimeDays 설정에 따라 결정됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
~ 128자룸 이름
룸 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
accessTokenstring
~ 128자액세스 토큰
categoryint00 ~ 2147483645메시지 분류용 카테고리 번호
메시지를 분류하기 위한 숫자 값입니다. 예를 들어, 0은 텍스트 메시지, 1은 스탬프(스티커), 그 외의 값은 커스텀 메시지 타입으로 사용할 수 있습니다. 카테고리에 따라 메시지에 적용되는 CategoryModel의 규칙이 결정됩니다.
metadatastring
~ 1024자메타데이터
메타데이터에는 임의의 값을 설정할 수 있습니다.
이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다.
passwordstring~ 128자비밀번호

Result

타입설명
itemMessage게시한 메시지

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.Post(
    &chat.PostRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        AccessToken: pointy.String("accessToken-0001"),
        Category: nil,
        Metadata: pointy.String("MESSAGE_0001"),
        Password: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\PostRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->post(
        (new PostRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withAccessToken("accessToken-0001")
            ->withCategory(null)
            ->withMetadata("MESSAGE_0001")
            ->withPassword(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.PostRequest;
import io.gs2.chat.result.PostResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    PostResult result = client.post(
        new PostRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withAccessToken("accessToken-0001")
            .withCategory(null)
            .withMetadata("MESSAGE_0001")
            .withPassword(null)
    );
    Message item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.PostResult> asyncResult = null;
yield return client.Post(
    new Gs2.Gs2Chat.Request.PostRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithAccessToken("accessToken-0001")
        .WithCategory(null)
        .WithMetadata("MESSAGE_0001")
        .WithPassword(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.post(
        new Gs2Chat.PostRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withAccessToken("accessToken-0001")
            .withCategory(null)
            .withMetadata("MESSAGE_0001")
            .withPassword(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.post(
        chat.PostRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_access_token('accessToken-0001')
            .with_category(None)
            .with_metadata('MESSAGE_0001')
            .with_password(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.post({
    namespaceName="namespace-0001",
    roomName="room-0001",
    accessToken="accessToken-0001",
    category=nil,
    metadata="MESSAGE_0001",
    password=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.post_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    accessToken="accessToken-0001",
    category=nil,
    metadata="MESSAGE_0001",
    password=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

postByUserId

사용자 ID를 지정하여 메시지 게시

서버 사이드에서 지정된 사용자로서 지정된 룸에 메시지를 게시합니다.
액세스 토큰을 통한 게시와 달리, 카테고리의 rejectAccessTokenPost 제한을 받지 않으므로 시스템 메시지나 공지사항 게시에 적합합니다.
룸에 비밀번호가 설정되어 있는 경우 올바른 비밀번호를 제공해야 합니다. 룸에 화이트리스트가 있는 경우 접근은 목록에 있는 사용자로 제한됩니다.
게시 후, 메시지의 카테고리 알림 설정과 일치하는 룸 구독 사용자 전원에게 자동으로 알림이 전송됩니다.
메시지의 TTL은 네임스페이스의 messageLifeTimeDays 설정에 따라 결정됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
~ 128자룸 이름
룸 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
userIdstring
~ 128자사용자ID
categoryint00 ~ 2147483645메시지 분류용 카테고리 번호
메시지를 분류하기 위한 숫자 값입니다. 예를 들어, 0은 텍스트 메시지, 1은 스탬프(스티커), 그 외의 값은 커스텀 메시지 타입으로 사용할 수 있습니다. 카테고리에 따라 메시지에 적용되는 CategoryModel의 규칙이 결정됩니다.
metadatastring
~ 1024자메타데이터
메타데이터에는 임의의 값을 설정할 수 있습니다.
이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다.
passwordstring~ 128자비밀번호
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
itemMessage게시한 메시지

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.PostByUserId(
    &chat.PostByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0002"),
        UserId: pointy.String("user-0002"),
        Category: nil,
        Metadata: pointy.String("MESSAGE_0003"),
        Password: pointy.String("password-0002"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\PostByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->postByUserId(
        (new PostByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0002")
            ->withUserId("user-0002")
            ->withCategory(null)
            ->withMetadata("MESSAGE_0003")
            ->withPassword("password-0002")
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.PostByUserIdRequest;
import io.gs2.chat.result.PostByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    PostByUserIdResult result = client.postByUserId(
        new PostByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0002")
            .withUserId("user-0002")
            .withCategory(null)
            .withMetadata("MESSAGE_0003")
            .withPassword("password-0002")
            .withTimeOffsetToken(null)
    );
    Message item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.PostByUserIdResult> asyncResult = null;
yield return client.PostByUserId(
    new Gs2.Gs2Chat.Request.PostByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0002")
        .WithUserId("user-0002")
        .WithCategory(null)
        .WithMetadata("MESSAGE_0003")
        .WithPassword("password-0002")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.postByUserId(
        new Gs2Chat.PostByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0002")
            .withUserId("user-0002")
            .withCategory(null)
            .withMetadata("MESSAGE_0003")
            .withPassword("password-0002")
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.post_by_user_id(
        chat.PostByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0002')
            .with_user_id('user-0002')
            .with_category(None)
            .with_metadata('MESSAGE_0003')
            .with_password('password-0002')
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.post_by_user_id({
    namespaceName="namespace-0001",
    roomName="room-0002",
    userId="user-0002",
    category=nil,
    metadata="MESSAGE_0003",
    password="password-0002",
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.post_by_user_id_async({
    namespaceName="namespace-0001",
    roomName="room-0002",
    userId="user-0002",
    category=nil,
    metadata="MESSAGE_0003",
    password="password-0002",
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

getMessage

메시지 취득

지정된 룸에서 메시지 이름을 지정하여 특정 메시지를 취득합니다.
룸에 비밀번호가 설정되어 있는 경우 올바른 비밀번호를 제공해야 합니다. 룸에 화이트리스트가 있는 경우 접근은 목록에 있는 사용자로 제한됩니다.
취득되는 정보에는 메시지의 카테고리, 메타데이터(내용), 게시 사용자 ID, 생성 타임스탬프가 포함됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
~ 128자룸 이름
룸 고유의 이름. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
messageNamestring
UUID~ 36자메시지 이름
메시지의 고유한 이름을 유지합니다.
이름은 UUID(Universally Unique Identifier) 형식으로 자동 생성되며, 각 메시지를 식별하는 데 사용됩니다.
passwordstring~ 128자비밀번호
accessTokenstring~ 128자액세스 토큰

Result

타입설명
itemMessage메시지

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.GetMessage(
    &chat.GetMessageRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        MessageName: pointy.String("message-0001"),
        Password: nil,
        AccessToken: pointy.String("accessToken-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\GetMessageRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->getMessage(
        (new GetMessageRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withMessageName("message-0001")
            ->withPassword(null)
            ->withAccessToken("accessToken-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.GetMessageRequest;
import io.gs2.chat.result.GetMessageResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    GetMessageResult result = client.getMessage(
        new GetMessageRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withMessageName("message-0001")
            .withPassword(null)
            .withAccessToken("accessToken-0001")
    );
    Message item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.GetMessageResult> asyncResult = null;
yield return client.GetMessage(
    new Gs2.Gs2Chat.Request.GetMessageRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithMessageName("message-0001")
        .WithPassword(null)
        .WithAccessToken("accessToken-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.getMessage(
        new Gs2Chat.GetMessageRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withMessageName("message-0001")
            .withPassword(null)
            .withAccessToken("accessToken-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.get_message(
        chat.GetMessageRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_message_name('message-0001')
            .with_password(None)
            .with_access_token('accessToken-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.get_message({
    namespaceName="namespace-0001",
    roomName="room-0001",
    messageName="message-0001",
    password=nil,
    accessToken="accessToken-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.get_message_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    messageName="message-0001",
    password=nil,
    accessToken="accessToken-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

getMessageByUserId

사용자 ID를 지정하여 메시지 취득

서버 사이드의 사용자 ID를 사용하여, 지정된 룸에서 메시지 이름을 지정해 특정 메시지를 취득합니다.
룸에 비밀번호가 설정되어 있는 경우 올바른 비밀번호를 제공해야 합니다. 룸에 화이트리스트가 있는 경우 접근은 목록에 있는 사용자로 제한됩니다.
취득되는 정보에는 메시지의 카테고리, 메타데이터(내용), 게시 사용자 ID, 생성 타임스탬프가 포함됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
~ 128자룸 이름
룸 고유의 이름. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
messageNamestring
UUID~ 36자메시지 이름
메시지의 고유한 이름을 유지합니다.
이름은 UUID(Universally Unique Identifier) 형식으로 자동 생성되며, 각 메시지를 식별하는 데 사용됩니다.
passwordstring~ 128자비밀번호
userIdstring~ 128자사용자ID
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
itemMessage메시지

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.GetMessageByUserId(
    &chat.GetMessageByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        MessageName: pointy.String("message-0001"),
        Password: nil,
        UserId: pointy.String("user-0002"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\GetMessageByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->getMessageByUserId(
        (new GetMessageByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withMessageName("message-0001")
            ->withPassword(null)
            ->withUserId("user-0002")
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.GetMessageByUserIdRequest;
import io.gs2.chat.result.GetMessageByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    GetMessageByUserIdResult result = client.getMessageByUserId(
        new GetMessageByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withMessageName("message-0001")
            .withPassword(null)
            .withUserId("user-0002")
            .withTimeOffsetToken(null)
    );
    Message item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.GetMessageByUserIdResult> asyncResult = null;
yield return client.GetMessageByUserId(
    new Gs2.Gs2Chat.Request.GetMessageByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithMessageName("message-0001")
        .WithPassword(null)
        .WithUserId("user-0002")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.getMessageByUserId(
        new Gs2Chat.GetMessageByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withMessageName("message-0001")
            .withPassword(null)
            .withUserId("user-0002")
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.get_message_by_user_id(
        chat.GetMessageByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_message_name('message-0001')
            .with_password(None)
            .with_user_id('user-0002')
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.get_message_by_user_id({
    namespaceName="namespace-0001",
    roomName="room-0001",
    messageName="message-0001",
    password=nil,
    userId="user-0002",
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.get_message_by_user_id_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    messageName="message-0001",
    password=nil,
    userId="user-0002",
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

deleteMessage

메시지 삭제

지정된 룸에서 특정 메시지를 삭제합니다.
이 작업은 메시지를 완전히 삭제하며, 복원할 수 없습니다.
게시 사용자에 관계없이 임의의 메시지를 삭제할 수 있는 관리용 API입니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
~ 128자룸 이름
룸 고유의 이름. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
userIdstring~ 128자사용자ID
messageNamestring
UUID~ 36자메시지 이름
메시지의 고유한 이름을 유지합니다.
이름은 UUID(Universally Unique Identifier) 형식으로 자동 생성되며, 각 메시지를 식별하는 데 사용됩니다.
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
itemMessage삭제한 메시지

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.DeleteMessage(
    &chat.DeleteMessageRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        UserId: pointy.String("user-0001"),
        MessageName: pointy.String("message-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\DeleteMessageRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->deleteMessage(
        (new DeleteMessageRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withUserId("user-0001")
            ->withMessageName("message-0001")
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.DeleteMessageRequest;
import io.gs2.chat.result.DeleteMessageResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    DeleteMessageResult result = client.deleteMessage(
        new DeleteMessageRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withUserId("user-0001")
            .withMessageName("message-0001")
            .withTimeOffsetToken(null)
    );
    Message item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.DeleteMessageResult> asyncResult = null;
yield return client.DeleteMessage(
    new Gs2.Gs2Chat.Request.DeleteMessageRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithUserId("user-0001")
        .WithMessageName("message-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.deleteMessage(
        new Gs2Chat.DeleteMessageRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withUserId("user-0001")
            .withMessageName("message-0001")
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.delete_message(
        chat.DeleteMessageRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_user_id('user-0001')
            .with_message_name('message-0001')
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.delete_message({
    namespaceName="namespace-0001",
    roomName="room-0001",
    userId="user-0001",
    messageName="message-0001",
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.delete_message_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    userId="user-0001",
    messageName="message-0001",
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

describeSubscribes

룸 구독 목록 취득

페이지 토큰과 취득 건수 제한을 지정하여 구독 중인 룸의 목록을 취득할 수 있습니다.
이를 통해 사용자가 구독 중인 룸의 개요를 확인할 수 있습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamePrefixstring~ 64자구독 중인 룸 이름의 필터 접두사
accessTokenstring
~ 128자액세스 토큰
pageTokenstring~ 1024자데이터 취득을 시작할 위치를 지정하는 토큰
limitint301 ~ 1000취득할 데이터 건수

Result

타입설명
itemsList<Subscribe>룸 구독 목록
nextPageTokenstring목록의 나머지를 취득하기 위한 페이지 토큰

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.DescribeSubscribes(
    &chat.DescribeSubscribesRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomNamePrefix: nil,
        AccessToken: pointy.String("accessToken-0001"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\DescribeSubscribesRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->describeSubscribes(
        (new DescribeSubscribesRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomNamePrefix(null)
            ->withAccessToken("accessToken-0001")
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.DescribeSubscribesRequest;
import io.gs2.chat.result.DescribeSubscribesResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    DescribeSubscribesResult result = client.describeSubscribes(
        new DescribeSubscribesRequest()
            .withNamespaceName("namespace-0001")
            .withRoomNamePrefix(null)
            .withAccessToken("accessToken-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Subscribe> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.DescribeSubscribesResult> asyncResult = null;
yield return client.DescribeSubscribes(
    new Gs2.Gs2Chat.Request.DescribeSubscribesRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomNamePrefix(null)
        .WithAccessToken("accessToken-0001")
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.describeSubscribes(
        new Gs2Chat.DescribeSubscribesRequest()
            .withNamespaceName("namespace-0001")
            .withRoomNamePrefix(null)
            .withAccessToken("accessToken-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.describe_subscribes(
        chat.DescribeSubscribesRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name_prefix(None)
            .with_access_token('accessToken-0001')
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.describe_subscribes({
    namespaceName="namespace-0001",
    roomNamePrefix=nil,
    accessToken="accessToken-0001",
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('chat')

api_result_handler = client.describe_subscribes_async({
    namespaceName="namespace-0001",
    roomNamePrefix=nil,
    accessToken="accessToken-0001",
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

describeSubscribesByUserId

사용자 ID를 지정하여 룸 구독의 목록 취득

페이지 토큰과 취득 건수 제한을 지정하여 구독 목록을 취득할 수 있습니다.
이를 통해 사용자가 구독 중인 룸의 개요를 확인할 수 있습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamePrefixstring~ 64자구독 중인 룸 이름의 필터 접두사
userIdstring
~ 128자사용자ID
pageTokenstring~ 1024자데이터 취득을 시작할 위치를 지정하는 토큰
limitint301 ~ 1000취득할 데이터 건수
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
itemsList<Subscribe>룸 구독 목록
nextPageTokenstring목록의 나머지를 취득하기 위한 페이지 토큰

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.DescribeSubscribesByUserId(
    &chat.DescribeSubscribesByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomNamePrefix: nil,
        UserId: pointy.String("user-0001"),
        PageToken: nil,
        Limit: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\DescribeSubscribesByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->describeSubscribesByUserId(
        (new DescribeSubscribesByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomNamePrefix(null)
            ->withUserId("user-0001")
            ->withPageToken(null)
            ->withLimit(null)
            ->withTimeOffsetToken(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.DescribeSubscribesByUserIdRequest;
import io.gs2.chat.result.DescribeSubscribesByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    DescribeSubscribesByUserIdResult result = client.describeSubscribesByUserId(
        new DescribeSubscribesByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withRoomNamePrefix(null)
            .withUserId("user-0001")
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    List<Subscribe> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.DescribeSubscribesByUserIdResult> asyncResult = null;
yield return client.DescribeSubscribesByUserId(
    new Gs2.Gs2Chat.Request.DescribeSubscribesByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomNamePrefix(null)
        .WithUserId("user-0001")
        .WithPageToken(null)
        .WithLimit(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.describeSubscribesByUserId(
        new Gs2Chat.DescribeSubscribesByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withRoomNamePrefix(null)
            .withUserId("user-0001")
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.describe_subscribes_by_user_id(
        chat.DescribeSubscribesByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name_prefix(None)
            .with_user_id('user-0001')
            .with_page_token(None)
            .with_limit(None)
            .with_time_offset_token(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.describe_subscribes_by_user_id({
    namespaceName="namespace-0001",
    roomNamePrefix=nil,
    userId="user-0001",
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('chat')

api_result_handler = client.describe_subscribes_by_user_id_async({
    namespaceName="namespace-0001",
    roomNamePrefix=nil,
    userId="user-0001",
    pageToken=nil,
    limit=nil,
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

describeSubscribesByRoomName

룸 이름을 지정하여 구독 중인 사용자의 목록 취득

페이지 토큰과 취득 건수 제한을 지정하여 해당 룸을 구독 중인 사용자 목록을 취득할 수 있습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
~ 128자구독할 룸 이름
구독할 채팅 룸의 이름입니다. 구독하면, 이 룸에 새로운 메시지가 게시될 때마다 GS2-Gateway를 통해 푸시 알림이 전송됩니다.
pageTokenstring~ 1024자데이터 취득을 시작할 위치를 지정하는 토큰
limitint301 ~ 1000취득할 데이터 건수

Result

타입설명
itemsList<Subscribe>룸 구독 목록
nextPageTokenstring목록의 나머지를 취득하기 위한 페이지 토큰

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.DescribeSubscribesByRoomName(
    &chat.DescribeSubscribesByRoomNameRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\DescribeSubscribesByRoomNameRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->describeSubscribesByRoomName(
        (new DescribeSubscribesByRoomNameRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.DescribeSubscribesByRoomNameRequest;
import io.gs2.chat.result.DescribeSubscribesByRoomNameResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    DescribeSubscribesByRoomNameResult result = client.describeSubscribesByRoomName(
        new DescribeSubscribesByRoomNameRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Subscribe> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.DescribeSubscribesByRoomNameResult> asyncResult = null;
yield return client.DescribeSubscribesByRoomName(
    new Gs2.Gs2Chat.Request.DescribeSubscribesByRoomNameRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.describeSubscribesByRoomName(
        new Gs2Chat.DescribeSubscribesByRoomNameRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.describe_subscribes_by_room_name(
        chat.DescribeSubscribesByRoomNameRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.describe_subscribes_by_room_name({
    namespaceName="namespace-0001",
    roomName="room-0001",
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('chat')

api_result_handler = client.describe_subscribes_by_room_name_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

subscribe

룸을 구독

지정된 룸에 새로운 메시지가 게시되었을 때 알림을 받을 수 있도록, 현재 로그인한 사용자를 구독 등록합니다.
알림 타입을 지정하여 알림 설정을 구성할 수 있으며, 메시지 카테고리별로 알림을 필터링할 수 있습니다.
구독 중인 룸에 메시지가 게시되면, 카테고리 필터가 일치하는 모든 구독자에게 알림이 전달됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
~ 128자구독할 룸 이름
구독할 채팅 룸의 이름입니다. 구독하면, 이 룸에 새로운 메시지가 게시될 때마다 GS2-Gateway를 통해 푸시 알림이 전송됩니다.
accessTokenstring
~ 128자액세스 토큰
notificationTypesList<NotificationType>[]0 ~ 100 items신규 메시지 알림을 받을 카테고리 리스트
푸시 알림을 트리거하는 메시지 카테고리를 필터링합니다. 비어 있는 경우, 모든 카테고리에 대해 알림이 전송됩니다. 각 항목은 카테고리 번호와 선택적인 모바일 푸시 알림 전달 여부를 지정합니다.

Result

타입설명
itemSubscribe룸 구독

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.Subscribe(
    &chat.SubscribeRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        AccessToken: pointy.String("accessToken-0001"),
        NotificationTypes: []chat.NotificationType{
            chat.NotificationType{
            },
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\SubscribeRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->subscribe(
        (new SubscribeRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withAccessToken("accessToken-0001")
            ->withNotificationTypes([
                (new \Gs2\Chat\Model\NotificationType()),
            ])
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.SubscribeRequest;
import io.gs2.chat.result.SubscribeResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    SubscribeResult result = client.subscribe(
        new SubscribeRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withAccessToken("accessToken-0001")
            .withNotificationTypes(Arrays.asList(
                new io.gs2.chat.model.NotificationType()
            ))
    );
    Subscribe item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.SubscribeResult> asyncResult = null;
yield return client.Subscribe(
    new Gs2.Gs2Chat.Request.SubscribeRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithAccessToken("accessToken-0001")
        .WithNotificationTypes(new Gs2.Gs2Chat.Model.NotificationType[] {
            new Gs2.Gs2Chat.Model.NotificationType(),
        }),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.subscribe(
        new Gs2Chat.SubscribeRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withAccessToken("accessToken-0001")
            .withNotificationTypes([
                new Gs2Chat.model.NotificationType(),
            ])
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.subscribe(
        chat.SubscribeRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_access_token('accessToken-0001')
            .with_notification_types([
                chat.NotificationType(),
            ])
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.subscribe({
    namespaceName="namespace-0001",
    roomName="room-0001",
    accessToken="accessToken-0001",
    notificationTypes={
        {
        }
    },
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.subscribe_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    accessToken="accessToken-0001",
    notificationTypes={
        {
        }
    },
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

subscribeByUserId

사용자 ID를 지정하여 룸을 구독

지정된 룸에 새로운 메시지가 게시되었을 때 알림을 받을 수 있도록, 지정된 사용자를 구독 등록합니다.
알림 타입을 지정하여 알림 설정을 구성할 수 있으며, 메시지 카테고리별로 알림을 필터링할 수 있습니다.
구독 중인 룸에 메시지가 게시되면, 카테고리 필터가 일치하는 모든 구독자에게 알림이 전달됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
~ 128자구독할 룸 이름
구독할 채팅 룸의 이름입니다. 구독하면, 이 룸에 새로운 메시지가 게시될 때마다 GS2-Gateway를 통해 푸시 알림이 전송됩니다.
userIdstring
~ 128자사용자ID
notificationTypesList<NotificationType>[]0 ~ 100 items신규 메시지 알림을 받을 카테고리 리스트
푸시 알림을 트리거하는 메시지 카테고리를 필터링합니다. 비어 있는 경우, 모든 카테고리에 대해 알림이 전송됩니다. 각 항목은 카테고리 번호와 선택적인 모바일 푸시 알림 전달 여부를 지정합니다.
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
itemSubscribe룸 구독

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.SubscribeByUserId(
    &chat.SubscribeByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        UserId: pointy.String("user-0001"),
        NotificationTypes: []chat.NotificationType{
            *.NotificationType(),
        },
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\SubscribeByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->subscribeByUserId(
        (new SubscribeByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withUserId("user-0001")
            ->withNotificationTypes([
                NotificationType(),
            ])
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.SubscribeByUserIdRequest;
import io.gs2.chat.result.SubscribeByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    SubscribeByUserIdResult result = client.subscribeByUserId(
        new SubscribeByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withUserId("user-0001")
            .withNotificationTypes(Arrays.asList(
                new NotificationType()
            ))
            .withTimeOffsetToken(null)
    );
    Subscribe item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.SubscribeByUserIdResult> asyncResult = null;
yield return client.SubscribeByUserId(
    new Gs2.Gs2Chat.Request.SubscribeByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithUserId("user-0001")
        .WithNotificationTypes(new Gs2.Gs2Chat.Model.NotificationType[] {
            new Gs2.Gs2Chat.Model.NotificationType(),
        })
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.subscribeByUserId(
        new Gs2Chat.SubscribeByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withUserId("user-0001")
            .withNotificationTypes([
                new NotificationType(),
            ])
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.subscribe_by_user_id(
        chat.SubscribeByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_user_id('user-0001')
            .with_notification_types([
                NotificationType(),
            ])
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.subscribe_by_user_id({
    namespaceName="namespace-0001",
    roomName="room-0001",
    userId="user-0001",
    notificationTypes={
        {}
    },
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.subscribe_by_user_id_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    userId="user-0001",
    notificationTypes={
        {}
    },
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

getSubscribe

룸 구독 정보 취득

현재 로그인한 사용자의, 지정된 룸에 대한 구독 정보를 취득합니다.
취득되는 정보에는 이 구독에 설정된 알림 타입 설정이 포함됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
~ 128자구독할 룸 이름
구독할 채팅 룸의 이름입니다. 구독하면, 이 룸에 새로운 메시지가 게시될 때마다 GS2-Gateway를 통해 푸시 알림이 전송됩니다.
accessTokenstring
~ 128자액세스 토큰

Result

타입설명
itemSubscribe룸 구독

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.GetSubscribe(
    &chat.GetSubscribeRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        AccessToken: pointy.String("accessToken-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\GetSubscribeRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->getSubscribe(
        (new GetSubscribeRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withAccessToken("accessToken-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.GetSubscribeRequest;
import io.gs2.chat.result.GetSubscribeResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    GetSubscribeResult result = client.getSubscribe(
        new GetSubscribeRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withAccessToken("accessToken-0001")
    );
    Subscribe item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.GetSubscribeResult> asyncResult = null;
yield return client.GetSubscribe(
    new Gs2.Gs2Chat.Request.GetSubscribeRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithAccessToken("accessToken-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.getSubscribe(
        new Gs2Chat.GetSubscribeRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withAccessToken("accessToken-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.get_subscribe(
        chat.GetSubscribeRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_access_token('accessToken-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.get_subscribe({
    namespaceName="namespace-0001",
    roomName="room-0001",
    accessToken="accessToken-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.get_subscribe_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    accessToken="accessToken-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

getSubscribeByUserId

사용자 ID를 지정하여 룸 구독 정보 취득

지정된 사용자의, 지정된 룸에 대한 구독 정보를 취득합니다.
취득되는 정보에는 이 구독에 설정된 알림 타입 설정이 포함됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
~ 128자구독할 룸 이름
구독할 채팅 룸의 이름입니다. 구독하면, 이 룸에 새로운 메시지가 게시될 때마다 GS2-Gateway를 통해 푸시 알림이 전송됩니다.
userIdstring
~ 128자사용자ID
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
itemSubscribe룸 구독

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.GetSubscribeByUserId(
    &chat.GetSubscribeByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        UserId: pointy.String("user-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\GetSubscribeByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->getSubscribeByUserId(
        (new GetSubscribeByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.GetSubscribeByUserIdRequest;
import io.gs2.chat.result.GetSubscribeByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    GetSubscribeByUserIdResult result = client.getSubscribeByUserId(
        new GetSubscribeByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    Subscribe item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.GetSubscribeByUserIdResult> asyncResult = null;
yield return client.GetSubscribeByUserId(
    new Gs2.Gs2Chat.Request.GetSubscribeByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithUserId("user-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.getSubscribeByUserId(
        new Gs2Chat.GetSubscribeByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.get_subscribe_by_user_id(
        chat.GetSubscribeByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_user_id('user-0001')
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.get_subscribe_by_user_id({
    namespaceName="namespace-0001",
    roomName="room-0001",
    userId="user-0001",
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.get_subscribe_by_user_id_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    userId="user-0001",
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

updateNotificationType

알림 방법을 갱신

현재 로그인한 사용자의, 지정된 룸에 대한 구독의 알림 타입 설정을 갱신합니다.
알림 타입을 설정함으로써, 어떤 메시지 카테고리가 사용자에게 푸시 알림을 발생시킬지 제어할 수 있습니다.
예를 들어, 특정 카테고리 번호의 알림만 수신하도록 설정하거나, 특정 카테고리의 알림을 비활성화할 수 있습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
~ 128자구독 중인 룸 이름
알림 설정을 변경할 대상 구독 중 채팅 룸 이름입니다.
accessTokenstring
~ 128자액세스 토큰
notificationTypesList<NotificationType>[]0 ~ 100 items신규 메시지 알림을 받을 카테고리 리스트
푸시 알림을 트리거하는 메시지 카테고리를 필터링합니다. 비어 있는 경우, 모든 카테고리에 대해 알림이 전송됩니다. 각 항목은 카테고리 번호와 선택적인 모바일 푸시 알림 전달 여부를 지정합니다.

Result

타입설명
itemSubscribe갱신한 룸 구독

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.UpdateNotificationType(
    &chat.UpdateNotificationTypeRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        AccessToken: pointy.String("accessToken-0001"),
        NotificationTypes: []chat.NotificationType{
            *.NotificationType(),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\UpdateNotificationTypeRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->updateNotificationType(
        (new UpdateNotificationTypeRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withAccessToken("accessToken-0001")
            ->withNotificationTypes([
                NotificationType(),
            ])
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.UpdateNotificationTypeRequest;
import io.gs2.chat.result.UpdateNotificationTypeResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    UpdateNotificationTypeResult result = client.updateNotificationType(
        new UpdateNotificationTypeRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withAccessToken("accessToken-0001")
            .withNotificationTypes(Arrays.asList(
                new NotificationType()
            ))
    );
    Subscribe item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.UpdateNotificationTypeResult> asyncResult = null;
yield return client.UpdateNotificationType(
    new Gs2.Gs2Chat.Request.UpdateNotificationTypeRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithAccessToken("accessToken-0001")
        .WithNotificationTypes(new Gs2.Gs2Chat.Model.NotificationType[] {
            new Gs2.Gs2Chat.Model.NotificationType(),
        }),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.updateNotificationType(
        new Gs2Chat.UpdateNotificationTypeRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withAccessToken("accessToken-0001")
            .withNotificationTypes([
                new NotificationType(),
            ])
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.update_notification_type(
        chat.UpdateNotificationTypeRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_access_token('accessToken-0001')
            .with_notification_types([
                NotificationType(),
            ])
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.update_notification_type({
    namespaceName="namespace-0001",
    roomName="room-0001",
    accessToken="accessToken-0001",
    notificationTypes={
        {}
    },
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.update_notification_type_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    accessToken="accessToken-0001",
    notificationTypes={
        {}
    },
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

updateNotificationTypeByUserId

사용자 ID를 지정하여 알림 방법을 갱신

지정된 사용자의, 지정된 룸에 대한 구독의 알림 타입 설정을 갱신합니다.
알림 타입을 설정함으로써, 어떤 메시지 카테고리가 사용자에게 푸시 알림을 발생시킬지 제어할 수 있습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
~ 128자구독 중인 룸 이름
알림 설정을 변경할 대상 구독 중 채팅 룸 이름입니다.
userIdstring
~ 128자사용자ID
notificationTypesList<NotificationType>[]0 ~ 100 items신규 메시지 알림을 받을 카테고리 리스트
푸시 알림을 트리거하는 메시지 카테고리를 필터링합니다. 비어 있는 경우, 모든 카테고리에 대해 알림이 전송됩니다. 각 항목은 카테고리 번호와 선택적인 모바일 푸시 알림 전달 여부를 지정합니다.
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
itemSubscribe갱신한 룸 구독

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.UpdateNotificationTypeByUserId(
    &chat.UpdateNotificationTypeByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        UserId: pointy.String("user-0001"),
        NotificationTypes: []chat.NotificationType{
            *.NotificationType(),
        },
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\UpdateNotificationTypeByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->updateNotificationTypeByUserId(
        (new UpdateNotificationTypeByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withUserId("user-0001")
            ->withNotificationTypes([
                NotificationType(),
            ])
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.UpdateNotificationTypeByUserIdRequest;
import io.gs2.chat.result.UpdateNotificationTypeByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    UpdateNotificationTypeByUserIdResult result = client.updateNotificationTypeByUserId(
        new UpdateNotificationTypeByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withUserId("user-0001")
            .withNotificationTypes(Arrays.asList(
                new NotificationType()
            ))
            .withTimeOffsetToken(null)
    );
    Subscribe item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.UpdateNotificationTypeByUserIdResult> asyncResult = null;
yield return client.UpdateNotificationTypeByUserId(
    new Gs2.Gs2Chat.Request.UpdateNotificationTypeByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithUserId("user-0001")
        .WithNotificationTypes(new Gs2.Gs2Chat.Model.NotificationType[] {
            new Gs2.Gs2Chat.Model.NotificationType(),
        })
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.updateNotificationTypeByUserId(
        new Gs2Chat.UpdateNotificationTypeByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withUserId("user-0001")
            .withNotificationTypes([
                new NotificationType(),
            ])
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.update_notification_type_by_user_id(
        chat.UpdateNotificationTypeByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_user_id('user-0001')
            .with_notification_types([
                NotificationType(),
            ])
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.update_notification_type_by_user_id({
    namespaceName="namespace-0001",
    roomName="room-0001",
    userId="user-0001",
    notificationTypes={
        {}
    },
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.update_notification_type_by_user_id_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    userId="user-0001",
    notificationTypes={
        {}
    },
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

unsubscribe

룸 구독 해제

현재 로그인한 사용자의, 지정된 룸에 대한 구독을 해제합니다.
구독 해제 후에는, 이 룸에 새로운 메시지가 게시되어도 알림을 수신하지 않습니다.
구독 레코드는 완전히 삭제됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
~ 128자룸 구독을 해제할 룸 이름
구독을 해제할 채팅 룸의 이름입니다.
accessTokenstring
~ 128자액세스 토큰

Result

타입설명
itemSubscribe해제한 룸 구독

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.Unsubscribe(
    &chat.UnsubscribeRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        AccessToken: pointy.String("accessToken-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\UnsubscribeRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->unsubscribe(
        (new UnsubscribeRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withAccessToken("accessToken-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.UnsubscribeRequest;
import io.gs2.chat.result.UnsubscribeResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    UnsubscribeResult result = client.unsubscribe(
        new UnsubscribeRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withAccessToken("accessToken-0001")
    );
    Subscribe item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.UnsubscribeResult> asyncResult = null;
yield return client.Unsubscribe(
    new Gs2.Gs2Chat.Request.UnsubscribeRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithAccessToken("accessToken-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.unsubscribe(
        new Gs2Chat.UnsubscribeRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withAccessToken("accessToken-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.unsubscribe(
        chat.UnsubscribeRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_access_token('accessToken-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.unsubscribe({
    namespaceName="namespace-0001",
    roomName="room-0001",
    accessToken="accessToken-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.unsubscribe_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    accessToken="accessToken-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

unsubscribeByUserId

사용자 ID를 지정하여 룸 구독 해제

지정된 사용자의, 지정된 룸에 대한 구독을 해제합니다.
구독 해제 후에는, 이 룸에 새로운 메시지가 게시되어도 알림을 수신하지 않습니다.
구독 레코드는 완전히 삭제됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
roomNamestring
~ 128자룸 구독을 해제할 룸 이름
구독을 해제할 채팅 룸의 이름입니다.
userIdstring
~ 128자사용자ID
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
itemSubscribe해제한 룸 구독

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.UnsubscribeByUserId(
    &chat.UnsubscribeByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        RoomName: pointy.String("room-0001"),
        UserId: pointy.String("user-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\UnsubscribeByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->unsubscribeByUserId(
        (new UnsubscribeByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withRoomName("room-0001")
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.UnsubscribeByUserIdRequest;
import io.gs2.chat.result.UnsubscribeByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    UnsubscribeByUserIdResult result = client.unsubscribeByUserId(
        new UnsubscribeByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    Subscribe item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.UnsubscribeByUserIdResult> asyncResult = null;
yield return client.UnsubscribeByUserId(
    new Gs2.Gs2Chat.Request.UnsubscribeByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithRoomName("room-0001")
        .WithUserId("user-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.unsubscribeByUserId(
        new Gs2Chat.UnsubscribeByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withRoomName("room-0001")
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.unsubscribe_by_user_id(
        chat.UnsubscribeByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_room_name('room-0001')
            .with_user_id('user-0001')
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.unsubscribe_by_user_id({
    namespaceName="namespace-0001",
    roomName="room-0001",
    userId="user-0001",
    timeOffsetToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.unsubscribe_by_user_id_async({
    namespaceName="namespace-0001",
    roomName="room-0001",
    userId="user-0001",
    timeOffsetToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

describeCategoryModels

메시지 카테고리 모델 목록 취득

지정된 네임스페이스에서 현재 유효화되어 있는 모든 메시지 카테고리 모델을 취득합니다.
메시지 카테고리 모델은 메시지의 카테고리(일반 텍스트 메시지, 스탬프/스티커 등)를 정의하며, 카테고리별 게시 권한을 제어합니다.
마스터 버전과 달리, 유효화(공개)된 모델만 반환하며 페이지네이션은 없습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.

Result

타입설명
itemsList<CategoryModel>메시지 카테고리 모델 목록

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.DescribeCategoryModels(
    &chat.DescribeCategoryModelsRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\DescribeCategoryModelsRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->describeCategoryModels(
        (new DescribeCategoryModelsRequest())
            ->withNamespaceName("namespace-0001")
    );
    $items = $result->getItems();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.DescribeCategoryModelsRequest;
import io.gs2.chat.result.DescribeCategoryModelsResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    DescribeCategoryModelsResult result = client.describeCategoryModels(
        new DescribeCategoryModelsRequest()
            .withNamespaceName("namespace-0001")
    );
    List<CategoryModel> items = result.getItems();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.DescribeCategoryModelsResult> asyncResult = null;
yield return client.DescribeCategoryModels(
    new Gs2.Gs2Chat.Request.DescribeCategoryModelsRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.describeCategoryModels(
        new Gs2Chat.DescribeCategoryModelsRequest()
            .withNamespaceName("namespace-0001")
    );
    const items = result.getItems();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.describe_category_models(
        chat.DescribeCategoryModelsRequest()
            .with_namespace_name('namespace-0001')
    )
    items = result.items
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.describe_category_models({
    namespaceName="namespace-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
client = gs2('chat')

api_result_handler = client.describe_category_models_async({
    namespaceName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;

getCategoryModel

메시지 카테고리 모델 취득

지정된 네임스페이스에서 지정된 카테고리 번호의, 현재 유효한 메시지 카테고리 모델을 취득합니다.
취득되는 정보에는 액세스 토큰 인증 사용자가 이 카테고리에 게시하는 것이 제한되어 있는지 여부(rejectAccessTokenPost 플래그)가 포함됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
categoryint
0 ~ 2147483645카테고리
메시지 카테고리의 숫자 식별자입니다. 이 카테고리 번호로 게시된 메시지는, 플레이어의 게시를 허용할지 여부 등 이 모델에서 정의된 규칙을 따릅니다.

Result

타입설명
itemCategoryModel메시지 카테고리 모델

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.GetCategoryModel(
    &chat.GetCategoryModelRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Category: pointy.Int32(0),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\GetCategoryModelRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->getCategoryModel(
        (new GetCategoryModelRequest())
            ->withNamespaceName("namespace-0001")
            ->withCategory(0)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.GetCategoryModelRequest;
import io.gs2.chat.result.GetCategoryModelResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    GetCategoryModelResult result = client.getCategoryModel(
        new GetCategoryModelRequest()
            .withNamespaceName("namespace-0001")
            .withCategory(0)
    );
    CategoryModel item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.GetCategoryModelResult> asyncResult = null;
yield return client.GetCategoryModel(
    new Gs2.Gs2Chat.Request.GetCategoryModelRequest()
        .WithNamespaceName("namespace-0001")
        .WithCategory(0),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.getCategoryModel(
        new Gs2Chat.GetCategoryModelRequest()
            .withNamespaceName("namespace-0001")
            .withCategory(0)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.get_category_model(
        chat.GetCategoryModelRequest()
            .with_namespace_name('namespace-0001')
            .with_category(0)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.get_category_model({
    namespaceName="namespace-0001",
    category=0,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.get_category_model_async({
    namespaceName="namespace-0001",
    category=0,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

exportMaster

메시지 카테고리 모델 마스터를 유효화 가능한 마스터 데이터 형식으로 내보내기

현재의 메시지 카테고리 모델 마스터 데이터를 유효화에 사용할 수 있는 형식으로 내보냅니다.
내보낸 데이터는 현재 마스터 구성의 백업이나 다른 네임스페이스로의 가져오기에 사용할 수 있습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.

Result

타입설명
itemCurrentModelMaster유효화 가능한 메시지 카테고리 모델의 마스터 데이터

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.ExportMaster(
    &chat.ExportMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\ExportMasterRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->exportMaster(
        (new ExportMasterRequest())
            ->withNamespaceName("namespace-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.ExportMasterRequest;
import io.gs2.chat.result.ExportMasterResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    ExportMasterResult result = client.exportMaster(
        new ExportMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    CurrentModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.ExportMasterResult> asyncResult = null;
yield return client.ExportMaster(
    new Gs2.Gs2Chat.Request.ExportMasterRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.exportMaster(
        new Gs2Chat.ExportMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.export_master(
        chat.ExportMasterRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.export_master({
    namespaceName="namespace-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.export_master_async({
    namespaceName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

getCurrentModelMaster

현재 활성화된 메시지 카테고리 모델의 마스터 데이터 취득

지정된 네임스페이스에서 현재 유효화(공개)되어 있는 메시지 카테고리 모델의 마스터 데이터를 취득합니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.

Result

타입설명
itemCurrentModelMaster현재 활성화된 메시지 카테고리 모델의 마스터 데이터

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.GetCurrentModelMaster(
    &chat.GetCurrentModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\GetCurrentModelMasterRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->getCurrentModelMaster(
        (new GetCurrentModelMasterRequest())
            ->withNamespaceName("namespace-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.GetCurrentModelMasterRequest;
import io.gs2.chat.result.GetCurrentModelMasterResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    GetCurrentModelMasterResult result = client.getCurrentModelMaster(
        new GetCurrentModelMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    CurrentModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.GetCurrentModelMasterResult> asyncResult = null;
yield return client.GetCurrentModelMaster(
    new Gs2.Gs2Chat.Request.GetCurrentModelMasterRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.getCurrentModelMaster(
        new Gs2Chat.GetCurrentModelMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.get_current_model_master(
        chat.GetCurrentModelMasterRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.get_current_model_master({
    namespaceName="namespace-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.get_current_model_master_async({
    namespaceName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

preUpdateCurrentModelMaster

현재 활성화된 메시지 카테고리 모델의 마스터 데이터를 갱신(3단계 버전)

1MB를 초과하는 마스터 데이터를 업로드하는 경우에는, 3단계로 갱신을 수행합니다.

  1. 이 API를 실행하여 업로드용 토큰과 URL을 취득합니다.
  2. 취득한 URL에 마스터 데이터를 업로드합니다.
  3. UpdateCurrentModelMaster 에 업로드로 취득한 토큰을 전달하여 실행하고, 마스터 데이터를 반영합니다.
상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.

Result

타입설명
uploadTokenstring업로드 후 결과를 반영할 때 사용하는 토큰
uploadUrlstring업로드 처리 실행에 사용하는 URL

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.PreUpdateCurrentModelMaster(
    &chat.PreUpdateCurrentModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
uploadToken := result.UploadToken
uploadUrl := result.UploadUrl
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\PreUpdateCurrentModelMasterRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->preUpdateCurrentModelMaster(
        (new PreUpdateCurrentModelMasterRequest())
            ->withNamespaceName("namespace-0001")
    );
    $uploadToken = $result->getUploadToken();
    $uploadUrl = $result->getUploadUrl();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.PreUpdateCurrentModelMasterRequest;
import io.gs2.chat.result.PreUpdateCurrentModelMasterResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    PreUpdateCurrentModelMasterResult result = client.preUpdateCurrentModelMaster(
        new PreUpdateCurrentModelMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    String uploadToken = result.getUploadToken();
    String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.PreUpdateCurrentModelMasterResult> asyncResult = null;
yield return client.PreUpdateCurrentModelMaster(
    new Gs2.Gs2Chat.Request.PreUpdateCurrentModelMasterRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var uploadToken = result.UploadToken;
var uploadUrl = result.UploadUrl;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.preUpdateCurrentModelMaster(
        new Gs2Chat.PreUpdateCurrentModelMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    const uploadToken = result.getUploadToken();
    const uploadUrl = result.getUploadUrl();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.pre_update_current_model_master(
        chat.PreUpdateCurrentModelMasterRequest()
            .with_namespace_name('namespace-0001')
    )
    upload_token = result.upload_token
    upload_url = result.upload_url
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.pre_update_current_model_master({
    namespaceName="namespace-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;
client = gs2('chat')

api_result_handler = client.pre_update_current_model_master_async({
    namespaceName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;

updateCurrentModelMaster

현재 활성화된 메시지 카테고리 모델의 마스터 데이터 갱신

지정된 네임스페이스의 메시지 카테고리 모델의 마스터 데이터를 갱신하고 유효화(공개)합니다.
2가지 모드를 지원합니다: 인라인 마스터 데이터용 ‘direct’ 모드와, 사전에 업로드된 마스터 데이터용 ‘preUpload’ 모드입니다.
1MB를 초과하는 마스터 데이터의 경우에는, 3단계 갱신 흐름(PreUpdate -> 업로드 -> Update(preUpload 모드))을 사용해 주세요.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
mode문자열 열거형
enum {
  “direct”,
  “preUpload”
}
“direct”업데이트 모드
정의설명
direct마스터 데이터를 직접 업데이트
preUpload마스터 데이터를 업로드한 후 업데이트
settingsstring{mode} == “direct”
✓※
~ 5242880 바이트 (5MB)마스터 데이터
※ mode이(가) “direct” 이면 필수
uploadTokenstring{mode} == “preUpload”
✓※
~ 1024자사전 업로드로 획득한 토큰
업로드한 마스터 데이터를 적용하기 위해 사용됩니다.
※ mode이(가) “preUpload” 이면 필수

Result

타입설명
itemCurrentModelMaster갱신된 현재 활성화된 메시지 카테고리 모델의 마스터 데이터

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.UpdateCurrentModelMaster(
    &chat.UpdateCurrentModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Mode: pointy.String("direct"),
        Settings: pointy.String("{\"version\": \"2020-04-30\", \"categoryModels\": [{\"category\": 0, \"rejectAccessTokenPost\": \"Disabled\"}, {\"category\": 1, \"rejectAccessTokenPost\": \"Disabled\"}]}"),
        UploadToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\UpdateCurrentModelMasterRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->updateCurrentModelMaster(
        (new UpdateCurrentModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withMode("direct")
            ->withSettings("{\"version\": \"2020-04-30\", \"categoryModels\": [{\"category\": 0, \"rejectAccessTokenPost\": \"Disabled\"}, {\"category\": 1, \"rejectAccessTokenPost\": \"Disabled\"}]}")
            ->withUploadToken(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.UpdateCurrentModelMasterRequest;
import io.gs2.chat.result.UpdateCurrentModelMasterResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    UpdateCurrentModelMasterResult result = client.updateCurrentModelMaster(
        new UpdateCurrentModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withMode("direct")
            .withSettings("{\"version\": \"2020-04-30\", \"categoryModels\": [{\"category\": 0, \"rejectAccessTokenPost\": \"Disabled\"}, {\"category\": 1, \"rejectAccessTokenPost\": \"Disabled\"}]}")
            .withUploadToken(null)
    );
    CurrentModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.UpdateCurrentModelMasterResult> asyncResult = null;
yield return client.UpdateCurrentModelMaster(
    new Gs2.Gs2Chat.Request.UpdateCurrentModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithMode("direct")
        .WithSettings("{\"version\": \"2020-04-30\", \"categoryModels\": [{\"category\": 0, \"rejectAccessTokenPost\": \"Disabled\"}, {\"category\": 1, \"rejectAccessTokenPost\": \"Disabled\"}]}")
        .WithUploadToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.updateCurrentModelMaster(
        new Gs2Chat.UpdateCurrentModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withMode("direct")
            .withSettings("{\"version\": \"2020-04-30\", \"categoryModels\": [{\"category\": 0, \"rejectAccessTokenPost\": \"Disabled\"}, {\"category\": 1, \"rejectAccessTokenPost\": \"Disabled\"}]}")
            .withUploadToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.update_current_model_master(
        chat.UpdateCurrentModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_mode('direct')
            .with_settings('{"version": "2020-04-30", "categoryModels": [{"category": 0, "rejectAccessTokenPost": "Disabled"}, {"category": 1, "rejectAccessTokenPost": "Disabled"}]}')
            .with_upload_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.update_current_model_master({
    namespaceName="namespace-0001",
    mode="direct",
    settings="{\"version\": \"2020-04-30\", \"categoryModels\": [{\"category\": 0, \"rejectAccessTokenPost\": \"Disabled\"}, {\"category\": 1, \"rejectAccessTokenPost\": \"Disabled\"}]}",
    uploadToken=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.update_current_model_master_async({
    namespaceName="namespace-0001",
    mode="direct",
    settings="{\"version\": \"2020-04-30\", \"categoryModels\": [{\"category\": 0, \"rejectAccessTokenPost\": \"Disabled\"}, {\"category\": 1, \"rejectAccessTokenPost\": \"Disabled\"}]}",
    uploadToken=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

updateCurrentModelMasterFromGitHub

현재 활성화된 메시지 카테고리 모델의 마스터 데이터를 GitHub에서 갱신

GitHub 리포지토리에서 직접 마스터 데이터를 가져와 갱신·유효화(공개)합니다.
체크아웃 설정에는, 사용할 리포지토리, 브랜치/태그, 파일 경로를 지정합니다.
마스터 데이터를 버전 관리로 관리하고, 직접 배포하는 경우에 유용합니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
checkoutSettingGitHubCheckoutSetting
GitHub에서 마스터 데이터를 체크아웃하는 설정

Result

타입설명
itemCurrentModelMaster갱신된 현재 활성화된 메시지 카테고리 모델의 마스터 데이터

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.UpdateCurrentModelMasterFromGitHub(
    &chat.UpdateCurrentModelMasterFromGitHubRequest {
        NamespaceName: pointy.String("namespace-0001"),
        CheckoutSetting: &chat.GitHubCheckoutSetting{
            ApiKeyId: pointy.String("apiKeyId-0001"),
            RepositoryName: pointy.String("gs2io/master-data"),
            SourcePath: pointy.String("path/to/file.json"),
            ReferenceType: pointy.String("branch"),
            BranchName: pointy.String("develop"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\UpdateCurrentModelMasterFromGitHubRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->updateCurrentModelMasterFromGitHub(
        (new UpdateCurrentModelMasterFromGitHubRequest())
            ->withNamespaceName("namespace-0001")
            ->withCheckoutSetting((new GitHubCheckoutSetting())
                ->withApiKeyId("apiKeyId-0001")
                ->withRepositoryName("gs2io/master-data")
                ->withSourcePath("path/to/file.json")
                ->withReferenceType("branch")
                ->withBranchName("develop")
            )
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.UpdateCurrentModelMasterFromGitHubRequest;
import io.gs2.chat.result.UpdateCurrentModelMasterFromGitHubResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    UpdateCurrentModelMasterFromGitHubResult result = client.updateCurrentModelMasterFromGitHub(
        new UpdateCurrentModelMasterFromGitHubRequest()
            .withNamespaceName("namespace-0001")
            .withCheckoutSetting(new GitHubCheckoutSetting()
                .withApiKeyId("apiKeyId-0001")
                .withRepositoryName("gs2io/master-data")
                .withSourcePath("path/to/file.json")
                .withReferenceType("branch")
                .withBranchName("develop")
            )
    );
    CurrentModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.UpdateCurrentModelMasterFromGitHubResult> asyncResult = null;
yield return client.UpdateCurrentModelMasterFromGitHub(
    new Gs2.Gs2Chat.Request.UpdateCurrentModelMasterFromGitHubRequest()
        .WithNamespaceName("namespace-0001")
        .WithCheckoutSetting(new Gs2.Gs2Chat.Model.GitHubCheckoutSetting()
            .WithApiKeyId("apiKeyId-0001")
            .WithRepositoryName("gs2io/master-data")
            .WithSourcePath("path/to/file.json")
            .WithReferenceType("branch")
            .WithBranchName("develop")
        ),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.updateCurrentModelMasterFromGitHub(
        new Gs2Chat.UpdateCurrentModelMasterFromGitHubRequest()
            .withNamespaceName("namespace-0001")
            .withCheckoutSetting(new Gs2Chat.model.GitHubCheckoutSetting()
                .withApiKeyId("apiKeyId-0001")
                .withRepositoryName("gs2io/master-data")
                .withSourcePath("path/to/file.json")
                .withReferenceType("branch")
                .withBranchName("develop")
            )
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.update_current_model_master_from_git_hub(
        chat.UpdateCurrentModelMasterFromGitHubRequest()
            .with_namespace_name('namespace-0001')
            .with_checkout_setting(chat.GitHubCheckoutSetting()
                .with_api_key_id('apiKeyId-0001')
                .with_repository_name('gs2io/master-data')
                .with_source_path('path/to/file.json')
                .with_reference_type('branch')
                .with_branch_name('develop')
            )
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.update_current_model_master_from_git_hub({
    namespaceName="namespace-0001",
    checkoutSetting={
        api_key_id="apiKeyId-0001",
        repository_name="gs2io/master-data",
        source_path="path/to/file.json",
        reference_type="branch",
        branch_name="develop",
    },
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.update_current_model_master_from_git_hub_async({
    namespaceName="namespace-0001",
    checkoutSetting={
        api_key_id="apiKeyId-0001",
        repository_name="gs2io/master-data",
        source_path="path/to/file.json",
        reference_type="branch",
        branch_name="develop",
    },
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

describeCategoryModelMasters

메시지 카테고리 모델 마스터 목록 취득

지정된 네임스페이스의 메시지 카테고리 모델 마스터를 페이지네이션을 지원하여 취득합니다.
메시지 카테고리 모델 마스터는 메시지의 카테고리와 그 게시 권한을 정의하는 메시지 카테고리 모델의 편집 가능한 버전입니다.
마스터 데이터에 대한 변경 사항은 현재 모델 마스터를 통해 활성화(공개)될 때까지 반영되지 않습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
pageTokenstring~ 1024자데이터 취득을 시작할 위치를 지정하는 토큰
limitint301 ~ 1000취득할 데이터 건수

Result

타입설명
itemsList<CategoryModelMaster>메시지 카테고리 모델 마스터 목록
nextPageTokenstring목록의 나머지를 취득하기 위한 페이지 토큰

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.DescribeCategoryModelMasters(
    &chat.DescribeCategoryModelMastersRequest {
        NamespaceName: pointy.String("namespace-0001"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\DescribeCategoryModelMastersRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->describeCategoryModelMasters(
        (new DescribeCategoryModelMastersRequest())
            ->withNamespaceName("namespace-0001")
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.DescribeCategoryModelMastersRequest;
import io.gs2.chat.result.DescribeCategoryModelMastersResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    DescribeCategoryModelMastersResult result = client.describeCategoryModelMasters(
        new DescribeCategoryModelMastersRequest()
            .withNamespaceName("namespace-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<CategoryModelMaster> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.DescribeCategoryModelMastersResult> asyncResult = null;
yield return client.DescribeCategoryModelMasters(
    new Gs2.Gs2Chat.Request.DescribeCategoryModelMastersRequest()
        .WithNamespaceName("namespace-0001")
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.describeCategoryModelMasters(
        new Gs2Chat.DescribeCategoryModelMastersRequest()
            .withNamespaceName("namespace-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.describe_category_model_masters(
        chat.DescribeCategoryModelMastersRequest()
            .with_namespace_name('namespace-0001')
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.describe_category_model_masters({
    namespaceName="namespace-0001",
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('chat')

api_result_handler = client.describe_category_model_masters_async({
    namespaceName="namespace-0001",
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

createCategoryModelMaster

메시지 카테고리 모델 마스터를 신규 작성

메시지의 카테고리와 그 게시 권한을 정의하는 새로운 메시지 카테고리 모델 마스터를 작성합니다.
카테고리 번호, 설명, 그리고 rejectAccessTokenPost 플래그를 설정할 수 있습니다. 이 플래그는 액세스 토큰 인증 사용자(게임 플레이어)가 이 카테고리에 메시지를 게시할 수 있는지 여부를 제어합니다.
rejectAccessTokenPost를 활성화하면, 이 카테고리에서는 서버 사이드(사용자 ID 지정)로부터의 게시만 허용되어 시스템 메시지나 공지사항에 적합합니다.
변경 사항은 현재 모델 마스터를 통해 활성화(공개)될 때까지 반영되지 않습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
categoryint
0 ~ 2147483645카테고리
메시지 카테고리의 숫자 식별자입니다. 이 카테고리 번호로 게시된 메시지는, 플레이어의 게시를 허용할지 여부 등 이 모델에서 정의된 규칙을 따릅니다.
descriptionstring~ 1024자설명문
rejectAccessTokenPost문자열 열거형
enum {
  “Enabled”,
  “Disabled”
}
플레이어의 액세스 토큰을 이용한 게시를 거부한다
활성화하면, 이 카테고리에서는 서버 사이드 API 호출(사용자 ID 지정)만으로 메시지를 게시할 수 있습니다. 플레이어가 직접 게시해서는 안 되는 시스템 안내나 서버 생성 메시지에 유용합니다.
정의설명
Enabled플레이어의 액세스 토큰을 이용한 게시를 거부한다
Disabled플레이어의 액세스 토큰을 이용한 게시를 허용한다

Result

타입설명
itemCategoryModelMaster작성한 메시지 카테고리 모델 마스터

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.CreateCategoryModelMaster(
    &chat.CreateCategoryModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Category: pointy.Int32(0),
        Description: nil,
        RejectAccessTokenPost: pointy.String("Disabled"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\CreateCategoryModelMasterRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->createCategoryModelMaster(
        (new CreateCategoryModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withCategory(0)
            ->withDescription(null)
            ->withRejectAccessTokenPost("Disabled")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.CreateCategoryModelMasterRequest;
import io.gs2.chat.result.CreateCategoryModelMasterResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    CreateCategoryModelMasterResult result = client.createCategoryModelMaster(
        new CreateCategoryModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withCategory(0)
            .withDescription(null)
            .withRejectAccessTokenPost("Disabled")
    );
    CategoryModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.CreateCategoryModelMasterResult> asyncResult = null;
yield return client.CreateCategoryModelMaster(
    new Gs2.Gs2Chat.Request.CreateCategoryModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithCategory(0)
        .WithDescription(null)
        .WithRejectAccessTokenPost("Disabled"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.createCategoryModelMaster(
        new Gs2Chat.CreateCategoryModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withCategory(0)
            .withDescription(null)
            .withRejectAccessTokenPost("Disabled")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.create_category_model_master(
        chat.CreateCategoryModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_category(0)
            .with_description(None)
            .with_reject_access_token_post('Disabled')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.create_category_model_master({
    namespaceName="namespace-0001",
    category=0,
    description=nil,
    rejectAccessTokenPost="Disabled",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.create_category_model_master_async({
    namespaceName="namespace-0001",
    category=0,
    description=nil,
    rejectAccessTokenPost="Disabled",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

getCategoryModelMaster

메시지 카테고리 모델 마스터를 취득

지정된 네임스페이스에서 카테고리 번호를 지정하여 특정 메시지 카테고리 모델 마스터를 취득합니다.
취득되는 정보에는 설명 및 rejectAccessTokenPost 플래그가 포함되어 있어 편집 용도로 사용할 수 있습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
categoryint
0 ~ 2147483645카테고리
메시지 카테고리의 숫자 식별자입니다. 이 카테고리 번호로 게시된 메시지는, 플레이어의 게시를 허용할지 여부 등 이 모델에서 정의된 규칙을 따릅니다.

Result

타입설명
itemCategoryModelMaster메시지 카테고리 모델 마스터

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.GetCategoryModelMaster(
    &chat.GetCategoryModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Category: pointy.Int32(0),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\GetCategoryModelMasterRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->getCategoryModelMaster(
        (new GetCategoryModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withCategory(0)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.GetCategoryModelMasterRequest;
import io.gs2.chat.result.GetCategoryModelMasterResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    GetCategoryModelMasterResult result = client.getCategoryModelMaster(
        new GetCategoryModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withCategory(0)
    );
    CategoryModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.GetCategoryModelMasterResult> asyncResult = null;
yield return client.GetCategoryModelMaster(
    new Gs2.Gs2Chat.Request.GetCategoryModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithCategory(0),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.getCategoryModelMaster(
        new Gs2Chat.GetCategoryModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withCategory(0)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.get_category_model_master(
        chat.GetCategoryModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_category(0)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.get_category_model_master({
    namespaceName="namespace-0001",
    category=0,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.get_category_model_master_async({
    namespaceName="namespace-0001",
    category=0,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

updateCategoryModelMaster

메시지 카테고리 모델 마스터를 갱신

지정된 메시지 카테고리 모델 마스터를 갱신합니다.
설명 및, 액세스 토큰 인증 사용자가 이 카테고리에 게시할 수 있는지 여부를 제어하는 rejectAccessTokenPost 플래그를 변경할 수 있습니다.
변경 사항은 현재 모델 마스터를 통해 활성화(공개)될 때까지 반영되지 않습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
categoryint
0 ~ 2147483645카테고리
메시지 카테고리의 숫자 식별자입니다. 이 카테고리 번호로 게시된 메시지는, 플레이어의 게시를 허용할지 여부 등 이 모델에서 정의된 규칙을 따릅니다.
descriptionstring~ 1024자설명문
rejectAccessTokenPost문자열 열거형
enum {
  “Enabled”,
  “Disabled”
}
플레이어의 액세스 토큰을 이용한 게시를 거부한다
활성화하면, 이 카테고리에서는 서버 사이드 API 호출(사용자 ID 지정)만으로 메시지를 게시할 수 있습니다. 플레이어가 직접 게시해서는 안 되는 시스템 안내나 서버 생성 메시지에 유용합니다.
정의설명
Enabled플레이어의 액세스 토큰을 이용한 게시를 거부한다
Disabled플레이어의 액세스 토큰을 이용한 게시를 허용한다

Result

타입설명
itemCategoryModelMaster갱신한 메시지 카테고리 모델 마스터

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.UpdateCategoryModelMaster(
    &chat.UpdateCategoryModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Category: pointy.Int32(0),
        Description: pointy.String("description1"),
        RejectAccessTokenPost: pointy.String("Enabled"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\UpdateCategoryModelMasterRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->updateCategoryModelMaster(
        (new UpdateCategoryModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withCategory(0)
            ->withDescription("description1")
            ->withRejectAccessTokenPost("Enabled")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.UpdateCategoryModelMasterRequest;
import io.gs2.chat.result.UpdateCategoryModelMasterResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    UpdateCategoryModelMasterResult result = client.updateCategoryModelMaster(
        new UpdateCategoryModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withCategory(0)
            .withDescription("description1")
            .withRejectAccessTokenPost("Enabled")
    );
    CategoryModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.UpdateCategoryModelMasterResult> asyncResult = null;
yield return client.UpdateCategoryModelMaster(
    new Gs2.Gs2Chat.Request.UpdateCategoryModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithCategory(0)
        .WithDescription("description1")
        .WithRejectAccessTokenPost("Enabled"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.updateCategoryModelMaster(
        new Gs2Chat.UpdateCategoryModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withCategory(0)
            .withDescription("description1")
            .withRejectAccessTokenPost("Enabled")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.update_category_model_master(
        chat.UpdateCategoryModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_category(0)
            .with_description('description1')
            .with_reject_access_token_post('Enabled')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.update_category_model_master({
    namespaceName="namespace-0001",
    category=0,
    description="description1",
    rejectAccessTokenPost="Enabled",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.update_category_model_master_async({
    namespaceName="namespace-0001",
    category=0,
    description="description1",
    rejectAccessTokenPost="Enabled",
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;

deleteCategoryModelMaster

메시지 카테고리 모델 마스터를 삭제

지정된 네임스페이스에서 지정된 메시지 카테고리 모델 마스터를 삭제합니다.
삭제 후, 다음 마스터 데이터 활성화 이후부터 이 카테고리는 사용할 수 없게 됩니다.
이 작업은 마스터 데이터에만 영향을 미치며, 마스터 데이터가 재활성화될 때까지 현재 활성화된 모델은 변경되지 않습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
categoryint
0 ~ 2147483645카테고리
메시지 카테고리의 숫자 식별자입니다. 이 카테고리 번호로 게시된 메시지는, 플레이어의 게시를 허용할지 여부 등 이 모델에서 정의된 규칙을 따릅니다.

Result

타입설명
itemCategoryModelMaster삭제한 메시지 카테고리 모델 마스터

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/chat"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := chat.Gs2ChatRestClient{
    Session: &session,
}
result, err := client.DeleteCategoryModelMaster(
    &chat.DeleteCategoryModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Category: pointy.Int32(0),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Chat\Gs2ChatRestClient;
use Gs2\Chat\Request\DeleteCategoryModelMasterRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2ChatRestClient(
    $session
);

try {
    $result = $client->deleteCategoryModelMaster(
        (new DeleteCategoryModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withCategory(0)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.chat.rest.Gs2ChatRestClient;
import io.gs2.chat.request.DeleteCategoryModelMasterRequest;
import io.gs2.chat.result.DeleteCategoryModelMasterResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2ChatRestClient client = new Gs2ChatRestClient(session);

try {
    DeleteCategoryModelMasterResult result = client.deleteCategoryModelMaster(
        new DeleteCategoryModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withCategory(0)
    );
    CategoryModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2ChatRestClient(session);

AsyncResult<Gs2.Gs2Chat.Result.DeleteCategoryModelMasterResult> asyncResult = null;
yield return client.DeleteCategoryModelMaster(
    new Gs2.Gs2Chat.Request.DeleteCategoryModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithCategory(0),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Chat from '@/gs2/chat';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Chat.Gs2ChatRestClient(session);

try {
    const result = await client.deleteCategoryModelMaster(
        new Gs2Chat.DeleteCategoryModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withCategory(0)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import chat

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = chat.Gs2ChatRestClient(session)

try:
    result = client.delete_category_model_master(
        chat.DeleteCategoryModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_category(0)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('chat')

api_result = client.delete_category_model_master({
    namespaceName="namespace-0001",
    category=0,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;
client = gs2('chat')

api_result_handler = client.delete_category_model_master_async({
    namespaceName="namespace-0001",
    category=0,
})

api_result = api_result_handler()  -- Call the handler to get the result

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['errorMessage'])
end

result = api_result.result
item = result.item;