> For the complete documentation index, see [llms.txt](/llms.txt)

# GS2-Limit SDK API リファレンス

各種プログラミング言語向け GS2-Limit SDK の モデルの仕様 と API のリファレンス



## モデル

### Namespace

ネームスペース<br>

ネームスペースは、一つのプロジェクト内で同じサービスを異なる用途で複数利用するためのエンティティです。<br>
GS2 の各サービスはネームスペース単位で管理されます。ネームスペースが異なれば、同じサービスでも完全に独立したデータ空間として扱われます。<br>

そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceId | string |  | ※ |  |  ~ 1024文字 | ネームスペースGRN<br>※ サーバーが自動で設定 |
| name | string |  | ✓ |  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| description | string |  |  |  |  ~ 1024文字 | 説明文 |
| transactionSetting | [TransactionSetting](#transactionsetting) |  |  |  |  | トランザクション設定<br>カウントアップやカウンターリセットなどの回数制限操作時のトランザクションの処理方法を制御する設定です。 |
| countUpScript | [ScriptSetting](#scriptsetting) |  |  |  |  | カウントアップするときに実行するスクリプトの設定<br>Script トリガーリファレンス - [`countUp`](../script/#countup) |
| logSetting | [LogSetting](#logsetting) |  |  |  |  | ログの出力設定<br>回数制限操作のAPIリクエスト・レスポンスログを出力するためのGS2-Logネームスペースを指定します。デバッグや分析のためにカウンターの増加、リセット、制限チェックの追跡に便利です。 |
| createdAt | long |  | ※ | 現在時刻 |  | 作成日時<br>UNIX 時間・ミリ秒<br>※ サーバーが自動で設定 |
| updatedAt | long |  | ※ | 現在時刻 |  | 最終更新日時<br>UNIX 時間・ミリ秒<br>※ サーバーが自動で設定 |
| revision | long |  |  | 0 | 0 ~ 9223372036854775805 | リビジョン |

**関連するメソッド:**
describeNamespaces - ネームスペースの一覧を取得
createNamespace - ネームスペースを新規作成
getNamespace - ネームスペースを取得
updateNamespace - ネームスペースを更新
deleteNamespace - ネームスペースを削除




---

### TransactionSetting

トランザクション設定<br>

トランザクション設定は、トランザクションの実行方法・整合性・非同期処理・競合回避の仕組みを制御する設定です。<br>
自動実行（AutoRun）、アトミック実行（AtomicCommit）、GS2-Distributor を利用した非同期実行、スクリプト結果の一括適用、GS2-JobQueue による入手アクションの非同期化などを組み合わせ、ゲームロジックに応じた堅牢なトランザクション管理を可能にします。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| enableAutoRun | bool |  |  | false |  | 発行したトランザクションをサーバーサイドで自動的に実行するか |
| enableAtomicCommit | bool | {enableAutoRun} == true |  | false |  | トランザクションの実行をアトミックにコミットするか<br>※ enableAutoRun が true であれば 有効 |
| transactionUseDistributor | bool | {enableAtomicCommit} == true |  | false |  | トランザクションを非同期処理で実行する<br>※ enableAtomicCommit が true であれば 有効 |
| commitScriptResultInUseDistributor | bool | {transactionUseDistributor} == true |  | false |  | スクリプトの結果コミット処理を非同期処理で実行するか<br>※ transactionUseDistributor が true であれば 有効 |
| acquireActionUseJobQueue | bool | {enableAtomicCommit} == true |  | false |  | 入手アクションを実行する際に GS2-JobQueue を使用するか<br>※ enableAtomicCommit が true であれば 有効 |
| distributorNamespaceId | string |  |  | "grn:gs2:{region}:{ownerId}:distributor:default" |  ~ 1024文字 | トランザクションの実行に使用する GS2-Distributor ネームスペースGRN |
| queueNamespaceId | string |  |  | "grn:gs2:{region}:{ownerId}:queue:default" |  ~ 1024文字 | トランザクションの実行に使用する GS2-JobQueue のネームスペースGRN |

**関連するメソッド:**
createNamespace - ネームスペースを新規作成
updateNamespace - ネームスペースを更新


**関連するモデル:**
Namespace - ネームスペース




---

### ScriptSetting

スクリプト設定<br>

GS2 ではマイクロサービスのイベントに関連づけて、カスタムスクリプトを実行することができます。<br>
このモデルは、スクリプトの実行をトリガーするための設定を保持します。<br>

スクリプトの実行方式は大きく2種類あり、それは「同期実行」と「非同期実行」です。<br>
同期実行は、スクリプトの実行が完了するまで処理がブロックされます。<br>
代わりに、スクリプトの実行結果を使って API の実行を止めたり、API のレスポンス内容を制御することができます。<br>

一方、非同期実行ではスクリプトの完了を待つために処理がブロックされることはありません。<br>
ただし、スクリプトの実行結果を利用して API の実行を停止したり、API の応答内容を変更することはできません。<br>
非同期実行は API の応答フローに影響を与えないため、原則として非同期実行を推奨します。<br>

非同期実行には実行方式が2種類あり、GS2-Script と Amazon EventBridge があります。<br>
Amazon EventBridge を使用することで、Lua 以外の言語で処理を記述することができます。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| triggerScriptId | string |  |  |  |  ~ 1024文字 | API 実行時に同期的に実行される GS2-Script のスクリプトGRN<br>「grn:gs2:」ではじまる GRN 形式のIDで指定する必要があります。 |
| doneTriggerTargetType | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"none",<br>&nbsp;&nbsp;"gs2_script",<br>&nbsp;&nbsp;"aws"<br>}<br> |  |  | "none" |  | 非同期スクリプトの実行方法<br>非同期実行で使用するスクリプトの種類を指定します。<br>「非同期実行のスクリプトを使用しない(none)」「GS2-Scriptを使用する(gs2_script)」「Amazon EventBridgeを使用する(aws)」が選択できます。"none": なし / "gs2_script": GS2-Script / "aws": Amazon EventBridge /  |
| doneTriggerScriptId | string | {doneTriggerTargetType} == "gs2_script" |  |  |  ~ 1024文字 | 非同期実行する GS2-Script スクリプトGRN<br>「grn:gs2:」ではじまる GRN 形式のIDで指定する必要があります。<br>※ doneTriggerTargetType が "gs2_script" であれば 有効 |
| doneTriggerQueueNamespaceId | string | {doneTriggerTargetType} == "gs2_script" |  |  |  ~ 1024文字 | 非同期実行スクリプトを実行する GS2-JobQueue ネームスペースGRN<br>非同期実行スクリプトを直接実行するのではなく、GS2-JobQueue を経由する場合は GS2-JobQueue のネームスペースGRN を指定します。<br>GS2-JobQueue を利用する理由は多くはありませんので、特に理由がなければ指定する必要はありません。<br>※ doneTriggerTargetType が "gs2_script" であれば 有効 |

**関連するメソッド:**
createNamespace - ネームスペースを新規作成
updateNamespace - ネームスペースを更新


**関連するモデル:**
Namespace - ネームスペース




---

### LogSetting

ログの出力設定<br>

ログデータの出力設定を管理します。この型は、ログデータを書き出すために使用される GS2-Log ネームスペースの識別子（Namespace ID）を保持します。<br>
ログネームスペースID(loggingNamespaceId)には、ログデータを収集し保存する GS2-Log のネームスペースを、GRNの形式で指定します。<br>
この設定をすることで、設定されたネームスペース内で発生したAPIリクエスト・レスポンスのログデータが、対象の GS2-Log ネームスペース側へ出力されるようになります。<br>
GS2-Log ではリアルタイムでログが提供され、システムの監視や分析、デバッグなどに利用できます。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| loggingNamespaceId | string |  | ✓ |  |  ~ 1024文字 | ログを出力する GS2-Log のネームスペースGRN<br>「grn:gs2:」ではじまる GRN 形式のIDで指定する必要があります。 |

**関連するメソッド:**
createNamespace - ネームスペースを新規作成
updateNamespace - ネームスペースを更新


**関連するモデル:**
Namespace - ネームスペース




---

### GitHubCheckoutSetting

GitHubからマスターデータをチェックアウトする設定



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| apiKeyId | string |  | ✓ |  |  ~ 1024文字 | GitHub APIキーのGRN |
| repositoryName | string |  | ✓ |  |  ~ 1024文字 | リポジトリ名 |
| sourcePath | string |  | ✓ |  |  ~ 1024文字 | マスターデータ（JSON）ファイルのパス |
| referenceType | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"commit_hash",<br>&nbsp;&nbsp;"branch",<br>&nbsp;&nbsp;"tag"<br>}<br> |  | ✓ |  |  | コードの取得元"commit_hash": コミットハッシュ / "branch": ブランチ / "tag": タグ /  |
| commitHash | string | {referenceType} == "commit_hash" | ✓※ |  |  ~ 1024文字 | コミットハッシュ<br>※ referenceType が "commit_hash" であれば 必須 |
| branchName | string | {referenceType} == "branch" | ✓※ |  |  ~ 1024文字 | ブランチ名<br>※ referenceType が "branch" であれば 必須 |
| tagName | string | {referenceType} == "tag" | ✓※ |  |  ~ 1024文字 | タグ名<br>※ referenceType が "tag" であれば 必須 |

**関連するメソッド:**
updateCurrentLimitMasterFromGitHub - 現在アクティブな回数制限モデルマスターをGitHubから更新




---

### Counter

回数制限の現在の値<br>

各ユーザーの回数制限モデル配下の特定カウンターの現在の使用回数を追跡します。1つの回数制限モデルの下に複数のカウンターを作成できます（例：1回限りの報酬用にクエストごとに1つのカウンター）。カウント値はカウントアップ操作時に指定される最大値と比較され、回数制限モデルのリセットスケジュールに基づいて自動的にゼロにリセットされます。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| counterId | string |  | ※ |  |  ~ 1024文字 | カウンターGRN<br>※ サーバーが自動で設定 |
| limitName | string |  | ✓ |  |  ~ 128文字 | 回数制限モデル名<br>このカウンターが属する回数制限モデルの名前です。このカウンターの値に適用されるリセットスケジュール（毎日、毎週、毎月など）を決定します。 |
| name | string |  | ✓ |  |  ~ 128文字 | カウンターの名前<br>回数制限モデル内でこのカウンターを一意に識別する名前です。同じ回数制限モデルを異なる名前の複数のカウンターで共有でき、個別の回数制限モデルを作成せずに別々の使用回数追跡（例：クエストごとや商品ごとに1カウンター）が可能です。 |
| userId | string |  | ✓ |  |  ~ 128文字 | ユーザーID |
| count | int |  |  | 0 | 0 ~ 2147483646 | カウント値<br>このカウンターの現在の使用回数です。countUp操作でインクリメントされ、その際に指定された最大値と比較されます。回数制限モデルのリセットタイミングに達すると自動的にゼロにリセットされます。 |
| nextResetAt | long |  |  |  |  | 次回リセットタイミング<br>回数制限モデルのリセットスケジュールから計算された、このカウンターが次にゼロにリセットされるタイムスタンプです。"notReset" タイプの場合、この値は設定されません。各リセット発生後に自動的に再計算されます。 |
| createdAt | long |  | ※ | 現在時刻 |  | 作成日時<br>UNIX 時間・ミリ秒<br>※ サーバーが自動で設定 |
| updatedAt | long |  | ※ | 現在時刻 |  | 最終更新日時<br>UNIX 時間・ミリ秒<br>※ サーバーが自動で設定 |
| revision | long |  |  | 0 | 0 ~ 9223372036854775805 | リビジョン |

**関連するメソッド:**
describeCounters - カウンターの一覧を取得
describeCountersByUserId - ユーザーIDを指定してカウンターの一覧を取得
getCounter - カウンターを取得
getCounterByUserId - ユーザーIDを指定してカウンターを取得
countUp - カウントアップ
countUpByUserId - ユーザーIDを指定してカウントアップ
countDownByUserId - ユーザーIDを指定してカウントダウン
deleteCounterByUserId - ユーザーIDを指定してカウンターを削除
verifyCounter - カウンター値を検証
verifyCounterByUserId - ユーザーIDを指定してカウンター値を検証




---

### LimitModel

回数制限モデル<br>

回数制限モデルには、使用回数をリセットするタイミングを設定できます。<br>
リセット間隔は 「毎日」「毎週」「毎月」「リセットしない」「一定日数」の 5 種類から選択できます。<br>

また、回数制限の最大値はマスターデータ側では固定しません。<br>
これは、ゲーム内のコンテキストに応じて、許可される最大回数を動的に変化させるためです。<br>
たとえばステップアップガチャのように、<br>
- 購入回数カウンターが 3 回未満 の場合に購入できる商品<br>
- 上記の商品が購入できない場合に、購入回数カウンターが 5 回未満 なら購入できる別の商品<br>

といったように、状況に応じて「最大回数」を切り替えられる設計を想定しています。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| limitModelId | string |  | ※ |  |  ~ 1024文字 | 回数制限モデルGRN<br>※ サーバーが自動で設定 |
| name | string |  | ✓ |  |  ~ 128文字 | 回数制限モデル名<br>回数制限モデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| metadata | string |  |  |  |  ~ 2048文字 | メタデータ<br>メタデータには任意の値を設定できます。<br>これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
| resetType | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"notReset",<br>&nbsp;&nbsp;"daily",<br>&nbsp;&nbsp;"weekly",<br>&nbsp;&nbsp;"monthly",<br>&nbsp;&nbsp;"days"<br>}<br> |  | ✓ |  |  | リセットタイミング<br>この回数制限モデル配下のカウンター値が自動的にゼロにリセットされるタイミングを決定します。notReset（恒久的、リセットなし）、daily（毎日指定時刻にリセット）、weekly（指定曜日にリセット）、monthly（指定日にリセット）、days（基準日時から一定日数ごとにリセット）から選択します。すべての時刻はUTCです。"notReset": リセットしない / "daily": 毎日 / "weekly": 毎週 / "monthly": 毎月 / "days": 一定日数ごと /  |
| resetDayOfMonth | int | {resetType} == "monthly" | ✓※ |  | 1 ~ 31 | リセット日<br>resetTypeが "monthly" の場合にカウンターがリセットされる月の日にちです。1〜31の値が有効です。指定した日がその月の日数を超える場合（例：2月の31日）、その月の最終日にリセットされます。<br>※ resetType が "monthly" であれば 必須 |
| resetDayOfWeek | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"sunday",<br>&nbsp;&nbsp;"monday",<br>&nbsp;&nbsp;"tuesday",<br>&nbsp;&nbsp;"wednesday",<br>&nbsp;&nbsp;"thursday",<br>&nbsp;&nbsp;"friday",<br>&nbsp;&nbsp;"saturday"<br>}<br> | {resetType} == "weekly" | ✓※ |  |  | リセット曜日<br>resetTypeが "weekly" の場合にカウンターがリセットされる曜日です。この曜日のresetHour（UTC）で指定された時刻にリセットされます。"sunday": 日曜日 / "monday": 月曜日 / "tuesday": 火曜日 / "wednesday": 水曜日 / "thursday": 木曜日 / "friday": 金曜日 / "saturday": 土曜日 / <br>※ resetType が "weekly" であれば 必須 |
| resetHour | int | {resetType} in ["monthly", "weekly", "daily"] | ✓※ |  | 0 ~ 23 | リセット時刻<br>daily、weekly、monthlyリセットタイプでカウンターがリセットされるUTCの時刻（0〜23）です。例えば0の場合、UTC午前0時にカウンターがリセットされます。<br>※ resetType が "monthly","weekly","daily"であれば 必須 |
| anchorTimestamp | long | {resetType} == "days" | ✓※ |  |  | 経過日数のカウントをする基準日時<br>UNIX 時間・ミリ秒<br>※ resetType が "days" であれば 必須 |
| days | int | {resetType} == "days" | ✓※ |  | 1 ~ 2147483646 | リセットする日数<br>resetTypeが "days" の場合のカウンターリセットの間隔（日数）です。リセット周期はanchorTimestampから計算されます。例えばdaysが7でanchorTimestampが月曜日の正午なら、毎週月曜日の正午にカウンターがリセットされます。<br>※ resetType が "days" であれば 必須 |

**関連するメソッド:**
describeLimitModels - 回数制限モデルの一覧を取得
getLimitModel - 回数制限モデルを取得




---

### CurrentLimitMaster

現在アクティブな回数制限モデルのマスターデータ<br>

現在ネームスペース内で有効な、回数制限モデルの定義を記述したマスターデータです。<br>
GS2ではマスターデータの管理にJSON形式のファイルを使用します。<br>
ファイルをアップロードすることで、実際にサーバーに設定を反映することができます。<br>

JSONファイルを作成する方法として、マネージメントコンソール内にマスターデータエディタを提供しています。<br>
また、よりゲームの運営に相応しいツールを作成し、適切なフォーマットのJSONファイルを書き出すことでもサービスを利用可能です。
{{% alert title="Note" color="info" %}}
JSONファイルの形式については [GS2-Limit マスターデータリファレンス](api_reference/limit/master_data/) をご参照ください。
{{% /alert %}}



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceId | string |  | ※ |  |  ~ 1024文字 | ネームスペースGRN<br>※ サーバーが自動で設定 |
| settings | string |  | ✓ |  |  ~ 5242880 バイト (5MB) | マスターデータ |

**関連するメソッド:**
exportMaster - 回数制限モデルマスターを有効化可能なマスターデータ形式でエクスポート
getCurrentLimitMaster - 現在アクティブな回数制限モデルマスターを取得
updateCurrentLimitMaster - 現在アクティブな回数制限モデルのマスターデータを更新
updateCurrentLimitMasterFromGitHub - 現在アクティブな回数制限モデルマスターをGitHubから更新




---

### LimitModelMaster

回数制限モデルマスター<br>

回数制限モデルマスターは、ゲーム内で使用される回数制限モデルの編集・管理用データで、マネージメントコンソールのマスターデータエディタで一時的に保持されます。<br>
インポート・更新処理を行うことで、実際にゲームから参照される回数制限モデルとして反映されます。<br>

回数制限には、使用回数をリセットするタイミングを設定できます。<br>
リセット間隔は 「毎日」「毎週」「毎月」「一定日数」「リセットしない」の 5 種類から選択できます。<br>
なお、ここで指定する時刻はすべて協定世界時（UTC）です。<br>

また、回数制限の最大値はマスターデータ側では固定しません。<br>
これは、ゲーム内のコンテキストに応じて、許可される最大回数を動的に変化させるためです。<br>
たとえばステップアップガチャのように、<br>
- 購入回数カウンターが 3 回未満 の場合に購入できる商品<br>
- 上記の商品が購入できない場合に、購入回数カウンターが 5 回未満 なら購入できる別の商品<br>

といったように、状況に応じて「最大回数」を切り替えられる設計を想定しています。<br>

さらに、この回数制限モデルに紐づくカウンターは複数作成できます。<br>
例えば「1 回だけ受け取れるクエスト報酬」が複数ある場合、クエストごとに個別の回数制限モデルを作る必要はなく、1 つの回数制限モデルを共有し、クエストごとにカウンターだけを分けて作成することで、設定の種類が過剰に増えることを防げます。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| limitModelId | string |  | ※ |  |  ~ 1024文字 | 回数制限モデルマスターGRN<br>※ サーバーが自動で設定 |
| name | string |  | ✓ |  |  ~ 128文字 | 回数制限モデル名<br>回数制限モデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| description | string |  |  |  |  ~ 1024文字 | 説明文 |
| metadata | string |  |  |  |  ~ 2048文字 | メタデータ<br>メタデータには任意の値を設定できます。<br>これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
| resetType | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"notReset",<br>&nbsp;&nbsp;"daily",<br>&nbsp;&nbsp;"weekly",<br>&nbsp;&nbsp;"monthly",<br>&nbsp;&nbsp;"days"<br>}<br> |  | ✓ |  |  | リセットタイミング<br>この回数制限モデル配下のカウンター値が自動的にゼロにリセットされるタイミングを決定します。notReset（恒久的、リセットなし）、daily（毎日指定時刻にリセット）、weekly（指定曜日にリセット）、monthly（指定日にリセット）、days（基準日時から一定日数ごとにリセット）から選択します。すべての時刻はUTCです。"notReset": リセットしない / "daily": 毎日 / "weekly": 毎週 / "monthly": 毎月 / "days": 一定日数ごと /  |
| resetDayOfMonth | int | {resetType} == "monthly" | ✓※ |  | 1 ~ 31 | リセット日<br>resetTypeが "monthly" の場合にカウンターがリセットされる月の日にちです。1〜31の値が有効です。指定した日がその月の日数を超える場合（例：2月の31日）、その月の最終日にリセットされます。<br>※ resetType が "monthly" であれば 必須 |
| resetDayOfWeek | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"sunday",<br>&nbsp;&nbsp;"monday",<br>&nbsp;&nbsp;"tuesday",<br>&nbsp;&nbsp;"wednesday",<br>&nbsp;&nbsp;"thursday",<br>&nbsp;&nbsp;"friday",<br>&nbsp;&nbsp;"saturday"<br>}<br> | {resetType} == "weekly" | ✓※ |  |  | リセット曜日<br>resetTypeが "weekly" の場合にカウンターがリセットされる曜日です。この曜日のresetHour（UTC）で指定された時刻にリセットされます。"sunday": 日曜日 / "monday": 月曜日 / "tuesday": 火曜日 / "wednesday": 水曜日 / "thursday": 木曜日 / "friday": 金曜日 / "saturday": 土曜日 / <br>※ resetType が "weekly" であれば 必須 |
| resetHour | int | {resetType} in ["monthly", "weekly", "daily"] | ✓※ |  | 0 ~ 23 | リセット時刻<br>daily、weekly、monthlyリセットタイプでカウンターがリセットされるUTCの時刻（0〜23）です。例えば0の場合、UTC午前0時にカウンターがリセットされます。<br>※ resetType が "monthly","weekly","daily"であれば 必須 |
| anchorTimestamp | long | {resetType} == "days" | ✓※ |  |  | 経過日数のカウントをする基準日時<br>UNIX 時間・ミリ秒<br>※ resetType が "days" であれば 必須 |
| days | int | {resetType} == "days" | ✓※ |  | 1 ~ 2147483646 | リセットする日数<br>resetTypeが "days" の場合のカウンターリセットの間隔（日数）です。リセット周期はanchorTimestampから計算されます。例えばdaysが7でanchorTimestampが月曜日の正午なら、毎週月曜日の正午にカウンターがリセットされます。<br>※ resetType が "days" であれば 必須 |
| createdAt | long |  | ※ | 現在時刻 |  | 作成日時<br>UNIX 時間・ミリ秒<br>※ サーバーが自動で設定 |
| updatedAt | long |  | ※ | 現在時刻 |  | 最終更新日時<br>UNIX 時間・ミリ秒<br>※ サーバーが自動で設定 |
| revision | long |  |  | 0 | 0 ~ 9223372036854775805 | リビジョン |

**関連するメソッド:**
describeLimitModelMasters - 回数制限モデルマスターの一覧を取得
createLimitModelMaster - 回数制限モデルマスターを新規作成
getLimitModelMaster - 回数制限モデルマスターを取得
updateLimitModelMaster - 回数制限モデルマスターを更新
deleteLimitModelMaster - 回数制限モデルマスターを削除




---
## メソッド

### describeNamespaces

ネームスペースの一覧を取得<br>

プロジェクト内において、サービス単位で作成されたネームスペースの一覧を取得します。<br>
オプションのページトークンを使用して、リストの特定の位置からデータの取得を開始できます。<br>
また、取得するネームスペースの数を制限することも可能です。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namePrefix | string |  | |  |  ~ 64文字 | ネームスペース名のフィルター接頭辞 |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 1000 | データの取得件数 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;Namespace&gt;](#namespace) | ネームスペースのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.DescribeNamespaces(
    &limit.DescribeNamespacesRequest {
        NamePrefix: nil,
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\DescribeNamespacesRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $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")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DescribeNamespacesRequest;
import io.gs2.limit.result.DescribeNamespacesResult;

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

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
    new Gs2.Gs2Limit.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;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

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

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

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


```

**GS2-Script**
```lua

client = gs2('limit')

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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

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

ネームスペースを新規作成<br>

ネームスペースの名前、説明、および各種設定を含む詳細情報を指定する必要があります。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| name | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| description | string |  | |  |  ~ 1024文字 | 説明文 |
| transactionSetting | [TransactionSetting](#transactionsetting) |  | |  |  | トランザクション設定<br>カウントアップやカウンターリセットなどの回数制限操作時のトランザクションの処理方法を制御する設定です。 |
| countUpScript | [ScriptSetting](#scriptsetting) |  | |  |  | カウントアップするときに実行するスクリプトの設定<br>Script トリガーリファレンス - [`countUp`](../script/#countup) |
| logSetting | [LogSetting](#logsetting) |  | |  |  | ログの出力設定<br>回数制限操作のAPIリクエスト・レスポンスログを出力するためのGS2-Logネームスペースを指定します。デバッグや分析のためにカウンターの増加、リセット、制限チェックの追跡に便利です。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Namespace](#namespace) | 作成したネームスペース |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.CreateNamespace(
    &limit.CreateNamespaceRequest {
        Name: pointy.String("namespace-0001"),
        Description: nil,
        TransactionSetting: nil,
        CountUpScript: nil,
        LogSetting: &limit.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\CreateNamespaceRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->createNamespace(
        (new CreateNamespaceRequest())
            ->withName("namespace-0001")
            ->withDescription(null)
            ->withTransactionSetting(null)
            ->withCountUpScript(null)
            ->withLogSetting((new \Gs2\Limit\Model\LogSetting())
                ->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CreateNamespaceRequest;
import io.gs2.limit.result.CreateNamespaceResult;

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

try {
    CreateNamespaceResult result = client.createNamespace(
        new CreateNamespaceRequest()
            .withName("namespace-0001")
            .withDescription(null)
            .withTransactionSetting(null)
            .withCountUpScript(null)
            .withLogSetting(new io.gs2.limit.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
    new Gs2.Gs2Limit.Request.CreateNamespaceRequest()
        .WithName("namespace-0001")
        .WithDescription(null)
        .WithTransactionSetting(null)
        .WithCountUpScript(null)
        .WithLogSetting(new Gs2.Gs2Limit.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;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.createNamespace(
        new Gs2Limit.CreateNamespaceRequest()
            .withName("namespace-0001")
            .withDescription(null)
            .withTransactionSetting(null)
            .withCountUpScript(null)
            .withLogSetting(new Gs2Limit.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.create_namespace(
        limit.CreateNamespaceRequest()
            .with_name('namespace-0001')
            .with_description(None)
            .with_transaction_setting(None)
            .with_count_up_script(None)
            .with_log_setting(
                limit.LogSetting()
                    .with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.create_namespace({
    name="namespace-0001",
    description=nil,
    transactionSetting=nil,
    countUpScript=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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

api_result_handler = client.create_namespace_async({
    name="namespace-0001",
    description=nil,
    transactionSetting=nil,
    countUpScript=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

ネームスペースの状態を取得<br>

指定されたネームスペースの現在の状態を取得します。<br>
これには、ネームスペースがアクティブか、保留中か、またはその他の状態にあるかが含まれます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| status | string |  |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.GetNamespaceStatus(
    &limit.GetNamespaceStatusRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
status := result.Status

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\GetNamespaceStatusRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->getNamespaceStatus(
        (new GetNamespaceStatusRequest())
            ->withNamespaceName("namespace-0001")
    );
    $status = $result->getStatus();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.GetNamespaceStatusRequest;
import io.gs2.limit.result.GetNamespaceStatusResult;

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

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

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
    new Gs2.Gs2Limit.Request.GetNamespaceStatusRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.getNamespaceStatus(
        new Gs2Limit.GetNamespaceStatusRequest()
            .withNamespaceName("namespace-0001")
    );
    const status = result.getStatus();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

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


```

**GS2-Script**
```lua

client = gs2('limit')

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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

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

ネームスペースを取得<br>

指定されたネームスペースの詳細情報を取得します。<br>
これには、ネームスペースの名前、説明、およびその他の設定情報が含まれます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Namespace](#namespace) | ネームスペース |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.GetNamespace(
    &limit.GetNamespaceRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\GetNamespaceRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->getNamespace(
        (new GetNamespaceRequest())
            ->withNamespaceName("namespace-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.GetNamespaceRequest;
import io.gs2.limit.result.GetNamespaceResult;

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

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

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
    new Gs2.Gs2Limit.Request.GetNamespaceRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.getNamespace(
        new Gs2Limit.GetNamespaceRequest()
            .withNamespaceName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

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


```

**GS2-Script**
```lua

client = gs2('limit')

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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

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

ネームスペースを更新<br>

指定されたネームスペースの設定を更新します。<br>
ネームスペースの説明や、特定の設定を変更することができます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| description | string |  | |  |  ~ 1024文字 | 説明文 |
| transactionSetting | [TransactionSetting](#transactionsetting) |  | |  |  | トランザクション設定<br>カウントアップやカウンターリセットなどの回数制限操作時のトランザクションの処理方法を制御する設定です。 |
| countUpScript | [ScriptSetting](#scriptsetting) |  | |  |  | カウントアップするときに実行するスクリプトの設定<br>Script トリガーリファレンス - [`countUp`](../script/#countup) |
| logSetting | [LogSetting](#logsetting) |  | |  |  | ログの出力設定<br>回数制限操作のAPIリクエスト・レスポンスログを出力するためのGS2-Logネームスペースを指定します。デバッグや分析のためにカウンターの増加、リセット、制限チェックの追跡に便利です。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Namespace](#namespace) | 更新したネームスペース |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.UpdateNamespace(
    &limit.UpdateNamespaceRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Description: pointy.String("description1"),
        TransactionSetting: nil,
        CountUpScript: nil,
        LogSetting: &limit.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\UpdateNamespaceRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->updateNamespace(
        (new UpdateNamespaceRequest())
            ->withNamespaceName("namespace-0001")
            ->withDescription("description1")
            ->withTransactionSetting(null)
            ->withCountUpScript(null)
            ->withLogSetting((new \Gs2\Limit\Model\LogSetting())
                ->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.UpdateNamespaceRequest;
import io.gs2.limit.result.UpdateNamespaceResult;

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

try {
    UpdateNamespaceResult result = client.updateNamespace(
        new UpdateNamespaceRequest()
            .withNamespaceName("namespace-0001")
            .withDescription("description1")
            .withTransactionSetting(null)
            .withCountUpScript(null)
            .withLogSetting(new io.gs2.limit.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
    new Gs2.Gs2Limit.Request.UpdateNamespaceRequest()
        .WithNamespaceName("namespace-0001")
        .WithDescription("description1")
        .WithTransactionSetting(null)
        .WithCountUpScript(null)
        .WithLogSetting(new Gs2.Gs2Limit.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;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.updateNamespace(
        new Gs2Limit.UpdateNamespaceRequest()
            .withNamespaceName("namespace-0001")
            .withDescription("description1")
            .withTransactionSetting(null)
            .withCountUpScript(null)
            .withLogSetting(new Gs2Limit.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.update_namespace(
        limit.UpdateNamespaceRequest()
            .with_namespace_name('namespace-0001')
            .with_description('description1')
            .with_transaction_setting(None)
            .with_count_up_script(None)
            .with_log_setting(
                limit.LogSetting()
                    .with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.update_namespace({
    namespaceName="namespace-0001",
    description="description1",
    transactionSetting=nil,
    countUpScript=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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

api_result_handler = client.update_namespace_async({
    namespaceName="namespace-0001",
    description="description1",
    transactionSetting=nil,
    countUpScript=nil,
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
    },
})

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

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

result = api_result.result
item = result.item;

```




---

### deleteNamespace

ネームスペースを削除<br>

指定されたネームスペースを削除します。<br>
この操作は不可逆であり、削除されたネームスペースに関連するすべてのデータは回復不能になります。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Namespace](#namespace) | 削除したネームスペース |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.DeleteNamespace(
    &limit.DeleteNamespaceRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\DeleteNamespaceRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->deleteNamespace(
        (new DeleteNamespaceRequest())
            ->withNamespaceName("namespace-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DeleteNamespaceRequest;
import io.gs2.limit.result.DeleteNamespaceResult;

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

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

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
    new Gs2.Gs2Limit.Request.DeleteNamespaceRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.deleteNamespace(
        new Gs2Limit.DeleteNamespaceRequest()
            .withNamespaceName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

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


```

**GS2-Script**
```lua

client = gs2('limit')

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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

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

|  | 型 | 説明 |
| --- | --- | --- |
| item | string | バージョン |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.GetServiceVersion(
    &limit.GetServiceVersionRequest {
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\GetServiceVersionRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->getServiceVersion(
        (new GetServiceVersionRequest())
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.GetServiceVersionRequest;
import io.gs2.limit.result.GetServiceVersionResult;

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

try {
    GetServiceVersionResult result = client.getServiceVersion(
        new GetServiceVersionRequest()
    );
    String item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.GetServiceVersionResult> asyncResult = null;
yield return client.GetServiceVersion(
    new Gs2.Gs2Limit.Request.GetServiceVersionRequest(),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.getServiceVersion(
        new Gs2Limit.GetServiceVersionRequest()
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

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


```

**GS2-Script**
```lua

client = gs2('limit')

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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

api_result_handler = client.get_service_version_async({
})

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

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

result = api_result.result
item = result.item;

```




---

### dumpUserDataByUserId

指定したユーザーIDに紐づくデータのダンプを取得<br>

個人情報保護の法的要件を満たすために使用したり、データのバックアップや移行に使用できます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| userId | string |  | ✓|  |  ~ 128文字 | ユーザーID |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.DumpUserDataByUserId(
    &limit.DumpUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\DumpUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->dumpUserDataByUserId(
        (new DumpUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DumpUserDataByUserIdRequest;
import io.gs2.limit.result.DumpUserDataByUserIdResult;

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

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

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.DumpUserDataByUserIdResult> asyncResult = null;
yield return client.DumpUserDataByUserId(
    new Gs2.Gs2Limit.Request.DumpUserDataByUserIdRequest()
        .WithUserId("user-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.dumpUserDataByUserId(
        new Gs2Limit.DumpUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

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


```

**GS2-Script**
```lua

client = gs2('limit')

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

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

result = api_result.result

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

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

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

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

result = api_result.result

```




---

### checkDumpUserDataByUserId

指定したユーザーIDに紐づくデータのダンプが完了しているか確認



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| userId | string |  | ✓|  |  ~ 128文字 | ユーザーID |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| url | string | 出力データのURL |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.CheckDumpUserDataByUserId(
    &limit.CheckDumpUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
url := result.Url

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\CheckDumpUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->checkDumpUserDataByUserId(
        (new CheckDumpUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
    $url = $result->getUrl();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CheckDumpUserDataByUserIdRequest;
import io.gs2.limit.result.CheckDumpUserDataByUserIdResult;

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

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

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.CheckDumpUserDataByUserIdResult> asyncResult = null;
yield return client.CheckDumpUserDataByUserId(
    new Gs2.Gs2Limit.Request.CheckDumpUserDataByUserIdRequest()
        .WithUserId("user-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var url = result.Url;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

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

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

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


```

**GS2-Script**
```lua

client = gs2('limit')

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

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

result = api_result.result
url = result.url;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

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

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

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

result = api_result.result
url = result.url;

```




---

### cleanUserDataByUserId

ユーザーデータの完全削除<br>

指定されたユーザーIDに紐づくデータのクリーニングを実行します。<br>
これにより、特定のユーザーデータをプロジェクトから安全に削除できます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| userId | string |  | ✓|  |  ~ 128文字 | ユーザーID |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.CleanUserDataByUserId(
    &limit.CleanUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\CleanUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->cleanUserDataByUserId(
        (new CleanUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CleanUserDataByUserIdRequest;
import io.gs2.limit.result.CleanUserDataByUserIdResult;

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

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

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.CleanUserDataByUserIdResult> asyncResult = null;
yield return client.CleanUserDataByUserId(
    new Gs2.Gs2Limit.Request.CleanUserDataByUserIdRequest()
        .WithUserId("user-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.cleanUserDataByUserId(
        new Gs2Limit.CleanUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

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


```

**GS2-Script**
```lua

client = gs2('limit')

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

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

result = api_result.result

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

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

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

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

result = api_result.result

```




---

### checkCleanUserDataByUserId

指定したユーザーIDのユーザーデータの完全削除が完了しているか確認



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| userId | string |  | ✓|  |  ~ 128文字 | ユーザーID |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.CheckCleanUserDataByUserId(
    &limit.CheckCleanUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\CheckCleanUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->checkCleanUserDataByUserId(
        (new CheckCleanUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CheckCleanUserDataByUserIdRequest;
import io.gs2.limit.result.CheckCleanUserDataByUserIdResult;

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

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

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.CheckCleanUserDataByUserIdResult> asyncResult = null;
yield return client.CheckCleanUserDataByUserId(
    new Gs2.Gs2Limit.Request.CheckCleanUserDataByUserIdRequest()
        .WithUserId("user-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.checkCleanUserDataByUserId(
        new Gs2Limit.CheckCleanUserDataByUserIdRequest()
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

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


```

**GS2-Script**
```lua

client = gs2('limit')

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

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

result = api_result.result

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

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

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

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

result = api_result.result

```




---

### prepareImportUserDataByUserId

指定したユーザーIDに紐づくデータのインポートを準備<br>

インポートに使用できるデータは GS2 によってエクスポートして取得したデータに限定され、古いデータはインポートに失敗する可能性があります。<br>
エクスポートしたユーザーIDと異なるユーザーIDでインポートすることができますが、ユーザーデータのペイロード内にユーザーIDが含まれる場合はその限りではありません。<br>

このAPIの戻り値で応答されたURLにエクスポートした zip ファイルをアップロードし、importUserDataByUserId を呼び出すことで実際のインポート処理を開始できます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| userId | string |  | ✓|  |  ~ 128文字 | ユーザーID |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| uploadToken | string | アップロード後に結果を反映する際に使用するトークン |
| uploadUrl | string | ユーザーデータアップロード処理の実行に使用するURL |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.PrepareImportUserDataByUserId(
    &limit.PrepareImportUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
uploadToken := result.UploadToken
uploadUrl := result.UploadUrl

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\PrepareImportUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->prepareImportUserDataByUserId(
        (new PrepareImportUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
    $uploadToken = $result->getUploadToken();
    $uploadUrl = $result->getUploadUrl();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.PrepareImportUserDataByUserIdRequest;
import io.gs2.limit.result.PrepareImportUserDataByUserIdResult;

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

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

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.PrepareImportUserDataByUserIdResult> asyncResult = null;
yield return client.PrepareImportUserDataByUserId(
    new Gs2.Gs2Limit.Request.PrepareImportUserDataByUserIdRequest()
        .WithUserId("user-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var uploadToken = result.UploadToken;
var uploadUrl = result.UploadUrl;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

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

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

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


```

**GS2-Script**
```lua

client = gs2('limit')

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

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

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

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

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

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

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

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

```




---

### importUserDataByUserId

指定したユーザーIDに紐づくデータのインポートを実行<br>

インポートに使用できるデータは GS2 によってエクスポートして取得したデータに限定され、古いデータはインポートに失敗する可能性があります。<br>
エクスポートしたユーザーIDと異なるユーザーIDでインポートすることができますが、ユーザーデータのペイロード内にユーザーIDが含まれる場合はその限りではありません。<br>

このAPIを呼び出す前に prepareImportUserDataByUserId を呼び出して、アップロード準備を完了させる必要があります。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| userId | string |  | ✓|  |  ~ 128文字 | ユーザーID |
| uploadToken | string |  | ✓|  |  ~ 1024文字 | アップロード準備で受け取ったトークン |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.ImportUserDataByUserId(
    &limit.ImportUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
        UploadToken: pointy.String("upload-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\ImportUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->importUserDataByUserId(
        (new ImportUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withUploadToken("upload-0001")
            ->withTimeOffsetToken(null)
    );
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.ImportUserDataByUserIdRequest;
import io.gs2.limit.result.ImportUserDataByUserIdResult;

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

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

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.ImportUserDataByUserIdResult> asyncResult = null;
yield return client.ImportUserDataByUserId(
    new Gs2.Gs2Limit.Request.ImportUserDataByUserIdRequest()
        .WithUserId("user-0001")
        .WithUploadToken("upload-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

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

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

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


```

**GS2-Script**
```lua

client = gs2('limit')

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

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

result = api_result.result

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

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

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

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

result = api_result.result

```




---

### checkImportUserDataByUserId

指定したユーザーIDに紐づくデータのインポートが完了しているか確認



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| userId | string |  | ✓|  |  ~ 128文字 | ユーザーID |
| uploadToken | string |  | ✓|  |  ~ 1024文字 | アップロード準備で受け取ったトークン |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| url | string | 出力ログのURL |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.CheckImportUserDataByUserId(
    &limit.CheckImportUserDataByUserIdRequest {
        UserId: pointy.String("user-0001"),
        UploadToken: pointy.String("upload-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
url := result.Url

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\CheckImportUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->checkImportUserDataByUserId(
        (new CheckImportUserDataByUserIdRequest())
            ->withUserId("user-0001")
            ->withUploadToken("upload-0001")
            ->withTimeOffsetToken(null)
    );
    $url = $result->getUrl();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CheckImportUserDataByUserIdRequest;
import io.gs2.limit.result.CheckImportUserDataByUserIdResult;

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

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

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.CheckImportUserDataByUserIdResult> asyncResult = null;
yield return client.CheckImportUserDataByUserId(
    new Gs2.Gs2Limit.Request.CheckImportUserDataByUserIdRequest()
        .WithUserId("user-0001")
        .WithUploadToken("upload-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var url = result.Url;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

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

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

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


```

**GS2-Script**
```lua

client = gs2('limit')

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

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

result = api_result.result
url = result.url;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

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

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

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

result = api_result.result
url = result.url;

```




---

### describeCounters

カウンターの一覧を取得<br>

リクエストしたユーザーのカウンターのページネーション付きリストを取得します。<br>
回数制限モデル名でフィルタリングすることで、特定のモデルのカウンターのみを取得できます。<br>
各カウンターは、特定のアクションが実行された回数を追跡します。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| accessToken | string |  | ✓|  |  ~ 128文字 | アクセストークン |
| limitName | string |  | |  |  ~ 128文字 | 回数制限モデル名<br>回数制限モデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 1000 | データの取得件数 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;Counter&gt;](#counter) | カウンターのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.DescribeCounters(
    &limit.DescribeCountersRequest {
        NamespaceName: pointy.String("namespace-0001"),
        AccessToken: pointy.String("accessToken-0001"),
        LimitName: pointy.String("daily"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\DescribeCountersRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->describeCounters(
        (new DescribeCountersRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
            ->withLimitName("daily")
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DescribeCountersRequest;
import io.gs2.limit.result.DescribeCountersResult;

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

try {
    DescribeCountersResult result = client.describeCounters(
        new DescribeCountersRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withLimitName("daily")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Counter> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.DescribeCountersResult> asyncResult = null;
yield return client.DescribeCounters(
    new Gs2.Gs2Limit.Request.DescribeCountersRequest()
        .WithNamespaceName("namespace-0001")
        .WithAccessToken("accessToken-0001")
        .WithLimitName("daily")
        .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;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.describeCounters(
        new Gs2Limit.DescribeCountersRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withLimitName("daily")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.describe_counters(
        limit.DescribeCountersRequest()
            .with_namespace_name('namespace-0001')
            .with_access_token('accessToken-0001')
            .with_limit_name('daily')
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.describe_counters({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    limitName="daily",
    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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

api_result_handler = client.describe_counters_async({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    limitName="daily",
    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;

```




---

### describeCountersByUserId

ユーザーIDを指定してカウンターの一覧を取得<br>

指定されたユーザーのカウンターのページネーション付きリストを取得します。<br>
回数制限モデル名でフィルタリングできます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| userId | string |  | ✓|  |  ~ 128文字 | ユーザーID |
| limitName | string |  | |  |  ~ 128文字 | 回数制限モデル名<br>回数制限モデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 1000 | データの取得件数 |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;Counter&gt;](#counter) | カウンターのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.DescribeCountersByUserId(
    &limit.DescribeCountersByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        LimitName: pointy.String("daily"),
        PageToken: nil,
        Limit: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\DescribeCountersByUserIdRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->describeCountersByUserId(
        (new DescribeCountersByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withLimitName("daily")
            ->withPageToken(null)
            ->withLimit(null)
            ->withTimeOffsetToken(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DescribeCountersByUserIdRequest;
import io.gs2.limit.result.DescribeCountersByUserIdResult;

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

try {
    DescribeCountersByUserIdResult result = client.describeCountersByUserId(
        new DescribeCountersByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withLimitName("daily")
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    List<Counter> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.DescribeCountersByUserIdResult> asyncResult = null;
yield return client.DescribeCountersByUserId(
    new Gs2.Gs2Limit.Request.DescribeCountersByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithLimitName("daily")
        .WithPageToken(null)
        .WithLimit(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.describeCountersByUserId(
        new Gs2Limit.DescribeCountersByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withLimitName("daily")
            .withPageToken(null)
            .withLimit(null)
            .withTimeOffsetToken(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.describe_counters_by_user_id(
        limit.DescribeCountersByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_limit_name('daily')
            .with_page_token(None)
            .with_limit(None)
            .with_time_offset_token(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

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

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

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

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

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

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

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

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

```




---

### getCounter

カウンターを取得<br>

指定された回数制限モデルとカウンター名に対するリクエストユーザーのカウンターを取得します。<br>
現在のカウント値を返します。カウンターが存在しない場合、データは返されません。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| limitName | string |  | ✓|  |  ~ 128文字 | 回数制限モデル名<br>このカウンターが属する回数制限モデルの名前です。このカウンターの値に適用されるリセットスケジュール（毎日、毎週、毎月など）を決定します。 |
| accessToken | string |  | ✓|  |  ~ 128文字 | アクセストークン |
| counterName | string |  | ✓|  |  ~ 128文字 | カウンターの名前<br>回数制限モデル内でこのカウンターを一意に識別する名前です。同じ回数制限モデルを異なる名前の複数のカウンターで共有でき、個別の回数制限モデルを作成せずに別々の使用回数追跡（例：クエストごとや商品ごとに1カウンター）が可能です。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Counter](#counter) | カウンター |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.GetCounter(
    &limit.GetCounterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        LimitName: pointy.String("daily"),
        AccessToken: pointy.String("accessToken-0001"),
        CounterName: pointy.String("counter1"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\GetCounterRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->getCounter(
        (new GetCounterRequest())
            ->withNamespaceName("namespace-0001")
            ->withLimitName("daily")
            ->withAccessToken("accessToken-0001")
            ->withCounterName("counter1")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.GetCounterRequest;
import io.gs2.limit.result.GetCounterResult;

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

try {
    GetCounterResult result = client.getCounter(
        new GetCounterRequest()
            .withNamespaceName("namespace-0001")
            .withLimitName("daily")
            .withAccessToken("accessToken-0001")
            .withCounterName("counter1")
    );
    Counter item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.GetCounterResult> asyncResult = null;
yield return client.GetCounter(
    new Gs2.Gs2Limit.Request.GetCounterRequest()
        .WithNamespaceName("namespace-0001")
        .WithLimitName("daily")
        .WithAccessToken("accessToken-0001")
        .WithCounterName("counter1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.getCounter(
        new Gs2Limit.GetCounterRequest()
            .withNamespaceName("namespace-0001")
            .withLimitName("daily")
            .withAccessToken("accessToken-0001")
            .withCounterName("counter1")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.get_counter(
        limit.GetCounterRequest()
            .with_namespace_name('namespace-0001')
            .with_limit_name('daily')
            .with_access_token('accessToken-0001')
            .with_counter_name('counter1')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.get_counter({
    namespaceName="namespace-0001",
    limitName="daily",
    accessToken="accessToken-0001",
    counterName="counter1",
})

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

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

api_result_handler = client.get_counter_async({
    namespaceName="namespace-0001",
    limitName="daily",
    accessToken="accessToken-0001",
    counterName="counter1",
})

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;

```




---

### getCounterByUserId

ユーザーIDを指定してカウンターを取得<br>

指定された回数制限モデルとカウンター名に対するユーザーのカウンターを取得します。<br>
現在のカウント値を返します。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| limitName | string |  | ✓|  |  ~ 128文字 | 回数制限モデル名<br>このカウンターが属する回数制限モデルの名前です。このカウンターの値に適用されるリセットスケジュール（毎日、毎週、毎月など）を決定します。 |
| userId | string |  | ✓|  |  ~ 128文字 | ユーザーID |
| counterName | string |  | ✓|  |  ~ 128文字 | カウンターの名前<br>回数制限モデル内でこのカウンターを一意に識別する名前です。同じ回数制限モデルを異なる名前の複数のカウンターで共有でき、個別の回数制限モデルを作成せずに別々の使用回数追跡（例：クエストごとや商品ごとに1カウンター）が可能です。 |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Counter](#counter) | カウンター |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.GetCounterByUserId(
    &limit.GetCounterByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        LimitName: pointy.String("daily"),
        UserId: pointy.String("user-0001"),
        CounterName: pointy.String("counter2"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\GetCounterByUserIdRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->getCounterByUserId(
        (new GetCounterByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withLimitName("daily")
            ->withUserId("user-0001")
            ->withCounterName("counter2")
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.GetCounterByUserIdRequest;
import io.gs2.limit.result.GetCounterByUserIdResult;

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

try {
    GetCounterByUserIdResult result = client.getCounterByUserId(
        new GetCounterByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withLimitName("daily")
            .withUserId("user-0001")
            .withCounterName("counter2")
            .withTimeOffsetToken(null)
    );
    Counter item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.GetCounterByUserIdResult> asyncResult = null;
yield return client.GetCounterByUserId(
    new Gs2.Gs2Limit.Request.GetCounterByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithLimitName("daily")
        .WithUserId("user-0001")
        .WithCounterName("counter2")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.getCounterByUserId(
        new Gs2Limit.GetCounterByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withLimitName("daily")
            .withUserId("user-0001")
            .withCounterName("counter2")
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.get_counter_by_user_id(
        limit.GetCounterByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_limit_name('daily')
            .with_user_id('user-0001')
            .with_counter_name('counter2')
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.get_counter_by_user_id({
    namespaceName="namespace-0001",
    limitName="daily",
    userId="user-0001",
    counterName="counter2",
    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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

api_result_handler = client.get_counter_by_user_id_async({
    namespaceName="namespace-0001",
    limitName="daily",
    userId="user-0001",
    counterName="counter2",
    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;

```




---

### countUp

カウントアップ<br>

リクエストしたユーザーのカウンターを指定されたカウントアップ値だけ増加させます。<br>
maxValue が指定された場合、カウンターはその上限を超えません。操作が最大値を超える場合は Overflow エラーが返されます。<br>
カウンターがまだ存在しない場合、カウント 0 で自動的に作成された後に増加します。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| limitName | string |  | ✓|  |  ~ 128文字 | 回数制限モデル名<br>このカウンターが属する回数制限モデルの名前です。このカウンターの値に適用されるリセットスケジュール（毎日、毎週、毎月など）を決定します。 |
| counterName | string |  | ✓|  |  ~ 128文字 | カウンターの名前<br>回数制限モデル内でこのカウンターを一意に識別する名前です。同じ回数制限モデルを異なる名前の複数のカウンターで共有でき、個別の回数制限モデルを作成せずに別々の使用回数追跡（例：クエストごとや商品ごとに1カウンター）が可能です。 |
| accessToken | string |  | ✓|  |  ~ 128文字 | アクセストークン |
| countUpValue | int |  | | 1 | 1 ~ 2147483646 | カウントアップする量 |
| maxValue | int |  | |  | 1 ~ 2147483646 | カウントアップを許容する最大値 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Counter](#counter) | カウントを増やしたカウンター |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.CountUp(
    &limit.CountUpRequest {
        NamespaceName: pointy.String("namespace-0001"),
        LimitName: pointy.String("daily"),
        CounterName: pointy.String("counter1"),
        AccessToken: pointy.String("accessToken-0001"),
        CountUpValue: pointy.Int32(1),
        MaxValue: pointy.Int32(100),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\CountUpRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->countUp(
        (new CountUpRequest())
            ->withNamespaceName("namespace-0001")
            ->withLimitName("daily")
            ->withCounterName("counter1")
            ->withAccessToken("accessToken-0001")
            ->withCountUpValue(1)
            ->withMaxValue(100)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CountUpRequest;
import io.gs2.limit.result.CountUpResult;

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

try {
    CountUpResult result = client.countUp(
        new CountUpRequest()
            .withNamespaceName("namespace-0001")
            .withLimitName("daily")
            .withCounterName("counter1")
            .withAccessToken("accessToken-0001")
            .withCountUpValue(1)
            .withMaxValue(100)
    );
    Counter item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.CountUpResult> asyncResult = null;
yield return client.CountUp(
    new Gs2.Gs2Limit.Request.CountUpRequest()
        .WithNamespaceName("namespace-0001")
        .WithLimitName("daily")
        .WithCounterName("counter1")
        .WithAccessToken("accessToken-0001")
        .WithCountUpValue(1)
        .WithMaxValue(100),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.countUp(
        new Gs2Limit.CountUpRequest()
            .withNamespaceName("namespace-0001")
            .withLimitName("daily")
            .withCounterName("counter1")
            .withAccessToken("accessToken-0001")
            .withCountUpValue(1)
            .withMaxValue(100)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.count_up(
        limit.CountUpRequest()
            .with_namespace_name('namespace-0001')
            .with_limit_name('daily')
            .with_counter_name('counter1')
            .with_access_token('accessToken-0001')
            .with_count_up_value(1)
            .with_max_value(100)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.count_up({
    namespaceName="namespace-0001",
    limitName="daily",
    counterName="counter1",
    accessToken="accessToken-0001",
    countUpValue=1,
    maxValue=100,
})

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

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

api_result_handler = client.count_up_async({
    namespaceName="namespace-0001",
    limitName="daily",
    counterName="counter1",
    accessToken="accessToken-0001",
    countUpValue=1,
    maxValue=100,
})

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;

```




---

### countUpByUserId

ユーザーIDを指定してカウントアップ<br>

指定されたユーザーのカウンターを指定されたカウントアップ値だけ増加させます。<br>
maxValue が指定された場合、カウンターはその上限を超えません。操作が最大値を超える場合は Overflow エラーが返されます。<br>
カウンターがまだ存在しない場合、自動的に作成されます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| limitName | string |  | ✓|  |  ~ 128文字 | 回数制限モデル名<br>このカウンターが属する回数制限モデルの名前です。このカウンターの値に適用されるリセットスケジュール（毎日、毎週、毎月など）を決定します。 |
| counterName | string |  | ✓|  |  ~ 128文字 | カウンターの名前<br>回数制限モデル内でこのカウンターを一意に識別する名前です。同じ回数制限モデルを異なる名前の複数のカウンターで共有でき、個別の回数制限モデルを作成せずに別々の使用回数追跡（例：クエストごとや商品ごとに1カウンター）が可能です。 |
| userId | string |  | ✓|  |  ~ 128文字 | ユーザーID |
| countUpValue | int |  | | 1 | 1 ~ 2147483646 | カウントアップする量 |
| maxValue | int |  | |  | 1 ~ 2147483646 | カウントアップを許容する最大値 |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Counter](#counter) | カウントを増やしたカウンター |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.CountUpByUserId(
    &limit.CountUpByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        LimitName: pointy.String("daily"),
        CounterName: pointy.String("counter2"),
        UserId: pointy.String("user-0001"),
        CountUpValue: pointy.Int32(2),
        MaxValue: pointy.Int32(100),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\CountUpByUserIdRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->countUpByUserId(
        (new CountUpByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withLimitName("daily")
            ->withCounterName("counter2")
            ->withUserId("user-0001")
            ->withCountUpValue(2)
            ->withMaxValue(100)
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CountUpByUserIdRequest;
import io.gs2.limit.result.CountUpByUserIdResult;

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

try {
    CountUpByUserIdResult result = client.countUpByUserId(
        new CountUpByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withLimitName("daily")
            .withCounterName("counter2")
            .withUserId("user-0001")
            .withCountUpValue(2)
            .withMaxValue(100)
            .withTimeOffsetToken(null)
    );
    Counter item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.CountUpByUserIdResult> asyncResult = null;
yield return client.CountUpByUserId(
    new Gs2.Gs2Limit.Request.CountUpByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithLimitName("daily")
        .WithCounterName("counter2")
        .WithUserId("user-0001")
        .WithCountUpValue(2)
        .WithMaxValue(100)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.countUpByUserId(
        new Gs2Limit.CountUpByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withLimitName("daily")
            .withCounterName("counter2")
            .withUserId("user-0001")
            .withCountUpValue(2)
            .withMaxValue(100)
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.count_up_by_user_id(
        limit.CountUpByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_limit_name('daily')
            .with_counter_name('counter2')
            .with_user_id('user-0001')
            .with_count_up_value(2)
            .with_max_value(100)
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.count_up_by_user_id({
    namespaceName="namespace-0001",
    limitName="daily",
    counterName="counter2",
    userId="user-0001",
    countUpValue=2,
    maxValue=100,
    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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

api_result_handler = client.count_up_by_user_id_async({
    namespaceName="namespace-0001",
    limitName="daily",
    counterName="counter2",
    userId="user-0001",
    countUpValue=2,
    maxValue=100,
    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;

```




---

### countDownByUserId

ユーザーIDを指定してカウントダウン<br>

指定されたユーザーのカウンターを指定されたカウントダウン値だけ減少させます。<br>
カウンター値は 0 を下回りません。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| limitName | string |  | ✓|  |  ~ 128文字 | 回数制限モデル名<br>このカウンターが属する回数制限モデルの名前です。このカウンターの値に適用されるリセットスケジュール（毎日、毎週、毎月など）を決定します。 |
| counterName | string |  | ✓|  |  ~ 128文字 | カウンターの名前<br>回数制限モデル内でこのカウンターを一意に識別する名前です。同じ回数制限モデルを異なる名前の複数のカウンターで共有でき、個別の回数制限モデルを作成せずに別々の使用回数追跡（例：クエストごとや商品ごとに1カウンター）が可能です。 |
| userId | string |  | ✓|  |  ~ 128文字 | ユーザーID |
| countDownValue | int |  | | 1 | 1 ~ 2147483646 | カウントダウンする量 |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Counter](#counter) | カウントを増やしたカウンター |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.CountDownByUserId(
    &limit.CountDownByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        LimitName: pointy.String("daily"),
        CounterName: pointy.String("counter2"),
        UserId: pointy.String("user-0001"),
        CountDownValue: pointy.Int32(2),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\CountDownByUserIdRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->countDownByUserId(
        (new CountDownByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withLimitName("daily")
            ->withCounterName("counter2")
            ->withUserId("user-0001")
            ->withCountDownValue(2)
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CountDownByUserIdRequest;
import io.gs2.limit.result.CountDownByUserIdResult;

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

try {
    CountDownByUserIdResult result = client.countDownByUserId(
        new CountDownByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withLimitName("daily")
            .withCounterName("counter2")
            .withUserId("user-0001")
            .withCountDownValue(2)
            .withTimeOffsetToken(null)
    );
    Counter item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.CountDownByUserIdResult> asyncResult = null;
yield return client.CountDownByUserId(
    new Gs2.Gs2Limit.Request.CountDownByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithLimitName("daily")
        .WithCounterName("counter2")
        .WithUserId("user-0001")
        .WithCountDownValue(2)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.countDownByUserId(
        new Gs2Limit.CountDownByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withLimitName("daily")
            .withCounterName("counter2")
            .withUserId("user-0001")
            .withCountDownValue(2)
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.count_down_by_user_id(
        limit.CountDownByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_limit_name('daily')
            .with_counter_name('counter2')
            .with_user_id('user-0001')
            .with_count_down_value(2)
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.count_down_by_user_id({
    namespaceName="namespace-0001",
    limitName="daily",
    counterName="counter2",
    userId="user-0001",
    countDownValue=2,
    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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

api_result_handler = client.count_down_by_user_id_async({
    namespaceName="namespace-0001",
    limitName="daily",
    counterName="counter2",
    userId="user-0001",
    countDownValue=2,
    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;

```




---

### deleteCounterByUserId

ユーザーIDを指定してカウンターを削除<br>

指定されたユーザーのカウンターを削除し、使用回数をリセットします。<br>
これにより、このカウンターに対する回数制限が実質的に解除され、ユーザーは再び 0 からカウントを開始できます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| limitName | string |  | ✓|  |  ~ 128文字 | 回数制限モデル名<br>このカウンターが属する回数制限モデルの名前です。このカウンターの値に適用されるリセットスケジュール（毎日、毎週、毎月など）を決定します。 |
| userId | string |  | ✓|  |  ~ 128文字 | ユーザーID |
| counterName | string |  | ✓|  |  ~ 128文字 | カウンターの名前<br>回数制限モデル内でこのカウンターを一意に識別する名前です。同じ回数制限モデルを異なる名前の複数のカウンターで共有でき、個別の回数制限モデルを作成せずに別々の使用回数追跡（例：クエストごとや商品ごとに1カウンター）が可能です。 |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Counter](#counter) | 削除したカウンター |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.DeleteCounterByUserId(
    &limit.DeleteCounterByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        LimitName: pointy.String("daily"),
        UserId: pointy.String("user-0001"),
        CounterName: pointy.String("counter1"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\DeleteCounterByUserIdRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->deleteCounterByUserId(
        (new DeleteCounterByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withLimitName("daily")
            ->withUserId("user-0001")
            ->withCounterName("counter1")
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DeleteCounterByUserIdRequest;
import io.gs2.limit.result.DeleteCounterByUserIdResult;

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

try {
    DeleteCounterByUserIdResult result = client.deleteCounterByUserId(
        new DeleteCounterByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withLimitName("daily")
            .withUserId("user-0001")
            .withCounterName("counter1")
            .withTimeOffsetToken(null)
    );
    Counter item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.DeleteCounterByUserIdResult> asyncResult = null;
yield return client.DeleteCounterByUserId(
    new Gs2.Gs2Limit.Request.DeleteCounterByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithLimitName("daily")
        .WithUserId("user-0001")
        .WithCounterName("counter1")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.deleteCounterByUserId(
        new Gs2Limit.DeleteCounterByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withLimitName("daily")
            .withUserId("user-0001")
            .withCounterName("counter1")
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.delete_counter_by_user_id(
        limit.DeleteCounterByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_limit_name('daily')
            .with_user_id('user-0001')
            .with_counter_name('counter1')
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.delete_counter_by_user_id({
    namespaceName="namespace-0001",
    limitName="daily",
    userId="user-0001",
    counterName="counter1",
    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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

api_result_handler = client.delete_counter_by_user_id_async({
    namespaceName="namespace-0001",
    limitName="daily",
    userId="user-0001",
    counterName="counter1",
    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;

```




---

### verifyCounter

カウンター値を検証<br>

リクエストしたユーザーのカウンター値が指定された条件を満たすことを検証します。<br>
6つの比較演算子をサポートします：less、lessEqual、greater、greaterEqual、equal、notEqual。<br>
条件が満たされない場合、エラーが返されます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| accessToken | string |  | ✓|  |  ~ 128文字 | アクセストークン |
| limitName | string |  | ✓|  |  ~ 128文字 | 回数制限モデル名<br>このカウンターが属する回数制限モデルの名前です。このカウンターの値に適用されるリセットスケジュール（毎日、毎週、毎月など）を決定します。 |
| counterName | string |  | ✓|  |  ~ 128文字 | カウンターの名前<br>回数制限モデル内でこのカウンターを一意に識別する名前です。同じ回数制限モデルを異なる名前の複数のカウンターで共有でき、個別の回数制限モデルを作成せずに別々の使用回数追跡（例：クエストごとや商品ごとに1カウンター）が可能です。 |
| verifyType | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"less",<br>&nbsp;&nbsp;"lessEqual",<br>&nbsp;&nbsp;"greater",<br>&nbsp;&nbsp;"greaterEqual",<br>&nbsp;&nbsp;"equal",<br>&nbsp;&nbsp;"notEqual"<br>}<br> |  | ✓|  |  | 検証の種類"less": カウンター値が指定値未満であること / "lessEqual": カウンター値が指定値以下であること / "greater": カウンター値が指定値超過であること / "greaterEqual": カウンター値が指定値以上であること / "equal": カウンター値が指定値と一致すること / "notEqual": カウンター値が指定値と一致しないこと /  |
| count | int |  | | 0 | 0 ~ 2147483646 | カウント値<br>このカウンターの現在の使用回数です。countUp操作でインクリメントされ、その際に指定された最大値と比較されます。回数制限モデルのリセットタイミングに達すると自動的にゼロにリセットされます。 |
| multiplyValueSpecifyingQuantity | bool |  | | true |  | 数量指定した際に、検証に使用する値も乗算するか |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Counter](#counter) | 削除したカウンター |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.VerifyCounter(
    &limit.VerifyCounterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        AccessToken: pointy.String("accessToken-0001"),
        LimitName: pointy.String("daily"),
        CounterName: pointy.String("counter2"),
        VerifyType: pointy.String("less"),
        Count: pointy.Int32(10),
        MultiplyValueSpecifyingQuantity: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\VerifyCounterRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->verifyCounter(
        (new VerifyCounterRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
            ->withLimitName("daily")
            ->withCounterName("counter2")
            ->withVerifyType("less")
            ->withCount(10)
            ->withMultiplyValueSpecifyingQuantity(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.VerifyCounterRequest;
import io.gs2.limit.result.VerifyCounterResult;

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

try {
    VerifyCounterResult result = client.verifyCounter(
        new VerifyCounterRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withLimitName("daily")
            .withCounterName("counter2")
            .withVerifyType("less")
            .withCount(10)
            .withMultiplyValueSpecifyingQuantity(null)
    );
    Counter item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.VerifyCounterResult> asyncResult = null;
yield return client.VerifyCounter(
    new Gs2.Gs2Limit.Request.VerifyCounterRequest()
        .WithNamespaceName("namespace-0001")
        .WithAccessToken("accessToken-0001")
        .WithLimitName("daily")
        .WithCounterName("counter2")
        .WithVerifyType("less")
        .WithCount(10)
        .WithMultiplyValueSpecifyingQuantity(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.verifyCounter(
        new Gs2Limit.VerifyCounterRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
            .withLimitName("daily")
            .withCounterName("counter2")
            .withVerifyType("less")
            .withCount(10)
            .withMultiplyValueSpecifyingQuantity(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.verify_counter(
        limit.VerifyCounterRequest()
            .with_namespace_name('namespace-0001')
            .with_access_token('accessToken-0001')
            .with_limit_name('daily')
            .with_counter_name('counter2')
            .with_verify_type('less')
            .with_count(10)
            .with_multiply_value_specifying_quantity(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.verify_counter({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    limitName="daily",
    counterName="counter2",
    verifyType="less",
    count=10,
    multiplyValueSpecifyingQuantity=nil,
})

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

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

api_result_handler = client.verify_counter_async({
    namespaceName="namespace-0001",
    accessToken="accessToken-0001",
    limitName="daily",
    counterName="counter2",
    verifyType="less",
    count=10,
    multiplyValueSpecifyingQuantity=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;

```




---

### verifyCounterByUserId

ユーザーIDを指定してカウンター値を検証<br>

指定されたユーザーのカウンター値が指定された条件を満たすことを検証します。<br>
6つの比較演算子をサポートします：less、lessEqual、greater、greaterEqual、equal、notEqual。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| userId | string |  | ✓|  |  ~ 128文字 | ユーザーID |
| limitName | string |  | ✓|  |  ~ 128文字 | 回数制限モデル名<br>このカウンターが属する回数制限モデルの名前です。このカウンターの値に適用されるリセットスケジュール（毎日、毎週、毎月など）を決定します。 |
| counterName | string |  | ✓|  |  ~ 128文字 | カウンターの名前<br>回数制限モデル内でこのカウンターを一意に識別する名前です。同じ回数制限モデルを異なる名前の複数のカウンターで共有でき、個別の回数制限モデルを作成せずに別々の使用回数追跡（例：クエストごとや商品ごとに1カウンター）が可能です。 |
| verifyType | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"less",<br>&nbsp;&nbsp;"lessEqual",<br>&nbsp;&nbsp;"greater",<br>&nbsp;&nbsp;"greaterEqual",<br>&nbsp;&nbsp;"equal",<br>&nbsp;&nbsp;"notEqual"<br>}<br> |  | ✓|  |  | 検証の種類"less": カウンター値が指定値未満であること / "lessEqual": カウンター値が指定値以下であること / "greater": カウンター値が指定値超過であること / "greaterEqual": カウンター値が指定値以上であること / "equal": カウンター値が指定値と一致すること / "notEqual": カウンター値が指定値と一致しないこと /  |
| count | int |  | | 0 | 0 ~ 2147483646 | カウント値<br>このカウンターの現在の使用回数です。countUp操作でインクリメントされ、その際に指定された最大値と比較されます。回数制限モデルのリセットタイミングに達すると自動的にゼロにリセットされます。 |
| multiplyValueSpecifyingQuantity | bool |  | | true |  | 数量指定した際に、検証に使用する値も乗算するか |
| timeOffsetToken | string |  | |  |  ~ 1024文字 | タイムオフセットトークン |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [Counter](#counter) | 削除したカウンター |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.VerifyCounterByUserId(
    &limit.VerifyCounterByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        LimitName: pointy.String("daily"),
        CounterName: pointy.String("counter2"),
        VerifyType: pointy.String("less"),
        Count: pointy.Int32(10),
        MultiplyValueSpecifyingQuantity: nil,
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\VerifyCounterByUserIdRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->verifyCounterByUserId(
        (new VerifyCounterByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withLimitName("daily")
            ->withCounterName("counter2")
            ->withVerifyType("less")
            ->withCount(10)
            ->withMultiplyValueSpecifyingQuantity(null)
            ->withTimeOffsetToken(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.VerifyCounterByUserIdRequest;
import io.gs2.limit.result.VerifyCounterByUserIdResult;

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

try {
    VerifyCounterByUserIdResult result = client.verifyCounterByUserId(
        new VerifyCounterByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withLimitName("daily")
            .withCounterName("counter2")
            .withVerifyType("less")
            .withCount(10)
            .withMultiplyValueSpecifyingQuantity(null)
            .withTimeOffsetToken(null)
    );
    Counter item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.VerifyCounterByUserIdResult> asyncResult = null;
yield return client.VerifyCounterByUserId(
    new Gs2.Gs2Limit.Request.VerifyCounterByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithLimitName("daily")
        .WithCounterName("counter2")
        .WithVerifyType("less")
        .WithCount(10)
        .WithMultiplyValueSpecifyingQuantity(null)
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.verifyCounterByUserId(
        new Gs2Limit.VerifyCounterByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withLimitName("daily")
            .withCounterName("counter2")
            .withVerifyType("less")
            .withCount(10)
            .withMultiplyValueSpecifyingQuantity(null)
            .withTimeOffsetToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.verify_counter_by_user_id(
        limit.VerifyCounterByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_limit_name('daily')
            .with_counter_name('counter2')
            .with_verify_type('less')
            .with_count(10)
            .with_multiply_value_specifying_quantity(None)
            .with_time_offset_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.verify_counter_by_user_id({
    namespaceName="namespace-0001",
    userId="user-0001",
    limitName="daily",
    counterName="counter2",
    verifyType="less",
    count=10,
    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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

api_result_handler = client.verify_counter_by_user_id_async({
    namespaceName="namespace-0001",
    userId="user-0001",
    limitName="daily",
    counterName="counter2",
    verifyType="less",
    count=10,
    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;

```




---

### describeLimitModels

回数制限モデルの一覧を取得<br>

現在アクティブな回数制限モデルの一覧を取得します。<br>
モデルはカウンターのリセットタイミング（リセットなし、日次、週次、月次など）と関連設定を定義します。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;LimitModel&gt;](#limitmodel) | 回数制限モデルのリスト |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.DescribeLimitModels(
    &limit.DescribeLimitModelsRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\DescribeLimitModelsRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->describeLimitModels(
        (new DescribeLimitModelsRequest())
            ->withNamespaceName("namespace-0001")
    );
    $items = $result->getItems();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DescribeLimitModelsRequest;
import io.gs2.limit.result.DescribeLimitModelsResult;

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

try {
    DescribeLimitModelsResult result = client.describeLimitModels(
        new DescribeLimitModelsRequest()
            .withNamespaceName("namespace-0001")
    );
    List<LimitModel> items = result.getItems();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.DescribeLimitModelsResult> asyncResult = null;
yield return client.DescribeLimitModels(
    new Gs2.Gs2Limit.Request.DescribeLimitModelsRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.describeLimitModels(
        new Gs2Limit.DescribeLimitModelsRequest()
            .withNamespaceName("namespace-0001")
    );
    const items = result.getItems();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.describe_limit_models(
        limit.DescribeLimitModelsRequest()
            .with_namespace_name('namespace-0001')
    )
    items = result.items
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.describe_limit_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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

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

```




---

### getLimitModel

回数制限モデルを取得<br>

指定された回数制限モデルを取得します。<br>
モデルはこの制限に関連するカウンターのリセットタイプとタイミングを定義します。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| limitName | string |  | ✓|  |  ~ 128文字 | 回数制限モデル名<br>回数制限モデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [LimitModel](#limitmodel) | 回数制限モデル |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.GetLimitModel(
    &limit.GetLimitModelRequest {
        NamespaceName: pointy.String("namespace-0001"),
        LimitName: pointy.String("limit-model-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\GetLimitModelRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->getLimitModel(
        (new GetLimitModelRequest())
            ->withNamespaceName("namespace-0001")
            ->withLimitName("limit-model-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.GetLimitModelRequest;
import io.gs2.limit.result.GetLimitModelResult;

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

try {
    GetLimitModelResult result = client.getLimitModel(
        new GetLimitModelRequest()
            .withNamespaceName("namespace-0001")
            .withLimitName("limit-model-0001")
    );
    LimitModel item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.GetLimitModelResult> asyncResult = null;
yield return client.GetLimitModel(
    new Gs2.Gs2Limit.Request.GetLimitModelRequest()
        .WithNamespaceName("namespace-0001")
        .WithLimitName("limit-model-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.getLimitModel(
        new Gs2Limit.GetLimitModelRequest()
            .withNamespaceName("namespace-0001")
            .withLimitName("limit-model-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.get_limit_model(
        limit.GetLimitModelRequest()
            .with_namespace_name('namespace-0001')
            .with_limit_name('limit-model-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.get_limit_model({
    namespaceName="namespace-0001",
    limitName="limit-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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

api_result_handler = client.get_limit_model_async({
    namespaceName="namespace-0001",
    limitName="limit-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

回数制限モデルマスターを有効化可能なマスターデータ形式でエクスポート<br>

現在アクティブな回数制限モデルマスターを有効化可能な形式でエクスポートします。<br>
エクスポートされたデータは、他のネームスペースのマスターデータ更新やバックアップとして使用できます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [CurrentLimitMaster](#currentlimitmaster) | 有効化可能な回数制限モデルマスター |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.ExportMaster(
    &limit.ExportMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\ExportMasterRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->exportMaster(
        (new ExportMasterRequest())
            ->withNamespaceName("namespace-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.ExportMasterRequest;
import io.gs2.limit.result.ExportMasterResult;

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

try {
    ExportMasterResult result = client.exportMaster(
        new ExportMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    CurrentLimitMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.ExportMasterResult> asyncResult = null;
yield return client.ExportMaster(
    new Gs2.Gs2Limit.Request.ExportMasterRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.exportMaster(
        new Gs2Limit.ExportMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

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


```

**GS2-Script**
```lua

client = gs2('limit')

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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

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;

```




---

### getCurrentLimitMaster

現在アクティブな回数制限モデルマスターを取得<br>

指定されたネームスペースの現在アクティブな回数制限モデルのマスターデータを取得します。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [CurrentLimitMaster](#currentlimitmaster) | 現在アクティブな回数制限モデルのマスターデータ |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.GetCurrentLimitMaster(
    &limit.GetCurrentLimitMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\GetCurrentLimitMasterRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->getCurrentLimitMaster(
        (new GetCurrentLimitMasterRequest())
            ->withNamespaceName("namespace-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.GetCurrentLimitMasterRequest;
import io.gs2.limit.result.GetCurrentLimitMasterResult;

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

try {
    GetCurrentLimitMasterResult result = client.getCurrentLimitMaster(
        new GetCurrentLimitMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    CurrentLimitMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.GetCurrentLimitMasterResult> asyncResult = null;
yield return client.GetCurrentLimitMaster(
    new Gs2.Gs2Limit.Request.GetCurrentLimitMasterRequest()
        .WithNamespaceName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.getCurrentLimitMaster(
        new Gs2Limit.GetCurrentLimitMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.get_current_limit_master(
        limit.GetCurrentLimitMasterRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.get_current_limit_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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

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

```




---

### preUpdateCurrentLimitMaster

現在アクティブな回数制限モデルマスターを更新（3フェーズ版）<br>

1MBを超えるマスターデータをアップロードする場合は、3フェーズで更新を行います。<br>
1. このAPIを実行し、アップロード用のトークンとURLを取得します。<br>
2. 取得したURLに対して、マスターデータをアップロードします。<br>
3. UpdateCurrentLimitMaster にアップロードで取得したトークンを渡して実行し、マスターデータを反映します。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| uploadToken | string | アップロード後に結果を反映する際に使用するトークン |
| uploadUrl | string | アップロード処理の実行に使用するURL |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.PreUpdateCurrentLimitMaster(
    &limit.PreUpdateCurrentLimitMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
uploadToken := result.UploadToken
uploadUrl := result.UploadUrl

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\PreUpdateCurrentLimitMasterRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->preUpdateCurrentLimitMaster(
        (new PreUpdateCurrentLimitMasterRequest())
            ->withNamespaceName("namespace-0001")
    );
    $uploadToken = $result->getUploadToken();
    $uploadUrl = $result->getUploadUrl();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.PreUpdateCurrentLimitMasterRequest;
import io.gs2.limit.result.PreUpdateCurrentLimitMasterResult;

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

try {
    PreUpdateCurrentLimitMasterResult result = client.preUpdateCurrentLimitMaster(
        new PreUpdateCurrentLimitMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    String uploadToken = result.getUploadToken();
    String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.PreUpdateCurrentLimitMasterResult> asyncResult = null;
yield return client.PreUpdateCurrentLimitMaster(
    new Gs2.Gs2Limit.Request.PreUpdateCurrentLimitMasterRequest()
        .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;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.preUpdateCurrentLimitMaster(
        new Gs2Limit.PreUpdateCurrentLimitMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    const uploadToken = result.getUploadToken();
    const uploadUrl = result.getUploadUrl();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.pre_update_current_limit_master(
        limit.PreUpdateCurrentLimitMasterRequest()
            .with_namespace_name('namespace-0001')
    )
    upload_token = result.upload_token
    upload_url = result.upload_url
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.pre_update_current_limit_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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

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

```




---

### updateCurrentLimitMaster

現在アクティブな回数制限モデルのマスターデータを更新<br>

現在アクティブな回数制限モデルのマスターデータを更新します。<br>
2つのモードをサポートします：インライン設定用の 'direct' モードと、3フェーズ更新プロセスで事前にアップロードした設定を適用する 'preUpload' モードです。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| mode | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"direct",<br>&nbsp;&nbsp;"preUpload"<br>}<br> |  | | "direct" |  | 更新モード"direct": マスターデータを直接更新 / "preUpload": マスターデータをアップロードしてから更新 /  |
| settings | string | {mode} == "direct" | ✓※|  |  ~ 5242880 バイト (5MB) | マスターデータ<br>※ mode が "direct" であれば必須 |
| uploadToken | string | {mode} == "preUpload" | ✓※|  |  ~ 1024文字 | 事前アップロードで取得したトークン<br>アップロードしたマスターデータを適用するために使用されます。<br>※ mode が "preUpload" であれば必須 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [CurrentLimitMaster](#currentlimitmaster) | 更新された現在アクティブな回数制限モデルのマスターデータ |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.UpdateCurrentLimitMaster(
    &limit.UpdateCurrentLimitMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Mode: pointy.String("direct"),
        Settings: pointy.String("{\n  \"version\": \"2019-04-05\",\n  \"limitModels\": [\n    {\n      \"name\": \"daily\",\n      \"metadata\": \"DAILY\",\n      \"resetType\": \"daily\",\n      \"resetHour\": 9\n    },\n    {\n      \"name\": \"weekly\",\n      \"metadata\": \"WEEKLY\",\n      \"resetType\": \"weekly\",\n      \"resetDayOfWeek\": \"sunday\",\n      \"resetHour\": 18\n    }\n  ]\n}"),
        UploadToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\UpdateCurrentLimitMasterRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->updateCurrentLimitMaster(
        (new UpdateCurrentLimitMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withMode("direct")
            ->withSettings("{\n  \"version\": \"2019-04-05\",\n  \"limitModels\": [\n    {\n      \"name\": \"daily\",\n      \"metadata\": \"DAILY\",\n      \"resetType\": \"daily\",\n      \"resetHour\": 9\n    },\n    {\n      \"name\": \"weekly\",\n      \"metadata\": \"WEEKLY\",\n      \"resetType\": \"weekly\",\n      \"resetDayOfWeek\": \"sunday\",\n      \"resetHour\": 18\n    }\n  ]\n}")
            ->withUploadToken(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.UpdateCurrentLimitMasterRequest;
import io.gs2.limit.result.UpdateCurrentLimitMasterResult;

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

try {
    UpdateCurrentLimitMasterResult result = client.updateCurrentLimitMaster(
        new UpdateCurrentLimitMasterRequest()
            .withNamespaceName("namespace-0001")
            .withMode("direct")
            .withSettings("{\n  \"version\": \"2019-04-05\",\n  \"limitModels\": [\n    {\n      \"name\": \"daily\",\n      \"metadata\": \"DAILY\",\n      \"resetType\": \"daily\",\n      \"resetHour\": 9\n    },\n    {\n      \"name\": \"weekly\",\n      \"metadata\": \"WEEKLY\",\n      \"resetType\": \"weekly\",\n      \"resetDayOfWeek\": \"sunday\",\n      \"resetHour\": 18\n    }\n  ]\n}")
            .withUploadToken(null)
    );
    CurrentLimitMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.UpdateCurrentLimitMasterResult> asyncResult = null;
yield return client.UpdateCurrentLimitMaster(
    new Gs2.Gs2Limit.Request.UpdateCurrentLimitMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithMode("direct")
        .WithSettings("{\n  \"version\": \"2019-04-05\",\n  \"limitModels\": [\n    {\n      \"name\": \"daily\",\n      \"metadata\": \"DAILY\",\n      \"resetType\": \"daily\",\n      \"resetHour\": 9\n    },\n    {\n      \"name\": \"weekly\",\n      \"metadata\": \"WEEKLY\",\n      \"resetType\": \"weekly\",\n      \"resetDayOfWeek\": \"sunday\",\n      \"resetHour\": 18\n    }\n  ]\n}")
        .WithUploadToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.updateCurrentLimitMaster(
        new Gs2Limit.UpdateCurrentLimitMasterRequest()
            .withNamespaceName("namespace-0001")
            .withMode("direct")
            .withSettings("{\n  \"version\": \"2019-04-05\",\n  \"limitModels\": [\n    {\n      \"name\": \"daily\",\n      \"metadata\": \"DAILY\",\n      \"resetType\": \"daily\",\n      \"resetHour\": 9\n    },\n    {\n      \"name\": \"weekly\",\n      \"metadata\": \"WEEKLY\",\n      \"resetType\": \"weekly\",\n      \"resetDayOfWeek\": \"sunday\",\n      \"resetHour\": 18\n    }\n  ]\n}")
            .withUploadToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.update_current_limit_master(
        limit.UpdateCurrentLimitMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_mode('direct')
            .with_settings('{\n  "version": "2019-04-05",\n  "limitModels": [\n    {\n      "name": "daily",\n      "metadata": "DAILY",\n      "resetType": "daily",\n      "resetHour": 9\n    },\n    {\n      "name": "weekly",\n      "metadata": "WEEKLY",\n      "resetType": "weekly",\n      "resetDayOfWeek": "sunday",\n      "resetHour": 18\n    }\n  ]\n}')
            .with_upload_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.update_current_limit_master({
    namespaceName="namespace-0001",
    mode="direct",
    settings="{\n  \"version\": \"2019-04-05\",\n  \"limitModels\": [\n    {\n      \"name\": \"daily\",\n      \"metadata\": \"DAILY\",\n      \"resetType\": \"daily\",\n      \"resetHour\": 9\n    },\n    {\n      \"name\": \"weekly\",\n      \"metadata\": \"WEEKLY\",\n      \"resetType\": \"weekly\",\n      \"resetDayOfWeek\": \"sunday\",\n      \"resetHour\": 18\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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

api_result_handler = client.update_current_limit_master_async({
    namespaceName="namespace-0001",
    mode="direct",
    settings="{\n  \"version\": \"2019-04-05\",\n  \"limitModels\": [\n    {\n      \"name\": \"daily\",\n      \"metadata\": \"DAILY\",\n      \"resetType\": \"daily\",\n      \"resetHour\": 9\n    },\n    {\n      \"name\": \"weekly\",\n      \"metadata\": \"WEEKLY\",\n      \"resetType\": \"weekly\",\n      \"resetDayOfWeek\": \"sunday\",\n      \"resetHour\": 18\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;

```




---

### updateCurrentLimitMasterFromGitHub

現在アクティブな回数制限モデルマスターをGitHubから更新<br>

指定された GitHub リポジトリからマスターデータを取得して、現在アクティブな回数制限モデルのマスターデータを更新します。<br>
GS2-Key に保存された API キーが認証に使用され、チェックアウトするブランチ、タグ、またはコミットハッシュを指定できます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| checkoutSetting | [GitHubCheckoutSetting](#githubcheckoutsetting) |  | ✓|  |  | GitHubからマスターデータをチェックアウトする設定 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [CurrentLimitMaster](#currentlimitmaster) | 更新された現在アクティブな回数制限モデルのマスターデータ |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.UpdateCurrentLimitMasterFromGitHub(
    &limit.UpdateCurrentLimitMasterFromGitHubRequest {
        NamespaceName: pointy.String("namespace-0001"),
        CheckoutSetting: &limit.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

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\UpdateCurrentLimitMasterFromGitHubRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->updateCurrentLimitMasterFromGitHub(
        (new UpdateCurrentLimitMasterFromGitHubRequest())
            ->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")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.UpdateCurrentLimitMasterFromGitHubRequest;
import io.gs2.limit.result.UpdateCurrentLimitMasterFromGitHubResult;

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

try {
    UpdateCurrentLimitMasterFromGitHubResult result = client.updateCurrentLimitMasterFromGitHub(
        new UpdateCurrentLimitMasterFromGitHubRequest()
            .withNamespaceName("namespace-0001")
            .withCheckoutSetting(new GitHubCheckoutSetting()
                .withApiKeyId("apiKeyId-0001")
                .withRepositoryName("gs2io/master-data")
                .withSourcePath("path/to/file.json")
                .withReferenceType("branch")
                .withBranchName("develop")
            )
    );
    CurrentLimitMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.UpdateCurrentLimitMasterFromGitHubResult> asyncResult = null;
yield return client.UpdateCurrentLimitMasterFromGitHub(
    new Gs2.Gs2Limit.Request.UpdateCurrentLimitMasterFromGitHubRequest()
        .WithNamespaceName("namespace-0001")
        .WithCheckoutSetting(new Gs2.Gs2Limit.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;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.updateCurrentLimitMasterFromGitHub(
        new Gs2Limit.UpdateCurrentLimitMasterFromGitHubRequest()
            .withNamespaceName("namespace-0001")
            .withCheckoutSetting(new Gs2Limit.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);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.update_current_limit_master_from_git_hub(
        limit.UpdateCurrentLimitMasterFromGitHubRequest()
            .with_namespace_name('namespace-0001')
            .with_checkout_setting(limit.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)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.update_current_limit_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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

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

```




---

### describeLimitModelMasters

回数制限モデルマスターの一覧を取得<br>

回数制限モデルマスターのページネーション付きリストを取得します。<br>
名前の接頭辞でフィルタリングできます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| namePrefix | string |  | |  |  ~ 64文字 | 回数制限モデル名のフィルター接頭辞 |
| pageToken | string |  | |  |  ~ 1024文字 | データの取得を開始する位置を指定するトークン |
| limit | int |  | | 30 | 1 ~ 1000 | データの取得件数 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;LimitModelMaster&gt;](#limitmodelmaster) | 回数制限モデルマスターのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.DescribeLimitModelMasters(
    &limit.DescribeLimitModelMastersRequest {
        NamespaceName: pointy.String("namespace-0001"),
        NamePrefix: nil,
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\DescribeLimitModelMastersRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->describeLimitModelMasters(
        (new DescribeLimitModelMastersRequest())
            ->withNamespaceName("namespace-0001")
            ->withNamePrefix(null)
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DescribeLimitModelMastersRequest;
import io.gs2.limit.result.DescribeLimitModelMastersResult;

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

try {
    DescribeLimitModelMastersResult result = client.describeLimitModelMasters(
        new DescribeLimitModelMastersRequest()
            .withNamespaceName("namespace-0001")
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    List<LimitModelMaster> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.DescribeLimitModelMastersResult> asyncResult = null;
yield return client.DescribeLimitModelMasters(
    new Gs2.Gs2Limit.Request.DescribeLimitModelMastersRequest()
        .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;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.describeLimitModelMasters(
        new Gs2Limit.DescribeLimitModelMastersRequest()
            .withNamespaceName("namespace-0001")
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.describe_limit_model_masters(
        limit.DescribeLimitModelMastersRequest()
            .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)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.describe_limit_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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

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

```




---

### createLimitModelMaster

回数制限モデルマスターを新規作成<br>

指定されたリセットタイミング設定で新しい回数制限モデルマスターを作成します。<br>
リセットタイプは notReset、daily、weekly、monthly、days から選択でき、定期リセットのためのリセット時間や曜日/日付を設定できます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| name | string |  | ✓|  |  ~ 128文字 | 回数制限モデル名<br>回数制限モデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| description | string |  | |  |  ~ 1024文字 | 説明文 |
| metadata | string |  | |  |  ~ 2048文字 | メタデータ<br>メタデータには任意の値を設定できます。<br>これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
| resetType | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"notReset",<br>&nbsp;&nbsp;"daily",<br>&nbsp;&nbsp;"weekly",<br>&nbsp;&nbsp;"monthly",<br>&nbsp;&nbsp;"days"<br>}<br> |  | ✓|  |  | リセットタイミング<br>この回数制限モデル配下のカウンター値が自動的にゼロにリセットされるタイミングを決定します。notReset（恒久的、リセットなし）、daily（毎日指定時刻にリセット）、weekly（指定曜日にリセット）、monthly（指定日にリセット）、days（基準日時から一定日数ごとにリセット）から選択します。すべての時刻はUTCです。"notReset": リセットしない / "daily": 毎日 / "weekly": 毎週 / "monthly": 毎月 / "days": 一定日数ごと /  |
| resetDayOfMonth | int | {resetType} == "monthly" | ✓※|  | 1 ~ 31 | リセット日<br>resetTypeが "monthly" の場合にカウンターがリセットされる月の日にちです。1〜31の値が有効です。指定した日がその月の日数を超える場合（例：2月の31日）、その月の最終日にリセットされます。<br>※ resetType が "monthly" であれば必須 |
| resetDayOfWeek | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"sunday",<br>&nbsp;&nbsp;"monday",<br>&nbsp;&nbsp;"tuesday",<br>&nbsp;&nbsp;"wednesday",<br>&nbsp;&nbsp;"thursday",<br>&nbsp;&nbsp;"friday",<br>&nbsp;&nbsp;"saturday"<br>}<br> | {resetType} == "weekly" | ✓※|  |  | リセット曜日<br>resetTypeが "weekly" の場合にカウンターがリセットされる曜日です。この曜日のresetHour（UTC）で指定された時刻にリセットされます。"sunday": 日曜日 / "monday": 月曜日 / "tuesday": 火曜日 / "wednesday": 水曜日 / "thursday": 木曜日 / "friday": 金曜日 / "saturday": 土曜日 / <br>※ resetType が "weekly" であれば必須 |
| resetHour | int | {resetType} in ["monthly", "weekly", "daily"] | ✓※|  | 0 ~ 23 | リセット時刻<br>daily、weekly、monthlyリセットタイプでカウンターがリセットされるUTCの時刻（0〜23）です。例えば0の場合、UTC午前0時にカウンターがリセットされます。<br>※ resetType が "monthly","weekly","daily"であれば 必須 |
| anchorTimestamp | long | {resetType} == "days" | ✓※|  |  | 経過日数のカウントをする基準日時<br>UNIX 時間・ミリ秒<br>※ resetType が "days" であれば必須 |
| days | int | {resetType} == "days" | ✓※|  | 1 ~ 2147483646 | リセットする日数<br>resetTypeが "days" の場合のカウンターリセットの間隔（日数）です。リセット周期はanchorTimestampから計算されます。例えばdaysが7でanchorTimestampが月曜日の正午なら、毎週月曜日の正午にカウンターがリセットされます。<br>※ resetType が "days" であれば必須 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [LimitModelMaster](#limitmodelmaster) | 作成した回数制限モデルマスター |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.CreateLimitModelMaster(
    &limit.CreateLimitModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Name: pointy.String("limit-model-0001"),
        Description: nil,
        Metadata: nil,
        ResetType: pointy.String("monthly"),
        ResetDayOfMonth: pointy.Int32(1),
        ResetDayOfWeek: pointy.String("monday"),
        ResetHour: pointy.Int32(5),
        AnchorTimestamp: pointy.Int64(1000),
        Days: pointy.Int32(10),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\CreateLimitModelMasterRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->createLimitModelMaster(
        (new CreateLimitModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withName("limit-model-0001")
            ->withDescription(null)
            ->withMetadata(null)
            ->withResetType("monthly")
            ->withResetDayOfMonth(1)
            ->withResetDayOfWeek("monday")
            ->withResetHour(5)
            ->withAnchorTimestamp(1000)
            ->withDays(10)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.CreateLimitModelMasterRequest;
import io.gs2.limit.result.CreateLimitModelMasterResult;

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

try {
    CreateLimitModelMasterResult result = client.createLimitModelMaster(
        new CreateLimitModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withName("limit-model-0001")
            .withDescription(null)
            .withMetadata(null)
            .withResetType("monthly")
            .withResetDayOfMonth(1)
            .withResetDayOfWeek("monday")
            .withResetHour(5)
            .withAnchorTimestamp(1000L)
            .withDays(10)
    );
    LimitModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.CreateLimitModelMasterResult> asyncResult = null;
yield return client.CreateLimitModelMaster(
    new Gs2.Gs2Limit.Request.CreateLimitModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithName("limit-model-0001")
        .WithDescription(null)
        .WithMetadata(null)
        .WithResetType("monthly")
        .WithResetDayOfMonth(1)
        .WithResetDayOfWeek("monday")
        .WithResetHour(5)
        .WithAnchorTimestamp(1000L)
        .WithDays(10),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.createLimitModelMaster(
        new Gs2Limit.CreateLimitModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withName("limit-model-0001")
            .withDescription(null)
            .withMetadata(null)
            .withResetType("monthly")
            .withResetDayOfMonth(1)
            .withResetDayOfWeek("monday")
            .withResetHour(5)
            .withAnchorTimestamp(1000)
            .withDays(10)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.create_limit_model_master(
        limit.CreateLimitModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_name('limit-model-0001')
            .with_description(None)
            .with_metadata(None)
            .with_reset_type('monthly')
            .with_reset_day_of_month(1)
            .with_reset_day_of_week('monday')
            .with_reset_hour(5)
            .with_anchor_timestamp(1000)
            .with_days(10)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.create_limit_model_master({
    namespaceName="namespace-0001",
    name="limit-model-0001",
    description=nil,
    metadata=nil,
    resetType="monthly",
    resetDayOfMonth=1,
    resetDayOfWeek="monday",
    resetHour=5,
    anchorTimestamp=1000,
    days=10,
})

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

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

api_result_handler = client.create_limit_model_master_async({
    namespaceName="namespace-0001",
    name="limit-model-0001",
    description=nil,
    metadata=nil,
    resetType="monthly",
    resetDayOfMonth=1,
    resetDayOfWeek="monday",
    resetHour=5,
    anchorTimestamp=1000,
    days=10,
})

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;

```




---

### getLimitModelMaster

回数制限モデルマスターを取得<br>

指定された回数制限モデルマスターを取得します。リセットタイプとタイミング設定を含みます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| limitName | string |  | ✓|  |  ~ 128文字 | 回数制限モデル名<br>回数制限モデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [LimitModelMaster](#limitmodelmaster) | 回数制限モデルマスター |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.GetLimitModelMaster(
    &limit.GetLimitModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        LimitName: pointy.String("limit-model-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\GetLimitModelMasterRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->getLimitModelMaster(
        (new GetLimitModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withLimitName("limit-model-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.GetLimitModelMasterRequest;
import io.gs2.limit.result.GetLimitModelMasterResult;

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

try {
    GetLimitModelMasterResult result = client.getLimitModelMaster(
        new GetLimitModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withLimitName("limit-model-0001")
    );
    LimitModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.GetLimitModelMasterResult> asyncResult = null;
yield return client.GetLimitModelMaster(
    new Gs2.Gs2Limit.Request.GetLimitModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithLimitName("limit-model-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.getLimitModelMaster(
        new Gs2Limit.GetLimitModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withLimitName("limit-model-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.get_limit_model_master(
        limit.GetLimitModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_limit_name('limit-model-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.get_limit_model_master({
    namespaceName="namespace-0001",
    limitName="limit-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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

api_result_handler = client.get_limit_model_master_async({
    namespaceName="namespace-0001",
    limitName="limit-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;

```




---

### updateLimitModelMaster

回数制限モデルマスターを更新<br>

指定された回数制限モデルマスターを更新します。説明、メタデータ、およびリセットタイミング設定を変更できます。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| limitName | string |  | ✓|  |  ~ 128文字 | 回数制限モデル名<br>回数制限モデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| description | string |  | |  |  ~ 1024文字 | 説明文 |
| metadata | string |  | |  |  ~ 2048文字 | メタデータ<br>メタデータには任意の値を設定できます。<br>これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
| resetType | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"notReset",<br>&nbsp;&nbsp;"daily",<br>&nbsp;&nbsp;"weekly",<br>&nbsp;&nbsp;"monthly",<br>&nbsp;&nbsp;"days"<br>}<br> |  | ✓|  |  | リセットタイミング<br>この回数制限モデル配下のカウンター値が自動的にゼロにリセットされるタイミングを決定します。notReset（恒久的、リセットなし）、daily（毎日指定時刻にリセット）、weekly（指定曜日にリセット）、monthly（指定日にリセット）、days（基準日時から一定日数ごとにリセット）から選択します。すべての時刻はUTCです。"notReset": リセットしない / "daily": 毎日 / "weekly": 毎週 / "monthly": 毎月 / "days": 一定日数ごと /  |
| resetDayOfMonth | int | {resetType} == "monthly" | ✓※|  | 1 ~ 31 | リセット日<br>resetTypeが "monthly" の場合にカウンターがリセットされる月の日にちです。1〜31の値が有効です。指定した日がその月の日数を超える場合（例：2月の31日）、その月の最終日にリセットされます。<br>※ resetType が "monthly" であれば必須 |
| resetDayOfWeek | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"sunday",<br>&nbsp;&nbsp;"monday",<br>&nbsp;&nbsp;"tuesday",<br>&nbsp;&nbsp;"wednesday",<br>&nbsp;&nbsp;"thursday",<br>&nbsp;&nbsp;"friday",<br>&nbsp;&nbsp;"saturday"<br>}<br> | {resetType} == "weekly" | ✓※|  |  | リセット曜日<br>resetTypeが "weekly" の場合にカウンターがリセットされる曜日です。この曜日のresetHour（UTC）で指定された時刻にリセットされます。"sunday": 日曜日 / "monday": 月曜日 / "tuesday": 火曜日 / "wednesday": 水曜日 / "thursday": 木曜日 / "friday": 金曜日 / "saturday": 土曜日 / <br>※ resetType が "weekly" であれば必須 |
| resetHour | int | {resetType} in ["monthly", "weekly", "daily"] | ✓※|  | 0 ~ 23 | リセット時刻<br>daily、weekly、monthlyリセットタイプでカウンターがリセットされるUTCの時刻（0〜23）です。例えば0の場合、UTC午前0時にカウンターがリセットされます。<br>※ resetType が "monthly","weekly","daily"であれば 必須 |
| anchorTimestamp | long | {resetType} == "days" | ✓※|  |  | 経過日数のカウントをする基準日時<br>UNIX 時間・ミリ秒<br>※ resetType が "days" であれば必須 |
| days | int | {resetType} == "days" | ✓※|  | 1 ~ 2147483646 | リセットする日数<br>resetTypeが "days" の場合のカウンターリセットの間隔（日数）です。リセット周期はanchorTimestampから計算されます。例えばdaysが7でanchorTimestampが月曜日の正午なら、毎週月曜日の正午にカウンターがリセットされます。<br>※ resetType が "days" であれば必須 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [LimitModelMaster](#limitmodelmaster) | 更新した回数制限モデルマスター |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.UpdateLimitModelMaster(
    &limit.UpdateLimitModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        LimitName: pointy.String("limit-model-0001"),
        Description: pointy.String("description1"),
        Metadata: pointy.String("{\"hoge\": \"fuga\"}"),
        ResetType: pointy.String("daily"),
        ResetDayOfMonth: pointy.Int32(1),
        ResetDayOfWeek: pointy.String("monday"),
        ResetHour: pointy.Int32(18),
        AnchorTimestamp: pointy.Int64(2000),
        Days: pointy.Int32(5),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\UpdateLimitModelMasterRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->updateLimitModelMaster(
        (new UpdateLimitModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withLimitName("limit-model-0001")
            ->withDescription("description1")
            ->withMetadata("{\"hoge\": \"fuga\"}")
            ->withResetType("daily")
            ->withResetDayOfMonth(1)
            ->withResetDayOfWeek("monday")
            ->withResetHour(18)
            ->withAnchorTimestamp(2000)
            ->withDays(5)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.UpdateLimitModelMasterRequest;
import io.gs2.limit.result.UpdateLimitModelMasterResult;

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

try {
    UpdateLimitModelMasterResult result = client.updateLimitModelMaster(
        new UpdateLimitModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withLimitName("limit-model-0001")
            .withDescription("description1")
            .withMetadata("{\"hoge\": \"fuga\"}")
            .withResetType("daily")
            .withResetDayOfMonth(1)
            .withResetDayOfWeek("monday")
            .withResetHour(18)
            .withAnchorTimestamp(2000L)
            .withDays(5)
    );
    LimitModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.UpdateLimitModelMasterResult> asyncResult = null;
yield return client.UpdateLimitModelMaster(
    new Gs2.Gs2Limit.Request.UpdateLimitModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithLimitName("limit-model-0001")
        .WithDescription("description1")
        .WithMetadata("{\"hoge\": \"fuga\"}")
        .WithResetType("daily")
        .WithResetDayOfMonth(1)
        .WithResetDayOfWeek("monday")
        .WithResetHour(18)
        .WithAnchorTimestamp(2000L)
        .WithDays(5),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.updateLimitModelMaster(
        new Gs2Limit.UpdateLimitModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withLimitName("limit-model-0001")
            .withDescription("description1")
            .withMetadata("{\"hoge\": \"fuga\"}")
            .withResetType("daily")
            .withResetDayOfMonth(1)
            .withResetDayOfWeek("monday")
            .withResetHour(18)
            .withAnchorTimestamp(2000)
            .withDays(5)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.update_limit_model_master(
        limit.UpdateLimitModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_limit_name('limit-model-0001')
            .with_description('description1')
            .with_metadata('{"hoge": "fuga"}')
            .with_reset_type('daily')
            .with_reset_day_of_month(1)
            .with_reset_day_of_week('monday')
            .with_reset_hour(18)
            .with_anchor_timestamp(2000)
            .with_days(5)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.update_limit_model_master({
    namespaceName="namespace-0001",
    limitName="limit-model-0001",
    description="description1",
    metadata="{\"hoge\": \"fuga\"}",
    resetType="daily",
    resetDayOfMonth=1,
    resetDayOfWeek="monday",
    resetHour=18,
    anchorTimestamp=2000,
    days=5,
})

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

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

api_result_handler = client.update_limit_model_master_async({
    namespaceName="namespace-0001",
    limitName="limit-model-0001",
    description="description1",
    metadata="{\"hoge\": \"fuga\"}",
    resetType="daily",
    resetDayOfMonth=1,
    resetDayOfWeek="monday",
    resetHour=18,
    anchorTimestamp=2000,
    days=5,
})

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;

```




---

### deleteLimitModelMaster

回数制限モデルマスターを削除<br>

指定された回数制限モデルマスターを削除します。<br>
次のマスターデータ更新まで、現在アクティブなマスターデータには影響しません。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| limitName | string |  | ✓|  |  ~ 128文字 | 回数制限モデル名<br>回数制限モデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [LimitModelMaster](#limitmodelmaster) | 削除した回数制限モデルマスター |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/limit"
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 := limit.Gs2LimitRestClient{
    Session: &session,
}
result, err := client.DeleteLimitModelMaster(
    &limit.DeleteLimitModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        LimitName: pointy.String("limit-model-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Limit\Gs2LimitRestClient;
use Gs2\Limit\Request\DeleteLimitModelMasterRequest;

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

$session->open();

$client = new Gs2LimitRestClient(
    $session
);

try {
    $result = $client->deleteLimitModelMaster(
        (new DeleteLimitModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withLimitName("limit-model-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.limit.rest.Gs2LimitRestClient;
import io.gs2.limit.request.DeleteLimitModelMasterRequest;
import io.gs2.limit.result.DeleteLimitModelMasterResult;

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

try {
    DeleteLimitModelMasterResult result = client.deleteLimitModelMaster(
        new DeleteLimitModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withLimitName("limit-model-0001")
    );
    LimitModelMaster item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2LimitRestClient(session);

AsyncResult<Gs2.Gs2Limit.Result.DeleteLimitModelMasterResult> asyncResult = null;
yield return client.DeleteLimitModelMaster(
    new Gs2.Gs2Limit.Request.DeleteLimitModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithLimitName("limit-model-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Limit from '@/gs2/limit';

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

try {
    const result = await client.deleteLimitModelMaster(
        new Gs2Limit.DeleteLimitModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withLimitName("limit-model-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import limit

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

try:
    result = client.delete_limit_model_master(
        limit.DeleteLimitModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_limit_name('limit-model-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('limit')

api_result = client.delete_limit_model_master({
    namespaceName="namespace-0001",
    limitName="limit-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;

```

**GS2-Script(Async)**
```lua

client = gs2('limit')

api_result_handler = client.delete_limit_model_master_async({
    namespaceName="namespace-0001",
    limitName="limit-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;

```




---



