Documentation index for AI agents

GS2-Distributor SDK API 레퍼런스

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

모델

Namespace

네임스페이스

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

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

상세
타입활성화 조건필수기본값값 제한설명
namespaceIdstring
~ 1024자네임스페이스 GRN
※ 서버가 자동으로 설정
namestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
descriptionstring~ 1024자설명문
transactionSettingTransactionSetting트랜잭션 설정
리소스 배포 처리 시 분산 트랜잭션의 실행 방법을 제어하는 설정입니다. 자동 실행, 원자적 커밋, 비동기 처리 등의 옵션을 지원합니다.
assumeUserIdstring~ 1024자GS2-Identifier 사용자 GRN
autoRunStampSheetNotificationNotificationSetting
트랜잭션 자동 실행이 완료되었을 때의 푸시 알림(구 사양)
트랜잭션이 서버사이드에서 자동 실행 완료되었을 때 GS2-Gateway를 통해 푸시 알림을 전송하기 위한 설정입니다. 이는 구 사양이며, 신 사양에서는 autoRunTransactionNotification을 사용하세요.
autoRunTransactionNotificationNotificationSetting
트랜잭션 자동 실행이 완료되었을 때의 푸시 알림
분산 트랜잭션이 서버사이드에서 자동 실행 완료되었을 때 GS2-Gateway를 통해 푸시 알림을 전송하기 위한 설정입니다. 트랜잭션 결과를 클라이언트에 통지하여 로컬 상태를 적절히 갱신할 수 있도록 합니다.
logSettingLogSetting로그 출력 설정
디스트리뷰터 조작의 로그 데이터를 GS2-Log에 출력하기 위한 설정입니다. GS2-Log의 네임스페이스를 지정함으로써 리소스 배포·입수 액션 실행·트랜잭션 처리의 API 요청·응답 로그를 수집할 수 있습니다.
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

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

로그의 출력 설정

로그 데이터의 출력 설정을 관리합니다. 이 타입은 로그 데이터를 출력하는 데 사용되는 로그 네임스페이스의 식별자(Namespace ID)를 보유합니다.
로그 네임스페이스 ID는 로그 데이터를 집계하여 저장할 대상 GS2-Log 의 네임스페이스를 지정합니다.
이 설정을 통해 이 네임스페이스 이하의 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” 이면 필수

StampSheetResult

트랜잭션 실행 결과(레거시)

서버사이드 자동 실행으로 처리된 트랜잭션의 실행 결과를 기록합니다.
각 단계의 요청 내용과 응답 결과를 포함합니다: 검증 액션(사전 조건 확인), 소비 액션, 입수 액션. 오류 감지 및 재시도 로직을 위해 HTTP 상태 코드도 추적합니다.

상세
타입활성화 조건필수기본값값 제한설명
stampSheetResultIdstring
~ 1024자트랜잭션 실행 결과 GRN
※ 서버가 자동으로 설정
userIdstring
~ 128자사용자ID
transactionIdstring
36 ~ 36자트랜잭션 ID
이 트랜잭션을 고유하게 식별하는 UUID입니다. 트랜잭션과 그 실행 결과, 그리고 연쇄되는 후속 트랜잭션의 연결에 사용됩니다.
verifyTaskRequestsList<VerifyAction>0 ~ 100 items검증 액션의 요청 내용 목록
taskRequestsList<ConsumeAction>0 ~ 100 items소비 액션의 요청 내용 목록
sheetRequestAcquireAction
입수 액션의 요청 내용
verifyTaskResultCodesList<int>[]0 ~ 100 items검증 액션의 실행 상태 코드
verifyTaskResultsList<string>[]0 ~ 100 items검증 액션의 실행 결과
taskResultCodesList<int>[]0 ~ 100 items소비 액션의 실행 상태 코드
taskResultsList<string>[]0 ~ 100 items소비 액션의 실행 결과
sheetResultCodeint0 ~ 999획득 액션의 실행 상태 코드
sheetResultstring~ 1048576자입수 액션의 실행 결과 응답 내용
nextTransactionIdstring36 ~ 36자트랜잭션 실행에 의해 새로 발급된 트랜잭션의 트랜잭션 ID
입수 액션의 결과에 새로운 트랜잭션 ID가 포함되어 있는 경우, 여기에 추출되어 저장됩니다. 이를 통해 하나의 트랜잭션 완료가 다른 트랜잭션을 트리거하는 트랜잭션 체인이 가능해집니다.
createdAtlong
현재 시각생성일시
UNIX 시간·밀리초
※ 서버가 자동으로 설정
revisionlong00 ~ 9223372036854775805리비전

TransactionResult

트랜잭션 실행 결과

서버사이드 자동 실행으로 처리된 분산 트랜잭션의 실행 결과를 기록합니다.
각 단계의 구조화된 결과를 포함합니다: 검증 액션(사전 조건 확인), 소비 액션(리소스 소비), 입수 액션(리소스 지급). 각 액션 결과에는 요청, HTTP 상태 코드, 응답 페이로드가 포함됩니다. 상태 코드(비2xx)에 의한 오류 감지와, 충돌(409)이나 서버 오류(5xx)에서의 재시도가 지원됩니다.

상세
타입활성화 조건필수기본값값 제한설명
transactionResultIdstring
~ 1024자트랜잭션 실행 결과 GRN
※ 서버가 자동으로 설정
userIdstring
~ 128자사용자ID
transactionIdstring
36 ~ 36자트랜잭션 ID
이 분산 트랜잭션을 고유하게 식별하는 UUID입니다. 실행 결과 조회 및 원래 API 요청과의 연결에 사용됩니다.
verifyResultsList<VerifyActionResult>0 ~ 100 items검증 액션의 실행 결과 목록
consumeResultsList<ConsumeActionResult>0 ~ 100 items소비 액션의 실행 결과 목록
acquireResultsList<AcquireActionResult>0 ~ 100 items입수 액션의 실행 결과 목록
hasErrorboolfalse트랜잭션 실행 중 오류가 발생했는지 여부
어느 하나의 액션(검증, 소비, 입수)이 비2xx 상태 코드를 반환한 경우 true로 설정됩니다. true인 경우, 클라이언트는 개별 액션 결과를 확인하여 실패 원인을 파악해야 합니다.
createdAtlong
현재 시각생성일시
UNIX 시간·밀리초
※ 서버가 자동으로 설정
revisionlong00 ~ 9223372036854775805리비전

DistributorModel

배포 모델

배포 모델이란 리소스 입수 시 소지 한도를 초과하여 입수했을 때의 정책을 설정하는 엔티티입니다.
GS2-Distributor를 통해 입수 처리를 수행함으로써, 넘친 리소스를 GS2-Inbox의 메시지로 전송할 수 있습니다.

상세
타입활성화 조건필수기본값값 제한설명
distributorModelIdstring
~ 1024자배포 모델 GRN
※ 서버가 자동으로 설정
namestring
~ 128자배포 모델 이름
배포 모델 고유의 이름. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
metadatastring~ 2048자메타데이터
메타데이터에는 임의의 값을 설정할 수 있습니다.
이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다.
inboxNamespaceIdstring~ 1024자넘친 리소스를 전송할 GS2-Inbox 네임스페이스 GRN
리소스 입수가 플레이어의 소지 한도를 초과한 경우, 넘친 리소스는 지정된 GS2-Inbox 네임스페이스에 메시지로 전송됩니다. 플레이어는 이후 수신함에서 리소스를 수령할 수 있습니다.
whiteListTargetIdsList<string>[]0 ~ 1000 itemsGS2-Distributor를 통해 처리할 수 있는 대상 리소스 GRN의 화이트리스트
이 배포 모델을 사용하여 입수 처리를 수행할 수 있는 대상 리소스의 GRN 프리픽스를 지정합니다.

BatchRequestPayload

API 일괄 실행 요청

일괄 실행 내 단일 API 요청을 나타냅니다. 여러 배치 요청 페이로드를 함께 전송함으로써 여러 GS2 API 호출을 한 번의 라운드트립으로 실행할 수 있어, 네트워크 오버헤드와 지연 시간을 줄일 수 있습니다.

상세
타입활성화 조건필수기본값값 제한설명
requestIdstring
~ 128자요청 ID
배치 내에서 이 요청에 대해 클라이언트가 할당한 식별자입니다. 배치 응답 내에서 각 요청과 대응하는 결과를 연결하는 데 사용됩니다.
service문자열 열거형
enum {
  “account”,
  “adReward”,
  “auth”,
  “buff”,
  “chat”,
  “datastore”,
  “deploy”,
  “dictionary”,
  “distributor”,
  “enchant”,
  “enhance”,
  “exchange”,
  “experience”,
  “formation”,
  “friend”,
  “gateway”,
  “grade”,
  “guard”,
  “guild”,
  “identifier”,
  “idle”,
  “inbox”,
  “inventory”,
  “jobQueue”,
  “key”,
  “limit”,
  “lock”,
  “log”,
  “loginReward”,
  “lottery”,
  “matchmaking”,
  “megaField”,
  “mission”,
  “money”,
  “money2”,
  “news”,
  “quest”,
  “ranking”,
  “ranking2”,
  “realtime”,
  “schedule”,
  “script”,
  “seasonRating”,
  “serialKey”,
  “showcase”,
  “skillTree”,
  “stamina”,
  “stateMachine”,
  “version”
}
마이크로서비스 이름
호출할 GS2 마이크로서비스 이름입니다(예: “inventory”, “experience”, “money”). 이 API 요청을 수신할 서비스 엔드포인트를 결정합니다.
정의설명
accountGS2-Account
adRewardGS2-AdReward
authGS2-Auth
buffGS2-Buff
chatGS2-Chat
datastoreGS2-Datastore
deployGS2-Deploy
dictionaryGS2-Dictionary
distributorGS2-Distributor
enchantGS2-Enchant
enhanceGS2-Enhance
exchangeGS2-Exchange
experienceGS2-Experience
formationGS2-Formation
friendGS2-Friend
gatewayGS2-Gateway
gradeGS2-Grade
guardGS2-Guard
guildGS2-Guild
identifierGS2-Identifier
idleGS2-Idle
inboxGS2-Inbox
inventoryGS2-Inventory
jobQueueGS2-JobQueue
keyGS2-Key
limitGS2-Limit
lockGS2-Lock
logGS2-Log
loginRewardGS2-LoginReward
lotteryGS2-Lottery
matchmakingGS2-Matchmaking
megaFieldGS2-MegaField
missionGS2-Mission
moneyGS2-Money
money2GS2-Money2
newsGS2-News
questGS2-Quest
rankingGS2-Ranking
ranking2GS2-Ranking2
realtimeGS2-Realtime
scheduleGS2-Schedule
scriptGS2-Script
seasonRatingGS2-SeasonRating
serialKeyGS2-SerialKey
showcaseGS2-Showcase
skillTreeGS2-SkillTree
staminaGS2-Stamina
stateMachineGS2-StateMachine
versionGS2-Version
methodNamestring
~ 128자메서드 이름
대상 서비스에서 호출할 API 메서드 이름입니다(예: “describeNamespaces”, “getInventory”). 지정된 서비스의 유효한 API 메서드와 일치해야 합니다.
parameterstring
~ 10240자파라미터
API 메서드의 JSON으로 직렬화된 요청 파라미터입니다. 지정된 서비스 메서드의 요청 스키마를 준수해야 합니다.

BatchResultPayload

API 일괄 실행 결과

일괄 실행 내 단일 API 요청의 결과를 나타냅니다. 각 결과는 요청 ID로 원래 요청과 연결되며, HTTP 상태 코드와 JSON 응답 페이로드를 포함합니다.

상세
타입활성화 조건필수기본값값 제한설명
requestIdstring
~ 128자요청 ID
대응하는 배치 요청과 일치하는 클라이언트 할당 식별자입니다. 이 결과를 원래 요청과 연결하는 데 사용됩니다.
statusCodeint
100 ~ 1000상태 코드
이 배치 요청에 대해 GS2 API가 반환한 HTTP 상태 코드입니다. 2xx는 성공, 4xx는 클라이언트 오류, 5xx는 서버 오류를 나타냅니다.
resultPayloadstring
~ 10240자응답
이 배치 요청에 대해 GS2 API가 반환한 JSON 응답 본문입니다. API 메서드의 응답 데이터 또는 오류 상세 정보를 포함합니다.

AcquireAction

입수 액션

분산 트랜잭션 내 리소스 입수 조작을 나타냅니다. 플레이어에게 리소스(아이템, 화폐, 경험치 등)를 지급하는 입수 액션에 대응합니다. GS2 API의 액션 식별자와 JSON으로 직렬화된 요청 파라미터를 포함합니다.

상세
타입활성화 조건필수기본값값 제한설명
action문자열 열거형
enum {
"Gs2AdReward:AcquirePointByUserId",
"Gs2Dictionary:AddEntriesByUserId",
"Gs2Enchant:ReDrawBalanceParameterStatusByUserId",
"Gs2Enchant:SetBalanceParameterStatusByUserId",
"Gs2Enchant:ReDrawRarityParameterStatusByUserId",
"Gs2Enchant:AddRarityParameterStatusByUserId",
"Gs2Enchant:SetRarityParameterStatusByUserId",
"Gs2Enhance:DirectEnhanceByUserId",
"Gs2Enhance:UnleashByUserId",
"Gs2Enhance:CreateProgressByUserId",
"Gs2Exchange:ExchangeByUserId",
"Gs2Exchange:IncrementalExchangeByUserId",
"Gs2Exchange:CreateAwaitByUserId",
"Gs2Exchange:AcquireForceByUserId",
"Gs2Exchange:SkipByUserId",
"Gs2Experience:AddExperienceByUserId",
"Gs2Experience:SetExperienceByUserId",
"Gs2Experience:AddRankCapByUserId",
"Gs2Experience:SetRankCapByUserId",
"Gs2Experience:MultiplyAcquireActionsByUserId",
"Gs2Formation:AddMoldCapacityByUserId",
"Gs2Formation:SetMoldCapacityByUserId",
"Gs2Formation:AcquireActionsToFormProperties",
"Gs2Formation:SetFormByUserId",
"Gs2Formation:AcquireActionsToPropertyFormProperties",
"Gs2Friend:UpdateProfileByUserId",
"Gs2Grade:AddGradeByUserId",
"Gs2Grade:ApplyRankCapByUserId",
"Gs2Grade:MultiplyAcquireActionsByUserId",
"Gs2Guild:IncreaseMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Guild:SetMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Idle:IncreaseMaximumIdleMinutesByUserId",
"Gs2Idle:SetMaximumIdleMinutesByUserId",
"Gs2Idle:ReceiveByUserId",
"Gs2Inbox:SendMessageByUserId",
"Gs2Inventory:AddCapacityByUserId",
"Gs2Inventory:SetCapacityByUserId",
"Gs2Inventory:AcquireItemSetByUserId",
"Gs2Inventory:AcquireItemSetWithGradeByUserId",
"Gs2Inventory:AddReferenceOfByUserId",
"Gs2Inventory:DeleteReferenceOfByUserId",
"Gs2Inventory:AcquireSimpleItemsByUserId",
"Gs2Inventory:SetSimpleItemsByUserId",
"Gs2Inventory:AcquireBigItemByUserId",
"Gs2Inventory:SetBigItemByUserId",
"Gs2JobQueue:PushByUserId",
"Gs2Limit:CountDownByUserId",
"Gs2Limit:DeleteCounterByUserId",
"Gs2LoginReward:DeleteReceiveStatusByUserId",
"Gs2LoginReward:UnmarkReceivedByUserId",
"Gs2Lottery:DrawByUserId",
"Gs2Lottery:ResetBoxByUserId",
"Gs2Mission:RevertReceiveByUserId",
"Gs2Mission:IncreaseCounterByUserId",
"Gs2Mission:SetCounterByUserId",
"Gs2Money:DepositByUserId",
"Gs2Money:RevertRecordReceipt",
"Gs2Money2:DepositByUserId",
"Gs2Quest:CreateProgressByUserId",
"Gs2Schedule:TriggerByUserId",
"Gs2Schedule:ExtendTriggerByUserId",
"Gs2Script:InvokeScript",
"Gs2SerialKey:RevertUseByUserId",
"Gs2SerialKey:IssueOnce",
"Gs2Showcase:DecrementPurchaseCountByUserId",
"Gs2Showcase:ForceReDrawByUserId",
"Gs2SkillTree:MarkReleaseByUserId",
"Gs2Stamina:RecoverStaminaByUserId",
"Gs2Stamina:RaiseMaxValueByUserId",
"Gs2Stamina:SetMaxValueByUserId",
"Gs2Stamina:SetRecoverIntervalByUserId",
"Gs2Stamina:SetRecoverValueByUserId",
"Gs2StateMachine:StartStateMachineByUserId",
}
입수 액션에서 실행할 액션의 종류
requeststring
~ 524288자액션 실행 시 사용되는 요청의 JSON 문자열

ConsumeAction

소비 액션

분산 트랜잭션 내 리소스 소비 조작을 나타냅니다. 플레이어로부터 리소스(아이템, 화폐, 스태미나 등)를 소비하는 소비 액션에 대응합니다. 소비 액션은 입수 액션보다 먼저 실행되어, 플레이어가 필요한 비용을 충족하는지 확인합니다.

상세
타입활성화 조건필수기본값값 제한설명
action문자열 열거형
enum {
"Gs2AdReward:ConsumePointByUserId",
"Gs2Dictionary:DeleteEntriesByUserId",
"Gs2Enhance:DeleteProgressByUserId",
"Gs2Exchange:DeleteAwaitByUserId",
"Gs2Experience:SubExperienceByUserId",
"Gs2Experience:SubRankCapByUserId",
"Gs2Formation:SubMoldCapacityByUserId",
"Gs2Grade:SubGradeByUserId",
"Gs2Guild:DecreaseMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Idle:DecreaseMaximumIdleMinutesByUserId",
"Gs2Inbox:OpenMessageByUserId",
"Gs2Inbox:DeleteMessageByUserId",
"Gs2Inventory:ConsumeItemSetByUserId",
"Gs2Inventory:ConsumeSimpleItemsByUserId",
"Gs2Inventory:ConsumeBigItemByUserId",
"Gs2JobQueue:DeleteJobByUserId",
"Gs2Limit:CountUpByUserId",
"Gs2LoginReward:MarkReceivedByUserId",
"Gs2Mission:ReceiveByUserId",
"Gs2Mission:BatchReceiveByUserId",
"Gs2Mission:DecreaseCounterByUserId",
"Gs2Mission:ResetCounterByUserId",
"Gs2Money:WithdrawByUserId",
"Gs2Money:RecordReceipt",
"Gs2Money2:WithdrawByUserId",
"Gs2Money2:VerifyReceiptByUserId",
"Gs2Quest:DeleteProgressByUserId",
"Gs2Ranking2:CreateGlobalRankingReceivedRewardByUserId",
"Gs2Ranking2:CreateClusterRankingReceivedRewardByUserId",
"Gs2Schedule:DeleteTriggerByUserId",
"Gs2SerialKey:UseByUserId",
"Gs2Showcase:IncrementPurchaseCountByUserId",
"Gs2SkillTree:MarkRestrainByUserId",
"Gs2Stamina:DecreaseMaxValueByUserId",
"Gs2Stamina:ConsumeStaminaByUserId",
}
소비 액션에서 실행할 액션의 종류
requeststring
~ 524288자액션 실행 시 사용되는 요청의 JSON 문자열

VerifyAction

검증 액션

분산 트랜잭션 내 사전 조건 검증 조작을 나타냅니다. 소비·입수 액션보다 먼저 실행되어 조건이 충족되었는지 검증합니다(예: 소지 한도 확인, 퀘스트 완료 상태 검증 등). 검증 액션 중 하나라도 실패하면 트랜잭션 전체가 중단됩니다.

상세
타입활성화 조건필수기본값값 제한설명
action문자열 열거형
enum {
"Gs2Dictionary:VerifyEntryByUserId",
"Gs2Distributor:IfExpressionByUserId",
"Gs2Distributor:AndExpressionByUserId",
"Gs2Distributor:OrExpressionByUserId",
"Gs2Enchant:VerifyRarityParameterStatusByUserId",
"Gs2Experience:VerifyRankByUserId",
"Gs2Experience:VerifyRankCapByUserId",
"Gs2Grade:VerifyGradeByUserId",
"Gs2Grade:VerifyGradeUpMaterialByUserId",
"Gs2Guild:VerifyCurrentMaximumMemberCountByGuildName",
"Gs2Guild:VerifyIncludeMemberByUserId",
"Gs2Inventory:VerifyInventoryCurrentMaxCapacityByUserId",
"Gs2Inventory:VerifyItemSetByUserId",
"Gs2Inventory:VerifyReferenceOfByUserId",
"Gs2Inventory:VerifySimpleItemByUserId",
"Gs2Inventory:VerifyBigItemByUserId",
"Gs2Limit:VerifyCounterByUserId",
"Gs2Matchmaking:VerifyIncludeParticipantByUserId",
"Gs2Mission:VerifyCompleteByUserId",
"Gs2Mission:VerifyCounterValueByUserId",
"Gs2Ranking2:VerifyGlobalRankingScoreByUserId",
"Gs2Ranking2:VerifyClusterRankingScoreByUserId",
"Gs2Ranking2:VerifySubscribeRankingScoreByUserId",
"Gs2Schedule:VerifyTriggerByUserId",
"Gs2Schedule:VerifyEventByUserId",
"Gs2SerialKey:VerifyCodeByUserId",
"Gs2Stamina:VerifyStaminaValueByUserId",
"Gs2Stamina:VerifyStaminaMaxValueByUserId",
"Gs2Stamina:VerifyStaminaRecoverIntervalMinutesByUserId",
"Gs2Stamina:VerifyStaminaRecoverValueByUserId",
"Gs2Stamina:VerifyStaminaOverflowValueByUserId",
}
검증 액션에서 실행할 액션의 종류
requeststring
~ 524288자액션 실행 시 사용되는 요청의 JSON 문자열

AcquireActionResult

입수 액션의 실행 결과

단일 입수 액션 실행 결과를 기록합니다. 액션 식별자, 원래 요청, 성공·실패를 나타내는 HTTP 상태 코드, GS2 API로부터의 JSON 응답 페이로드를 포함합니다.

상세
타입활성화 조건필수기본값값 제한설명
action문자열 열거형
enum {
"Gs2AdReward:AcquirePointByUserId",
"Gs2Dictionary:AddEntriesByUserId",
"Gs2Enchant:ReDrawBalanceParameterStatusByUserId",
"Gs2Enchant:SetBalanceParameterStatusByUserId",
"Gs2Enchant:ReDrawRarityParameterStatusByUserId",
"Gs2Enchant:AddRarityParameterStatusByUserId",
"Gs2Enchant:SetRarityParameterStatusByUserId",
"Gs2Enhance:DirectEnhanceByUserId",
"Gs2Enhance:UnleashByUserId",
"Gs2Enhance:CreateProgressByUserId",
"Gs2Exchange:ExchangeByUserId",
"Gs2Exchange:IncrementalExchangeByUserId",
"Gs2Exchange:CreateAwaitByUserId",
"Gs2Exchange:AcquireForceByUserId",
"Gs2Exchange:SkipByUserId",
"Gs2Experience:AddExperienceByUserId",
"Gs2Experience:SetExperienceByUserId",
"Gs2Experience:AddRankCapByUserId",
"Gs2Experience:SetRankCapByUserId",
"Gs2Experience:MultiplyAcquireActionsByUserId",
"Gs2Formation:AddMoldCapacityByUserId",
"Gs2Formation:SetMoldCapacityByUserId",
"Gs2Formation:AcquireActionsToFormProperties",
"Gs2Formation:SetFormByUserId",
"Gs2Formation:AcquireActionsToPropertyFormProperties",
"Gs2Friend:UpdateProfileByUserId",
"Gs2Grade:AddGradeByUserId",
"Gs2Grade:ApplyRankCapByUserId",
"Gs2Grade:MultiplyAcquireActionsByUserId",
"Gs2Guild:IncreaseMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Guild:SetMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Idle:IncreaseMaximumIdleMinutesByUserId",
"Gs2Idle:SetMaximumIdleMinutesByUserId",
"Gs2Idle:ReceiveByUserId",
"Gs2Inbox:SendMessageByUserId",
"Gs2Inventory:AddCapacityByUserId",
"Gs2Inventory:SetCapacityByUserId",
"Gs2Inventory:AcquireItemSetByUserId",
"Gs2Inventory:AcquireItemSetWithGradeByUserId",
"Gs2Inventory:AddReferenceOfByUserId",
"Gs2Inventory:DeleteReferenceOfByUserId",
"Gs2Inventory:AcquireSimpleItemsByUserId",
"Gs2Inventory:SetSimpleItemsByUserId",
"Gs2Inventory:AcquireBigItemByUserId",
"Gs2Inventory:SetBigItemByUserId",
"Gs2JobQueue:PushByUserId",
"Gs2Limit:CountDownByUserId",
"Gs2Limit:DeleteCounterByUserId",
"Gs2LoginReward:DeleteReceiveStatusByUserId",
"Gs2LoginReward:UnmarkReceivedByUserId",
"Gs2Lottery:DrawByUserId",
"Gs2Lottery:ResetBoxByUserId",
"Gs2Mission:RevertReceiveByUserId",
"Gs2Mission:IncreaseCounterByUserId",
"Gs2Mission:SetCounterByUserId",
"Gs2Money:DepositByUserId",
"Gs2Money:RevertRecordReceipt",
"Gs2Money2:DepositByUserId",
"Gs2Quest:CreateProgressByUserId",
"Gs2Schedule:TriggerByUserId",
"Gs2Schedule:ExtendTriggerByUserId",
"Gs2Script:InvokeScript",
"Gs2SerialKey:RevertUseByUserId",
"Gs2SerialKey:IssueOnce",
"Gs2Showcase:DecrementPurchaseCountByUserId",
"Gs2Showcase:ForceReDrawByUserId",
"Gs2SkillTree:MarkReleaseByUserId",
"Gs2Stamina:RecoverStaminaByUserId",
"Gs2Stamina:RaiseMaxValueByUserId",
"Gs2Stamina:SetMaxValueByUserId",
"Gs2Stamina:SetRecoverIntervalByUserId",
"Gs2Stamina:SetRecoverValueByUserId",
"Gs2StateMachine:StartStateMachineByUserId",
}
입수 액션에서 실행할 액션의 종류
acquireRequeststring
~ 524288자액션 실행 시 사용되는 요청의 JSON 문자열
statusCodeint0 ~ 999상태 코드
이 입수 액션에 대해 GS2 API가 반환한 HTTP 상태 코드입니다. 2xx는 성공, 409는 재시도가 필요한 충돌, 5xx는 서버 오류를 나타냅니다.
acquireResultstring~ 1048576자결과 내용
입수 액션 실행 후 GS2 API가 반환한 JSON 응답 본문입니다. 입수한 리소스의 상세 정보를 포함하며, 연쇄되는 트랜잭션 ID가 포함될 수도 있습니다.

ConsumeActionResult

소비 액션의 실행 결과

단일 소비 액션 실행 결과를 기록합니다. 액션 식별자, 원래 요청, 성공·실패를 나타내는 HTTP 상태 코드, GS2 API로부터의 JSON 응답 페이로드를 포함합니다.

상세
타입활성화 조건필수기본값값 제한설명
action문자열 열거형
enum {
"Gs2AdReward:ConsumePointByUserId",
"Gs2Dictionary:DeleteEntriesByUserId",
"Gs2Enhance:DeleteProgressByUserId",
"Gs2Exchange:DeleteAwaitByUserId",
"Gs2Experience:SubExperienceByUserId",
"Gs2Experience:SubRankCapByUserId",
"Gs2Formation:SubMoldCapacityByUserId",
"Gs2Grade:SubGradeByUserId",
"Gs2Guild:DecreaseMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Idle:DecreaseMaximumIdleMinutesByUserId",
"Gs2Inbox:OpenMessageByUserId",
"Gs2Inbox:DeleteMessageByUserId",
"Gs2Inventory:ConsumeItemSetByUserId",
"Gs2Inventory:ConsumeSimpleItemsByUserId",
"Gs2Inventory:ConsumeBigItemByUserId",
"Gs2JobQueue:DeleteJobByUserId",
"Gs2Limit:CountUpByUserId",
"Gs2LoginReward:MarkReceivedByUserId",
"Gs2Mission:ReceiveByUserId",
"Gs2Mission:BatchReceiveByUserId",
"Gs2Mission:DecreaseCounterByUserId",
"Gs2Mission:ResetCounterByUserId",
"Gs2Money:WithdrawByUserId",
"Gs2Money:RecordReceipt",
"Gs2Money2:WithdrawByUserId",
"Gs2Money2:VerifyReceiptByUserId",
"Gs2Quest:DeleteProgressByUserId",
"Gs2Ranking2:CreateGlobalRankingReceivedRewardByUserId",
"Gs2Ranking2:CreateClusterRankingReceivedRewardByUserId",
"Gs2Schedule:DeleteTriggerByUserId",
"Gs2SerialKey:UseByUserId",
"Gs2Showcase:IncrementPurchaseCountByUserId",
"Gs2SkillTree:MarkRestrainByUserId",
"Gs2Stamina:DecreaseMaxValueByUserId",
"Gs2Stamina:ConsumeStaminaByUserId",
}
소비 액션에서 실행할 액션의 종류
consumeRequeststring
~ 524288자액션 실행 시 사용되는 요청의 JSON 문자열
statusCodeint0 ~ 999상태 코드
이 소비 액션에 대해 GS2 API가 반환한 HTTP 상태 코드입니다. 2xx는 성공, 409는 재시도가 필요한 충돌, 5xx는 서버 오류를 나타냅니다.
consumeResultstring~ 1048576자결과 내용
소비 액션 실행 후 GS2 API가 반환한 JSON 응답 본문입니다. 소비된 리소스의 상세 정보를 포함합니다.

VerifyActionResult

검증 액션의 실행 결과

단일 검증 액션 실행 결과를 기록합니다. 액션 식별자, 원래 요청, 성공·실패를 나타내는 HTTP 상태 코드, GS2 API로부터의 JSON 응답 페이로드를 포함합니다.

상세
타입활성화 조건필수기본값값 제한설명
action문자열 열거형
enum {
"Gs2Dictionary:VerifyEntryByUserId",
"Gs2Distributor:IfExpressionByUserId",
"Gs2Distributor:AndExpressionByUserId",
"Gs2Distributor:OrExpressionByUserId",
"Gs2Enchant:VerifyRarityParameterStatusByUserId",
"Gs2Experience:VerifyRankByUserId",
"Gs2Experience:VerifyRankCapByUserId",
"Gs2Grade:VerifyGradeByUserId",
"Gs2Grade:VerifyGradeUpMaterialByUserId",
"Gs2Guild:VerifyCurrentMaximumMemberCountByGuildName",
"Gs2Guild:VerifyIncludeMemberByUserId",
"Gs2Inventory:VerifyInventoryCurrentMaxCapacityByUserId",
"Gs2Inventory:VerifyItemSetByUserId",
"Gs2Inventory:VerifyReferenceOfByUserId",
"Gs2Inventory:VerifySimpleItemByUserId",
"Gs2Inventory:VerifyBigItemByUserId",
"Gs2Limit:VerifyCounterByUserId",
"Gs2Matchmaking:VerifyIncludeParticipantByUserId",
"Gs2Mission:VerifyCompleteByUserId",
"Gs2Mission:VerifyCounterValueByUserId",
"Gs2Ranking2:VerifyGlobalRankingScoreByUserId",
"Gs2Ranking2:VerifyClusterRankingScoreByUserId",
"Gs2Ranking2:VerifySubscribeRankingScoreByUserId",
"Gs2Schedule:VerifyTriggerByUserId",
"Gs2Schedule:VerifyEventByUserId",
"Gs2SerialKey:VerifyCodeByUserId",
"Gs2Stamina:VerifyStaminaValueByUserId",
"Gs2Stamina:VerifyStaminaMaxValueByUserId",
"Gs2Stamina:VerifyStaminaRecoverIntervalMinutesByUserId",
"Gs2Stamina:VerifyStaminaRecoverValueByUserId",
"Gs2Stamina:VerifyStaminaOverflowValueByUserId",
}
검증 액션에서 실행할 액션의 종류
verifyRequeststring
~ 524288자액션 실행 시 사용되는 요청의 JSON 문자열
statusCodeint0 ~ 999상태 코드
이 검증 액션에 대해 GS2 API가 반환한 HTTP 상태 코드입니다. 2xx는 검증 성공, 비2xx는 사전 조건이 충족되지 않았음을 나타냅니다.
verifyResultstring~ 1048576자결과 내용
검증 액션 실행 후 GS2 API가 반환한 JSON 응답 본문입니다. 검증 결과의 상세 정보를 포함합니다.

Config

컨피그 설정

트랜잭션의 변수에 적용하는 설정 값

상세
타입활성화 조건필수기본값값 제한설명
keystring
~ 64자이름
valuestring~ 51200자

DistributeResource

리소스 배포

입수 액션과 그 요청 파라미터로 구성된 단일 리소스 배포 조작을 나타냅니다. 플레이어에게 리소스를 배포할 때 어떤 GS2 API 액션을 어떤 파라미터로 실행할지 지정하는 데 사용됩니다.

상세
타입활성화 조건필수기본값값 제한설명
action문자열 열거형
enum {
"Gs2AdReward:AcquirePointByUserId",
"Gs2Dictionary:AddEntriesByUserId",
"Gs2Enchant:ReDrawBalanceParameterStatusByUserId",
"Gs2Enchant:SetBalanceParameterStatusByUserId",
"Gs2Enchant:ReDrawRarityParameterStatusByUserId",
"Gs2Enchant:AddRarityParameterStatusByUserId",
"Gs2Enchant:SetRarityParameterStatusByUserId",
"Gs2Enhance:DirectEnhanceByUserId",
"Gs2Enhance:UnleashByUserId",
"Gs2Enhance:CreateProgressByUserId",
"Gs2Exchange:ExchangeByUserId",
"Gs2Exchange:IncrementalExchangeByUserId",
"Gs2Exchange:CreateAwaitByUserId",
"Gs2Exchange:AcquireForceByUserId",
"Gs2Exchange:SkipByUserId",
"Gs2Experience:AddExperienceByUserId",
"Gs2Experience:SetExperienceByUserId",
"Gs2Experience:AddRankCapByUserId",
"Gs2Experience:SetRankCapByUserId",
"Gs2Experience:MultiplyAcquireActionsByUserId",
"Gs2Formation:AddMoldCapacityByUserId",
"Gs2Formation:SetMoldCapacityByUserId",
"Gs2Formation:AcquireActionsToFormProperties",
"Gs2Formation:SetFormByUserId",
"Gs2Formation:AcquireActionsToPropertyFormProperties",
"Gs2Friend:UpdateProfileByUserId",
"Gs2Grade:AddGradeByUserId",
"Gs2Grade:ApplyRankCapByUserId",
"Gs2Grade:MultiplyAcquireActionsByUserId",
"Gs2Guild:IncreaseMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Guild:SetMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Idle:IncreaseMaximumIdleMinutesByUserId",
"Gs2Idle:SetMaximumIdleMinutesByUserId",
"Gs2Idle:ReceiveByUserId",
"Gs2Inbox:SendMessageByUserId",
"Gs2Inventory:AddCapacityByUserId",
"Gs2Inventory:SetCapacityByUserId",
"Gs2Inventory:AcquireItemSetByUserId",
"Gs2Inventory:AcquireItemSetWithGradeByUserId",
"Gs2Inventory:AddReferenceOfByUserId",
"Gs2Inventory:DeleteReferenceOfByUserId",
"Gs2Inventory:AcquireSimpleItemsByUserId",
"Gs2Inventory:SetSimpleItemsByUserId",
"Gs2Inventory:AcquireBigItemByUserId",
"Gs2Inventory:SetBigItemByUserId",
"Gs2JobQueue:PushByUserId",
"Gs2Limit:CountDownByUserId",
"Gs2Limit:DeleteCounterByUserId",
"Gs2LoginReward:DeleteReceiveStatusByUserId",
"Gs2LoginReward:UnmarkReceivedByUserId",
"Gs2Lottery:DrawByUserId",
"Gs2Lottery:ResetBoxByUserId",
"Gs2Mission:RevertReceiveByUserId",
"Gs2Mission:IncreaseCounterByUserId",
"Gs2Mission:SetCounterByUserId",
"Gs2Money:DepositByUserId",
"Gs2Money:RevertRecordReceipt",
"Gs2Money2:DepositByUserId",
"Gs2Quest:CreateProgressByUserId",
"Gs2Schedule:TriggerByUserId",
"Gs2Schedule:ExtendTriggerByUserId",
"Gs2Script:InvokeScript",
"Gs2SerialKey:RevertUseByUserId",
"Gs2SerialKey:IssueOnce",
"Gs2Showcase:DecrementPurchaseCountByUserId",
"Gs2Showcase:ForceReDrawByUserId",
"Gs2SkillTree:MarkReleaseByUserId",
"Gs2Stamina:RecoverStaminaByUserId",
"Gs2Stamina:RaiseMaxValueByUserId",
"Gs2Stamina:SetMaxValueByUserId",
"Gs2Stamina:SetRecoverIntervalByUserId",
"Gs2Stamina:SetRecoverValueByUserId",
"Gs2StateMachine:StartStateMachineByUserId",
}
입수 액션에서 실행할 액션의 종류
requeststring
~ 524288자액션 실행 시 사용되는 요청의 JSON 문자열

CurrentDistributorMaster

현재 활성화된 배포 모델의 마스터 데이터

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

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

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

DistributorModelMaster

배포 모델 마스터

배포 모델 마스터는 게임 내에서 사용되는 배포 모델의 편집·관리용 데이터로, 관리 콘솔의 마스터 데이터 에디터에 일시적으로 보관됩니다.
임포트·갱신 처리를 수행함으로써 실제로 게임에서 참조되는 배포 모델로 반영됩니다.

배포 모델이란 리소스를 입수할 때 보유 한도를 초과하여 입수했을 경우의 정책을 설정하는 엔티티입니다.
GS2-Distributor를 통해 입수 처리를 수행함으로써, 넘친 리소스를 GS2-Inbox의 메시지로 전달할 수 있습니다.

상세
타입활성화 조건필수기본값값 제한설명
distributorModelIdstring
~ 1024자배포 모델 마스터 GRN
※ 서버가 자동으로 설정
namestring
~ 128자배포 모델 이름
배포 모델 고유의 이름. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
descriptionstring~ 1024자설명문
metadatastring~ 2048자메타데이터
메타데이터에는 임의의 값을 설정할 수 있습니다.
이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다.
inboxNamespaceIdstring~ 1024자넘친 리소스를 전송할 GS2-Inbox 네임스페이스 GRN
리소스 입수가 플레이어의 소지 한도를 초과한 경우, 넘친 리소스는 지정된 GS2-Inbox 네임스페이스에 메시지로 전송됩니다. 플레이어는 이후 수신함에서 리소스를 수령할 수 있습니다.
whiteListTargetIdsList<string>[]0 ~ 1000 itemsGS2-Distributor를 통해 처리할 수 있는 대상 리소스 GRN의 화이트리스트
이 배포 모델을 사용하여 입수 처리를 수행할 수 있는 대상 리소스의 GRN 프리픽스를 지정합니다.
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/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.DescribeNamespaces(
    &distributor.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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\DescribeNamespacesRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DescribeNamespacesRequest;
import io.gs2.distributor.result.DescribeNamespacesResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
    new Gs2.Gs2Distributor.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 Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.describeNamespaces(
        new Gs2Distributor.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 distributor

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

try:
    result = client.describe_namespaces(
        distributor.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('distributor')

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('distributor')

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트랜잭션 설정
리소스 배포 처리 시 분산 트랜잭션의 실행 방법을 제어하는 설정입니다. 자동 실행, 원자적 커밋, 비동기 처리 등의 옵션을 지원합니다.
assumeUserIdstring~ 1024자GS2-Identifier 사용자 GRN
autoRunStampSheetNotificationNotificationSetting
트랜잭션 자동 실행이 완료되었을 때의 푸시 알림(구 사양)
트랜잭션이 서버사이드에서 자동 실행 완료되었을 때 GS2-Gateway를 통해 푸시 알림을 전송하기 위한 설정입니다. 이는 구 사양이며, 신 사양에서는 autoRunTransactionNotification을 사용하세요.
autoRunTransactionNotificationNotificationSetting
트랜잭션 자동 실행이 완료되었을 때의 푸시 알림
분산 트랜잭션이 서버사이드에서 자동 실행 완료되었을 때 GS2-Gateway를 통해 푸시 알림을 전송하기 위한 설정입니다. 트랜잭션 결과를 클라이언트에 통지하여 로컬 상태를 적절히 갱신할 수 있도록 합니다.
logSettingLogSetting로그 출력 설정
디스트리뷰터 조작의 로그 데이터를 GS2-Log에 출력하기 위한 설정입니다. GS2-Log의 네임스페이스를 지정함으로써 리소스 배포·입수 액션 실행·트랜잭션 처리의 API 요청·응답 로그를 수집할 수 있습니다.

Result

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

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.CreateNamespace(
    &distributor.CreateNamespaceRequest {
        Name: pointy.String("namespace-0001"),
        Description: nil,
        TransactionSetting: nil,
        AssumeUserId: pointy.String("grn:gs2::YourOwnerId:identifier:user:user-0001"),
        AutoRunStampSheetNotification: nil,
        AutoRunTransactionNotification: nil,
        LogSetting: &distributor.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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\CreateNamespaceRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->createNamespace(
        (new CreateNamespaceRequest())
            ->withName("namespace-0001")
            ->withDescription(null)
            ->withTransactionSetting(null)
            ->withAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
            ->withAutoRunStampSheetNotification(null)
            ->withAutoRunTransactionNotification(null)
            ->withLogSetting((new \Gs2\Distributor\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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.CreateNamespaceRequest;
import io.gs2.distributor.result.CreateNamespaceResult;

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

try {
    CreateNamespaceResult result = client.createNamespace(
        new CreateNamespaceRequest()
            .withName("namespace-0001")
            .withDescription(null)
            .withTransactionSetting(null)
            .withAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
            .withAutoRunStampSheetNotification(null)
            .withAutoRunTransactionNotification(null)
            .withLogSetting(new io.gs2.distributor.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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
    new Gs2.Gs2Distributor.Request.CreateNamespaceRequest()
        .WithName("namespace-0001")
        .WithDescription(null)
        .WithTransactionSetting(null)
        .WithAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
        .WithAutoRunStampSheetNotification(null)
        .WithAutoRunTransactionNotification(null)
        .WithLogSetting(new Gs2.Gs2Distributor.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 Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.createNamespace(
        new Gs2Distributor.CreateNamespaceRequest()
            .withName("namespace-0001")
            .withDescription(null)
            .withTransactionSetting(null)
            .withAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
            .withAutoRunStampSheetNotification(null)
            .withAutoRunTransactionNotification(null)
            .withLogSetting(new Gs2Distributor.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 distributor

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

try:
    result = client.create_namespace(
        distributor.CreateNamespaceRequest()
            .with_name('namespace-0001')
            .with_description(None)
            .with_transaction_setting(None)
            .with_assume_user_id('grn:gs2::YourOwnerId:identifier:user:user-0001')
            .with_auto_run_stamp_sheet_notification(None)
            .with_auto_run_transaction_notification(None)
            .with_log_setting(
                distributor.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('distributor')

api_result = client.create_namespace({
    name="namespace-0001",
    description=nil,
    transactionSetting=nil,
    assumeUserId="grn:gs2::YourOwnerId:identifier:user:user-0001",
    autoRunStampSheetNotification=nil,
    autoRunTransactionNotification=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('distributor')

api_result_handler = client.create_namespace_async({
    name="namespace-0001",
    description=nil,
    transactionSetting=nil,
    assumeUserId="grn:gs2::YourOwnerId:identifier:user:user-0001",
    autoRunStampSheetNotification=nil,
    autoRunTransactionNotification=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/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.GetNamespaceStatus(
    &distributor.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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetNamespaceStatusRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetNamespaceStatusRequest;
import io.gs2.distributor.result.GetNamespaceStatusResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
    new Gs2.Gs2Distributor.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 Gs2Distributor from '@/gs2/distributor';

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

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

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

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

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('distributor')

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/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.GetNamespace(
    &distributor.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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetNamespaceRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetNamespaceRequest;
import io.gs2.distributor.result.GetNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
    new Gs2.Gs2Distributor.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 Gs2Distributor from '@/gs2/distributor';

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

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

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

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

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('distributor')

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트랜잭션 설정
리소스 배포 처리 시 분산 트랜잭션의 실행 방법을 제어하는 설정입니다. 자동 실행, 원자적 커밋, 비동기 처리 등의 옵션을 지원합니다.
assumeUserIdstring~ 1024자GS2-Identifier 사용자 GRN
autoRunStampSheetNotificationNotificationSetting
트랜잭션 자동 실행이 완료되었을 때의 푸시 알림(구 사양)
트랜잭션이 서버사이드에서 자동 실행 완료되었을 때 GS2-Gateway를 통해 푸시 알림을 전송하기 위한 설정입니다. 이는 구 사양이며, 신 사양에서는 autoRunTransactionNotification을 사용하세요.
autoRunTransactionNotificationNotificationSetting
트랜잭션 자동 실행이 완료되었을 때의 푸시 알림
분산 트랜잭션이 서버사이드에서 자동 실행 완료되었을 때 GS2-Gateway를 통해 푸시 알림을 전송하기 위한 설정입니다. 트랜잭션 결과를 클라이언트에 통지하여 로컬 상태를 적절히 갱신할 수 있도록 합니다.
logSettingLogSetting로그 출력 설정
디스트리뷰터 조작의 로그 데이터를 GS2-Log에 출력하기 위한 설정입니다. GS2-Log의 네임스페이스를 지정함으로써 리소스 배포·입수 액션 실행·트랜잭션 처리의 API 요청·응답 로그를 수집할 수 있습니다.

Result

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

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.UpdateNamespace(
    &distributor.UpdateNamespaceRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Description: pointy.String("description1"),
        TransactionSetting: nil,
        AssumeUserId: pointy.String("grn:gs2::YourOwnerId:identifier:user:user-0001"),
        AutoRunStampSheetNotification: nil,
        AutoRunTransactionNotification: nil,
        LogSetting: 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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\UpdateNamespaceRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->updateNamespace(
        (new UpdateNamespaceRequest())
            ->withNamespaceName("namespace-0001")
            ->withDescription("description1")
            ->withTransactionSetting(null)
            ->withAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
            ->withAutoRunStampSheetNotification(null)
            ->withAutoRunTransactionNotification(null)
            ->withLogSetting(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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.UpdateNamespaceRequest;
import io.gs2.distributor.result.UpdateNamespaceResult;

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

try {
    UpdateNamespaceResult result = client.updateNamespace(
        new UpdateNamespaceRequest()
            .withNamespaceName("namespace-0001")
            .withDescription("description1")
            .withTransactionSetting(null)
            .withAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
            .withAutoRunStampSheetNotification(null)
            .withAutoRunTransactionNotification(null)
            .withLogSetting(null)
    );
    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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
    new Gs2.Gs2Distributor.Request.UpdateNamespaceRequest()
        .WithNamespaceName("namespace-0001")
        .WithDescription("description1")
        .WithTransactionSetting(null)
        .WithAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
        .WithAutoRunStampSheetNotification(null)
        .WithAutoRunTransactionNotification(null)
        .WithLogSetting(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 Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.updateNamespace(
        new Gs2Distributor.UpdateNamespaceRequest()
            .withNamespaceName("namespace-0001")
            .withDescription("description1")
            .withTransactionSetting(null)
            .withAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
            .withAutoRunStampSheetNotification(null)
            .withAutoRunTransactionNotification(null)
            .withLogSetting(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.update_namespace(
        distributor.UpdateNamespaceRequest()
            .with_namespace_name('namespace-0001')
            .with_description('description1')
            .with_transaction_setting(None)
            .with_assume_user_id('grn:gs2::YourOwnerId:identifier:user:user-0001')
            .with_auto_run_stamp_sheet_notification(None)
            .with_auto_run_transaction_notification(None)
            .with_log_setting(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.update_namespace({
    namespaceName="namespace-0001",
    description="description1",
    transactionSetting=nil,
    assumeUserId="grn:gs2::YourOwnerId:identifier:user:user-0001",
    autoRunStampSheetNotification=nil,
    autoRunTransactionNotification=nil,
    logSetting=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('distributor')

api_result_handler = client.update_namespace_async({
    namespaceName="namespace-0001",
    description="description1",
    transactionSetting=nil,
    assumeUserId="grn:gs2::YourOwnerId:identifier:user:user-0001",
    autoRunStampSheetNotification=nil,
    autoRunTransactionNotification=nil,
    logSetting=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;

deleteNamespace

네임스페이스 삭제

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

상세

Request

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

Result

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

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.DeleteNamespace(
    &distributor.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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\DeleteNamespaceRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DeleteNamespaceRequest;
import io.gs2.distributor.result.DeleteNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
    new Gs2.Gs2Distributor.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 Gs2Distributor from '@/gs2/distributor';

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

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

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

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

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('distributor')

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/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.GetServiceVersion(
    &distributor.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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetServiceVersionRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetServiceVersionRequest;
import io.gs2.distributor.result.GetServiceVersionResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2DistributorRestClient client = new Gs2DistributorRestClient(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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.GetServiceVersionResult> asyncResult = null;
yield return client.GetServiceVersion(
    new Gs2.Gs2Distributor.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 Gs2Distributor from '@/gs2/distributor';

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

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

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

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

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('distributor')

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;

distribute

소지품 배포

배포 리소스에 지정된 액션을 기반으로 사용자에게 리소스를 배포합니다.
대응 서비스에는 Inventory, Stamina, Experience, Inbox, Money 등이 포함됩니다.
배포로 인해 사용자의 소지품이 용량을 초과하는 경우, 초과분은 배포 모델에 설정된 프레젠트박스의 네임스페이스로 자동 전송됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
distributorNamestring
~ 128자배포 모델 이름
배포 모델 고유의 이름. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
userIdstring
~ 128자사용자ID
distributeResourceDistributeResource
가산할 리소스
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
distributeResourceDistributeResource처리한 DistributeResource
inboxNamespaceIdstring소지품이 용량을 초과했을 때 전달할 GS2-Inbox 네임스페이스의 GRN
resultstring응답 내용

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.Distribute(
    &distributor.DistributeRequest {
        NamespaceName: pointy.String("namespace-0001"),
        DistributorName: pointy.String("distributor-0001"),
        UserId: pointy.String("user-0001"),
        DistributeResource: &distributor.DistributeResource{
            Action: pointy.String("Gs2Money:DepositWallet"),
            Request: pointy.String("{}"),
        },
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
distributeResource := result.DistributeResource
inboxNamespaceId := result.InboxNamespaceId
result := result.Result
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\DistributeRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->distribute(
        (new DistributeRequest())
            ->withNamespaceName("namespace-0001")
            ->withDistributorName("distributor-0001")
            ->withUserId("user-0001")
            ->withDistributeResource((new DistributeResource())
                ->withAction("Gs2Money:DepositWallet")
                ->withRequest("{}")
            )
            ->withTimeOffsetToken(null)
    );
    $distributeResource = $result->getDistributeResource();
    $inboxNamespaceId = $result->getInboxNamespaceId();
    $result = $result->getResult();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DistributeRequest;
import io.gs2.distributor.result.DistributeResult;

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

try {
    DistributeResult result = client.distribute(
        new DistributeRequest()
            .withNamespaceName("namespace-0001")
            .withDistributorName("distributor-0001")
            .withUserId("user-0001")
            .withDistributeResource(new DistributeResource()
                .withAction("Gs2Money:DepositWallet")
                .withRequest("{}")
            )
            .withTimeOffsetToken(null)
    );
    DistributeResource distributeResource = result.getDistributeResource();
    String inboxNamespaceId = result.getInboxNamespaceId();
    String result = result.getResult();
} 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.DistributeResult> asyncResult = null;
yield return client.Distribute(
    new Gs2.Gs2Distributor.Request.DistributeRequest()
        .WithNamespaceName("namespace-0001")
        .WithDistributorName("distributor-0001")
        .WithUserId("user-0001")
        .WithDistributeResource(new Gs2.Gs2Distributor.Model.DistributeResource()
            .WithAction("Gs2Money:DepositWallet")
            .WithRequest("{}")
        )
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var distributeResource = result.DistributeResource;
var inboxNamespaceId = result.InboxNamespaceId;
var result = result.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.distribute(
        new Gs2Distributor.DistributeRequest()
            .withNamespaceName("namespace-0001")
            .withDistributorName("distributor-0001")
            .withUserId("user-0001")
            .withDistributeResource(new Gs2Distributor.model.DistributeResource()
                .withAction("Gs2Money:DepositWallet")
                .withRequest("{}")
            )
            .withTimeOffsetToken(null)
    );
    const distributeResource = result.getDistributeResource();
    const inboxNamespaceId = result.getInboxNamespaceId();
    const result = result.getResult();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.distribute(
        distributor.DistributeRequest()
            .with_namespace_name('namespace-0001')
            .with_distributor_name('distributor-0001')
            .with_user_id('user-0001')
            .with_distribute_resource(distributor.DistributeResource()
                .with_action('Gs2Money:DepositWallet')
                .with_request('{}')
            )
            .with_time_offset_token(None)
    )
    distribute_resource = result.distribute_resource
    inbox_namespace_id = result.inbox_namespace_id
    result = result.result
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.distribute({
    namespaceName="namespace-0001",
    distributorName="distributor-0001",
    userId="user-0001",
    distributeResource={
        action="Gs2Money:DepositWallet",
        request="{}",
    },
    timeOffsetToken=nil,
})

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

result = api_result.result
distributeResource = result.distributeResource;
inboxNamespaceId = result.inboxNamespaceId;
result = result.result;
client = gs2('distributor')

api_result_handler = client.distribute_async({
    namespaceName="namespace-0001",
    distributorName="distributor-0001",
    userId="user-0001",
    distributeResource={
        action="Gs2Money:DepositWallet",
        request="{}",
    },
    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
distributeResource = result.distributeResource;
inboxNamespaceId = result.inboxNamespaceId;
result = result.result;

distributeWithoutOverflowProcess

소지품 배포(초과 시 구제 조치 없음)

초과 처리 없이 사용자에게 리소스를 배포합니다.
일반적인 배포 조작과 달리, 배포로 인해 사용자의 소지품이 용량을 초과하는 경우 초과분은 그대로 폐기되며 프레젠트박스로의 전송은 이루어지지 않습니다.
이 방식에서는 네임스페이스 지정이 필요하지 않습니다.

상세

Request

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

Result

타입설명
distributeResourceDistributeResource처리한 DistributeResource
resultstring응답 내용

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.DistributeWithoutOverflowProcess(
    &distributor.DistributeWithoutOverflowProcessRequest {
        UserId: pointy.String("user-0001"),
        DistributeResource: &distributor.DistributeResource{
            Action: pointy.String("Gs2Money:DepositWallet"),
            Request: pointy.String("{}"),
        },
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
distributeResource := result.DistributeResource
result := result.Result
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\DistributeWithoutOverflowProcessRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->distributeWithoutOverflowProcess(
        (new DistributeWithoutOverflowProcessRequest())
            ->withUserId("user-0001")
            ->withDistributeResource((new DistributeResource())
                ->withAction("Gs2Money:DepositWallet")
                ->withRequest("{}")
            )
            ->withTimeOffsetToken(null)
    );
    $distributeResource = $result->getDistributeResource();
    $result = $result->getResult();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DistributeWithoutOverflowProcessRequest;
import io.gs2.distributor.result.DistributeWithoutOverflowProcessResult;

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

try {
    DistributeWithoutOverflowProcessResult result = client.distributeWithoutOverflowProcess(
        new DistributeWithoutOverflowProcessRequest()
            .withUserId("user-0001")
            .withDistributeResource(new DistributeResource()
                .withAction("Gs2Money:DepositWallet")
                .withRequest("{}")
            )
            .withTimeOffsetToken(null)
    );
    DistributeResource distributeResource = result.getDistributeResource();
    String result = result.getResult();
} 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.DistributeWithoutOverflowProcessResult> asyncResult = null;
yield return client.DistributeWithoutOverflowProcess(
    new Gs2.Gs2Distributor.Request.DistributeWithoutOverflowProcessRequest()
        .WithUserId("user-0001")
        .WithDistributeResource(new Gs2.Gs2Distributor.Model.DistributeResource()
            .WithAction("Gs2Money:DepositWallet")
            .WithRequest("{}")
        )
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var distributeResource = result.DistributeResource;
var result = result.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.distributeWithoutOverflowProcess(
        new Gs2Distributor.DistributeWithoutOverflowProcessRequest()
            .withUserId("user-0001")
            .withDistributeResource(new Gs2Distributor.model.DistributeResource()
                .withAction("Gs2Money:DepositWallet")
                .withRequest("{}")
            )
            .withTimeOffsetToken(null)
    );
    const distributeResource = result.getDistributeResource();
    const result = result.getResult();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.distribute_without_overflow_process(
        distributor.DistributeWithoutOverflowProcessRequest()
            .with_user_id('user-0001')
            .with_distribute_resource(distributor.DistributeResource()
                .with_action('Gs2Money:DepositWallet')
                .with_request('{}')
            )
            .with_time_offset_token(None)
    )
    distribute_resource = result.distribute_resource
    result = result.result
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.distribute_without_overflow_process({
    userId="user-0001",
    distributeResource={
        action="Gs2Money:DepositWallet",
        request="{}",
    },
    timeOffsetToken=nil,
})

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

result = api_result.result
distributeResource = result.distributeResource;
result = result.result;
client = gs2('distributor')

api_result_handler = client.distribute_without_overflow_process_async({
    userId="user-0001",
    distributeResource={
        action="Gs2Money:DepositWallet",
        request="{}",
    },
    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
distributeResource = result.distributeResource;
result = result.result;

runVerifyTask

트랜잭션의 검증 액션을 실행한다

트랜잭션 내의 단일 검증 태스크를 실행하여 전제 조건을 확인합니다.
반환되는 컨텍스트 스택은 검증 결과를 반영하며, 트랜잭션 내 후속 태스크로 전달됩니다.

상세

Request

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

Result

타입설명
contextStackstring태스크 실행 결과를 반영한 ContextStack
statusCodeint상태 코드
resultstring응답 내용

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.RunVerifyTask(
    &distributor.RunVerifyTaskRequest {
        NamespaceName: pointy.String("namespace-0001"),
        VerifyTask: pointy.String("stampTask"),
        KeyId: pointy.String("key-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
contextStack := result.ContextStack
statusCode := result.StatusCode
result := result.Result
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\RunVerifyTaskRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->runVerifyTask(
        (new RunVerifyTaskRequest())
            ->withNamespaceName("namespace-0001")
            ->withVerifyTask("stampTask")
            ->withKeyId("key-0001")
    );
    $contextStack = $result->getContextStack();
    $statusCode = $result->getStatusCode();
    $result = $result->getResult();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.RunVerifyTaskRequest;
import io.gs2.distributor.result.RunVerifyTaskResult;

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

try {
    RunVerifyTaskResult result = client.runVerifyTask(
        new RunVerifyTaskRequest()
            .withNamespaceName("namespace-0001")
            .withVerifyTask("stampTask")
            .withKeyId("key-0001")
    );
    String contextStack = result.getContextStack();
    int statusCode = result.getStatusCode();
    String result = result.getResult();
} 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.RunVerifyTaskResult> asyncResult = null;
yield return client.RunVerifyTask(
    new Gs2.Gs2Distributor.Request.RunVerifyTaskRequest()
        .WithNamespaceName("namespace-0001")
        .WithVerifyTask("stampTask")
        .WithKeyId("key-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var contextStack = result.ContextStack;
var statusCode = result.StatusCode;
var result = result.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.runVerifyTask(
        new Gs2Distributor.RunVerifyTaskRequest()
            .withNamespaceName("namespace-0001")
            .withVerifyTask("stampTask")
            .withKeyId("key-0001")
    );
    const contextStack = result.getContextStack();
    const statusCode = result.getStatusCode();
    const result = result.getResult();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.run_verify_task(
        distributor.RunVerifyTaskRequest()
            .with_namespace_name('namespace-0001')
            .with_verify_task('stampTask')
            .with_key_id('key-0001')
    )
    context_stack = result.context_stack
    status_code = result.status_code
    result = result.result
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.run_verify_task({
    namespaceName="namespace-0001",
    verifyTask="stampTask",
    keyId="key-0001",
})

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

result = api_result.result
contextStack = result.contextStack;
statusCode = result.statusCode;
result = result.result;
client = gs2('distributor')

api_result_handler = client.run_verify_task_async({
    namespaceName="namespace-0001",
    verifyTask="stampTask",
    keyId="key-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
contextStack = result.contextStack;
statusCode = result.statusCode;
result = result.result;

runStampSheetExpress

트랜잭션을 실행한다

트랜잭션의 세 단계를 순서대로 실행합니다: 검증 액션, 소비 액션, 입수 액션.
이는 RunVerifyTask, RunStampTask, RunStampSheet를 한 번의 호출로 결합한 편의 API입니다.
각 검증 태스크, 소비 액션, 입수 액션의 개별 상태 코드와 응답 내용을 포함하여, 모든 단계의 결과가 함께 반환됩니다.

상세

Request

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

Result

타입설명
verifyTaskResultCodesList<int>검증 액션의 실행 상태 코드
verifyTaskResultsList<string>검증 액션의 실행 결과
taskResultCodesList<int>소비 액션의 실행 상태 코드
taskResultsList<string>소비 액션의 실행 결과
sheetResultCodeint획득 액션의 실행 상태 코드
sheetResultstring획득 액션의 실행 결과 응답 내용

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.RunStampSheetExpress(
    &distributor.RunStampSheetExpressRequest {
        NamespaceName: pointy.String("namespace-0001"),
        StampSheet: pointy.String("stampSheet"),
        KeyId: pointy.String("key-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
verifyTaskResultCodes := result.VerifyTaskResultCodes
verifyTaskResults := result.VerifyTaskResults
taskResultCodes := result.TaskResultCodes
taskResults := result.TaskResults
sheetResultCode := result.SheetResultCode
sheetResult := result.SheetResult
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\RunStampSheetExpressRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->runStampSheetExpress(
        (new RunStampSheetExpressRequest())
            ->withNamespaceName("namespace-0001")
            ->withStampSheet("stampSheet")
            ->withKeyId("key-0001")
    );
    $verifyTaskResultCodes = $result->getVerifyTaskResultCodes();
    $verifyTaskResults = $result->getVerifyTaskResults();
    $taskResultCodes = $result->getTaskResultCodes();
    $taskResults = $result->getTaskResults();
    $sheetResultCode = $result->getSheetResultCode();
    $sheetResult = $result->getSheetResult();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.RunStampSheetExpressRequest;
import io.gs2.distributor.result.RunStampSheetExpressResult;

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

try {
    RunStampSheetExpressResult result = client.runStampSheetExpress(
        new RunStampSheetExpressRequest()
            .withNamespaceName("namespace-0001")
            .withStampSheet("stampSheet")
            .withKeyId("key-0001")
    );
    List<int> verifyTaskResultCodes = result.getVerifyTaskResultCodes();
    List<String> verifyTaskResults = result.getVerifyTaskResults();
    List<int> taskResultCodes = result.getTaskResultCodes();
    List<String> taskResults = result.getTaskResults();
    int sheetResultCode = result.getSheetResultCode();
    String sheetResult = result.getSheetResult();
} 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.RunStampSheetExpressResult> asyncResult = null;
yield return client.RunStampSheetExpress(
    new Gs2.Gs2Distributor.Request.RunStampSheetExpressRequest()
        .WithNamespaceName("namespace-0001")
        .WithStampSheet("stampSheet")
        .WithKeyId("key-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var verifyTaskResultCodes = result.VerifyTaskResultCodes;
var verifyTaskResults = result.VerifyTaskResults;
var taskResultCodes = result.TaskResultCodes;
var taskResults = result.TaskResults;
var sheetResultCode = result.SheetResultCode;
var sheetResult = result.SheetResult;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.runStampSheetExpress(
        new Gs2Distributor.RunStampSheetExpressRequest()
            .withNamespaceName("namespace-0001")
            .withStampSheet("stampSheet")
            .withKeyId("key-0001")
    );
    const verifyTaskResultCodes = result.getVerifyTaskResultCodes();
    const verifyTaskResults = result.getVerifyTaskResults();
    const taskResultCodes = result.getTaskResultCodes();
    const taskResults = result.getTaskResults();
    const sheetResultCode = result.getSheetResultCode();
    const sheetResult = result.getSheetResult();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.run_stamp_sheet_express(
        distributor.RunStampSheetExpressRequest()
            .with_namespace_name('namespace-0001')
            .with_stamp_sheet('stampSheet')
            .with_key_id('key-0001')
    )
    verify_task_result_codes = result.verify_task_result_codes
    verify_task_results = result.verify_task_results
    task_result_codes = result.task_result_codes
    task_results = result.task_results
    sheet_result_code = result.sheet_result_code
    sheet_result = result.sheet_result
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.run_stamp_sheet_express({
    namespaceName="namespace-0001",
    stampSheet="stampSheet",
    keyId="key-0001",
})

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

result = api_result.result
verifyTaskResultCodes = result.verifyTaskResultCodes;
verifyTaskResults = result.verifyTaskResults;
taskResultCodes = result.taskResultCodes;
taskResults = result.taskResults;
sheetResultCode = result.sheetResultCode;
sheetResult = result.sheetResult;
client = gs2('distributor')

api_result_handler = client.run_stamp_sheet_express_async({
    namespaceName="namespace-0001",
    stampSheet="stampSheet",
    keyId="key-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
verifyTaskResultCodes = result.verifyTaskResultCodes;
verifyTaskResults = result.verifyTaskResults;
taskResultCodes = result.taskResultCodes;
taskResults = result.taskResults;
sheetResultCode = result.sheetResultCode;
sheetResult = result.sheetResult;

runVerifyTaskWithoutNamespace

GS2-Distributor의 네임스페이스를 지정하지 않고, 트랜잭션의 검증 액션을 실행한다

GS2-Distributor의 네임스페이스를 지정하지 않고 검증 태스크를 실행합니다.
네임스페이스 지정을 생략하면 다음과 같은 부작용이 있습니다:

  • 실행 로그가 기록되지 않습니다
  • 리소스 초과 처리가 실행되지 않습니다
    네임스페이스 수준 기능의 오버헤드 없이 가벼운 검증 실행이 필요한 경우에 사용합니다.
상세

Request

타입활성화 조건필수기본값값 제한설명
verifyTaskstring
~ 5242880자검증 액션
keyIdstring
~ 1024자암호화 키 GRN

Result

타입설명
contextStackstring태스크 실행 결과를 반영한 ContextStack
statusCodeint상태 코드
resultstring응답 내용

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.RunVerifyTaskWithoutNamespace(
    &distributor.RunVerifyTaskWithoutNamespaceRequest {
        VerifyTask: pointy.String("stampTask"),
        KeyId: pointy.String("key-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
contextStack := result.ContextStack
statusCode := result.StatusCode
result := result.Result
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\RunVerifyTaskWithoutNamespaceRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->runVerifyTaskWithoutNamespace(
        (new RunVerifyTaskWithoutNamespaceRequest())
            ->withVerifyTask("stampTask")
            ->withKeyId("key-0001")
    );
    $contextStack = $result->getContextStack();
    $statusCode = $result->getStatusCode();
    $result = $result->getResult();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.RunVerifyTaskWithoutNamespaceRequest;
import io.gs2.distributor.result.RunVerifyTaskWithoutNamespaceResult;

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

try {
    RunVerifyTaskWithoutNamespaceResult result = client.runVerifyTaskWithoutNamespace(
        new RunVerifyTaskWithoutNamespaceRequest()
            .withVerifyTask("stampTask")
            .withKeyId("key-0001")
    );
    String contextStack = result.getContextStack();
    int statusCode = result.getStatusCode();
    String result = result.getResult();
} 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.RunVerifyTaskWithoutNamespaceResult> asyncResult = null;
yield return client.RunVerifyTaskWithoutNamespace(
    new Gs2.Gs2Distributor.Request.RunVerifyTaskWithoutNamespaceRequest()
        .WithVerifyTask("stampTask")
        .WithKeyId("key-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var contextStack = result.ContextStack;
var statusCode = result.StatusCode;
var result = result.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.runVerifyTaskWithoutNamespace(
        new Gs2Distributor.RunVerifyTaskWithoutNamespaceRequest()
            .withVerifyTask("stampTask")
            .withKeyId("key-0001")
    );
    const contextStack = result.getContextStack();
    const statusCode = result.getStatusCode();
    const result = result.getResult();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.run_verify_task_without_namespace(
        distributor.RunVerifyTaskWithoutNamespaceRequest()
            .with_verify_task('stampTask')
            .with_key_id('key-0001')
    )
    context_stack = result.context_stack
    status_code = result.status_code
    result = result.result
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.run_verify_task_without_namespace({
    verifyTask="stampTask",
    keyId="key-0001",
})

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

result = api_result.result
contextStack = result.contextStack;
statusCode = result.statusCode;
result = result.result;
client = gs2('distributor')

api_result_handler = client.run_verify_task_without_namespace_async({
    verifyTask="stampTask",
    keyId="key-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
contextStack = result.contextStack;
statusCode = result.statusCode;
result = result.result;

runStampTaskWithoutNamespace

GS2-Distributor 네임스페이스를 지정하지 않고 트랜잭션의 소비 액션 실행

GS2-Distributor 네임스페이스를 지정하지 않고 소비 액션을 실행합니다.
네임스페이스 지정을 생략하면 다음과 같은 부작용이 발생합니다:

  • 실행 로그가 기록되지 않습니다
  • 리소스 초과 처리가 실행되지 않습니다
    네임스페이스 레벨 기능의 오버헤드 없이 경량 소비 실행이 필요한 경우에 사용합니다.
상세

Request

타입활성화 조건필수기본값값 제한설명
stampTaskstring
~ 5242880자소비 액션
keyIdstring
~ 1024자암호화 키 GRN

Result

타입설명
contextStackstring태스크 실행 결과를 반영한 ContextStack
statusCodeint상태 코드
resultstring응답 내용

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.RunStampTaskWithoutNamespace(
    &distributor.RunStampTaskWithoutNamespaceRequest {
        StampTask: pointy.String("stampTask"),
        KeyId: pointy.String("key-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
contextStack := result.ContextStack
statusCode := result.StatusCode
result := result.Result
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\RunStampTaskWithoutNamespaceRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->runStampTaskWithoutNamespace(
        (new RunStampTaskWithoutNamespaceRequest())
            ->withStampTask("stampTask")
            ->withKeyId("key-0001")
    );
    $contextStack = $result->getContextStack();
    $statusCode = $result->getStatusCode();
    $result = $result->getResult();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.RunStampTaskWithoutNamespaceRequest;
import io.gs2.distributor.result.RunStampTaskWithoutNamespaceResult;

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

try {
    RunStampTaskWithoutNamespaceResult result = client.runStampTaskWithoutNamespace(
        new RunStampTaskWithoutNamespaceRequest()
            .withStampTask("stampTask")
            .withKeyId("key-0001")
    );
    String contextStack = result.getContextStack();
    int statusCode = result.getStatusCode();
    String result = result.getResult();
} 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.RunStampTaskWithoutNamespaceResult> asyncResult = null;
yield return client.RunStampTaskWithoutNamespace(
    new Gs2.Gs2Distributor.Request.RunStampTaskWithoutNamespaceRequest()
        .WithStampTask("stampTask")
        .WithKeyId("key-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var contextStack = result.ContextStack;
var statusCode = result.StatusCode;
var result = result.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.runStampTaskWithoutNamespace(
        new Gs2Distributor.RunStampTaskWithoutNamespaceRequest()
            .withStampTask("stampTask")
            .withKeyId("key-0001")
    );
    const contextStack = result.getContextStack();
    const statusCode = result.getStatusCode();
    const result = result.getResult();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.run_stamp_task_without_namespace(
        distributor.RunStampTaskWithoutNamespaceRequest()
            .with_stamp_task('stampTask')
            .with_key_id('key-0001')
    )
    context_stack = result.context_stack
    status_code = result.status_code
    result = result.result
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.run_stamp_task_without_namespace({
    stampTask="stampTask",
    keyId="key-0001",
})

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

result = api_result.result
contextStack = result.contextStack;
statusCode = result.statusCode;
result = result.result;
client = gs2('distributor')

api_result_handler = client.run_stamp_task_without_namespace_async({
    stampTask="stampTask",
    keyId="key-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
contextStack = result.contextStack;
statusCode = result.statusCode;
result = result.result;

runStampSheetWithoutNamespace

GS2-Distributor 네임스페이스를 지정하지 않고 트랜잭션의 획득 액션 실행

GS2-Distributor 네임스페이스를 지정하지 않고 획득 액션을 실행합니다.
네임스페이스 지정을 생략하면 다음과 같은 부작용이 발생합니다:

  • 실행 로그가 기록되지 않습니다
  • 리소스 초과 처리가 실행되지 않습니다(초과 리소스는 폐기됩니다)
    네임스페이스 레벨 기능의 오버헤드 없이 경량 획득 실행이 필요한 경우에 사용합니다.
상세

Request

타입활성화 조건필수기본값값 제한설명
stampSheetstring
~ 5242880자트랜잭션
keyIdstring
~ 1024자암호화 키 GRN

Result

타입설명
statusCodeint상태 코드
resultstring응답 내용

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.RunStampSheetWithoutNamespace(
    &distributor.RunStampSheetWithoutNamespaceRequest {
        StampSheet: pointy.String("stampSheet"),
        KeyId: pointy.String("key-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
statusCode := result.StatusCode
result := result.Result
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\RunStampSheetWithoutNamespaceRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->runStampSheetWithoutNamespace(
        (new RunStampSheetWithoutNamespaceRequest())
            ->withStampSheet("stampSheet")
            ->withKeyId("key-0001")
    );
    $statusCode = $result->getStatusCode();
    $result = $result->getResult();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.RunStampSheetWithoutNamespaceRequest;
import io.gs2.distributor.result.RunStampSheetWithoutNamespaceResult;

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

try {
    RunStampSheetWithoutNamespaceResult result = client.runStampSheetWithoutNamespace(
        new RunStampSheetWithoutNamespaceRequest()
            .withStampSheet("stampSheet")
            .withKeyId("key-0001")
    );
    int statusCode = result.getStatusCode();
    String result = result.getResult();
} 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.RunStampSheetWithoutNamespaceResult> asyncResult = null;
yield return client.RunStampSheetWithoutNamespace(
    new Gs2.Gs2Distributor.Request.RunStampSheetWithoutNamespaceRequest()
        .WithStampSheet("stampSheet")
        .WithKeyId("key-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var statusCode = result.StatusCode;
var result = result.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.runStampSheetWithoutNamespace(
        new Gs2Distributor.RunStampSheetWithoutNamespaceRequest()
            .withStampSheet("stampSheet")
            .withKeyId("key-0001")
    );
    const statusCode = result.getStatusCode();
    const result = result.getResult();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.run_stamp_sheet_without_namespace(
        distributor.RunStampSheetWithoutNamespaceRequest()
            .with_stamp_sheet('stampSheet')
            .with_key_id('key-0001')
    )
    status_code = result.status_code
    result = result.result
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.run_stamp_sheet_without_namespace({
    stampSheet="stampSheet",
    keyId="key-0001",
})

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

result = api_result.result
statusCode = result.statusCode;
result = result.result;
client = gs2('distributor')

api_result_handler = client.run_stamp_sheet_without_namespace_async({
    stampSheet="stampSheet",
    keyId="key-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
statusCode = result.statusCode;
result = result.result;

runStampSheetExpressWithoutNamespace

GS2-Distributor 네임스페이스를 지정하지 않고 트랜잭션 실행

GS2-Distributor 네임스페이스를 지정하지 않고 트랜잭션의 3가지 단계(검증, 소비, 획득)를 순서대로 실행합니다.
네임스페이스 지정을 생략하면 다음과 같은 부작용이 발생합니다:

  • 실행 로그가 기록되지 않습니다
  • 리소스 초과 처리가 실행되지 않습니다(초과 리소스는 폐기됩니다)
    네임스페이스 레벨 기능의 오버헤드 없이 경량 트랜잭션 전체 실행이 필요한 경우에 사용합니다.
상세

Request

타입활성화 조건필수기본값값 제한설명
stampSheetstring
~ 5242880자트랜잭션
keyIdstring
~ 1024자암호화 키 GRN

Result

타입설명
verifyTaskResultCodesList<int>검증 액션의 실행 상태 코드
verifyTaskResultsList<string>검증 액션의 실행 결과
taskResultCodesList<int>소비 액션의 실행 상태 코드
taskResultsList<string>소비 액션의 실행 결과
sheetResultCodeint획득 액션의 실행 상태 코드
sheetResultstring획득 액션의 실행 결과 응답 내용

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.RunStampSheetExpressWithoutNamespace(
    &distributor.RunStampSheetExpressWithoutNamespaceRequest {
        StampSheet: pointy.String("stampSheet"),
        KeyId: pointy.String("key-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
verifyTaskResultCodes := result.VerifyTaskResultCodes
verifyTaskResults := result.VerifyTaskResults
taskResultCodes := result.TaskResultCodes
taskResults := result.TaskResults
sheetResultCode := result.SheetResultCode
sheetResult := result.SheetResult
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\RunStampSheetExpressWithoutNamespaceRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->runStampSheetExpressWithoutNamespace(
        (new RunStampSheetExpressWithoutNamespaceRequest())
            ->withStampSheet("stampSheet")
            ->withKeyId("key-0001")
    );
    $verifyTaskResultCodes = $result->getVerifyTaskResultCodes();
    $verifyTaskResults = $result->getVerifyTaskResults();
    $taskResultCodes = $result->getTaskResultCodes();
    $taskResults = $result->getTaskResults();
    $sheetResultCode = $result->getSheetResultCode();
    $sheetResult = $result->getSheetResult();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.RunStampSheetExpressWithoutNamespaceRequest;
import io.gs2.distributor.result.RunStampSheetExpressWithoutNamespaceResult;

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

try {
    RunStampSheetExpressWithoutNamespaceResult result = client.runStampSheetExpressWithoutNamespace(
        new RunStampSheetExpressWithoutNamespaceRequest()
            .withStampSheet("stampSheet")
            .withKeyId("key-0001")
    );
    List<int> verifyTaskResultCodes = result.getVerifyTaskResultCodes();
    List<String> verifyTaskResults = result.getVerifyTaskResults();
    List<int> taskResultCodes = result.getTaskResultCodes();
    List<String> taskResults = result.getTaskResults();
    int sheetResultCode = result.getSheetResultCode();
    String sheetResult = result.getSheetResult();
} 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.RunStampSheetExpressWithoutNamespaceResult> asyncResult = null;
yield return client.RunStampSheetExpressWithoutNamespace(
    new Gs2.Gs2Distributor.Request.RunStampSheetExpressWithoutNamespaceRequest()
        .WithStampSheet("stampSheet")
        .WithKeyId("key-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var verifyTaskResultCodes = result.VerifyTaskResultCodes;
var verifyTaskResults = result.VerifyTaskResults;
var taskResultCodes = result.TaskResultCodes;
var taskResults = result.TaskResults;
var sheetResultCode = result.SheetResultCode;
var sheetResult = result.SheetResult;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.runStampSheetExpressWithoutNamespace(
        new Gs2Distributor.RunStampSheetExpressWithoutNamespaceRequest()
            .withStampSheet("stampSheet")
            .withKeyId("key-0001")
    );
    const verifyTaskResultCodes = result.getVerifyTaskResultCodes();
    const verifyTaskResults = result.getVerifyTaskResults();
    const taskResultCodes = result.getTaskResultCodes();
    const taskResults = result.getTaskResults();
    const sheetResultCode = result.getSheetResultCode();
    const sheetResult = result.getSheetResult();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.run_stamp_sheet_express_without_namespace(
        distributor.RunStampSheetExpressWithoutNamespaceRequest()
            .with_stamp_sheet('stampSheet')
            .with_key_id('key-0001')
    )
    verify_task_result_codes = result.verify_task_result_codes
    verify_task_results = result.verify_task_results
    task_result_codes = result.task_result_codes
    task_results = result.task_results
    sheet_result_code = result.sheet_result_code
    sheet_result = result.sheet_result
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.run_stamp_sheet_express_without_namespace({
    stampSheet="stampSheet",
    keyId="key-0001",
})

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

result = api_result.result
verifyTaskResultCodes = result.verifyTaskResultCodes;
verifyTaskResults = result.verifyTaskResults;
taskResultCodes = result.taskResultCodes;
taskResults = result.taskResults;
sheetResultCode = result.sheetResultCode;
sheetResult = result.sheetResult;
client = gs2('distributor')

api_result_handler = client.run_stamp_sheet_express_without_namespace_async({
    stampSheet="stampSheet",
    keyId="key-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
verifyTaskResultCodes = result.verifyTaskResultCodes;
verifyTaskResults = result.verifyTaskResults;
taskResultCodes = result.taskResultCodes;
taskResults = result.taskResults;
sheetResultCode = result.sheetResultCode;
sheetResult = result.sheetResult;

setTransactionDefaultConfig

트랜잭션 발행 API에 지정할 Config의 기본값 설정

후속 트랜잭션 API 호출에 자동으로 적용되는 기본 Config 값을 설정합니다.
기본값은 반환되는 ContextStack에 포함되며, 이 ContextStack을 후속 요청에 포함하면 Config 값이 자동으로 적용됩니다.
설정된 기본값의 유효기간은 설정 시점부터 18시간입니다. 이 시간을 초과하면 값은 무시되며 다시 설정해야 합니다.
슬롯 이름이나 레이트 모델 이름 등 자주 사용하는 Config 값을 매번 지정하지 않고 한 번만 설정하고자 할 때 유용합니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
accessTokenstring
~ 128자액세스 토큰
configList<Config>
1 ~ 1000 items트랜잭션의 플레이스홀더에 적용하는 설정값

Result

타입설명
newContextStackstring기본 Config를 반영하기 위한 ContextStack

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.SetTransactionDefaultConfig(
    &distributor.SetTransactionDefaultConfigRequest {
        AccessToken: pointy.String("accessToken-0001"),
        Config: []distributor.Config{
            distributor.Config{
                Key: pointy.String("key-0001"),
                Value: pointy.String("value-0001"),
            },
            distributor.Config{
                Key: pointy.String("key-0002"),
                Value: pointy.String("value-0002"),
            },
        },
    }
)
if err != nil {
    panic("error occurred")
}
newContextStack := result.NewContextStack
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\SetTransactionDefaultConfigRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->setTransactionDefaultConfig(
        (new SetTransactionDefaultConfigRequest())
            ->withAccessToken("accessToken-0001")
            ->withConfig([
                (new Config())
                    ->withKey("key-0001")
                    ->withValue("value-0001"),
                (new Config())
                    ->withKey("key-0002")
                    ->withValue("value-0002"),
            ])
    );
    $newContextStack = $result->getNewContextStack();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.SetTransactionDefaultConfigRequest;
import io.gs2.distributor.result.SetTransactionDefaultConfigResult;

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

try {
    SetTransactionDefaultConfigResult result = client.setTransactionDefaultConfig(
        new SetTransactionDefaultConfigRequest()
            .withAccessToken("accessToken-0001")
            .withConfig(Arrays.asList(
                new Config()
                    .withKey("key-0001")
                    .withValue("value-0001"),
                new Config()
                    .withKey("key-0002")
                    .withValue("value-0002")
            ))
    );
    String newContextStack = result.getNewContextStack();
} 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.SetTransactionDefaultConfigResult> asyncResult = null;
yield return client.SetTransactionDefaultConfig(
    new Gs2.Gs2Distributor.Request.SetTransactionDefaultConfigRequest()
        .WithAccessToken("accessToken-0001")
        .WithConfig(new Gs2.Gs2Distributor.Model.Config[] {
            new Gs2.Gs2Distributor.Model.Config()
                .WithKey("key-0001")
                .WithValue("value-0001"),
            new Gs2.Gs2Distributor.Model.Config()
                .WithKey("key-0002")
                .WithValue("value-0002"),
        }),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var newContextStack = result.NewContextStack;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.setTransactionDefaultConfig(
        new Gs2Distributor.SetTransactionDefaultConfigRequest()
            .withAccessToken("accessToken-0001")
            .withConfig([
                new Gs2Distributor.model.Config()
                    .withKey("key-0001")
                    .withValue("value-0001"),
                new Gs2Distributor.model.Config()
                    .withKey("key-0002")
                    .withValue("value-0002"),
            ])
    );
    const newContextStack = result.getNewContextStack();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.set_transaction_default_config(
        distributor.SetTransactionDefaultConfigRequest()
            .with_access_token('accessToken-0001')
            .with_config([
                distributor.Config()
                    .with_key('key-0001')
                    .with_value('value-0001'),
                distributor.Config()
                    .with_key('key-0002')
                    .with_value('value-0002'),
            ])
    )
    new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.set_transaction_default_config({
    accessToken="accessToken-0001",
    config={
        {
            key="key-0001",
            value="value-0001",
        },
        {
            key="key-0002",
            value="value-0002",
        }
    },
})

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

result = api_result.result
newContextStack = result.newContextStack;
client = gs2('distributor')

api_result_handler = client.set_transaction_default_config_async({
    accessToken="accessToken-0001",
    config={
        {
            key="key-0001",
            value="value-0001",
        },
        {
            key="key-0002",
            value="value-0002",
        }
    },
})

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
newContextStack = result.newContextStack;

setTransactionDefaultConfigByUserId

사용자 ID를 지정하여 트랜잭션 발행 API에 지정할 Config의 기본값 설정

지정된 사용자의 후속 트랜잭션 API 호출에 자동으로 적용되는 기본 Config 값을 설정합니다.
기본값은 반환되는 ContextStack에 포함되며, 이 ContextStack을 후속 요청에 포함하면 Config 값이 자동으로 적용됩니다.
설정된 기본값의 유효기간은 설정 시점부터 18시간입니다. 이 시간을 초과하면 값은 무시되며 다시 설정해야 합니다.
슬롯 이름이나 레이트 모델 이름 등 자주 사용하는 Config 값을 매번 지정하지 않고 한 번만 설정하고자 할 때 유용합니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
userIdstring
~ 128자사용자ID
configList<Config>
1 ~ 1000 items트랜잭션의 플레이스홀더에 적용하는 설정값
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
newContextStackstring기본 Config를 반영하기 위한 ContextStack

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.SetTransactionDefaultConfigByUserId(
    &distributor.SetTransactionDefaultConfigByUserIdRequest {
        UserId: pointy.String("user-0001"),
        Config: []distributor.Config{
            distributor.Config{
                Key: pointy.String("key-0001"),
                Value: pointy.String("value-0001"),
            },
            distributor.Config{
                Key: pointy.String("key-0002"),
                Value: pointy.String("value-0002"),
            },
        },
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
newContextStack := result.NewContextStack
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\SetTransactionDefaultConfigByUserIdRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->setTransactionDefaultConfigByUserId(
        (new SetTransactionDefaultConfigByUserIdRequest())
            ->withUserId("user-0001")
            ->withConfig([
                (new Config())
                    ->withKey("key-0001")
                    ->withValue("value-0001"),
                (new Config())
                    ->withKey("key-0002")
                    ->withValue("value-0002"),
            ])
            ->withTimeOffsetToken(null)
    );
    $newContextStack = $result->getNewContextStack();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.SetTransactionDefaultConfigByUserIdRequest;
import io.gs2.distributor.result.SetTransactionDefaultConfigByUserIdResult;

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

try {
    SetTransactionDefaultConfigByUserIdResult result = client.setTransactionDefaultConfigByUserId(
        new SetTransactionDefaultConfigByUserIdRequest()
            .withUserId("user-0001")
            .withConfig(Arrays.asList(
                new Config()
                    .withKey("key-0001")
                    .withValue("value-0001"),
                new Config()
                    .withKey("key-0002")
                    .withValue("value-0002")
            ))
            .withTimeOffsetToken(null)
    );
    String newContextStack = result.getNewContextStack();
} 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.SetTransactionDefaultConfigByUserIdResult> asyncResult = null;
yield return client.SetTransactionDefaultConfigByUserId(
    new Gs2.Gs2Distributor.Request.SetTransactionDefaultConfigByUserIdRequest()
        .WithUserId("user-0001")
        .WithConfig(new Gs2.Gs2Distributor.Model.Config[] {
            new Gs2.Gs2Distributor.Model.Config()
                .WithKey("key-0001")
                .WithValue("value-0001"),
            new Gs2.Gs2Distributor.Model.Config()
                .WithKey("key-0002")
                .WithValue("value-0002"),
        })
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var newContextStack = result.NewContextStack;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.setTransactionDefaultConfigByUserId(
        new Gs2Distributor.SetTransactionDefaultConfigByUserIdRequest()
            .withUserId("user-0001")
            .withConfig([
                new Gs2Distributor.model.Config()
                    .withKey("key-0001")
                    .withValue("value-0001"),
                new Gs2Distributor.model.Config()
                    .withKey("key-0002")
                    .withValue("value-0002"),
            ])
            .withTimeOffsetToken(null)
    );
    const newContextStack = result.getNewContextStack();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.set_transaction_default_config_by_user_id(
        distributor.SetTransactionDefaultConfigByUserIdRequest()
            .with_user_id('user-0001')
            .with_config([
                distributor.Config()
                    .with_key('key-0001')
                    .with_value('value-0001'),
                distributor.Config()
                    .with_key('key-0002')
                    .with_value('value-0002'),
            ])
            .with_time_offset_token(None)
    )
    new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.set_transaction_default_config_by_user_id({
    userId="user-0001",
    config={
        {
            key="key-0001",
            value="value-0001",
        },
        {
            key="key-0002",
            value="value-0002",
        }
    },
    timeOffsetToken=nil,
})

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

result = api_result.result
newContextStack = result.newContextStack;
client = gs2('distributor')

api_result_handler = client.set_transaction_default_config_by_user_id_async({
    userId="user-0001",
    config={
        {
            key="key-0001",
            value="value-0001",
        },
        {
            key="key-0002",
            value="value-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
newContextStack = result.newContextStack;

freezeMasterData

마스터 데이터를 현재 시각 기준으로 고정

현재 로그인한 사용자의 마스터 데이터를 현재 타임스탬프로 고정합니다.
고정 타임스탬프는 반환되는 ContextStack에 기록되며, 이 ContextStack을 후속 요청에 포함하면 최신 버전이 아닌 고정 시점의 마스터 데이터가 사용됩니다.
이를 통해 일련의 관련 작업 동안 마스터 데이터의 일관성이 보장되며, 작업 도중의 변경 사항이 사용자에게 영향을 주지 않습니다.

상세

Request

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

Result

타입설명
newContextStackstring마스터 데이터를 고정하는 시각을 기록한 컨텍스트

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.FreezeMasterData(
    &distributor.FreezeMasterDataRequest {
        NamespaceName: pointy.String("namespace-0001"),
        AccessToken: pointy.String("accessToken-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
newContextStack := result.NewContextStack
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\FreezeMasterDataRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->freezeMasterData(
        (new FreezeMasterDataRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
    );
    $newContextStack = $result->getNewContextStack();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.FreezeMasterDataRequest;
import io.gs2.distributor.result.FreezeMasterDataResult;

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

try {
    FreezeMasterDataResult result = client.freezeMasterData(
        new FreezeMasterDataRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
    );
    String newContextStack = result.getNewContextStack();
} 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.FreezeMasterDataResult> asyncResult = null;
yield return client.FreezeMasterData(
    new Gs2.Gs2Distributor.Request.FreezeMasterDataRequest()
        .WithNamespaceName("namespace-0001")
        .WithAccessToken("accessToken-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var newContextStack = result.NewContextStack;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.freezeMasterData(
        new Gs2Distributor.FreezeMasterDataRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
    );
    const newContextStack = result.getNewContextStack();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.freeze_master_data(
        distributor.FreezeMasterDataRequest()
            .with_namespace_name('namespace-0001')
            .with_access_token('accessToken-0001')
    )
    new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

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

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

result = api_result.result
newContextStack = result.newContextStack;
client = gs2('distributor')

api_result_handler = client.freeze_master_data_async({
    namespaceName="namespace-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
newContextStack = result.newContextStack;

freezeMasterDataByUserId

사용자 ID를 지정하여 마스터 데이터를 현재 시각 기준으로 고정

지정된 사용자의 마스터 데이터를 현재 타임스탬프로 고정합니다.
고정 타임스탬프는 반환되는 ContextStack에 기록되며, 이 ContextStack을 후속 요청에 포함하면 최신 버전이 아닌 고정 시점의 마스터 데이터가 사용됩니다.
이를 통해 일련의 관련 작업 동안 마스터 데이터의 일관성이 보장되며, 작업 도중의 변경 사항이 사용자에게 영향을 주지 않습니다.

상세

Request

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

Result

타입설명
newContextStackstring마스터 데이터를 고정하는 시각을 기록한 컨텍스트

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.FreezeMasterDataByUserId(
    &distributor.FreezeMasterDataByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
newContextStack := result.NewContextStack
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\FreezeMasterDataByUserIdRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->freezeMasterDataByUserId(
        (new FreezeMasterDataByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
    $newContextStack = $result->getNewContextStack();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.FreezeMasterDataByUserIdRequest;
import io.gs2.distributor.result.FreezeMasterDataByUserIdResult;

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

try {
    FreezeMasterDataByUserIdResult result = client.freezeMasterDataByUserId(
        new FreezeMasterDataByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    String newContextStack = result.getNewContextStack();
} 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.FreezeMasterDataByUserIdResult> asyncResult = null;
yield return client.FreezeMasterDataByUserId(
    new Gs2.Gs2Distributor.Request.FreezeMasterDataByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var newContextStack = result.NewContextStack;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.freezeMasterDataByUserId(
        new Gs2Distributor.FreezeMasterDataByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    const newContextStack = result.getNewContextStack();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.freeze_master_data_by_user_id(
        distributor.FreezeMasterDataByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_time_offset_token(None)
    )
    new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.freeze_master_data_by_user_id({
    namespaceName="namespace-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
newContextStack = result.newContextStack;
client = gs2('distributor')

api_result_handler = client.freeze_master_data_by_user_id_async({
    namespaceName="namespace-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
newContextStack = result.newContextStack;

signFreezeMasterDataTimestamp

마스터 데이터 고정용 타임스탬프에 서명

지정된 암호화 키를 사용하여 지정된 타임스탬프의 암호 서명을 생성합니다.
반환되는 본문과 서명은 FreezeMasterDataBySignedTimestamp에서 지정된 시각에 마스터 데이터를 고정하는 데 사용할 수 있습니다.
이를 통해 서버 측에서 고정 타임스탬프를 제어할 수 있어, 클라이언트가 임의의 타임스탬프를 지정하는 것을 방지합니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
timestamplong현재 시각마스터 데이터를 고정할 시각
keyIdstring
~ 1024자서명 계산에 사용할 GS2-Key 암호화 키 GRN

Result

타입설명
bodystring본문
signaturestring서명

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.SignFreezeMasterDataTimestamp(
    &distributor.SignFreezeMasterDataTimestampRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Timestamp: pointy.Int64(10000),
        KeyId: pointy.String("key-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
body := result.Body
signature := result.Signature
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\SignFreezeMasterDataTimestampRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->signFreezeMasterDataTimestamp(
        (new SignFreezeMasterDataTimestampRequest())
            ->withNamespaceName("namespace-0001")
            ->withTimestamp(10000)
            ->withKeyId("key-0001")
    );
    $body = $result->getBody();
    $signature = $result->getSignature();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.SignFreezeMasterDataTimestampRequest;
import io.gs2.distributor.result.SignFreezeMasterDataTimestampResult;

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

try {
    SignFreezeMasterDataTimestampResult result = client.signFreezeMasterDataTimestamp(
        new SignFreezeMasterDataTimestampRequest()
            .withNamespaceName("namespace-0001")
            .withTimestamp(10000L)
            .withKeyId("key-0001")
    );
    String body = result.getBody();
    String signature = result.getSignature();
} 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.SignFreezeMasterDataTimestampResult> asyncResult = null;
yield return client.SignFreezeMasterDataTimestamp(
    new Gs2.Gs2Distributor.Request.SignFreezeMasterDataTimestampRequest()
        .WithNamespaceName("namespace-0001")
        .WithTimestamp(10000L)
        .WithKeyId("key-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var body = result.Body;
var signature = result.Signature;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.signFreezeMasterDataTimestamp(
        new Gs2Distributor.SignFreezeMasterDataTimestampRequest()
            .withNamespaceName("namespace-0001")
            .withTimestamp(10000)
            .withKeyId("key-0001")
    );
    const body = result.getBody();
    const signature = result.getSignature();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.sign_freeze_master_data_timestamp(
        distributor.SignFreezeMasterDataTimestampRequest()
            .with_namespace_name('namespace-0001')
            .with_timestamp(10000)
            .with_key_id('key-0001')
    )
    body = result.body
    signature = result.signature
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.sign_freeze_master_data_timestamp({
    namespaceName="namespace-0001",
    timestamp=10000,
    keyId="key-0001",
})

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

result = api_result.result
body = result.body;
signature = result.signature;
client = gs2('distributor')

api_result_handler = client.sign_freeze_master_data_timestamp_async({
    namespaceName="namespace-0001",
    timestamp=10000,
    keyId="key-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
body = result.body;
signature = result.signature;

freezeMasterDataBySignedTimestamp

마스터 데이터를 지정된 서명 타임스탬프로 고정

SignFreezeMasterDataTimestamp로 사전에 서명된 타임스탬프로 마스터 데이터를 고정합니다.
서명은 지정된 암호화 키로 검증되어 타임스탬프가 변조되지 않았음을 확인합니다.
고정 타임스탬프는 반환되는 ContextStack에 기록되어 후속 요청에서 사용됩니다.
클라이언트 측 조작을 방지하기 위해 서버가 정확한 고정 시각을 제어해야 하는 경우에 사용합니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
accessTokenstring
~ 128자액세스 토큰
bodystring
~ 1024자본문
signaturestring
~ 256자서명
keyIdstring
~ 1024자서명 계산에 사용한 GS2-Key 암호화 키 GRN

Result

타입설명
newContextStackstring마스터 데이터를 고정하는 시각을 기록한 컨텍스트

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.FreezeMasterDataBySignedTimestamp(
    &distributor.FreezeMasterDataBySignedTimestampRequest {
        NamespaceName: pointy.String("namespace-0001"),
        AccessToken: pointy.String("accessToken-0001"),
        Body: pointy.String("body"),
        Signature: pointy.String("signature"),
        KeyId: pointy.String("key-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
newContextStack := result.NewContextStack
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\FreezeMasterDataBySignedTimestampRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->freezeMasterDataBySignedTimestamp(
        (new FreezeMasterDataBySignedTimestampRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
            ->withBody("body")
            ->withSignature("signature")
            ->withKeyId("key-0001")
    );
    $newContextStack = $result->getNewContextStack();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.FreezeMasterDataBySignedTimestampRequest;
import io.gs2.distributor.result.FreezeMasterDataBySignedTimestampResult;

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

try {
    FreezeMasterDataBySignedTimestampResult result = client.freezeMasterDataBySignedTimestamp(
        new FreezeMasterDataBySignedTimestampRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withBody("body")
            .withSignature("signature")
            .withKeyId("key-0001")
    );
    String newContextStack = result.getNewContextStack();
} 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.FreezeMasterDataBySignedTimestampResult> asyncResult = null;
yield return client.FreezeMasterDataBySignedTimestamp(
    new Gs2.Gs2Distributor.Request.FreezeMasterDataBySignedTimestampRequest()
        .WithNamespaceName("namespace-0001")
        .WithAccessToken("accessToken-0001")
        .WithBody("body")
        .WithSignature("signature")
        .WithKeyId("key-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var newContextStack = result.NewContextStack;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.freezeMasterDataBySignedTimestamp(
        new Gs2Distributor.FreezeMasterDataBySignedTimestampRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withBody("body")
            .withSignature("signature")
            .withKeyId("key-0001")
    );
    const newContextStack = result.getNewContextStack();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.freeze_master_data_by_signed_timestamp(
        distributor.FreezeMasterDataBySignedTimestampRequest()
            .with_namespace_name('namespace-0001')
            .with_access_token('accessToken-0001')
            .with_body('body')
            .with_signature('signature')
            .with_key_id('key-0001')
    )
    new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.freeze_master_data_by_signed_timestamp({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    body="body",
    signature="signature",
    keyId="key-0001",
})

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

result = api_result.result
newContextStack = result.newContextStack;
client = gs2('distributor')

api_result_handler = client.freeze_master_data_by_signed_timestamp_async({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    body="body",
    signature="signature",
    keyId="key-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
newContextStack = result.newContextStack;

freezeMasterDataByTimestamp

마스터 데이터를 지정된 시각으로 고정

서명 검증 없이 직접 지정된 타임스탬프로 마스터 데이터를 고정합니다.
고정 타임스탬프는 반환되는 ContextStack에 기록되어 후속 요청에서 사용됩니다.
FreezeMasterDataBySignedTimestamp와 달리 타임스탬프가 암호학적으로 검증되지 않으므로 신뢰할 수 있는 컨텍스트에서만 사용해야 합니다.

상세

Request

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

Result

타입설명
newContextStackstring마스터 데이터를 고정하는 시각을 기록한 컨텍스트

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.FreezeMasterDataByTimestamp(
    &distributor.FreezeMasterDataByTimestampRequest {
        NamespaceName: pointy.String("namespace-0001"),
        AccessToken: pointy.String("accessToken-0001"),
        Timestamp: pointy.Int64(10000),
    }
)
if err != nil {
    panic("error occurred")
}
newContextStack := result.NewContextStack
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\FreezeMasterDataByTimestampRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->freezeMasterDataByTimestamp(
        (new FreezeMasterDataByTimestampRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
            ->withTimestamp(10000)
    );
    $newContextStack = $result->getNewContextStack();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.FreezeMasterDataByTimestampRequest;
import io.gs2.distributor.result.FreezeMasterDataByTimestampResult;

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

try {
    FreezeMasterDataByTimestampResult result = client.freezeMasterDataByTimestamp(
        new FreezeMasterDataByTimestampRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withTimestamp(10000L)
    );
    String newContextStack = result.getNewContextStack();
} 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.FreezeMasterDataByTimestampResult> asyncResult = null;
yield return client.FreezeMasterDataByTimestamp(
    new Gs2.Gs2Distributor.Request.FreezeMasterDataByTimestampRequest()
        .WithNamespaceName("namespace-0001")
        .WithAccessToken("accessToken-0001")
        .WithTimestamp(10000L),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var newContextStack = result.NewContextStack;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.freezeMasterDataByTimestamp(
        new Gs2Distributor.FreezeMasterDataByTimestampRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withTimestamp(10000)
    );
    const newContextStack = result.getNewContextStack();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.freeze_master_data_by_timestamp(
        distributor.FreezeMasterDataByTimestampRequest()
            .with_namespace_name('namespace-0001')
            .with_access_token('accessToken-0001')
            .with_timestamp(10000)
    )
    new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.freeze_master_data_by_timestamp({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    timestamp=10000,
})

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

result = api_result.result
newContextStack = result.newContextStack;
client = gs2('distributor')

api_result_handler = client.freeze_master_data_by_timestamp_async({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    timestamp=10000,
})

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
newContextStack = result.newContextStack;

batchExecuteApi

여러 API를 일괄 실행

단일 배치 요청으로 여러 API 호출을 실행하여 필요한 라운드트립 수를 줄입니다.
한 번의 배치에는 최대 100건의 API 호출을 포함할 수 있습니다.
배치 내 각 요청은 독립적으로 처리되며, 결과는 요청과 동일한 순서로 반환됩니다.
여러 개의 독립적인 API 호출이 필요할 때 지연 시간을 줄이는 데 유용합니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
requestPayloadsList<BatchRequestPayload>
1 ~ 100 items배치 요청

Result

타입설명
resultsList<BatchResultPayload>배치 결과

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.BatchExecuteApi(
    &distributor.BatchExecuteApiRequest {
        RequestPayloads: []distributor.BatchRequestPayload{
            distributor.BatchRequestPayload{
                Service: pointy.String("inventory"),
                MethodName: pointy.String("describeSimpleItems"),
                Parameter: pointy.String("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"inventory-0001\", \"accessToken\": \"accessToken-0001\"}"),
            },
            distributor.BatchRequestPayload{
                Service: pointy.String("exchange"),
                MethodName: pointy.String("describeRateModels"),
                Parameter: pointy.String("{\"namespaceName\": \"namespace-0001\"}"),
            },
        },
    }
)
if err != nil {
    panic("error occurred")
}
results := result.Results
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\BatchExecuteApiRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->batchExecuteApi(
        (new BatchExecuteApiRequest())
            ->withRequestPayloads([
                (new BatchRequestPayload())
                    ->withService("inventory")
                    ->withMethodName("describeSimpleItems")
                    ->withParameter("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"inventory-0001\", \"accessToken\": \"accessToken-0001\"}"),
                (new BatchRequestPayload())
                    ->withService("exchange")
                    ->withMethodName("describeRateModels")
                    ->withParameter("{\"namespaceName\": \"namespace-0001\"}"),
            ])
    );
    $results = $result->getResults();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.BatchExecuteApiRequest;
import io.gs2.distributor.result.BatchExecuteApiResult;

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

try {
    BatchExecuteApiResult result = client.batchExecuteApi(
        new BatchExecuteApiRequest()
            .withRequestPayloads(Arrays.asList(
                new BatchRequestPayload()
                    .withService("inventory")
                    .withMethodName("describeSimpleItems")
                    .withParameter("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"inventory-0001\", \"accessToken\": \"accessToken-0001\"}"),
                new BatchRequestPayload()
                    .withService("exchange")
                    .withMethodName("describeRateModels")
                    .withParameter("{\"namespaceName\": \"namespace-0001\"}")
            ))
    );
    List<BatchResultPayload> results = result.getResults();
} 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.BatchExecuteApiResult> asyncResult = null;
yield return client.BatchExecuteApi(
    new Gs2.Gs2Distributor.Request.BatchExecuteApiRequest()
        .WithRequestPayloads(new Gs2.Gs2Distributor.Model.BatchRequestPayload[] {
            new Gs2.Gs2Distributor.Model.BatchRequestPayload()
                .WithService("inventory")
                .WithMethodName("describeSimpleItems")
                .WithParameter("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"inventory-0001\", \"accessToken\": \"accessToken-0001\"}"),
            new Gs2.Gs2Distributor.Model.BatchRequestPayload()
                .WithService("exchange")
                .WithMethodName("describeRateModels")
                .WithParameter("{\"namespaceName\": \"namespace-0001\"}"),
        }),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var results = result.Results;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.batchExecuteApi(
        new Gs2Distributor.BatchExecuteApiRequest()
            .withRequestPayloads([
                new Gs2Distributor.model.BatchRequestPayload()
                    .withService("inventory")
                    .withMethodName("describeSimpleItems")
                    .withParameter("{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"inventory-0001\", \"accessToken\": \"accessToken-0001\"}"),
                new Gs2Distributor.model.BatchRequestPayload()
                    .withService("exchange")
                    .withMethodName("describeRateModels")
                    .withParameter("{\"namespaceName\": \"namespace-0001\"}"),
            ])
    );
    const results = result.getResults();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.batch_execute_api(
        distributor.BatchExecuteApiRequest()
            .with_request_payloads([
                distributor.BatchRequestPayload()
                    .with_service('inventory')
                    .with_method_name('describeSimpleItems')
                    .with_parameter('{"namespaceName": "namespace-0001", "inventoryName": "inventory-0001", "accessToken": "accessToken-0001"}'),
                distributor.BatchRequestPayload()
                    .with_service('exchange')
                    .with_method_name('describeRateModels')
                    .with_parameter('{"namespaceName": "namespace-0001"}'),
            ])
    )
    results = result.results
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.batch_execute_api({
    requestPayloads={
        {
            service="inventory",
            method_name="describeSimpleItems",
            parameter="{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"inventory-0001\", \"accessToken\": \"accessToken-0001\"}",
        },
        {
            service="exchange",
            method_name="describeRateModels",
            parameter="{\"namespaceName\": \"namespace-0001\"}",
        }
    },
})

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

result = api_result.result
results = result.results;
client = gs2('distributor')

api_result_handler = client.batch_execute_api_async({
    requestPayloads={
        {
            service="inventory",
            method_name="describeSimpleItems",
            parameter="{\"namespaceName\": \"namespace-0001\", \"inventoryName\": \"inventory-0001\", \"accessToken\": \"accessToken-0001\"}",
        },
        {
            service="exchange",
            method_name="describeRateModels",
            parameter="{\"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
results = result.results;

ifExpressionByUserId

조건을 검증하고 소비 액션의 내용을 전환

검증 액션을 조건으로 평가하고, 결과에 따라 trueActions 또는 falseActions의 소비 액션 목록을 실행합니다.
이를 통해 트랜잭션 내에서 조건 분기가 가능해지며, 검증 결과에 따라 서로 다른 소비 액션을 실행할 수 있습니다.
multiplyValueSpecifyingQuantity가 활성화된 경우, 검증에 사용되는 값도 지정된 수량만큼 곱해집니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
userIdstring
~ 128자사용자ID
conditionVerifyAction
조건
trueActionsList<ConsumeAction>0 ~ 10 items조건이 참일 때 실행되는 소비 액션 목록
falseActionsList<ConsumeAction>0 ~ 10 items조건이 거짓일 때 실행되는 소비 액션 목록
multiplyValueSpecifyingQuantitybooltrue수량을 지정했을 때, 검증에 사용하는 값도 곱할지 여부
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
itemTransactionResult트랜잭션 실행 결과
expressionResultbool?조건 평가 결과

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.IfExpressionByUserId(
    &distributor.IfExpressionByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        Condition: &distributor.VerifyAction{
            Action: pointy.String("Gs2Inventory:VerifyItemSetByUserId"),
            Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
        },
        TrueActions: []distributor.ConsumeAction{
            distributor.ConsumeAction{
                Action: pointy.String("Gs2Inventory:ConsumeItemSetByUserId"),
                Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"consumeCount\": 1}"),
            },
        },
        FalseActions: []distributor.ConsumeAction{
            distributor.ConsumeAction{
                Action: pointy.String("Gs2Inventory:ConsumeSimpleItemsByUserId"),
                Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"consumeCounts\": [{\"itemName\": \"item-0001\", \"count\": 1}]}"),
            },
        },
        MultiplyValueSpecifyingQuantity: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
expressionResult := result.ExpressionResult
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\IfExpressionByUserIdRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->ifExpressionByUserId(
        (new IfExpressionByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withCondition((new VerifyAction())
                ->withAction("Gs2Inventory:VerifyItemSetByUserId")
                ->withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}")
            )
            ->withTrueActions([
                (new ConsumeAction())
                    ->withAction("Gs2Inventory:ConsumeItemSetByUserId")
                    ->withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"consumeCount\": 1}"),
            ])
            ->withFalseActions([
                (new ConsumeAction())
                    ->withAction("Gs2Inventory:ConsumeSimpleItemsByUserId")
                    ->withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"consumeCounts\": [{\"itemName\": \"item-0001\", \"count\": 1}]}"),
            ])
            ->withMultiplyValueSpecifyingQuantity(null)
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
    $expressionResult = $result->getExpressionResult();
} 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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.IfExpressionByUserIdRequest;
import io.gs2.distributor.result.IfExpressionByUserIdResult;

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

try {
    IfExpressionByUserIdResult result = client.ifExpressionByUserId(
        new IfExpressionByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withCondition(new VerifyAction()
                .withAction("Gs2Inventory:VerifyItemSetByUserId")
                .withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}")
            )
            .withTrueActions(Arrays.asList(
                new ConsumeAction()
                    .withAction("Gs2Inventory:ConsumeItemSetByUserId")
                    .withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"consumeCount\": 1}")
            ))
            .withFalseActions(Arrays.asList(
                new ConsumeAction()
                    .withAction("Gs2Inventory:ConsumeSimpleItemsByUserId")
                    .withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"consumeCounts\": [{\"itemName\": \"item-0001\", \"count\": 1}]}")
            ))
            .withMultiplyValueSpecifyingQuantity(null)
            .withTimeOffsetToken(null)
    );
    TransactionResult item = result.getItem();
    boolean expressionResult = result.getExpressionResult();
} 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.IfExpressionByUserIdResult> asyncResult = null;
yield return client.IfExpressionByUserId(
    new Gs2.Gs2Distributor.Request.IfExpressionByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithCondition(new Gs2.Core.Model.VerifyAction()
            .WithAction("Gs2Inventory:VerifyItemSetByUserId")
            .WithRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}")
        )
        .WithTrueActions(new Gs2.Core.Model.ConsumeAction[] {
            new Gs2.Core.Model.ConsumeAction()
                .WithAction("Gs2Inventory:ConsumeItemSetByUserId")
                .WithRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"consumeCount\": 1}"),
        })
        .WithFalseActions(new Gs2.Core.Model.ConsumeAction[] {
            new Gs2.Core.Model.ConsumeAction()
                .WithAction("Gs2Inventory:ConsumeSimpleItemsByUserId")
                .WithRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"consumeCounts\": [{\"itemName\": \"item-0001\", \"count\": 1}]}"),
        })
        .WithMultiplyValueSpecifyingQuantity(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var expressionResult = result.ExpressionResult;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.ifExpressionByUserId(
        new Gs2Distributor.IfExpressionByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withCondition(new Gs2Distributor.model.VerifyAction()
                .withAction("Gs2Inventory:VerifyItemSetByUserId")
                .withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}")
            )
            .withTrueActions([
                new Gs2Distributor.model.ConsumeAction()
                    .withAction("Gs2Inventory:ConsumeItemSetByUserId")
                    .withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"consumeCount\": 1}"),
            ])
            .withFalseActions([
                new Gs2Distributor.model.ConsumeAction()
                    .withAction("Gs2Inventory:ConsumeSimpleItemsByUserId")
                    .withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"consumeCounts\": [{\"itemName\": \"item-0001\", \"count\": 1}]}"),
            ])
            .withMultiplyValueSpecifyingQuantity(null)
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
    const expressionResult = result.getExpressionResult();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.if_expression_by_user_id(
        distributor.IfExpressionByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_condition(distributor.VerifyAction()
                .with_action('Gs2Inventory:VerifyItemSetByUserId')
                .with_request('{"namespaceName": "namespace-0001", "userId": "user-0001", "inventoryName": "inventory-0001", "itemName": "item-0001", "verifyType": "greaterEqual", "count": 1}')
            )
            .with_true_actions([
                distributor.ConsumeAction()
                    .with_action('Gs2Inventory:ConsumeItemSetByUserId')
                    .with_request('{"namespaceName": "namespace-0001", "userId": "user-0001", "inventoryName": "inventory-0001", "itemName": "item-0001", "consumeCount": 1}'),
            ])
            .with_false_actions([
                distributor.ConsumeAction()
                    .with_action('Gs2Inventory:ConsumeSimpleItemsByUserId')
                    .with_request('{"namespaceName": "namespace-0001", "userId": "user-0001", "inventoryName": "inventory-0001", "consumeCounts": [{"itemName": "item-0001", "count": 1}]}'),
            ])
            .with_multiply_value_specifying_quantity(None)
            .with_time_offset_token(None)
    )
    item = result.item
    expression_result = result.expression_result
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.if_expression_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    condition={
        action="Gs2Inventory:VerifyItemSetByUserId",
        request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}",
    },
    trueActions={
        {
            action="Gs2Inventory:ConsumeItemSetByUserId",
            request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"consumeCount\": 1}",
        }
    },
    falseActions={
        {
            action="Gs2Inventory:ConsumeSimpleItemsByUserId",
            request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"consumeCounts\": [{\"itemName\": \"item-0001\", \"count\": 1}]}",
        }
    },
    multiplyValueSpecifyingQuantity=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;
expressionResult = result.expressionResult;
client = gs2('distributor')

api_result_handler = client.if_expression_by_user_id_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    condition={
        action="Gs2Inventory:VerifyItemSetByUserId",
        request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}",
    },
    trueActions={
        {
            action="Gs2Inventory:ConsumeItemSetByUserId",
            request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"consumeCount\": 1}",
        }
    },
    falseActions={
        {
            action="Gs2Inventory:ConsumeSimpleItemsByUserId",
            request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"consumeCounts\": [{\"itemName\": \"item-0001\", \"count\": 1}]}",
        }
    },
    multiplyValueSpecifyingQuantity=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;
expressionResult = result.expressionResult;

andExpressionByUserId

여러 검증 액션을 실행하여 모두 참인지 판정

여러 검증 액션을 실행하고, 모두 참으로 평가된 경우에만 성공합니다(AND 논리).
검증 액션 중 하나라도 실패하면 전체 표현식이 실패합니다.
트랜잭션 실행 전에 모두 충족해야 하는 여러 전제 조건을 조합할 때 유용합니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
userIdstring
~ 128자사용자ID
actionsList<VerifyAction>0 ~ 10 items검증 액션 목록
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

반환값: 없음

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.AndExpressionByUserId(
    &distributor.AndExpressionByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        Actions: []distributor.VerifyAction{
            distributor.VerifyAction{
                Action: pointy.String("Gs2Inventory:VerifyItemSetByUserId"),
                Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
            },
            distributor.VerifyAction{
                Action: pointy.String("Gs2Inventory:ConsumeItemSetByUserId"),
                Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
            },
        },
        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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\AndExpressionByUserIdRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->andExpressionByUserId(
        (new AndExpressionByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withActions([
                (new VerifyAction())
                    ->withAction("Gs2Inventory:VerifyItemSetByUserId")
                    ->withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
                (new VerifyAction())
                    ->withAction("Gs2Inventory:ConsumeItemSetByUserId")
                    ->withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
            ])
            ->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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.AndExpressionByUserIdRequest;
import io.gs2.distributor.result.AndExpressionByUserIdResult;

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

try {
    AndExpressionByUserIdResult result = client.andExpressionByUserId(
        new AndExpressionByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withActions(Arrays.asList(
                new VerifyAction()
                    .withAction("Gs2Inventory:VerifyItemSetByUserId")
                    .withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
                new VerifyAction()
                    .withAction("Gs2Inventory:ConsumeItemSetByUserId")
                    .withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}")
            ))
            .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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.AndExpressionByUserIdResult> asyncResult = null;
yield return client.AndExpressionByUserId(
    new Gs2.Gs2Distributor.Request.AndExpressionByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithActions(new Gs2.Core.Model.VerifyAction[] {
            new Gs2.Core.Model.VerifyAction()
                .WithAction("Gs2Inventory:VerifyItemSetByUserId")
                .WithRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
            new Gs2.Core.Model.VerifyAction()
                .WithAction("Gs2Inventory:ConsumeItemSetByUserId")
                .WithRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
        })
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.andExpressionByUserId(
        new Gs2Distributor.AndExpressionByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withActions([
                new Gs2Distributor.model.VerifyAction()
                    .withAction("Gs2Inventory:VerifyItemSetByUserId")
                    .withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
                new Gs2Distributor.model.VerifyAction()
                    .withAction("Gs2Inventory:ConsumeItemSetByUserId")
                    .withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
            ])
            .withTimeOffsetToken(null)
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.and_expression_by_user_id(
        distributor.AndExpressionByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_actions([
                distributor.VerifyAction()
                    .with_action('Gs2Inventory:VerifyItemSetByUserId')
                    .with_request('{"namespaceName": "namespace-0001", "userId": "user-0001", "inventoryName": "inventory-0001", "itemName": "item-0001", "verifyType": "greaterEqual", "count": 1}'),
                distributor.VerifyAction()
                    .with_action('Gs2Inventory:ConsumeItemSetByUserId')
                    .with_request('{"namespaceName": "namespace-0001", "userId": "user-0001", "inventoryName": "inventory-0001", "itemName": "item-0002", "verifyType": "greaterEqual", "count": 1}'),
            ])
            .with_time_offset_token(None)
    )
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.and_expression_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    actions={
        {
            action="Gs2Inventory:VerifyItemSetByUserId",
            request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}",
        },
        {
            action="Gs2Inventory:ConsumeItemSetByUserId",
            request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}",
        }
    },
    timeOffsetToken=nil,
})

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

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

api_result_handler = client.and_expression_by_user_id_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    actions={
        {
            action="Gs2Inventory:VerifyItemSetByUserId",
            request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}",
        },
        {
            action="Gs2Inventory:ConsumeItemSetByUserId",
            request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}",
        }
    },
    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

orExpressionByUserId

여러 검증 액션을 실행하여 하나라도 참인지 판정

여러 검증 액션을 실행하고, 그중 하나라도 참으로 평가되면 성공합니다(OR 논리).
모든 검증 액션이 실패한 경우에만 표현식이 실패합니다.
그중 하나만 충족해도 되는 대체 조건을 정의할 때 유용합니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
userIdstring
~ 128자사용자ID
actionsList<VerifyAction>0 ~ 10 items검증 액션 목록
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

반환값: 없음

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.OrExpressionByUserId(
    &distributor.OrExpressionByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        Actions: []distributor.VerifyAction{
            distributor.VerifyAction{
                Action: pointy.String("Gs2Inventory:VerifyItemSetByUserId"),
                Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
            },
            distributor.VerifyAction{
                Action: pointy.String("Gs2Inventory:ConsumeItemSetByUserId"),
                Request: pointy.String("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
            },
        },
        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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\OrExpressionByUserIdRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->orExpressionByUserId(
        (new OrExpressionByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withActions([
                (new VerifyAction())
                    ->withAction("Gs2Inventory:VerifyItemSetByUserId")
                    ->withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
                (new VerifyAction())
                    ->withAction("Gs2Inventory:ConsumeItemSetByUserId")
                    ->withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
            ])
            ->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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.OrExpressionByUserIdRequest;
import io.gs2.distributor.result.OrExpressionByUserIdResult;

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

try {
    OrExpressionByUserIdResult result = client.orExpressionByUserId(
        new OrExpressionByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withActions(Arrays.asList(
                new VerifyAction()
                    .withAction("Gs2Inventory:VerifyItemSetByUserId")
                    .withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
                new VerifyAction()
                    .withAction("Gs2Inventory:ConsumeItemSetByUserId")
                    .withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}")
            ))
            .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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.OrExpressionByUserIdResult> asyncResult = null;
yield return client.OrExpressionByUserId(
    new Gs2.Gs2Distributor.Request.OrExpressionByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithActions(new Gs2.Core.Model.VerifyAction[] {
            new Gs2.Core.Model.VerifyAction()
                .WithAction("Gs2Inventory:VerifyItemSetByUserId")
                .WithRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
            new Gs2.Core.Model.VerifyAction()
                .WithAction("Gs2Inventory:ConsumeItemSetByUserId")
                .WithRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
        })
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.orExpressionByUserId(
        new Gs2Distributor.OrExpressionByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withActions([
                new Gs2Distributor.model.VerifyAction()
                    .withAction("Gs2Inventory:VerifyItemSetByUserId")
                    .withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
                new Gs2Distributor.model.VerifyAction()
                    .withAction("Gs2Inventory:ConsumeItemSetByUserId")
                    .withRequest("{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}"),
            ])
            .withTimeOffsetToken(null)
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.or_expression_by_user_id(
        distributor.OrExpressionByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_actions([
                distributor.VerifyAction()
                    .with_action('Gs2Inventory:VerifyItemSetByUserId')
                    .with_request('{"namespaceName": "namespace-0001", "userId": "user-0001", "inventoryName": "inventory-0001", "itemName": "item-0001", "verifyType": "greaterEqual", "count": 1}'),
                distributor.VerifyAction()
                    .with_action('Gs2Inventory:ConsumeItemSetByUserId')
                    .with_request('{"namespaceName": "namespace-0001", "userId": "user-0001", "inventoryName": "inventory-0001", "itemName": "item-0002", "verifyType": "greaterEqual", "count": 1}'),
            ])
            .with_time_offset_token(None)
    )
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.or_expression_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    actions={
        {
            action="Gs2Inventory:VerifyItemSetByUserId",
            request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}",
        },
        {
            action="Gs2Inventory:ConsumeItemSetByUserId",
            request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}",
        }
    },
    timeOffsetToken=nil,
})

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

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

api_result_handler = client.or_expression_by_user_id_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    actions={
        {
            action="Gs2Inventory:VerifyItemSetByUserId",
            request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0001\", \"verifyType\": \"greaterEqual\", \"count\": 1}",
        },
        {
            action="Gs2Inventory:ConsumeItemSetByUserId",
            request="{\"namespaceName\": \"namespace-0001\", \"userId\": \"user-0001\", \"inventoryName\": \"inventory-0001\", \"itemName\": \"item-0002\", \"verifyType\": \"greaterEqual\", \"count\": 1}",
        }
    },
    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

getStampSheetResult

트랜잭션의 실행 결과 가져오기

현재 로그인한 사용자의 특정 트랜잭션 실행 결과를 가져옵니다.
결과에는 트랜잭션의 각 단계(검증, 소비, 입수)에 대한 상태 코드와 응답 내용이 포함됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
accessTokenstring
~ 128자액세스 토큰
transactionIdstring
36 ~ 36자트랜잭션 ID
이 트랜잭션을 고유하게 식별하는 UUID입니다. 트랜잭션과 그 실행 결과, 그리고 연쇄되는 후속 트랜잭션의 연결에 사용됩니다.

Result

타입설명
itemStampSheetResult트랜잭션 실행 결과

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.GetStampSheetResult(
    &distributor.GetStampSheetResultRequest {
        NamespaceName: pointy.String("namespace-0001"),
        AccessToken: pointy.String("accessToken-0001"),
        TransactionId: pointy.String("cc1985c3-54f0-4fc3-b295-dc30214284ec"),
    }
)
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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetStampSheetResultRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->getStampSheetResult(
        (new GetStampSheetResultRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
            ->withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
    );
    $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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetStampSheetResultRequest;
import io.gs2.distributor.result.GetStampSheetResultResult;

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

try {
    GetStampSheetResultResult result = client.getStampSheetResult(
        new GetStampSheetResultRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
    );
    StampSheetResult 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.GetStampSheetResultResult> asyncResult = null;
yield return client.GetStampSheetResult(
    new Gs2.Gs2Distributor.Request.GetStampSheetResultRequest()
        .WithNamespaceName("namespace-0001")
        .WithAccessToken("accessToken-0001")
        .WithTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec"),
    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 Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.getStampSheetResult(
        new Gs2Distributor.GetStampSheetResultRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.get_stamp_sheet_result(
        distributor.GetStampSheetResultRequest()
            .with_namespace_name('namespace-0001')
            .with_access_token('accessToken-0001')
            .with_transaction_id('cc1985c3-54f0-4fc3-b295-dc30214284ec')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.get_stamp_sheet_result({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    transactionId="cc1985c3-54f0-4fc3-b295-dc30214284ec",
})

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('distributor')

api_result_handler = client.get_stamp_sheet_result_async({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    transactionId="cc1985c3-54f0-4fc3-b295-dc30214284ec",
})

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;

getStampSheetResultByUserId

사용자 ID를 지정하여 트랜잭션의 실행 결과 가져오기

지정된 사용자의 특정 트랜잭션 실행 결과를 가져옵니다.
결과에는 트랜잭션의 각 단계(검증, 소비, 입수)에 대한 상태 코드와 응답 내용이 포함됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
userIdstring
~ 128자사용자ID
transactionIdstring
36 ~ 36자트랜잭션 ID
이 트랜잭션을 고유하게 식별하는 UUID입니다. 트랜잭션과 그 실행 결과, 그리고 연쇄되는 후속 트랜잭션의 연결에 사용됩니다.
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
itemStampSheetResult트랜잭션 실행 결과

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.GetStampSheetResultByUserId(
    &distributor.GetStampSheetResultByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        TransactionId: pointy.String("cc1985c3-54f0-4fc3-b295-dc30214284ec"),
        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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetStampSheetResultByUserIdRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->getStampSheetResultByUserId(
        (new GetStampSheetResultByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
            ->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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetStampSheetResultByUserIdRequest;
import io.gs2.distributor.result.GetStampSheetResultByUserIdResult;

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

try {
    GetStampSheetResultByUserIdResult result = client.getStampSheetResultByUserId(
        new GetStampSheetResultByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
            .withTimeOffsetToken(null)
    );
    StampSheetResult 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.GetStampSheetResultByUserIdResult> asyncResult = null;
yield return client.GetStampSheetResultByUserId(
    new Gs2.Gs2Distributor.Request.GetStampSheetResultByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
        .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 Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.getStampSheetResultByUserId(
        new Gs2Distributor.GetStampSheetResultByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.get_stamp_sheet_result_by_user_id(
        distributor.GetStampSheetResultByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_transaction_id('cc1985c3-54f0-4fc3-b295-dc30214284ec')
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.get_stamp_sheet_result_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    transactionId="cc1985c3-54f0-4fc3-b295-dc30214284ec",
    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('distributor')

api_result_handler = client.get_stamp_sheet_result_by_user_id_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    transactionId="cc1985c3-54f0-4fc3-b295-dc30214284ec",
    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;

runTransaction

트랜잭션 실행

검증 액션, 소비 액션, 획득 액션으로 구성된 트랜잭션을 실행합니다.
트랜잭션은 검증 -> 소비 -> 획득 순서로 처리됩니다.
각 단계의 상태 코드와 응답 내용을 포함한 실행 결과가 기록되며, 이후에 조회할 수 있습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
userIdstring
~ 128자사용자ID
transactionstring
~ 5242880자트랜잭션
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
itemTransactionResult트랜잭션 실행 결과

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.RunTransaction(
    &distributor.RunTransactionRequest {
        OwnerId: nil,
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        Transaction: pointy.String("transaction..."),
        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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\RunTransactionRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->runTransaction(
        (new RunTransactionRequest())
            ->withOwnerId(null)
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withTransaction("transaction...")
            ->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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.RunTransactionRequest;
import io.gs2.distributor.result.RunTransactionResult;

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

try {
    RunTransactionResult result = client.runTransaction(
        new RunTransactionRequest()
            .withOwnerId(null)
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withTransaction("transaction...")
            .withTimeOffsetToken(null)
    );
    TransactionResult 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.RunTransactionResult> asyncResult = null;
yield return client.RunTransaction(
    new Gs2.Gs2Distributor.Request.RunTransactionRequest()
        .WithOwnerId(null)
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithTransaction("transaction...")
        .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 Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.runTransaction(
        new Gs2Distributor.RunTransactionRequest()
            .withOwnerId(null)
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withTransaction("transaction...")
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.run_transaction(
        distributor.RunTransactionRequest()
            .with_owner_id(None)
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_transaction('transaction...')
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.run_transaction({
    ownerId=nil,
    namespaceName="namespace-0001",
    userId="user-0001",
    transaction="transaction...",
    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('distributor')

api_result_handler = client.run_transaction_async({
    ownerId=nil,
    namespaceName="namespace-0001",
    userId="user-0001",
    transaction="transaction...",
    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;

getTransactionResult

트랜잭션의 실행 결과 가져오기

현재 로그인한 사용자의 특정 트랜잭션 실행 결과를 가져옵니다.
결과에는 트랜잭션의 각 단계(검증, 소비, 입수)에 대한 상태 코드와 응답 내용이 포함됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
accessTokenstring
~ 128자액세스 토큰
transactionIdstring
36 ~ 36자트랜잭션 ID
이 분산 트랜잭션을 고유하게 식별하는 UUID입니다. 실행 결과 조회 및 원래 API 요청과의 연결에 사용됩니다.

Result

타입설명
itemTransactionResult트랜잭션 실행 결과

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.GetTransactionResult(
    &distributor.GetTransactionResultRequest {
        NamespaceName: pointy.String("namespace-0001"),
        AccessToken: pointy.String("accessToken-0001"),
        TransactionId: pointy.String("cc1985c3-54f0-4fc3-b295-dc30214284ec"),
    }
)
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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetTransactionResultRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->getTransactionResult(
        (new GetTransactionResultRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
            ->withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
    );
    $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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetTransactionResultRequest;
import io.gs2.distributor.result.GetTransactionResultResult;

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

try {
    GetTransactionResultResult result = client.getTransactionResult(
        new GetTransactionResultRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
    );
    TransactionResult 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.GetTransactionResultResult> asyncResult = null;
yield return client.GetTransactionResult(
    new Gs2.Gs2Distributor.Request.GetTransactionResultRequest()
        .WithNamespaceName("namespace-0001")
        .WithAccessToken("accessToken-0001")
        .WithTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec"),
    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 Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.getTransactionResult(
        new Gs2Distributor.GetTransactionResultRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.get_transaction_result(
        distributor.GetTransactionResultRequest()
            .with_namespace_name('namespace-0001')
            .with_access_token('accessToken-0001')
            .with_transaction_id('cc1985c3-54f0-4fc3-b295-dc30214284ec')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.get_transaction_result({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    transactionId="cc1985c3-54f0-4fc3-b295-dc30214284ec",
})

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('distributor')

api_result_handler = client.get_transaction_result_async({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    transactionId="cc1985c3-54f0-4fc3-b295-dc30214284ec",
})

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;

getTransactionResultByUserId

사용자 ID를 지정하여 트랜잭션의 실행 결과 가져오기

지정된 사용자의 특정 트랜잭션 실행 결과를 가져옵니다.
결과에는 트랜잭션의 각 단계(검증, 소비, 입수)에 대한 상태 코드와 응답 내용이 포함됩니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
userIdstring
~ 128자사용자ID
transactionIdstring
36 ~ 36자트랜잭션 ID
이 분산 트랜잭션을 고유하게 식별하는 UUID입니다. 실행 결과 조회 및 원래 API 요청과의 연결에 사용됩니다.
timeOffsetTokenstring~ 1024자타임 오프셋 토큰

Result

타입설명
itemTransactionResult트랜잭션 실행 결과

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.GetTransactionResultByUserId(
    &distributor.GetTransactionResultByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        TransactionId: pointy.String("cc1985c3-54f0-4fc3-b295-dc30214284ec"),
        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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetTransactionResultByUserIdRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->getTransactionResultByUserId(
        (new GetTransactionResultByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
            ->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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetTransactionResultByUserIdRequest;
import io.gs2.distributor.result.GetTransactionResultByUserIdResult;

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

try {
    GetTransactionResultByUserIdResult result = client.getTransactionResultByUserId(
        new GetTransactionResultByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
            .withTimeOffsetToken(null)
    );
    TransactionResult 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.GetTransactionResultByUserIdResult> asyncResult = null;
yield return client.GetTransactionResultByUserId(
    new Gs2.Gs2Distributor.Request.GetTransactionResultByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
        .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 Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.getTransactionResultByUserId(
        new Gs2Distributor.GetTransactionResultByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withTransactionId("cc1985c3-54f0-4fc3-b295-dc30214284ec")
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.get_transaction_result_by_user_id(
        distributor.GetTransactionResultByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_transaction_id('cc1985c3-54f0-4fc3-b295-dc30214284ec')
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.get_transaction_result_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    transactionId="cc1985c3-54f0-4fc3-b295-dc30214284ec",
    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('distributor')

api_result_handler = client.get_transaction_result_by_user_id_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    transactionId="cc1985c3-54f0-4fc3-b295-dc30214284ec",
    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;

describeDistributorModels

배포 모델 목록 취득

지정된 네임스페이스에서 현재 활성화(공개)되어 있는 모든 배포 모델을 취득합니다.
배포 모델은 리소스 배포 규칙을 정의하며, 오버플로 시 전달 대상이 되는 인박스 네임스페이스와 대상 서비스 액션의 화이트리스트를 포함합니다.
현재 마스터 데이터를 통해 활성화된 모델만 반환되며, 편집 가능한 마스터 데이터는 포함되지 않습니다.

상세

Request

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

Result

타입설명
itemsList<DistributorModel>배포 모델 목록

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.DescribeDistributorModels(
    &distributor.DescribeDistributorModelsRequest {
        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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\DescribeDistributorModelsRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->describeDistributorModels(
        (new DescribeDistributorModelsRequest())
            ->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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DescribeDistributorModelsRequest;
import io.gs2.distributor.result.DescribeDistributorModelsResult;

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

try {
    DescribeDistributorModelsResult result = client.describeDistributorModels(
        new DescribeDistributorModelsRequest()
            .withNamespaceName("namespace-0001")
    );
    List<DistributorModel> 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.DescribeDistributorModelsResult> asyncResult = null;
yield return client.DescribeDistributorModels(
    new Gs2.Gs2Distributor.Request.DescribeDistributorModelsRequest()
        .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 Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.describeDistributorModels(
        new Gs2Distributor.DescribeDistributorModelsRequest()
            .withNamespaceName("namespace-0001")
    );
    const items = result.getItems();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.describe_distributor_models(
        distributor.DescribeDistributorModelsRequest()
            .with_namespace_name('namespace-0001')
    )
    items = result.items
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.describe_distributor_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('distributor')

api_result_handler = client.describe_distributor_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;

getDistributorModel

배포 모델 취득

이름을 지정하여 특정 활성 배포 모델의 상세 정보를 취득합니다.
반환되는 정보에는 모델의 이름, 메타데이터, 오버플로 처리용 인박스 네임스페이스, 대상 서비스 액션의 화이트리스트가 포함됩니다.

상세

Request

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

Result

타입설명
itemDistributorModel배포 모델

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.GetDistributorModel(
    &distributor.GetDistributorModelRequest {
        NamespaceName: pointy.String("namespace-0001"),
        DistributorName: pointy.String("distributor-model-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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetDistributorModelRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->getDistributorModel(
        (new GetDistributorModelRequest())
            ->withNamespaceName("namespace-0001")
            ->withDistributorName("distributor-model-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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetDistributorModelRequest;
import io.gs2.distributor.result.GetDistributorModelResult;

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

try {
    GetDistributorModelResult result = client.getDistributorModel(
        new GetDistributorModelRequest()
            .withNamespaceName("namespace-0001")
            .withDistributorName("distributor-model-0001")
    );
    DistributorModel 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.GetDistributorModelResult> asyncResult = null;
yield return client.GetDistributorModel(
    new Gs2.Gs2Distributor.Request.GetDistributorModelRequest()
        .WithNamespaceName("namespace-0001")
        .WithDistributorName("distributor-model-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 Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.getDistributorModel(
        new Gs2Distributor.GetDistributorModelRequest()
            .withNamespaceName("namespace-0001")
            .withDistributorName("distributor-model-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.get_distributor_model(
        distributor.GetDistributorModelRequest()
            .with_namespace_name('namespace-0001')
            .with_distributor_name('distributor-model-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.get_distributor_model({
    namespaceName="namespace-0001",
    distributorName="distributor-model-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('distributor')

api_result_handler = client.get_distributor_model_async({
    namespaceName="namespace-0001",
    distributorName="distributor-model-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;

exportMaster

배포 모델 마스터를 활성화 가능한 마스터 데이터 형식으로 내보내기

현재 배포 모델 마스터 데이터를 활성화에 사용할 수 있는 형식으로 내보냅니다.
내보낸 데이터는 현재 마스터 구성의 백업이나 다른 네임스페이스로의 가져오기에 사용할 수 있습니다.

상세

Request

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

Result

타입설명
itemCurrentDistributorMaster활성화 가능한 배포 모델의 마스터 데이터

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.ExportMaster(
    &distributor.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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\ExportMasterRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.ExportMasterRequest;
import io.gs2.distributor.result.ExportMasterResult;

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

try {
    ExportMasterResult result = client.exportMaster(
        new ExportMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    CurrentDistributorMaster 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.ExportMasterResult> asyncResult = null;
yield return client.ExportMaster(
    new Gs2.Gs2Distributor.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 Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.exportMaster(
        new Gs2Distributor.ExportMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.export_master(
        distributor.ExportMasterRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

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('distributor')

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;

getCurrentDistributorMaster

현재 활성화된 배포 모델의 마스터 데이터 가져오기

지정된 네임스페이스에서 현재 활성화(공개)된 배포 모델의 마스터 데이터를 가져옵니다.
이는 편집 가능한 마스터 데이터와 달리, 실제로 프로덕션에서 사용되고 있는 구성을 나타냅니다.

상세

Request

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

Result

타입설명
itemCurrentDistributorMaster현재 활성화된 배포 모델의 마스터 데이터

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.GetCurrentDistributorMaster(
    &distributor.GetCurrentDistributorMasterRequest {
        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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetCurrentDistributorMasterRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->getCurrentDistributorMaster(
        (new GetCurrentDistributorMasterRequest())
            ->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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetCurrentDistributorMasterRequest;
import io.gs2.distributor.result.GetCurrentDistributorMasterResult;

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

try {
    GetCurrentDistributorMasterResult result = client.getCurrentDistributorMaster(
        new GetCurrentDistributorMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    CurrentDistributorMaster 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.GetCurrentDistributorMasterResult> asyncResult = null;
yield return client.GetCurrentDistributorMaster(
    new Gs2.Gs2Distributor.Request.GetCurrentDistributorMasterRequest()
        .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 Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.getCurrentDistributorMaster(
        new Gs2Distributor.GetCurrentDistributorMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.get_current_distributor_master(
        distributor.GetCurrentDistributorMasterRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.get_current_distributor_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('distributor')

api_result_handler = client.get_current_distributor_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;

preUpdateCurrentDistributorMaster

현재 활성화된 배포 모델의 마스터 데이터 업데이트(3단계 버전)

1MB를 초과하는 마스터 데이터를 업로드하는 경우, 3단계로 업데이트를 수행합니다.

  1. 이 API를 실행하여 업로드용 토큰과 URL을 가져옵니다.
  2. 가져온 URL에 마스터 데이터를 업로드합니다.
  3. 업로드로 가져온 토큰을 전달하여 UpdateCurrentDistributorMaster를 실행하고 마스터 데이터를 반영합니다.
상세

Request

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

Result

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

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.PreUpdateCurrentDistributorMaster(
    &distributor.PreUpdateCurrentDistributorMasterRequest {
        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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\PreUpdateCurrentDistributorMasterRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->preUpdateCurrentDistributorMaster(
        (new PreUpdateCurrentDistributorMasterRequest())
            ->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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.PreUpdateCurrentDistributorMasterRequest;
import io.gs2.distributor.result.PreUpdateCurrentDistributorMasterResult;

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

try {
    PreUpdateCurrentDistributorMasterResult result = client.preUpdateCurrentDistributorMaster(
        new PreUpdateCurrentDistributorMasterRequest()
            .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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.PreUpdateCurrentDistributorMasterResult> asyncResult = null;
yield return client.PreUpdateCurrentDistributorMaster(
    new Gs2.Gs2Distributor.Request.PreUpdateCurrentDistributorMasterRequest()
        .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 Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.preUpdateCurrentDistributorMaster(
        new Gs2Distributor.PreUpdateCurrentDistributorMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    const uploadToken = result.getUploadToken();
    const uploadUrl = result.getUploadUrl();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.pre_update_current_distributor_master(
        distributor.PreUpdateCurrentDistributorMasterRequest()
            .with_namespace_name('namespace-0001')
    )
    upload_token = result.upload_token
    upload_url = result.upload_url
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.pre_update_current_distributor_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('distributor')

api_result_handler = client.pre_update_current_distributor_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;

updateCurrentDistributorMaster

현재 활성화된 배포 모델의 마스터 데이터 업데이트

지정된 네임스페이스의 배포 모델 마스터 데이터를 업데이트하고 활성화(공개)합니다.
인라인 마스터 데이터용 ‘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

타입설명
itemCurrentDistributorMaster업데이트된 현재 활성화된 배포 모델의 마스터 데이터

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.UpdateCurrentDistributorMaster(
    &distributor.UpdateCurrentDistributorMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Mode: pointy.String("direct"),
        Settings: pointy.String("{\n  \"version\": \"2019-03-01\",\n  \"distributorModels\": [\n    {\n      \"name\": \"basic\",\n      \"metadata\": \"BASIC\",\n      \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\"\n    },\n    {\n      \"name\": \"special\",\n      \"metadata\": \"SPECIAL\",\n      \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\",\n      \"whiteListTargetIds\": [\n        \"test\"\n      ]\n    }\n  ]\n}"),
        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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\UpdateCurrentDistributorMasterRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->updateCurrentDistributorMaster(
        (new UpdateCurrentDistributorMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withMode("direct")
            ->withSettings("{\n  \"version\": \"2019-03-01\",\n  \"distributorModels\": [\n    {\n      \"name\": \"basic\",\n      \"metadata\": \"BASIC\",\n      \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\"\n    },\n    {\n      \"name\": \"special\",\n      \"metadata\": \"SPECIAL\",\n      \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\",\n      \"whiteListTargetIds\": [\n        \"test\"\n      ]\n    }\n  ]\n}")
            ->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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.UpdateCurrentDistributorMasterRequest;
import io.gs2.distributor.result.UpdateCurrentDistributorMasterResult;

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

try {
    UpdateCurrentDistributorMasterResult result = client.updateCurrentDistributorMaster(
        new UpdateCurrentDistributorMasterRequest()
            .withNamespaceName("namespace-0001")
            .withMode("direct")
            .withSettings("{\n  \"version\": \"2019-03-01\",\n  \"distributorModels\": [\n    {\n      \"name\": \"basic\",\n      \"metadata\": \"BASIC\",\n      \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\"\n    },\n    {\n      \"name\": \"special\",\n      \"metadata\": \"SPECIAL\",\n      \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\",\n      \"whiteListTargetIds\": [\n        \"test\"\n      ]\n    }\n  ]\n}")
            .withUploadToken(null)
    );
    CurrentDistributorMaster 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.UpdateCurrentDistributorMasterResult> asyncResult = null;
yield return client.UpdateCurrentDistributorMaster(
    new Gs2.Gs2Distributor.Request.UpdateCurrentDistributorMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithMode("direct")
        .WithSettings("{\n  \"version\": \"2019-03-01\",\n  \"distributorModels\": [\n    {\n      \"name\": \"basic\",\n      \"metadata\": \"BASIC\",\n      \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\"\n    },\n    {\n      \"name\": \"special\",\n      \"metadata\": \"SPECIAL\",\n      \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\",\n      \"whiteListTargetIds\": [\n        \"test\"\n      ]\n    }\n  ]\n}")
        .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 Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.updateCurrentDistributorMaster(
        new Gs2Distributor.UpdateCurrentDistributorMasterRequest()
            .withNamespaceName("namespace-0001")
            .withMode("direct")
            .withSettings("{\n  \"version\": \"2019-03-01\",\n  \"distributorModels\": [\n    {\n      \"name\": \"basic\",\n      \"metadata\": \"BASIC\",\n      \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\"\n    },\n    {\n      \"name\": \"special\",\n      \"metadata\": \"SPECIAL\",\n      \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\",\n      \"whiteListTargetIds\": [\n        \"test\"\n      ]\n    }\n  ]\n}")
            .withUploadToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.update_current_distributor_master(
        distributor.UpdateCurrentDistributorMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_mode('direct')
            .with_settings('{\n  "version": "2019-03-01",\n  "distributorModels": [\n    {\n      "name": "basic",\n      "metadata": "BASIC",\n      "inboxNamespaceId": "grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001"\n    },\n    {\n      "name": "special",\n      "metadata": "SPECIAL",\n      "inboxNamespaceId": "grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001",\n      "whiteListTargetIds": [\n        "test"\n      ]\n    }\n  ]\n}')
            .with_upload_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.update_current_distributor_master({
    namespaceName="namespace-0001",
    mode="direct",
    settings="{\n  \"version\": \"2019-03-01\",\n  \"distributorModels\": [\n    {\n      \"name\": \"basic\",\n      \"metadata\": \"BASIC\",\n      \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\"\n    },\n    {\n      \"name\": \"special\",\n      \"metadata\": \"SPECIAL\",\n      \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\",\n      \"whiteListTargetIds\": [\n        \"test\"\n      ]\n    }\n  ]\n}",
    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('distributor')

api_result_handler = client.update_current_distributor_master_async({
    namespaceName="namespace-0001",
    mode="direct",
    settings="{\n  \"version\": \"2019-03-01\",\n  \"distributorModels\": [\n    {\n      \"name\": \"basic\",\n      \"metadata\": \"BASIC\",\n      \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\"\n    },\n    {\n      \"name\": \"special\",\n      \"metadata\": \"SPECIAL\",\n      \"inboxNamespaceId\": \"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001\",\n      \"whiteListTargetIds\": [\n        \"test\"\n      ]\n    }\n  ]\n}",
    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;

updateCurrentDistributorMasterFromGitHub

현재 활성화된 배포 모델의 마스터 데이터를 GitHub에서 업데이트

GitHub 리포지토리에서 마스터 데이터를 직접 가져와 업데이트하고 활성화(공개)합니다.
체크아웃 설정에는 사용할 리포지토리, 브랜치/태그, 파일 경로를 지정합니다.
마스터 데이터를 버전 관리로 관리하고 직접 배포하고자 할 때 유용합니다.

상세

Request

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

Result

타입설명
itemCurrentDistributorMaster업데이트된 현재 활성화된 배포 모델의 마스터 데이터

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.UpdateCurrentDistributorMasterFromGitHub(
    &distributor.UpdateCurrentDistributorMasterFromGitHubRequest {
        NamespaceName: pointy.String("namespace-0001"),
        CheckoutSetting: &distributor.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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\UpdateCurrentDistributorMasterFromGitHubRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->updateCurrentDistributorMasterFromGitHub(
        (new UpdateCurrentDistributorMasterFromGitHubRequest())
            ->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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.UpdateCurrentDistributorMasterFromGitHubRequest;
import io.gs2.distributor.result.UpdateCurrentDistributorMasterFromGitHubResult;

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

try {
    UpdateCurrentDistributorMasterFromGitHubResult result = client.updateCurrentDistributorMasterFromGitHub(
        new UpdateCurrentDistributorMasterFromGitHubRequest()
            .withNamespaceName("namespace-0001")
            .withCheckoutSetting(new GitHubCheckoutSetting()
                .withApiKeyId("apiKeyId-0001")
                .withRepositoryName("gs2io/master-data")
                .withSourcePath("path/to/file.json")
                .withReferenceType("branch")
                .withBranchName("develop")
            )
    );
    CurrentDistributorMaster 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.UpdateCurrentDistributorMasterFromGitHubResult> asyncResult = null;
yield return client.UpdateCurrentDistributorMasterFromGitHub(
    new Gs2.Gs2Distributor.Request.UpdateCurrentDistributorMasterFromGitHubRequest()
        .WithNamespaceName("namespace-0001")
        .WithCheckoutSetting(new Gs2.Gs2Distributor.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 Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.updateCurrentDistributorMasterFromGitHub(
        new Gs2Distributor.UpdateCurrentDistributorMasterFromGitHubRequest()
            .withNamespaceName("namespace-0001")
            .withCheckoutSetting(new Gs2Distributor.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 distributor

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

try:
    result = client.update_current_distributor_master_from_git_hub(
        distributor.UpdateCurrentDistributorMasterFromGitHubRequest()
            .with_namespace_name('namespace-0001')
            .with_checkout_setting(distributor.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('distributor')

api_result = client.update_current_distributor_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('distributor')

api_result_handler = client.update_current_distributor_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;

describeDistributorModelMasters

배포 모델 마스터 목록 취득

이름 접두사 필터링을 사용하여 편집 가능한 배포 모델 마스터의 페이지네이션된 목록을 취득합니다.
배포 모델 마스터는 리소스 배포 규칙을 위한 편집 가능한 정의입니다. 마스터에 대한 변경 사항은 CurrentDistributorMaster API를 통해 마스터 데이터가 활성화될 때까지 반영되지 않습니다.

상세

Request

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

Result

타입설명
itemsList<DistributorModelMaster>배포 모델 마스터 목록
nextPageTokenstring목록의 나머지를 취득하기 위한 페이지 토큰

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.DescribeDistributorModelMasters(
    &distributor.DescribeDistributorModelMastersRequest {
        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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\DescribeDistributorModelMastersRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->describeDistributorModelMasters(
        (new DescribeDistributorModelMastersRequest())
            ->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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DescribeDistributorModelMastersRequest;
import io.gs2.distributor.result.DescribeDistributorModelMastersResult;

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

try {
    DescribeDistributorModelMastersResult result = client.describeDistributorModelMasters(
        new DescribeDistributorModelMastersRequest()
            .withNamespaceName("namespace-0001")
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    List<DistributorModelMaster> 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.DescribeDistributorModelMastersResult> asyncResult = null;
yield return client.DescribeDistributorModelMasters(
    new Gs2.Gs2Distributor.Request.DescribeDistributorModelMastersRequest()
        .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 Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.describeDistributorModelMasters(
        new Gs2Distributor.DescribeDistributorModelMastersRequest()
            .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 distributor

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

try:
    result = client.describe_distributor_model_masters(
        distributor.DescribeDistributorModelMastersRequest()
            .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('distributor')

api_result = client.describe_distributor_model_masters({
    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('distributor')

api_result_handler = client.describe_distributor_model_masters_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;

createDistributorModelMaster

배포 모델 마스터 신규 작성

이름, 설명, 메타데이터, 오버플로 처리용 인박스 네임스페이스, 대상 서비스 액션의 화이트리스트를 지정하여 새로운 편집 가능한 배포 모델 마스터 정의를 작성합니다.
인박스 네임스페이스는 사용자의 보유물이 용량을 초과했을 때 리소스가 전달되는 대상을 지정합니다.
화이트리스트는 이 모델을 통해 배포가 허용되는 서비스 액션을 제한합니다.
변경 사항은 CurrentDistributorMaster API를 통해 마스터 데이터가 활성화될 때까지 반영되지 않습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
namestring
~ 128자배포 모델 이름
배포 모델 고유의 이름. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
descriptionstring~ 1024자설명문
metadatastring~ 2048자메타데이터
메타데이터에는 임의의 값을 설정할 수 있습니다.
이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다.
inboxNamespaceIdstring~ 1024자넘친 리소스를 전송할 GS2-Inbox 네임스페이스 GRN
리소스 입수가 플레이어의 소지 한도를 초과한 경우, 넘친 리소스는 지정된 GS2-Inbox 네임스페이스에 메시지로 전송됩니다. 플레이어는 이후 수신함에서 리소스를 수령할 수 있습니다.
whiteListTargetIdsList<string>[]0 ~ 1000 itemsGS2-Distributor를 통해 처리할 수 있는 대상 리소스 GRN의 화이트리스트
이 배포 모델을 사용하여 입수 처리를 수행할 수 있는 대상 리소스의 GRN 프리픽스를 지정합니다.

Result

타입설명
itemDistributorModelMaster작성한 배포 모델 마스터

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.CreateDistributorModelMaster(
    &distributor.CreateDistributorModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Name: pointy.String("distributor-model-0001"),
        Description: nil,
        Metadata: nil,
        InboxNamespaceId: nil,
        WhiteListTargetIds: 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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\CreateDistributorModelMasterRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->createDistributorModelMaster(
        (new CreateDistributorModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withName("distributor-model-0001")
            ->withDescription(null)
            ->withMetadata(null)
            ->withInboxNamespaceId(null)
            ->withWhiteListTargetIds(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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.CreateDistributorModelMasterRequest;
import io.gs2.distributor.result.CreateDistributorModelMasterResult;

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

try {
    CreateDistributorModelMasterResult result = client.createDistributorModelMaster(
        new CreateDistributorModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withName("distributor-model-0001")
            .withDescription(null)
            .withMetadata(null)
            .withInboxNamespaceId(null)
            .withWhiteListTargetIds(null)
    );
    DistributorModelMaster 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.CreateDistributorModelMasterResult> asyncResult = null;
yield return client.CreateDistributorModelMaster(
    new Gs2.Gs2Distributor.Request.CreateDistributorModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithName("distributor-model-0001")
        .WithDescription(null)
        .WithMetadata(null)
        .WithInboxNamespaceId(null)
        .WithWhiteListTargetIds(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 Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.createDistributorModelMaster(
        new Gs2Distributor.CreateDistributorModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withName("distributor-model-0001")
            .withDescription(null)
            .withMetadata(null)
            .withInboxNamespaceId(null)
            .withWhiteListTargetIds(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.create_distributor_model_master(
        distributor.CreateDistributorModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_name('distributor-model-0001')
            .with_description(None)
            .with_metadata(None)
            .with_inbox_namespace_id(None)
            .with_white_list_target_ids(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.create_distributor_model_master({
    namespaceName="namespace-0001",
    name="distributor-model-0001",
    description=nil,
    metadata=nil,
    inboxNamespaceId=nil,
    whiteListTargetIds=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('distributor')

api_result_handler = client.create_distributor_model_master_async({
    namespaceName="namespace-0001",
    name="distributor-model-0001",
    description=nil,
    metadata=nil,
    inboxNamespaceId=nil,
    whiteListTargetIds=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;

getDistributorModelMaster

배포 모델 마스터 취득

이름을 지정하여 특정 편집 가능한 배포 모델 마스터의 상세 정보를 취득합니다.
활성화 전 마스터 정의의 열람 및 편집에 사용합니다.

상세

Request

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

Result

타입설명
itemDistributorModelMaster배포 모델 마스터

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.GetDistributorModelMaster(
    &distributor.GetDistributorModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        DistributorName: pointy.String("distributor-model-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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\GetDistributorModelMasterRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->getDistributorModelMaster(
        (new GetDistributorModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withDistributorName("distributor-model-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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.GetDistributorModelMasterRequest;
import io.gs2.distributor.result.GetDistributorModelMasterResult;

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

try {
    GetDistributorModelMasterResult result = client.getDistributorModelMaster(
        new GetDistributorModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withDistributorName("distributor-model-0001")
    );
    DistributorModelMaster 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.GetDistributorModelMasterResult> asyncResult = null;
yield return client.GetDistributorModelMaster(
    new Gs2.Gs2Distributor.Request.GetDistributorModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithDistributorName("distributor-model-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 Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.getDistributorModelMaster(
        new Gs2Distributor.GetDistributorModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withDistributorName("distributor-model-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.get_distributor_model_master(
        distributor.GetDistributorModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_distributor_name('distributor-model-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.get_distributor_model_master({
    namespaceName="namespace-0001",
    distributorName="distributor-model-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('distributor')

api_result_handler = client.get_distributor_model_master_async({
    namespaceName="namespace-0001",
    distributorName="distributor-model-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;

updateDistributorModelMaster

배포 모델 마스터 갱신

기존 배포 모델 마스터의 설명, 메타데이터, 인박스 네임스페이스, 화이트리스트를 갱신합니다.
배포 모델 이름은 작성 후 변경할 수 없습니다.
변경 사항은 CurrentDistributorMaster API를 통해 마스터 데이터를 다시 활성화할 때까지 반영되지 않습니다.

상세

Request

타입활성화 조건필수기본값값 제한설명
namespaceNamestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
distributorNamestring
~ 128자배포 모델 이름
배포 모델 고유의 이름. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
descriptionstring~ 1024자설명문
metadatastring~ 2048자메타데이터
메타데이터에는 임의의 값을 설정할 수 있습니다.
이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다.
inboxNamespaceIdstring~ 1024자넘친 리소스를 전송할 GS2-Inbox 네임스페이스 GRN
리소스 입수가 플레이어의 소지 한도를 초과한 경우, 넘친 리소스는 지정된 GS2-Inbox 네임스페이스에 메시지로 전송됩니다. 플레이어는 이후 수신함에서 리소스를 수령할 수 있습니다.
whiteListTargetIdsList<string>[]0 ~ 1000 itemsGS2-Distributor를 통해 처리할 수 있는 대상 리소스 GRN의 화이트리스트
이 배포 모델을 사용하여 입수 처리를 수행할 수 있는 대상 리소스의 GRN 프리픽스를 지정합니다.

Result

타입설명
itemDistributorModelMaster갱신한 배포 모델 마스터

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.UpdateDistributorModelMaster(
    &distributor.UpdateDistributorModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        DistributorName: pointy.String("distributor-model-0001"),
        Description: pointy.String("description1"),
        Metadata: pointy.String("{\"hoge\": \"fuga\"}"),
        InboxNamespaceId: pointy.String("inbox-0001"),
        WhiteListTargetIds: []*string{
            pointy.String("grn:AAA"),
            pointy.String("grn:BBB"),
        },
    }
)
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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\UpdateDistributorModelMasterRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->updateDistributorModelMaster(
        (new UpdateDistributorModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withDistributorName("distributor-model-0001")
            ->withDescription("description1")
            ->withMetadata("{\"hoge\": \"fuga\"}")
            ->withInboxNamespaceId("inbox-0001")
            ->withWhiteListTargetIds([
                "grn:AAA",
                "grn:BBB",
            ])
    );
    $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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.UpdateDistributorModelMasterRequest;
import io.gs2.distributor.result.UpdateDistributorModelMasterResult;

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

try {
    UpdateDistributorModelMasterResult result = client.updateDistributorModelMaster(
        new UpdateDistributorModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withDistributorName("distributor-model-0001")
            .withDescription("description1")
            .withMetadata("{\"hoge\": \"fuga\"}")
            .withInboxNamespaceId("inbox-0001")
            .withWhiteListTargetIds(Arrays.asList(
                "grn:AAA",
                "grn:BBB"
            ))
    );
    DistributorModelMaster 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.UpdateDistributorModelMasterResult> asyncResult = null;
yield return client.UpdateDistributorModelMaster(
    new Gs2.Gs2Distributor.Request.UpdateDistributorModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithDistributorName("distributor-model-0001")
        .WithDescription("description1")
        .WithMetadata("{\"hoge\": \"fuga\"}")
        .WithInboxNamespaceId("inbox-0001")
        .WithWhiteListTargetIds(new string[] {
            "grn:AAA",
            "grn:BBB",
        }),
    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 Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.updateDistributorModelMaster(
        new Gs2Distributor.UpdateDistributorModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withDistributorName("distributor-model-0001")
            .withDescription("description1")
            .withMetadata("{\"hoge\": \"fuga\"}")
            .withInboxNamespaceId("inbox-0001")
            .withWhiteListTargetIds([
                "grn:AAA",
                "grn:BBB",
            ])
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.update_distributor_model_master(
        distributor.UpdateDistributorModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_distributor_name('distributor-model-0001')
            .with_description('description1')
            .with_metadata('{"hoge": "fuga"}')
            .with_inbox_namespace_id('inbox-0001')
            .with_white_list_target_ids([
                'grn:AAA',
                'grn:BBB',
            ])
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.update_distributor_model_master({
    namespaceName="namespace-0001",
    distributorName="distributor-model-0001",
    description="description1",
    metadata="{\"hoge\": \"fuga\"}",
    inboxNamespaceId="inbox-0001",
    whiteListTargetIds={
        "grn:AAA",
        "grn:BBB"
    },
})

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('distributor')

api_result_handler = client.update_distributor_model_master_async({
    namespaceName="namespace-0001",
    distributorName="distributor-model-0001",
    description="description1",
    metadata="{\"hoge\": \"fuga\"}",
    inboxNamespaceId="inbox-0001",
    whiteListTargetIds={
        "grn:AAA",
        "grn:BBB"
    },
})

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;

deleteDistributorModelMaster

배포 모델 마스터 삭제

편집 가능한 배포 모델 마스터 정의를 삭제합니다.
마스터 데이터만 영향을 받으며, 현재 활성화(공개)되어 있는 모델은 마스터 데이터가 다시 활성화될 때까지 영향을 받지 않습니다.

상세

Request

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

Result

타입설명
itemDistributorModelMaster삭제한 배포 모델 마스터

구현 예제

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/distributor"
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 := distributor.Gs2DistributorRestClient{
    Session: &session,
}
result, err := client.DeleteDistributorModelMaster(
    &distributor.DeleteDistributorModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        DistributorName: pointy.String("distributor-model-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\Distributor\Gs2DistributorRestClient;
use Gs2\Distributor\Request\DeleteDistributorModelMasterRequest;

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

$session->open();

$client = new Gs2DistributorRestClient(
    $session
);

try {
    $result = $client->deleteDistributorModelMaster(
        (new DeleteDistributorModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withDistributorName("distributor-model-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.distributor.rest.Gs2DistributorRestClient;
import io.gs2.distributor.request.DeleteDistributorModelMasterRequest;
import io.gs2.distributor.result.DeleteDistributorModelMasterResult;

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

try {
    DeleteDistributorModelMasterResult result = client.deleteDistributorModelMaster(
        new DeleteDistributorModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withDistributorName("distributor-model-0001")
    );
    DistributorModelMaster 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 Gs2DistributorRestClient(session);

AsyncResult<Gs2.Gs2Distributor.Result.DeleteDistributorModelMasterResult> asyncResult = null;
yield return client.DeleteDistributorModelMaster(
    new Gs2.Gs2Distributor.Request.DeleteDistributorModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithDistributorName("distributor-model-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 Gs2Distributor from '@/gs2/distributor';

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

try {
    const result = await client.deleteDistributorModelMaster(
        new Gs2Distributor.DeleteDistributorModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withDistributorName("distributor-model-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import distributor

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

try:
    result = client.delete_distributor_model_master(
        distributor.DeleteDistributorModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_distributor_name('distributor-model-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('distributor')

api_result = client.delete_distributor_model_master({
    namespaceName="namespace-0001",
    distributorName="distributor-model-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('distributor')

api_result_handler = client.delete_distributor_model_master_async({
    namespaceName="namespace-0001",
    distributorName="distributor-model-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;