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

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

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



## モデル

### Namespace

ネームスペース<br>

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

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



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceId | string |  | ※ |  |  ~ 1024文字 | ネームスペースGRN<br>※ サーバーが自動で設定 |
| name | string |  | ✓ |  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| description | string |  |  |  |  ~ 1024文字 | 説明文 |
| transactionSetting | [TransactionSetting](#transactionsetting) |  |  |  |  | トランザクション設定<br>バフの適用結果に基づいて実行される分散トランザクションの実行方法を制御する設定です。自動実行、アトミックコミット、非同期処理などのオプションが含まれます。 |
| applyBuffScript | [ScriptSetting](#scriptsetting) |  |  |  |  | バフを適用する際に実行するスクリプトの設定<br>Script トリガーリファレンス - [`apply`](../script/#apply) |
| logSetting | [LogSetting](#logsetting) |  |  |  |  | ログの出力設定<br>バフ操作のログデータを GS2-Log に出力するための設定です。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" であれば 必須 |

**関連するメソッド:**
updateCurrentBuffMasterFromGitHub - 現在アクティブなバフエントリーモデルのマスターデータをGitHubから更新




---

### BuffTargetModel

バフを適用する対象のモデル<br>

バフ適用の対象となる GS2 リソースモデルとフィールドを定義します。どのモデルのどのフィールド値をバフで変更するかを指定し、対象リソースインスタンスを特定する条件GRNと適用するレート値を含みます。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| targetModelName | 文字列列挙型<br>enum {<br>}<br> |  | ✓ |  |  | バフを適用するモデルの種類 |
| targetFieldName | string |  | ✓ |  |  ~ 64文字 | バフの適用対象フィールド名<br>バフによって値が変更される対象モデル上の数値フィールド名です。例えば、経験値や攻撃力などの数値属性を表すフィールドが対象となります。 |
| conditionGrns | [List&lt;BuffTargetGrn&gt;](#bufftargetgrn) |  | ✓ |  | 1 ~ 10 items | バフの適用条件GRNのリスト<br>バフ適用の対象リソースインスタンスを特定する GRN パターンのリストです。複数の GRN を組み合わせて、リソースを正確に特定する複合条件を形成します。 |
| rate | float |  | ✓ |  | 0 ~ 1000000 | 補正レート<br>適用されるバフ値です。適用タイプにより意味が異なります。「Rate Add」の場合は基本レートに加算、「Mul」の場合は現在のレートに乗算、「Value Add」の場合はレート計算後のフィールド値に直接加算されます。 |

**関連するメソッド:**
createBuffEntryModelMaster - バフエントリーモデルマスターを新規作成
updateBuffEntryModelMaster - バフエントリーモデルマスターを更新


**関連するモデル:**
BuffEntryModel - バフエントリーモデル
BuffEntryModelMaster - バフエントリーモデルマスター




---

### BuffEntryModel

バフエントリーモデル<br>

バフの適用量はバフエントリーモデルで管理し、同一の対象に対して複数のバフエントリーモデルを関連づけることが可能です。<br>
バフエントリーモデルの適用順番はバフエントリーモデルの `priority` で管理し、`priority` の値が小さいほど優先度が高くなります。<br>

バフの適用方式は3種類存在し「Rate Add」、「Mul」と「Value Add」があります。<br>
Rate Add はバフの適用レートに加算する命令、Mul はバフの適用レートに乗算する命令です。<br>
Value Add はバフの補正計算後の値に加算を行う命令です。<br>
たとえば、デフォルトのレートが 1.0 で、Rate Add 0.2 と設定するとバフの適用レートは 1.2 になります。<br>
Mul 0.5 と設定するとバフの適用レートは 0.5 倍になります。<br>

バフエントリーモデルには GS2-Schedule のイベントを関連づけることができ、イベントの開催期間中のみバフを適用するような設定も可能です。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| buffEntryModelId | string |  | ※ |  |  ~ 1024文字 | バフエントリーモデルGRN<br>※ サーバーが自動で設定 |
| name | string |  | ✓ |  |  ~ 128文字 | バフエントリーモデル名<br>バフエントリーモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| metadata | string |  |  |  |  ~ 2048文字 | メタデータ<br>メタデータには任意の値を設定できます。<br>これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
| expression | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"rate_add",<br>&nbsp;&nbsp;"mul",<br>&nbsp;&nbsp;"value_add"<br>}<br> |  | ✓ |  |  | バフの適用タイプ<br>バフ値を対象にどのように適用するかを指定します。「Rate Add」は補正レートに加算（例: 1.0 + 0.2 = 1.2）、「Mul」は補正レートに乗算（例: レート * 0.5）、「Value Add」はレートベースの補正計算後の値に直接加算します。"rate_add": 補正レートに加算 / "mul": 補正レートに乗算 / "value_add": 値を直接加算（モデルやアクションの数値のみ） /  |
| targetType | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"model",<br>&nbsp;&nbsp;"action"<br>}<br> |  | ✓ |  |  | バフを適用する対象の種類<br>バフをモデルのフィールド値に適用するか、アクションのパラメータに適用するかを指定します。「Model」は GS2 リソースモデルのフィールドを対象とし、「Action」は GS2 アクション（例：入手量や消費量）のパラメータを対象とします。"model": モデル / "action": アクション /  |
| targetModel | [BuffTargetModel](#bufftargetmodel) | {targetType} == "model" | ✓※ |  |  | バフを適用する対象のモデル<br>バフを適用する GS2 リソースモデルとフィールドを指定します。モデル名、フィールド名、対象リソースを特定する条件GRN、およびレート値が含まれます。<br>※ targetType が "model" であれば 必須 |
| targetAction | [BuffTargetAction](#bufftargetaction) | {targetType} == "action" | ✓※ |  |  | バフを適用する対象のアクション<br>バフを適用する GS2 アクションとパラメータを指定します。アクション名、フィールド名、対象リソースを特定する条件GRN、およびレート値が含まれます。<br>※ targetType が "action" であれば 必須 |
| priority | int |  | ✓ |  | 0 ~ 2147483646 | バフの適用優先度<br>バフエントリーモデルが評価される順序を決定します。値が小さいほど先に評価されます。同じフィールドを対象とする複数のバフがある場合、Rate Add と Mul 演算の相互作用により、適用順序が最終結果に影響します。 |
| applyPeriodScheduleEventId | string |  |  |  |  ~ 1024文字 | バフを適用するイベントの開催期間GRN<br>このバフの有効期間を制御する GS2-Schedule イベントの GRN です。指定した場合、イベントの開催期間中のみバフが適用されます。未指定の場合、バフは常に有効です。 |

**関連するメソッド:**
describeBuffEntryModels - バフエントリーモデルの一覧を取得
getBuffEntryModel - バフエントリーモデルを取得




---

### BuffTargetAction

バフを適用する対象のアクション<br>

バフ適用の対象となる GS2 アクションとパラメータを定義します。どのアクションのどのパラメータをバフで変更するかを指定し、対象リソースインスタンスを特定する条件GRNと適用するレート値を含みます。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| targetActionName | 文字列列挙型<br>enum {<br>}<br> |  | ✓ |  |  | バフを適用するアクションの種類 |
| targetFieldName | string |  | ✓ |  |  ~ 64文字 | バフの適用対象フィールド名<br>バフによって値が変更される対象アクション上の数値パラメータ名です。例えば、入手数、消費量、報酬数量などを表すパラメータが対象となります。 |
| conditionGrns | [List&lt;BuffTargetGrn&gt;](#bufftargetgrn) |  | ✓ |  | 1 ~ 10 items | バフの適用条件GRNのリスト<br>バフ適用の対象リソースインスタンスを特定する GRN パターンのリストです。複数の GRN を組み合わせて、リソースを正確に特定する複合条件を形成します。 |
| rate | float |  | ✓ |  | 0 ~ 1000000 | 補正レート<br>適用されるバフ値です。適用タイプにより意味が異なります。「Rate Add」の場合は基本レートに加算、「Mul」の場合は現在のレートに乗算、「Value Add」の場合はレート計算後のパラメータ値に直接加算されます。 |

**関連するメソッド:**
createBuffEntryModelMaster - バフエントリーモデルマスターを新規作成
updateBuffEntryModelMaster - バフエントリーモデルマスターを更新


**関連するモデル:**
BuffEntryModel - バフエントリーモデル
BuffEntryModelMaster - バフエントリーモデルマスター




---

### BuffTargetGrn

バフ適用条件となるリソースのGRNパターン<br>

バフが有効となるリソースインスタンスを絞り込むための条件 GRN パターンです。<br>
targetModelName で GS2サービスモデルの種別を特定し、targetGrn にはランタイムで解決されるコンテキスト変数（{region}、{ownerId}）を含めることができます。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| targetModelName | string |  | ✓ |  |  ~ 64文字 | バフの適用条件のモデル名<br>条件GRNを解決するために使用される GS2 サービスモデルの名前です。GRN パターンがどのサービスのリソースモデルを参照するかを特定します。 |
| targetGrn | string |  | ✓ |  |  ~ 1024文字 | バフの適用条件GRN<br>ランタイムで解決されるコンテキストプレースホルダー（例：{region}、{ownerId}）を含む GRN テンプレートです。バフの対象となる特定のリソースインスタンスを特定するために使用されます。 |

**関連するモデル:**
BuffTargetModel - バフを適用する対象のモデル
BuffTargetAction - バフを適用する対象のアクション




---

### OverrideBuffRate

バフの適用レート上書きモデル<br>

バフ適用時に特定の BuffEntryModel のレート値を上書きするためのモデルです。バフエントリー名とカスタムレートを指定することで、BuffEntryModel に定義されたデフォルトのレートを特定のリクエストで異なる値に置き換えることができます。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| name | string |  | ✓ |  |  ~ 128文字 | バフエントリーモデル名<br>バフエントリーモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| rate | float |  | ✓ |  | 0 ~ 100 | レート<br>BuffEntryModel に定義されたデフォルトのレートの代わりに使用する上書きレート値です。 |



---

### CurrentBuffMaster

現在アクティブなバフエントリーモデルのマスターデータ<br>

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

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



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

**関連するメソッド:**
exportMaster - バフエントリーモデルマスターを有効化可能なマスターデータ形式でエクスポート
getCurrentBuffMaster - 現在アクティブなバフエントリーモデルのマスターデータを取得
updateCurrentBuffMaster - 現在アクティブなバフエントリーモデルのマスターデータを更新
updateCurrentBuffMasterFromGitHub - 現在アクティブなバフエントリーモデルのマスターデータをGitHubから更新




---

### BuffEntryModelMaster

バフエントリーモデルマスター<br>

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

バフの適用量はバフエントリーモデルで管理し、同一の対象に対して複数のバフエントリーモデルを関連づけることが可能です。<br>
バフエントリーモデルの適用順番はバフエントリーモデルの `priority` で管理し、`priority` の値が小さいほど優先度が高くなります。<br>

バフの適用方式は3種類存在し「Rate Add」、「Mul」と「Value Add」があります。<br>
Rate Add はバフの適用レートに加算する命令、Mul はバフの適用レートに乗算する命令です。<br>
Value Add はバフの補正計算後の値に加算を行う命令です。<br>
たとえば、デフォルトのレートが 1.0 で、Rate Add 0.2 と設定するとバフの適用レートは 1.2 になります。<br>
Mul 0.5 と設定するとバフの適用レートは 0.5 倍になります。<br>

バフエントリーモデルには GS2-Schedule のイベントを関連づけることができ、イベントの開催期間中のみバフを適用するような設定も可能です。



|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| buffEntryModelId | string |  | ※ |  |  ~ 1024文字 | バフエントリーモデルマスターGRN<br>※ サーバーが自動で設定 |
| name | string |  | ✓ |  |  ~ 128文字 | バフエントリーモデル名<br>バフエントリーモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| description | string |  |  |  |  ~ 1024文字 | 説明文 |
| metadata | string |  |  |  |  ~ 2048文字 | メタデータ<br>メタデータには任意の値を設定できます。<br>これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
| expression | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"rate_add",<br>&nbsp;&nbsp;"mul",<br>&nbsp;&nbsp;"value_add"<br>}<br> |  | ✓ |  |  | バフの適用タイプ<br>バフ値を対象にどのように適用するかを指定します。「Rate Add」は補正レートに加算（例: 1.0 + 0.2 = 1.2）、「Mul」は補正レートに乗算（例: レート * 0.5）、「Value Add」はレートベースの補正計算後の値に直接加算します。"rate_add": Rate Add / "mul": Mul / "value_add": Value Add /  |
| targetType | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"model",<br>&nbsp;&nbsp;"action"<br>}<br> |  | ✓ |  |  | バフを適用する対象の種類<br>バフをモデルのフィールド値に適用するか、アクションのパラメータに適用するかを指定します。「Model」は GS2 リソースモデルのフィールドを対象とし、「Action」は GS2 アクション（例：入手量や消費量）のパラメータを対象とします。"model": モデル / "action": アクション /  |
| targetModel | [BuffTargetModel](#bufftargetmodel) | {targetType} == "model" | ✓※ |  |  | バフを適用する対象のモデル<br>バフを適用する GS2 リソースモデルとフィールドを指定します。モデル名、フィールド名、対象リソースを特定する条件GRN、およびレート値が含まれます。<br>※ targetType が "model" であれば 必須 |
| targetAction | [BuffTargetAction](#bufftargetaction) | {targetType} == "action" | ✓※ |  |  | バフを適用する対象のアクション<br>バフを適用する GS2 アクションとパラメータを指定します。アクション名、フィールド名、対象リソースを特定する条件GRN、およびレート値が含まれます。<br>※ targetType が "action" であれば 必須 |
| priority | int |  | ✓ |  | 0 ~ 2147483646 | バフの適用優先度<br>バフエントリーモデルが評価される順序を決定します。値が小さいほど先に評価されます。同じフィールドを対象とする複数のバフがある場合、Rate Add と Mul 演算の相互作用により、適用順序が最終結果に影響します。 |
| applyPeriodScheduleEventId | string |  |  |  |  ~ 1024文字 | バフを適用するイベントの開催期間GRN<br>このバフの有効期間を制御する GS2-Schedule イベントの GRN です。指定した場合、イベントの開催期間中のみバフが適用されます。未指定の場合、バフは常に有効です。 |
| createdAt | long |  | ※ | 現在時刻 |  | 作成日時<br>UNIX 時間・ミリ秒<br>※ サーバーが自動で設定 |
| updatedAt | long |  | ※ | 現在時刻 |  | 最終更新日時<br>UNIX 時間・ミリ秒<br>※ サーバーが自動で設定 |
| revision | long |  |  | 0 | 0 ~ 9223372036854775805 | リビジョン |

**関連するメソッド:**
describeBuffEntryModelMasters - バフエントリーモデルマスターの一覧を取得
createBuffEntryModelMaster - バフエントリーモデルマスターを新規作成
getBuffEntryModelMaster - バフエントリーモデルマスターを取得
updateBuffEntryModelMaster - バフエントリーモデルマスターを更新
deleteBuffEntryModelMaster - バフエントリーモデルマスターを削除




---
## メソッド

### 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/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.DescribeNamespaces(
    &buff.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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\DescribeNamespacesRequest;

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

$session->open();

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

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

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

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

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

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

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

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

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>バフの適用結果に基づいて実行される分散トランザクションの実行方法を制御する設定です。自動実行、アトミックコミット、非同期処理などのオプションが含まれます。 |
| applyBuffScript | [ScriptSetting](#scriptsetting) |  | |  |  | バフを適用する際に実行するスクリプトの設定<br>Script トリガーリファレンス - [`apply`](../script/#apply) |
| logSetting | [LogSetting](#logsetting) |  | |  |  | ログの出力設定<br>バフ操作のログデータを GS2-Log に出力するための設定です。APIリクエスト・レスポンスのログを収集する GS2-Log のネームスペースを指定します。 |

#### Result

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

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.CreateNamespace(
    &buff.CreateNamespaceRequest {
        Name: pointy.String("namespace-0001"),
        Description: nil,
        TransactionSetting: nil,
        ApplyBuffScript: nil,
        LogSetting: &buff.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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\CreateNamespaceRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $session
);

try {
    $result = $client->createNamespace(
        (new CreateNamespaceRequest())
            ->withName("namespace-0001")
            ->withDescription(null)
            ->withTransactionSetting(null)
            ->withApplyBuffScript(null)
            ->withLogSetting((new \Gs2\Buff\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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.CreateNamespaceRequest;
import io.gs2.buff.result.CreateNamespaceResult;

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

try {
    CreateNamespaceResult result = client.createNamespace(
        new CreateNamespaceRequest()
            .withName("namespace-0001")
            .withDescription(null)
            .withTransactionSetting(null)
            .withApplyBuffScript(null)
            .withLogSetting(new io.gs2.buff.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 Gs2BuffRestClient(session);

AsyncResult<Gs2.Gs2Buff.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
    new Gs2.Gs2Buff.Request.CreateNamespaceRequest()
        .WithName("namespace-0001")
        .WithDescription(null)
        .WithTransactionSetting(null)
        .WithApplyBuffScript(null)
        .WithLogSetting(new Gs2.Gs2Buff.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 Gs2Buff from '@/gs2/buff';

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

try {
    const result = await client.createNamespace(
        new Gs2Buff.CreateNamespaceRequest()
            .withName("namespace-0001")
            .withDescription(null)
            .withTransactionSetting(null)
            .withApplyBuffScript(null)
            .withLogSetting(new Gs2Buff.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 buff

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

try:
    result = client.create_namespace(
        buff.CreateNamespaceRequest()
            .with_name('namespace-0001')
            .with_description(None)
            .with_transaction_setting(None)
            .with_apply_buff_script(None)
            .with_log_setting(
                buff.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('buff')

api_result = client.create_namespace({
    name="namespace-0001",
    description=nil,
    transactionSetting=nil,
    applyBuffScript=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('buff')

api_result_handler = client.create_namespace_async({
    name="namespace-0001",
    description=nil,
    transactionSetting=nil,
    applyBuffScript=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/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.GetNamespaceStatus(
    &buff.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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\GetNamespaceStatusRequest;

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

$session->open();

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

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

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

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

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

```

**Python**
```python

from gs2 import core
from gs2 import buff

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

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


```

**GS2-Script**
```lua

client = gs2('buff')

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

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

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

$session->open();

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

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

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

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

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

```

**Python**
```python

from gs2 import core
from gs2 import buff

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

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


```

**GS2-Script**
```lua

client = gs2('buff')

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

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>バフの適用結果に基づいて実行される分散トランザクションの実行方法を制御する設定です。自動実行、アトミックコミット、非同期処理などのオプションが含まれます。 |
| applyBuffScript | [ScriptSetting](#scriptsetting) |  | |  |  | バフを適用する際に実行するスクリプトの設定<br>Script トリガーリファレンス - [`apply`](../script/#apply) |
| logSetting | [LogSetting](#logsetting) |  | |  |  | ログの出力設定<br>バフ操作のログデータを GS2-Log に出力するための設定です。APIリクエスト・レスポンスのログを収集する GS2-Log のネームスペースを指定します。 |

#### Result

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

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.UpdateNamespace(
    &buff.UpdateNamespaceRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Description: pointy.String("description1"),
        TransactionSetting: nil,
        ApplyBuffScript: nil,
        LogSetting: &buff.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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\UpdateNamespaceRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $session
);

try {
    $result = $client->updateNamespace(
        (new UpdateNamespaceRequest())
            ->withNamespaceName("namespace-0001")
            ->withDescription("description1")
            ->withTransactionSetting(null)
            ->withApplyBuffScript(null)
            ->withLogSetting((new \Gs2\Buff\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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.UpdateNamespaceRequest;
import io.gs2.buff.result.UpdateNamespaceResult;

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

try {
    UpdateNamespaceResult result = client.updateNamespace(
        new UpdateNamespaceRequest()
            .withNamespaceName("namespace-0001")
            .withDescription("description1")
            .withTransactionSetting(null)
            .withApplyBuffScript(null)
            .withLogSetting(new io.gs2.buff.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 Gs2BuffRestClient(session);

AsyncResult<Gs2.Gs2Buff.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
    new Gs2.Gs2Buff.Request.UpdateNamespaceRequest()
        .WithNamespaceName("namespace-0001")
        .WithDescription("description1")
        .WithTransactionSetting(null)
        .WithApplyBuffScript(null)
        .WithLogSetting(new Gs2.Gs2Buff.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 Gs2Buff from '@/gs2/buff';

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

try {
    const result = await client.updateNamespace(
        new Gs2Buff.UpdateNamespaceRequest()
            .withNamespaceName("namespace-0001")
            .withDescription("description1")
            .withTransactionSetting(null)
            .withApplyBuffScript(null)
            .withLogSetting(new Gs2Buff.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 buff

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

try:
    result = client.update_namespace(
        buff.UpdateNamespaceRequest()
            .with_namespace_name('namespace-0001')
            .with_description('description1')
            .with_transaction_setting(None)
            .with_apply_buff_script(None)
            .with_log_setting(
                buff.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('buff')

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

api_result_handler = client.update_namespace_async({
    namespaceName="namespace-0001",
    description="description1",
    transactionSetting=nil,
    applyBuffScript=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/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.DeleteNamespace(
    &buff.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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\DeleteNamespaceRequest;

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

$session->open();

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

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

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

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

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

```

**Python**
```python

from gs2 import core
from gs2 import buff

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

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


```

**GS2-Script**
```lua

client = gs2('buff')

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

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

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

$session->open();

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

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

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

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

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

```

**Python**
```python

from gs2 import core
from gs2 import buff

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

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


```

**GS2-Script**
```lua

client = gs2('buff')

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

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/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.DumpUserDataByUserId(
    &buff.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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\DumpUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.DumpUserDataByUserIdRequest;
import io.gs2.buff.result.DumpUserDataByUserIdResult;

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

AsyncResult<Gs2.Gs2Buff.Result.DumpUserDataByUserIdResult> asyncResult = null;
yield return client.DumpUserDataByUserId(
    new Gs2.Gs2Buff.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 Gs2Buff from '@/gs2/buff';

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

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

```

**Python**
```python

from gs2 import core
from gs2 import buff

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

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


```

**GS2-Script**
```lua

client = gs2('buff')

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

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/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.CheckDumpUserDataByUserId(
    &buff.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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\CheckDumpUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.CheckDumpUserDataByUserIdRequest;
import io.gs2.buff.result.CheckDumpUserDataByUserIdResult;

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

AsyncResult<Gs2.Gs2Buff.Result.CheckDumpUserDataByUserIdResult> asyncResult = null;
yield return client.CheckDumpUserDataByUserId(
    new Gs2.Gs2Buff.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 Gs2Buff from '@/gs2/buff';

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

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

```

**Python**
```python

from gs2 import core
from gs2 import buff

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

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

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

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/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.CleanUserDataByUserId(
    &buff.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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\CleanUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.CleanUserDataByUserIdRequest;
import io.gs2.buff.result.CleanUserDataByUserIdResult;

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

AsyncResult<Gs2.Gs2Buff.Result.CleanUserDataByUserIdResult> asyncResult = null;
yield return client.CleanUserDataByUserId(
    new Gs2.Gs2Buff.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 Gs2Buff from '@/gs2/buff';

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

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

```

**Python**
```python

from gs2 import core
from gs2 import buff

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

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


```

**GS2-Script**
```lua

client = gs2('buff')

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

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/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.CheckCleanUserDataByUserId(
    &buff.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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\CheckCleanUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.CheckCleanUserDataByUserIdRequest;
import io.gs2.buff.result.CheckCleanUserDataByUserIdResult;

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

AsyncResult<Gs2.Gs2Buff.Result.CheckCleanUserDataByUserIdResult> asyncResult = null;
yield return client.CheckCleanUserDataByUserId(
    new Gs2.Gs2Buff.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 Gs2Buff from '@/gs2/buff';

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

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

```

**Python**
```python

from gs2 import core
from gs2 import buff

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

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


```

**GS2-Script**
```lua

client = gs2('buff')

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

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/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.PrepareImportUserDataByUserId(
    &buff.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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\PrepareImportUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.PrepareImportUserDataByUserIdRequest;
import io.gs2.buff.result.PrepareImportUserDataByUserIdResult;

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

AsyncResult<Gs2.Gs2Buff.Result.PrepareImportUserDataByUserIdResult> asyncResult = null;
yield return client.PrepareImportUserDataByUserId(
    new Gs2.Gs2Buff.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 Gs2Buff from '@/gs2/buff';

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

try {
    const result = await client.prepareImportUserDataByUserId(
        new Gs2Buff.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 buff

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

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

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

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/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.ImportUserDataByUserId(
    &buff.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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\ImportUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.ImportUserDataByUserIdRequest;
import io.gs2.buff.result.ImportUserDataByUserIdResult;

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

AsyncResult<Gs2.Gs2Buff.Result.ImportUserDataByUserIdResult> asyncResult = null;
yield return client.ImportUserDataByUserId(
    new Gs2.Gs2Buff.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 Gs2Buff from '@/gs2/buff';

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

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

```

**Python**
```python

from gs2 import core
from gs2 import buff

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

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

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

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/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.CheckImportUserDataByUserId(
    &buff.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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\CheckImportUserDataByUserIdRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.CheckImportUserDataByUserIdRequest;
import io.gs2.buff.result.CheckImportUserDataByUserIdResult;

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

AsyncResult<Gs2.Gs2Buff.Result.CheckImportUserDataByUserIdResult> asyncResult = null;
yield return client.CheckImportUserDataByUserId(
    new Gs2.Gs2Buff.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 Gs2Buff from '@/gs2/buff';

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

try {
    const result = await client.checkImportUserDataByUserId(
        new Gs2Buff.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 buff

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

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

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

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;

```




---

### applyBuff

バフを適用<br>

指定されたネームスペース内のすべてのバフエントリーモデルを評価し、現在ログインしているユーザーに該当するバフを適用します。<br>
バフは優先度（値が小さいほど先に評価）に従って評価され、Rate Add（補正レートに加算）、Mul（補正レートに乗算）、Value Add（値に直接加算）の3つの適用方式をサポートしています。<br>
バフエントリーモデルが GS2-Schedule のイベントに関連付けられている場合、イベント開催期間中のみ適用されます。<br>
適用されたバフのリストと、バフの適用状態を記録した更新済みコンテキストスタックが返されます。



#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;BuffEntryModel&gt;](#buffentrymodel) | 適用したバフのリスト |
| newContextStack | string | バフの適用状況を記録したコンテキスト |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.ApplyBuff(
    &buff.ApplyBuffRequest {
        NamespaceName: pointy.String("namespace-0001"),
        AccessToken: pointy.String("accessToken-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
newContextStack := result.NewContextStack

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\ApplyBuffRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $session
);

try {
    $result = $client->applyBuff(
        (new ApplyBuffRequest())
            ->withNamespaceName("namespace-0001")
            ->withAccessToken("accessToken-0001")
    );
    $items = $result->getItems();
    $newContextStack = $result->getNewContextStack();
} 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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.ApplyBuffRequest;
import io.gs2.buff.result.ApplyBuffResult;

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

try {
    ApplyBuffResult result = client.applyBuff(
        new ApplyBuffRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
    );
    List<BuffEntryModel> items = result.getItems();
    String newContextStack = result.getNewContextStack();
} 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 Gs2BuffRestClient(session);

AsyncResult<Gs2.Gs2Buff.Result.ApplyBuffResult> asyncResult = null;
yield return client.ApplyBuff(
    new Gs2.Gs2Buff.Request.ApplyBuffRequest()
        .WithNamespaceName("namespace-0001")
        .WithAccessToken("accessToken-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var newContextStack = result.NewContextStack;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Buff from '@/gs2/buff';

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

try {
    const result = await client.applyBuff(
        new Gs2Buff.ApplyBuffRequest()
            .withNamespaceName("namespace-0001")
            .withAccessToken("accessToken-0001")
    );
    const items = result.getItems();
    const newContextStack = result.getNewContextStack();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import buff

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

try:
    result = client.apply_buff(
        buff.ApplyBuffRequest()
            .with_namespace_name('namespace-0001')
            .with_access_token('accessToken-0001')
    )
    items = result.items
    new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('buff')

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

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

result = api_result.result
items = result.items;
newContextStack = result.newContextStack;

```

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

client = gs2('buff')

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

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

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

result = api_result.result
items = result.items;
newContextStack = result.newContextStack;

```




---

### applyBuffByUserId

ユーザーIDを指定してバフを適用<br>

指定されたネームスペース内のすべてのバフエントリーモデルを評価し、指定されたユーザーに該当するバフを適用します。<br>
バフは優先度（値が小さいほど先に評価）に従って評価され、Rate Add（補正レートに加算）、Mul（補正レートに乗算）、Value Add（値に直接加算）の3つの適用方式をサポートしています。<br>
バフエントリーモデルが GS2-Schedule のイベントに関連付けられている場合、イベント開催期間中のみ適用されます。<br>
適用されたバフのリストと、バフの適用状態を記録した更新済みコンテキストスタックが返されます。



#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;BuffEntryModel&gt;](#buffentrymodel) | 適用したバフのリスト |
| newContextStack | string | バフの適用状況を記録したコンテキスト |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.ApplyBuffByUserId(
    &buff.ApplyBuffByUserIdRequest {
        NamespaceName: pointy.String("namespace-0001"),
        UserId: pointy.String("user-0001"),
        TimeOffsetToken: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
newContextStack := result.NewContextStack

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\ApplyBuffByUserIdRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $session
);

try {
    $result = $client->applyBuffByUserId(
        (new ApplyBuffByUserIdRequest())
            ->withNamespaceName("namespace-0001")
            ->withUserId("user-0001")
            ->withTimeOffsetToken(null)
    );
    $items = $result->getItems();
    $newContextStack = $result->getNewContextStack();
} 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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.ApplyBuffByUserIdRequest;
import io.gs2.buff.result.ApplyBuffByUserIdResult;

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

try {
    ApplyBuffByUserIdResult result = client.applyBuffByUserId(
        new ApplyBuffByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    List<BuffEntryModel> items = result.getItems();
    String newContextStack = result.getNewContextStack();
} 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 Gs2BuffRestClient(session);

AsyncResult<Gs2.Gs2Buff.Result.ApplyBuffByUserIdResult> asyncResult = null;
yield return client.ApplyBuffByUserId(
    new Gs2.Gs2Buff.Request.ApplyBuffByUserIdRequest()
        .WithNamespaceName("namespace-0001")
        .WithUserId("user-0001")
        .WithTimeOffsetToken(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var newContextStack = result.NewContextStack;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Buff from '@/gs2/buff';

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

try {
    const result = await client.applyBuffByUserId(
        new Gs2Buff.ApplyBuffByUserIdRequest()
            .withNamespaceName("namespace-0001")
            .withUserId("user-0001")
            .withTimeOffsetToken(null)
    );
    const items = result.getItems();
    const newContextStack = result.getNewContextStack();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import buff

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

try:
    result = client.apply_buff_by_user_id(
        buff.ApplyBuffByUserIdRequest()
            .with_namespace_name('namespace-0001')
            .with_user_id('user-0001')
            .with_time_offset_token(None)
    )
    items = result.items
    new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('buff')

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

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

result = api_result.result
items = result.items;
newContextStack = result.newContextStack;

```

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

client = gs2('buff')

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

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

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

result = api_result.result
items = result.items;
newContextStack = result.newContextStack;

```




---

### describeBuffEntryModels

バフエントリーモデルの一覧を取得<br>

指定されたネームスペースで現在有効化されているすべてのバフエントリーモデルを取得します。<br>
バフエントリーモデルは、ゲームデータに適用可能なバフ効果を定義し、適用方式（Rate Add、Mul、Value Add）、対象（モデルまたはアクション）、優先度などが含まれます。<br>
マスター版とは異なり、有効化（公開）済みのモデルのみを返し、ページネーションはありません。



#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;BuffEntryModel&gt;](#buffentrymodel) | バフエントリーモデルのリスト |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.DescribeBuffEntryModels(
    &buff.DescribeBuffEntryModelsRequest {
        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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\DescribeBuffEntryModelsRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $session
);

try {
    $result = $client->describeBuffEntryModels(
        (new DescribeBuffEntryModelsRequest())
            ->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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.DescribeBuffEntryModelsRequest;
import io.gs2.buff.result.DescribeBuffEntryModelsResult;

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

try {
    DescribeBuffEntryModelsResult result = client.describeBuffEntryModels(
        new DescribeBuffEntryModelsRequest()
            .withNamespaceName("namespace-0001")
    );
    List<BuffEntryModel> 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 Gs2BuffRestClient(session);

AsyncResult<Gs2.Gs2Buff.Result.DescribeBuffEntryModelsResult> asyncResult = null;
yield return client.DescribeBuffEntryModels(
    new Gs2.Gs2Buff.Request.DescribeBuffEntryModelsRequest()
        .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 Gs2Buff from '@/gs2/buff';

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

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

```

**Python**
```python

from gs2 import core
from gs2 import buff

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

try:
    result = client.describe_buff_entry_models(
        buff.DescribeBuffEntryModelsRequest()
            .with_namespace_name('namespace-0001')
    )
    items = result.items
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('buff')

api_result = client.describe_buff_entry_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('buff')

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

```




---

### getBuffEntryModel

バフエントリーモデルを取得<br>

指定されたネームスペースで指定された名前の、現在有効なバフエントリーモデルを取得します。<br>
取得される情報には、適用方式（Rate Add、Mul、Value Add）、対象の種類（モデルまたはアクション）、対象の詳細、優先度、および設定されている場合は関連する GS2-Schedule のイベント情報が含まれます。



#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [BuffEntryModel](#buffentrymodel) | バフエントリーモデル |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.GetBuffEntryModel(
    &buff.GetBuffEntryModelRequest {
        NamespaceName: pointy.String("namespace-0001"),
        BuffEntryName: pointy.String("character-level"),
    }
)
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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\GetBuffEntryModelRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $session
);

try {
    $result = $client->getBuffEntryModel(
        (new GetBuffEntryModelRequest())
            ->withNamespaceName("namespace-0001")
            ->withBuffEntryName("character-level")
    );
    $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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.GetBuffEntryModelRequest;
import io.gs2.buff.result.GetBuffEntryModelResult;

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

try {
    GetBuffEntryModelResult result = client.getBuffEntryModel(
        new GetBuffEntryModelRequest()
            .withNamespaceName("namespace-0001")
            .withBuffEntryName("character-level")
    );
    BuffEntryModel 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 Gs2BuffRestClient(session);

AsyncResult<Gs2.Gs2Buff.Result.GetBuffEntryModelResult> asyncResult = null;
yield return client.GetBuffEntryModel(
    new Gs2.Gs2Buff.Request.GetBuffEntryModelRequest()
        .WithNamespaceName("namespace-0001")
        .WithBuffEntryName("character-level"),
    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 Gs2Buff from '@/gs2/buff';

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

try {
    const result = await client.getBuffEntryModel(
        new Gs2Buff.GetBuffEntryModelRequest()
            .withNamespaceName("namespace-0001")
            .withBuffEntryName("character-level")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import buff

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

try:
    result = client.get_buff_entry_model(
        buff.GetBuffEntryModelRequest()
            .with_namespace_name('namespace-0001')
            .with_buff_entry_name('character-level')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('buff')

api_result = client.get_buff_entry_model({
    namespaceName="namespace-0001",
    buffEntryName="character-level",
})

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

api_result_handler = client.get_buff_entry_model_async({
    namespaceName="namespace-0001",
    buffEntryName="character-level",
})

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 | [CurrentBuffMaster](#currentbuffmaster) | 有効化可能なバフエントリーモデルのマスターデータ |

#### 実装例




**Go**
```go

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

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

$session->open();

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

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

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

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

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

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

```

**Python**
```python

from gs2 import core
from gs2 import buff

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

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


```

**GS2-Script**
```lua

client = gs2('buff')

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

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;

```




---

### getCurrentBuffMaster

現在アクティブなバフエントリーモデルのマスターデータを取得<br>

指定されたネームスペースで現在有効化（公開）されているバフエントリーモデルのマスターデータを取得します。<br>
これは編集可能なマスターデータとは異なり、実際に本番で使用されている構成を表します。



#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [CurrentBuffMaster](#currentbuffmaster) | 現在アクティブなバフエントリーモデルのマスターデータ |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.GetCurrentBuffMaster(
    &buff.GetCurrentBuffMasterRequest {
        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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\GetCurrentBuffMasterRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $session
);

try {
    $result = $client->getCurrentBuffMaster(
        (new GetCurrentBuffMasterRequest())
            ->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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.GetCurrentBuffMasterRequest;
import io.gs2.buff.result.GetCurrentBuffMasterResult;

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

try {
    GetCurrentBuffMasterResult result = client.getCurrentBuffMaster(
        new GetCurrentBuffMasterRequest()
            .withNamespaceName("namespace-0001")
    );
    CurrentBuffMaster 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 Gs2BuffRestClient(session);

AsyncResult<Gs2.Gs2Buff.Result.GetCurrentBuffMasterResult> asyncResult = null;
yield return client.GetCurrentBuffMaster(
    new Gs2.Gs2Buff.Request.GetCurrentBuffMasterRequest()
        .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 Gs2Buff from '@/gs2/buff';

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

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

```

**Python**
```python

from gs2 import core
from gs2 import buff

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

try:
    result = client.get_current_buff_master(
        buff.GetCurrentBuffMasterRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('buff')

api_result = client.get_current_buff_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('buff')

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

```




---

### preUpdateCurrentBuffMaster

現在アクティブなバフエントリーモデルのマスターデータを更新（3フェーズ版）<br>

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



#### 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/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.PreUpdateCurrentBuffMaster(
    &buff.PreUpdateCurrentBuffMasterRequest {
        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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\PreUpdateCurrentBuffMasterRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $session
);

try {
    $result = $client->preUpdateCurrentBuffMaster(
        (new PreUpdateCurrentBuffMasterRequest())
            ->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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.PreUpdateCurrentBuffMasterRequest;
import io.gs2.buff.result.PreUpdateCurrentBuffMasterResult;

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

try {
    PreUpdateCurrentBuffMasterResult result = client.preUpdateCurrentBuffMaster(
        new PreUpdateCurrentBuffMasterRequest()
            .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 Gs2BuffRestClient(session);

AsyncResult<Gs2.Gs2Buff.Result.PreUpdateCurrentBuffMasterResult> asyncResult = null;
yield return client.PreUpdateCurrentBuffMaster(
    new Gs2.Gs2Buff.Request.PreUpdateCurrentBuffMasterRequest()
        .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 Gs2Buff from '@/gs2/buff';

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

try {
    const result = await client.preUpdateCurrentBuffMaster(
        new Gs2Buff.PreUpdateCurrentBuffMasterRequest()
            .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 buff

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

try:
    result = client.pre_update_current_buff_master(
        buff.PreUpdateCurrentBuffMasterRequest()
            .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('buff')

api_result = client.pre_update_current_buff_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('buff')

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

```




---

### updateCurrentBuffMaster

現在アクティブなバフエントリーモデルのマスターデータを更新<br>

指定されたネームスペースのバフエントリーモデルのマスターデータを更新し有効化（公開）します。<br>
2つのモードをサポートしています：インラインのマスターデータ用の 'direct' モードと、事前にアップロードされたマスターデータ用の 'preUpload' モードです。<br>
1MBを超えるマスターデータの場合は、3フェーズの更新フロー（PreUpdate -> アップロード -> Update（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 | [CurrentBuffMaster](#currentbuffmaster) | 更新された現在アクティブなバフエントリーモデルのマスターデータ |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.UpdateCurrentBuffMaster(
    &buff.UpdateCurrentBuffMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Mode: pointy.String("direct"),
        Settings: pointy.String("{\"version\": \"2024-04-15\", \"buffEntryModels\": [{\"name\": \"buff-0001\", \"metadata\": \"BUFF_0001\", \"targetType\": \"model\", \"targetModel\": {\"targetModelName\": \"Gs2Experience:Status\", \"targetFieldName\": \"rankCapValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}, {\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0002\"}], \"rate\": 1.0}, \"expression\": \"rate_add\", \"priority\": 1}, {\"name\": \"buff-0002\", \"metadata\": \"BUFF_0002\", \"targetType\": \"action\", \"targetAction\": {\"targetActionName\": \"Gs2Experience:AddExperienceByUserId\", \"targetFieldName\": \"experienceValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}], \"rate\": 2.0}, \"expression\": \"mul\", \"priority\": 2}, {\"name\": \"buff-0003\", \"metadata\": \"BUFF_0003\", \"targetType\": \"model\", \"targetModel\": {\"targetModelName\": \"Gs2Experience:Status\", \"targetFieldName\": \"rankCapValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}], \"rate\": 3.0}, \"expression\": \"mul\", \"priority\": 3}]}"),
        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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\UpdateCurrentBuffMasterRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $session
);

try {
    $result = $client->updateCurrentBuffMaster(
        (new UpdateCurrentBuffMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withMode("direct")
            ->withSettings("{\"version\": \"2024-04-15\", \"buffEntryModels\": [{\"name\": \"buff-0001\", \"metadata\": \"BUFF_0001\", \"targetType\": \"model\", \"targetModel\": {\"targetModelName\": \"Gs2Experience:Status\", \"targetFieldName\": \"rankCapValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}, {\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0002\"}], \"rate\": 1.0}, \"expression\": \"rate_add\", \"priority\": 1}, {\"name\": \"buff-0002\", \"metadata\": \"BUFF_0002\", \"targetType\": \"action\", \"targetAction\": {\"targetActionName\": \"Gs2Experience:AddExperienceByUserId\", \"targetFieldName\": \"experienceValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}], \"rate\": 2.0}, \"expression\": \"mul\", \"priority\": 2}, {\"name\": \"buff-0003\", \"metadata\": \"BUFF_0003\", \"targetType\": \"model\", \"targetModel\": {\"targetModelName\": \"Gs2Experience:Status\", \"targetFieldName\": \"rankCapValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}], \"rate\": 3.0}, \"expression\": \"mul\", \"priority\": 3}]}")
            ->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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.UpdateCurrentBuffMasterRequest;
import io.gs2.buff.result.UpdateCurrentBuffMasterResult;

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

try {
    UpdateCurrentBuffMasterResult result = client.updateCurrentBuffMaster(
        new UpdateCurrentBuffMasterRequest()
            .withNamespaceName("namespace-0001")
            .withMode("direct")
            .withSettings("{\"version\": \"2024-04-15\", \"buffEntryModels\": [{\"name\": \"buff-0001\", \"metadata\": \"BUFF_0001\", \"targetType\": \"model\", \"targetModel\": {\"targetModelName\": \"Gs2Experience:Status\", \"targetFieldName\": \"rankCapValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}, {\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0002\"}], \"rate\": 1.0}, \"expression\": \"rate_add\", \"priority\": 1}, {\"name\": \"buff-0002\", \"metadata\": \"BUFF_0002\", \"targetType\": \"action\", \"targetAction\": {\"targetActionName\": \"Gs2Experience:AddExperienceByUserId\", \"targetFieldName\": \"experienceValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}], \"rate\": 2.0}, \"expression\": \"mul\", \"priority\": 2}, {\"name\": \"buff-0003\", \"metadata\": \"BUFF_0003\", \"targetType\": \"model\", \"targetModel\": {\"targetModelName\": \"Gs2Experience:Status\", \"targetFieldName\": \"rankCapValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}], \"rate\": 3.0}, \"expression\": \"mul\", \"priority\": 3}]}")
            .withUploadToken(null)
    );
    CurrentBuffMaster 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 Gs2BuffRestClient(session);

AsyncResult<Gs2.Gs2Buff.Result.UpdateCurrentBuffMasterResult> asyncResult = null;
yield return client.UpdateCurrentBuffMaster(
    new Gs2.Gs2Buff.Request.UpdateCurrentBuffMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithMode("direct")
        .WithSettings("{\"version\": \"2024-04-15\", \"buffEntryModels\": [{\"name\": \"buff-0001\", \"metadata\": \"BUFF_0001\", \"targetType\": \"model\", \"targetModel\": {\"targetModelName\": \"Gs2Experience:Status\", \"targetFieldName\": \"rankCapValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}, {\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0002\"}], \"rate\": 1.0}, \"expression\": \"rate_add\", \"priority\": 1}, {\"name\": \"buff-0002\", \"metadata\": \"BUFF_0002\", \"targetType\": \"action\", \"targetAction\": {\"targetActionName\": \"Gs2Experience:AddExperienceByUserId\", \"targetFieldName\": \"experienceValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}], \"rate\": 2.0}, \"expression\": \"mul\", \"priority\": 2}, {\"name\": \"buff-0003\", \"metadata\": \"BUFF_0003\", \"targetType\": \"model\", \"targetModel\": {\"targetModelName\": \"Gs2Experience:Status\", \"targetFieldName\": \"rankCapValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}], \"rate\": 3.0}, \"expression\": \"mul\", \"priority\": 3}]}")
        .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 Gs2Buff from '@/gs2/buff';

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

try {
    const result = await client.updateCurrentBuffMaster(
        new Gs2Buff.UpdateCurrentBuffMasterRequest()
            .withNamespaceName("namespace-0001")
            .withMode("direct")
            .withSettings("{\"version\": \"2024-04-15\", \"buffEntryModels\": [{\"name\": \"buff-0001\", \"metadata\": \"BUFF_0001\", \"targetType\": \"model\", \"targetModel\": {\"targetModelName\": \"Gs2Experience:Status\", \"targetFieldName\": \"rankCapValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}, {\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0002\"}], \"rate\": 1.0}, \"expression\": \"rate_add\", \"priority\": 1}, {\"name\": \"buff-0002\", \"metadata\": \"BUFF_0002\", \"targetType\": \"action\", \"targetAction\": {\"targetActionName\": \"Gs2Experience:AddExperienceByUserId\", \"targetFieldName\": \"experienceValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}], \"rate\": 2.0}, \"expression\": \"mul\", \"priority\": 2}, {\"name\": \"buff-0003\", \"metadata\": \"BUFF_0003\", \"targetType\": \"model\", \"targetModel\": {\"targetModelName\": \"Gs2Experience:Status\", \"targetFieldName\": \"rankCapValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}], \"rate\": 3.0}, \"expression\": \"mul\", \"priority\": 3}]}")
            .withUploadToken(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import buff

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

try:
    result = client.update_current_buff_master(
        buff.UpdateCurrentBuffMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_mode('direct')
            .with_settings('{"version": "2024-04-15", "buffEntryModels": [{"name": "buff-0001", "metadata": "BUFF_0001", "targetType": "model", "targetModel": {"targetModelName": "Gs2Experience:Status", "targetFieldName": "rankCapValue", "conditionGrns": [{"targetModelName": "Gs2Experience:ExperienceModel", "targetGrn": "grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001"}, {"targetModelName": "Gs2Experience:ExperienceModel", "targetGrn": "grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0002"}], "rate": 1.0}, "expression": "rate_add", "priority": 1}, {"name": "buff-0002", "metadata": "BUFF_0002", "targetType": "action", "targetAction": {"targetActionName": "Gs2Experience:AddExperienceByUserId", "targetFieldName": "experienceValue", "conditionGrns": [{"targetModelName": "Gs2Experience:ExperienceModel", "targetGrn": "grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001"}], "rate": 2.0}, "expression": "mul", "priority": 2}, {"name": "buff-0003", "metadata": "BUFF_0003", "targetType": "model", "targetModel": {"targetModelName": "Gs2Experience:Status", "targetFieldName": "rankCapValue", "conditionGrns": [{"targetModelName": "Gs2Experience:ExperienceModel", "targetGrn": "grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001"}], "rate": 3.0}, "expression": "mul", "priority": 3}]}')
            .with_upload_token(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('buff')

api_result = client.update_current_buff_master({
    namespaceName="namespace-0001",
    mode="direct",
    settings="{\"version\": \"2024-04-15\", \"buffEntryModels\": [{\"name\": \"buff-0001\", \"metadata\": \"BUFF_0001\", \"targetType\": \"model\", \"targetModel\": {\"targetModelName\": \"Gs2Experience:Status\", \"targetFieldName\": \"rankCapValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}, {\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0002\"}], \"rate\": 1.0}, \"expression\": \"rate_add\", \"priority\": 1}, {\"name\": \"buff-0002\", \"metadata\": \"BUFF_0002\", \"targetType\": \"action\", \"targetAction\": {\"targetActionName\": \"Gs2Experience:AddExperienceByUserId\", \"targetFieldName\": \"experienceValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}], \"rate\": 2.0}, \"expression\": \"mul\", \"priority\": 2}, {\"name\": \"buff-0003\", \"metadata\": \"BUFF_0003\", \"targetType\": \"model\", \"targetModel\": {\"targetModelName\": \"Gs2Experience:Status\", \"targetFieldName\": \"rankCapValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}], \"rate\": 3.0}, \"expression\": \"mul\", \"priority\": 3}]}",
    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('buff')

api_result_handler = client.update_current_buff_master_async({
    namespaceName="namespace-0001",
    mode="direct",
    settings="{\"version\": \"2024-04-15\", \"buffEntryModels\": [{\"name\": \"buff-0001\", \"metadata\": \"BUFF_0001\", \"targetType\": \"model\", \"targetModel\": {\"targetModelName\": \"Gs2Experience:Status\", \"targetFieldName\": \"rankCapValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}, {\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0002\"}], \"rate\": 1.0}, \"expression\": \"rate_add\", \"priority\": 1}, {\"name\": \"buff-0002\", \"metadata\": \"BUFF_0002\", \"targetType\": \"action\", \"targetAction\": {\"targetActionName\": \"Gs2Experience:AddExperienceByUserId\", \"targetFieldName\": \"experienceValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}], \"rate\": 2.0}, \"expression\": \"mul\", \"priority\": 2}, {\"name\": \"buff-0003\", \"metadata\": \"BUFF_0003\", \"targetType\": \"model\", \"targetModel\": {\"targetModelName\": \"Gs2Experience:Status\", \"targetFieldName\": \"rankCapValue\", \"conditionGrns\": [{\"targetModelName\": \"Gs2Experience:ExperienceModel\", \"targetGrn\": \"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:experience-0001\"}], \"rate\": 3.0}, \"expression\": \"mul\", \"priority\": 3}]}",
    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;

```




---

### updateCurrentBuffMasterFromGitHub

現在アクティブなバフエントリーモデルのマスターデータをGitHubから更新<br>

GitHub リポジトリから直接マスターデータを取得して更新・有効化（公開）します。<br>
チェックアウト設定には、使用するリポジトリ、ブランチ/タグ、ファイルパスを指定します。<br>
マスターデータをバージョン管理で管理し、直接デプロイする場合に便利です。



#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [CurrentBuffMaster](#currentbuffmaster) | 更新された現在アクティブなバフエントリーモデルのマスターデータ |

#### 実装例




**Go**
```go

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

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

$session->open();

$client = new Gs2BuffRestClient(
    $session
);

try {
    $result = $client->updateCurrentBuffMasterFromGitHub(
        (new UpdateCurrentBuffMasterFromGitHubRequest())
            ->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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.UpdateCurrentBuffMasterFromGitHubRequest;
import io.gs2.buff.result.UpdateCurrentBuffMasterFromGitHubResult;

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

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

AsyncResult<Gs2.Gs2Buff.Result.UpdateCurrentBuffMasterFromGitHubResult> asyncResult = null;
yield return client.UpdateCurrentBuffMasterFromGitHub(
    new Gs2.Gs2Buff.Request.UpdateCurrentBuffMasterFromGitHubRequest()
        .WithNamespaceName("namespace-0001")
        .WithCheckoutSetting(new Gs2.Gs2Buff.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 Gs2Buff from '@/gs2/buff';

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

try {
    const result = await client.updateCurrentBuffMasterFromGitHub(
        new Gs2Buff.UpdateCurrentBuffMasterFromGitHubRequest()
            .withNamespaceName("namespace-0001")
            .withCheckoutSetting(new Gs2Buff.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 buff

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

try:
    result = client.update_current_buff_master_from_git_hub(
        buff.UpdateCurrentBuffMasterFromGitHubRequest()
            .with_namespace_name('namespace-0001')
            .with_checkout_setting(buff.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('buff')

api_result = client.update_current_buff_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('buff')

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

```




---

### describeBuffEntryModelMasters

バフエントリーモデルマスターの一覧を取得<br>

指定されたネームスペースのバフエントリーモデルマスターのページネーション付きリストを取得します。<br>
バフエントリーモデルマスターは、ゲームデータに適用可能なバフ効果を定義するバフエントリーモデルの編集可能なバージョンです。<br>
マスターデータへの変更は、現在のバフマスターを通じて有効化（公開）されるまで反映されません。



#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| items | [List&lt;BuffEntryModelMaster&gt;](#buffentrymodelmaster) | バフエントリーモデルマスターのリスト |
| nextPageToken | string | リストの続きを取得するためのページトークン |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.DescribeBuffEntryModelMasters(
    &buff.DescribeBuffEntryModelMastersRequest {
        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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\DescribeBuffEntryModelMastersRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $session
);

try {
    $result = $client->describeBuffEntryModelMasters(
        (new DescribeBuffEntryModelMastersRequest())
            ->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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.DescribeBuffEntryModelMastersRequest;
import io.gs2.buff.result.DescribeBuffEntryModelMastersResult;

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

try {
    DescribeBuffEntryModelMastersResult result = client.describeBuffEntryModelMasters(
        new DescribeBuffEntryModelMastersRequest()
            .withNamespaceName("namespace-0001")
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    List<BuffEntryModelMaster> 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 Gs2BuffRestClient(session);

AsyncResult<Gs2.Gs2Buff.Result.DescribeBuffEntryModelMastersResult> asyncResult = null;
yield return client.DescribeBuffEntryModelMasters(
    new Gs2.Gs2Buff.Request.DescribeBuffEntryModelMastersRequest()
        .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 Gs2Buff from '@/gs2/buff';

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

try {
    const result = await client.describeBuffEntryModelMasters(
        new Gs2Buff.DescribeBuffEntryModelMastersRequest()
            .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 buff

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

try:
    result = client.describe_buff_entry_model_masters(
        buff.DescribeBuffEntryModelMastersRequest()
            .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('buff')

api_result = client.describe_buff_entry_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('buff')

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

```




---

### createBuffEntryModelMaster

バフエントリーモデルマスターを新規作成<br>

ゲームデータに適用可能なバフ効果を定義する新しいバフエントリーモデルマスターを作成します。<br>
名前、適用方式（Rate Add、Mul、Value Add）、対象の種類（モデルまたはアクション）、対象の詳細、優先度を設定でき、オプションで GS2-Schedule のイベントに関連付けてバフを特定期間に限定することもできます。<br>
同じ対象に複数のバフが適用される場合、優先度の値が小さいバフが先に評価されます。<br>
変更は、現在のバフマスターを通じて有効化（公開）されるまで反映されません。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| name | string |  | ✓|  |  ~ 128文字 | バフエントリーモデル名<br>バフエントリーモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| description | string |  | |  |  ~ 1024文字 | 説明文 |
| metadata | string |  | |  |  ~ 2048文字 | メタデータ<br>メタデータには任意の値を設定できます。<br>これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
| expression | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"rate_add",<br>&nbsp;&nbsp;"mul",<br>&nbsp;&nbsp;"value_add"<br>}<br> |  | ✓|  |  | バフの適用タイプ<br>バフ値を対象にどのように適用するかを指定します。「Rate Add」は補正レートに加算（例: 1.0 + 0.2 = 1.2）、「Mul」は補正レートに乗算（例: レート * 0.5）、「Value Add」はレートベースの補正計算後の値に直接加算します。"rate_add": Rate Add / "mul": Mul / "value_add": Value Add /  |
| targetType | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"model",<br>&nbsp;&nbsp;"action"<br>}<br> |  | ✓|  |  | バフを適用する対象の種類<br>バフをモデルのフィールド値に適用するか、アクションのパラメータに適用するかを指定します。「Model」は GS2 リソースモデルのフィールドを対象とし、「Action」は GS2 アクション（例：入手量や消費量）のパラメータを対象とします。"model": モデル / "action": アクション /  |
| targetModel | [BuffTargetModel](#bufftargetmodel) | {targetType} == "model" | ✓※|  |  | バフを適用する対象のモデル<br>バフを適用する GS2 リソースモデルとフィールドを指定します。モデル名、フィールド名、対象リソースを特定する条件GRN、およびレート値が含まれます。<br>※ targetType が "model" であれば必須 |
| targetAction | [BuffTargetAction](#bufftargetaction) | {targetType} == "action" | ✓※|  |  | バフを適用する対象のアクション<br>バフを適用する GS2 アクションとパラメータを指定します。アクション名、フィールド名、対象リソースを特定する条件GRN、およびレート値が含まれます。<br>※ targetType が "action" であれば必須 |
| priority | int |  | ✓|  | 0 ~ 2147483646 | バフの適用優先度<br>バフエントリーモデルが評価される順序を決定します。値が小さいほど先に評価されます。同じフィールドを対象とする複数のバフがある場合、Rate Add と Mul 演算の相互作用により、適用順序が最終結果に影響します。 |
| applyPeriodScheduleEventId | string |  | |  |  ~ 1024文字 | バフを適用するイベントの開催期間GRN<br>このバフの有効期間を制御する GS2-Schedule イベントの GRN です。指定した場合、イベントの開催期間中のみバフが適用されます。未指定の場合、バフは常に有効です。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [BuffEntryModelMaster](#buffentrymodelmaster) | 作成したバフエントリーモデルマスター |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.CreateBuffEntryModelMaster(
    &buff.CreateBuffEntryModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        Name: pointy.String("buff-0001"),
        Description: nil,
        Metadata: nil,
        Expression: pointy.String("add"),
        TargetType: pointy.String("model"),
        TargetModel: &buff.BuffTargetModel{
            TargetModelName: pointy.String("Gs2Experience:Status"),
            TargetFieldName: pointy.String("rankCapValue"),
            ConditionGrns: []buff.BuffTargetGrn{
                buff.BuffTargetGrn{
                    TargetModelName: pointy.String("Gs2Experience:RateModel"),
                    TargetGrn: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:exchange:namespace-0001:model:rate-0001"),
                },
            },
            Rate: pointy.Float32(1.0),
        },
        TargetAction: nil,
        Priority: pointy.Int32(1),
        ApplyPeriodScheduleEventId: 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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\CreateBuffEntryModelMasterRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $session
);

try {
    $result = $client->createBuffEntryModelMaster(
        (new CreateBuffEntryModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withName("buff-0001")
            ->withDescription(null)
            ->withMetadata(null)
            ->withExpression("add")
            ->withTargetType("model")
            ->withTargetModel((new \Gs2\Buff\Model\BuffTargetModel())
                ->withTargetModelName("Gs2Experience:Status")
                ->withTargetFieldName("rankCapValue")
                ->withConditionGrns([
                    (new \Gs2\Buff\Model\BuffTargetGrn())
                        ->withTargetModelName("Gs2Experience:RateModel")
                        ->withTargetGrn("grn:gs2:ap-northeast-1:YourOwnerId:exchange:namespace-0001:model:rate-0001"),
                ])
                ->withRate(1.0))
            ->withTargetAction(null)
            ->withPriority(1)
            ->withApplyPeriodScheduleEventId(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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.CreateBuffEntryModelMasterRequest;
import io.gs2.buff.result.CreateBuffEntryModelMasterResult;

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

try {
    CreateBuffEntryModelMasterResult result = client.createBuffEntryModelMaster(
        new CreateBuffEntryModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withName("buff-0001")
            .withDescription(null)
            .withMetadata(null)
            .withExpression("add")
            .withTargetType("model")
            .withTargetModel(new io.gs2.buff.model.BuffTargetModel()
                .withTargetModelName("Gs2Experience:Status")
                .withTargetFieldName("rankCapValue")
                .withConditionGrns(Arrays.asList(
                    new io.gs2.buff.model.BuffTargetGrn()
                        .withTargetModelName("Gs2Experience:RateModel")
                        .withTargetGrn("grn:gs2:ap-northeast-1:YourOwnerId:exchange:namespace-0001:model:rate-0001")
                ))
                .withRate(1.0f))
            .withTargetAction(null)
            .withPriority(1)
            .withApplyPeriodScheduleEventId(null)
    );
    BuffEntryModelMaster 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 Gs2BuffRestClient(session);

AsyncResult<Gs2.Gs2Buff.Result.CreateBuffEntryModelMasterResult> asyncResult = null;
yield return client.CreateBuffEntryModelMaster(
    new Gs2.Gs2Buff.Request.CreateBuffEntryModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithName("buff-0001")
        .WithDescription(null)
        .WithMetadata(null)
        .WithExpression("add")
        .WithTargetType("model")
        .WithTargetModel(new Gs2.Gs2Buff.Model.BuffTargetModel()
            .WithTargetModelName("Gs2Experience:Status")
            .WithTargetFieldName("rankCapValue")
            .WithConditionGrns(new Gs2.Gs2Buff.Model.BuffTargetGrn[] {
                new Gs2.Gs2Buff.Model.BuffTargetGrn()
                    .WithTargetModelName("Gs2Experience:RateModel")
                    .WithTargetGrn("grn:gs2:ap-northeast-1:YourOwnerId:exchange:namespace-0001:model:rate-0001"),
            })
            .WithRate(1.0f))
        .WithTargetAction(null)
        .WithPriority(1)
        .WithApplyPeriodScheduleEventId(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 Gs2Buff from '@/gs2/buff';

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

try {
    const result = await client.createBuffEntryModelMaster(
        new Gs2Buff.CreateBuffEntryModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withName("buff-0001")
            .withDescription(null)
            .withMetadata(null)
            .withExpression("add")
            .withTargetType("model")
            .withTargetModel(new Gs2Buff.model.BuffTargetModel()
                .withTargetModelName("Gs2Experience:Status")
                .withTargetFieldName("rankCapValue")
                .withConditionGrns([
                    new Gs2Buff.model.BuffTargetGrn()
                        .withTargetModelName("Gs2Experience:RateModel")
                        .withTargetGrn("grn:gs2:ap-northeast-1:YourOwnerId:exchange:namespace-0001:model:rate-0001"),
                ])
                .withRate(1.0))
            .withTargetAction(null)
            .withPriority(1)
            .withApplyPeriodScheduleEventId(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import buff

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

try:
    result = client.create_buff_entry_model_master(
        buff.CreateBuffEntryModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_name('buff-0001')
            .with_description(None)
            .with_metadata(None)
            .with_expression('add')
            .with_target_type('model')
            .with_target_model(
                buff.BuffTargetModel()
                    .with_target_model_name('Gs2Experience:Status')
                    .with_target_field_name('rankCapValue')
                    .with_condition_grns([
                        buff.BuffTargetGrn()
                            .with_target_model_name('Gs2Experience:RateModel')
                            .with_target_grn('grn:gs2:ap-northeast-1:YourOwnerId:exchange:namespace-0001:model:rate-0001'),
                    ])
                    .with_rate(1.0))
            .with_target_action(None)
            .with_priority(1)
            .with_apply_period_schedule_event_id(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('buff')

api_result = client.create_buff_entry_model_master({
    namespaceName="namespace-0001",
    name="buff-0001",
    description=nil,
    metadata=nil,
    expression="add",
    targetType="model",
    targetModel={
        targetModelName="Gs2Experience:Status",
        targetFieldName="rankCapValue",
        conditionGrns={
            {
                targetModelName="Gs2Experience:RateModel",
                targetGrn="grn:gs2:ap-northeast-1:YourOwnerId:exchange:namespace-0001:model:rate-0001",
            }
        },
        rate=1.0,
    },
    targetAction=nil,
    priority=1,
    applyPeriodScheduleEventId=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('buff')

api_result_handler = client.create_buff_entry_model_master_async({
    namespaceName="namespace-0001",
    name="buff-0001",
    description=nil,
    metadata=nil,
    expression="add",
    targetType="model",
    targetModel={
        targetModelName="Gs2Experience:Status",
        targetFieldName="rankCapValue",
        conditionGrns={
            {
                targetModelName="Gs2Experience:RateModel",
                targetGrn="grn:gs2:ap-northeast-1:YourOwnerId:exchange:namespace-0001:model:rate-0001",
            }
        },
        rate=1.0,
    },
    targetAction=nil,
    priority=1,
    applyPeriodScheduleEventId=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;

```




---

### getBuffEntryModelMaster

バフエントリーモデルマスターを取得<br>

指定されたネームスペースの名前を指定して、特定のバフエントリーモデルマスターを取得します。<br>
取得される情報には、適用方式、対象の種類、対象の詳細、優先度、メタデータ、および設定されている場合は関連する GS2-Schedule のイベント情報が含まれます。



#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [BuffEntryModelMaster](#buffentrymodelmaster) | バフエントリーモデルマスター |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.GetBuffEntryModelMaster(
    &buff.GetBuffEntryModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        BuffEntryName: pointy.String("buff-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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\GetBuffEntryModelMasterRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $session
);

try {
    $result = $client->getBuffEntryModelMaster(
        (new GetBuffEntryModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withBuffEntryName("buff-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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.GetBuffEntryModelMasterRequest;
import io.gs2.buff.result.GetBuffEntryModelMasterResult;

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

try {
    GetBuffEntryModelMasterResult result = client.getBuffEntryModelMaster(
        new GetBuffEntryModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withBuffEntryName("buff-0001")
    );
    BuffEntryModelMaster 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 Gs2BuffRestClient(session);

AsyncResult<Gs2.Gs2Buff.Result.GetBuffEntryModelMasterResult> asyncResult = null;
yield return client.GetBuffEntryModelMaster(
    new Gs2.Gs2Buff.Request.GetBuffEntryModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithBuffEntryName("buff-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 Gs2Buff from '@/gs2/buff';

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

try {
    const result = await client.getBuffEntryModelMaster(
        new Gs2Buff.GetBuffEntryModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withBuffEntryName("buff-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import buff

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

try:
    result = client.get_buff_entry_model_master(
        buff.GetBuffEntryModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_buff_entry_name('buff-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('buff')

api_result = client.get_buff_entry_model_master({
    namespaceName="namespace-0001",
    buffEntryName="buff-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('buff')

api_result_handler = client.get_buff_entry_model_master_async({
    namespaceName="namespace-0001",
    buffEntryName="buff-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;

```




---

### updateBuffEntryModelMaster

バフエントリーモデルマスターを更新<br>

指定されたバフエントリーモデルマスターを更新します。<br>
説明、メタデータ、適用方式（Rate Add、Mul、Value Add）、対象の種類、対象の詳細、優先度、および関連する GS2-Schedule のイベントを変更できます。<br>
変更は、現在のバフマスターを通じて有効化（公開）されるまで反映されません。



#### Request

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| buffEntryName | string |  | ✓|  |  ~ 128文字 | バフエントリーモデル名<br>バフエントリーモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| description | string |  | |  |  ~ 1024文字 | 説明文 |
| metadata | string |  | |  |  ~ 2048文字 | メタデータ<br>メタデータには任意の値を設定できます。<br>これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
| expression | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"rate_add",<br>&nbsp;&nbsp;"mul",<br>&nbsp;&nbsp;"value_add"<br>}<br> |  | ✓|  |  | バフの適用タイプ<br>バフ値を対象にどのように適用するかを指定します。「Rate Add」は補正レートに加算（例: 1.0 + 0.2 = 1.2）、「Mul」は補正レートに乗算（例: レート * 0.5）、「Value Add」はレートベースの補正計算後の値に直接加算します。"rate_add": Rate Add / "mul": Mul / "value_add": Value Add /  |
| targetType | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"model",<br>&nbsp;&nbsp;"action"<br>}<br> |  | ✓|  |  | バフを適用する対象の種類<br>バフをモデルのフィールド値に適用するか、アクションのパラメータに適用するかを指定します。「Model」は GS2 リソースモデルのフィールドを対象とし、「Action」は GS2 アクション（例：入手量や消費量）のパラメータを対象とします。"model": モデル / "action": アクション /  |
| targetModel | [BuffTargetModel](#bufftargetmodel) | {targetType} == "model" | ✓※|  |  | バフを適用する対象のモデル<br>バフを適用する GS2 リソースモデルとフィールドを指定します。モデル名、フィールド名、対象リソースを特定する条件GRN、およびレート値が含まれます。<br>※ targetType が "model" であれば必須 |
| targetAction | [BuffTargetAction](#bufftargetaction) | {targetType} == "action" | ✓※|  |  | バフを適用する対象のアクション<br>バフを適用する GS2 アクションとパラメータを指定します。アクション名、フィールド名、対象リソースを特定する条件GRN、およびレート値が含まれます。<br>※ targetType が "action" であれば必須 |
| priority | int |  | ✓|  | 0 ~ 2147483646 | バフの適用優先度<br>バフエントリーモデルが評価される順序を決定します。値が小さいほど先に評価されます。同じフィールドを対象とする複数のバフがある場合、Rate Add と Mul 演算の相互作用により、適用順序が最終結果に影響します。 |
| applyPeriodScheduleEventId | string |  | |  |  ~ 1024文字 | バフを適用するイベントの開催期間GRN<br>このバフの有効期間を制御する GS2-Schedule イベントの GRN です。指定した場合、イベントの開催期間中のみバフが適用されます。未指定の場合、バフは常に有効です。 |

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [BuffEntryModelMaster](#buffentrymodelmaster) | 更新したバフエントリーモデルマスター |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.UpdateBuffEntryModelMaster(
    &buff.UpdateBuffEntryModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        BuffEntryName: pointy.String("buff-0001"),
        Description: pointy.String("description1"),
        Metadata: pointy.String("BUFF_0001"),
        Expression: pointy.String("mul"),
        TargetType: pointy.String("action"),
        TargetModel: nil,
        TargetAction: &buff.BuffTargetAction{
            TargetActionName: pointy.String("Gs2Experience:AddExperienceByUserId"),
            TargetFieldName: pointy.String("experienceValue"),
            ConditionGrns: []buff.BuffTargetGrn{
                buff.BuffTargetGrn{
                    TargetModelName: pointy.String("Gs2Experience:RateModel"),
                    TargetGrn: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:exchange:namespace-0001:model:rate-0001"),
                },
            },
            Rate: pointy.Float32(1.5),
        },
        Priority: pointy.Int32(2),
        ApplyPeriodScheduleEventId: 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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\UpdateBuffEntryModelMasterRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $session
);

try {
    $result = $client->updateBuffEntryModelMaster(
        (new UpdateBuffEntryModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withBuffEntryName("buff-0001")
            ->withDescription("description1")
            ->withMetadata("BUFF_0001")
            ->withExpression("mul")
            ->withTargetType("action")
            ->withTargetModel(null)
            ->withTargetAction((new \Gs2\Buff\Model\BuffTargetAction())
                ->withTargetActionName("Gs2Experience:AddExperienceByUserId")
                ->withTargetFieldName("experienceValue")
                ->withConditionGrns([
                    (new \Gs2\Buff\Model\BuffTargetGrn())
                        ->withTargetModelName("Gs2Experience:RateModel")
                        ->withTargetGrn("grn:gs2:ap-northeast-1:YourOwnerId:exchange:namespace-0001:model:rate-0001"),
                ])
                ->withRate(1.5))
            ->withPriority(2)
            ->withApplyPeriodScheduleEventId(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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.UpdateBuffEntryModelMasterRequest;
import io.gs2.buff.result.UpdateBuffEntryModelMasterResult;

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

try {
    UpdateBuffEntryModelMasterResult result = client.updateBuffEntryModelMaster(
        new UpdateBuffEntryModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withBuffEntryName("buff-0001")
            .withDescription("description1")
            .withMetadata("BUFF_0001")
            .withExpression("mul")
            .withTargetType("action")
            .withTargetModel(null)
            .withTargetAction(new io.gs2.buff.model.BuffTargetAction()
                .withTargetActionName("Gs2Experience:AddExperienceByUserId")
                .withTargetFieldName("experienceValue")
                .withConditionGrns(Arrays.asList(
                    new io.gs2.buff.model.BuffTargetGrn()
                        .withTargetModelName("Gs2Experience:RateModel")
                        .withTargetGrn("grn:gs2:ap-northeast-1:YourOwnerId:exchange:namespace-0001:model:rate-0001")
                ))
                .withRate(1.5f))
            .withPriority(2)
            .withApplyPeriodScheduleEventId(null)
    );
    BuffEntryModelMaster 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 Gs2BuffRestClient(session);

AsyncResult<Gs2.Gs2Buff.Result.UpdateBuffEntryModelMasterResult> asyncResult = null;
yield return client.UpdateBuffEntryModelMaster(
    new Gs2.Gs2Buff.Request.UpdateBuffEntryModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithBuffEntryName("buff-0001")
        .WithDescription("description1")
        .WithMetadata("BUFF_0001")
        .WithExpression("mul")
        .WithTargetType("action")
        .WithTargetModel(null)
        .WithTargetAction(new Gs2.Gs2Buff.Model.BuffTargetAction()
            .WithTargetActionName("Gs2Experience:AddExperienceByUserId")
            .WithTargetFieldName("experienceValue")
            .WithConditionGrns(new Gs2.Gs2Buff.Model.BuffTargetGrn[] {
                new Gs2.Gs2Buff.Model.BuffTargetGrn()
                    .WithTargetModelName("Gs2Experience:RateModel")
                    .WithTargetGrn("grn:gs2:ap-northeast-1:YourOwnerId:exchange:namespace-0001:model:rate-0001"),
            })
            .WithRate(1.5f))
        .WithPriority(2)
        .WithApplyPeriodScheduleEventId(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 Gs2Buff from '@/gs2/buff';

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

try {
    const result = await client.updateBuffEntryModelMaster(
        new Gs2Buff.UpdateBuffEntryModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withBuffEntryName("buff-0001")
            .withDescription("description1")
            .withMetadata("BUFF_0001")
            .withExpression("mul")
            .withTargetType("action")
            .withTargetModel(null)
            .withTargetAction(new Gs2Buff.model.BuffTargetAction()
                .withTargetActionName("Gs2Experience:AddExperienceByUserId")
                .withTargetFieldName("experienceValue")
                .withConditionGrns([
                    new Gs2Buff.model.BuffTargetGrn()
                        .withTargetModelName("Gs2Experience:RateModel")
                        .withTargetGrn("grn:gs2:ap-northeast-1:YourOwnerId:exchange:namespace-0001:model:rate-0001"),
                ])
                .withRate(1.5))
            .withPriority(2)
            .withApplyPeriodScheduleEventId(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import buff

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

try:
    result = client.update_buff_entry_model_master(
        buff.UpdateBuffEntryModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_buff_entry_name('buff-0001')
            .with_description('description1')
            .with_metadata('BUFF_0001')
            .with_expression('mul')
            .with_target_type('action')
            .with_target_model(None)
            .with_target_action(
                buff.BuffTargetAction()
                    .with_target_action_name('Gs2Experience:AddExperienceByUserId')
                    .with_target_field_name('experienceValue')
                    .with_condition_grns([
                        buff.BuffTargetGrn()
                            .with_target_model_name('Gs2Experience:RateModel')
                            .with_target_grn('grn:gs2:ap-northeast-1:YourOwnerId:exchange:namespace-0001:model:rate-0001'),
                    ])
                    .with_rate(1.5))
            .with_priority(2)
            .with_apply_period_schedule_event_id(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('buff')

api_result = client.update_buff_entry_model_master({
    namespaceName="namespace-0001",
    buffEntryName="buff-0001",
    description="description1",
    metadata="BUFF_0001",
    expression="mul",
    targetType="action",
    targetModel=nil,
    targetAction={
        targetActionName="Gs2Experience:AddExperienceByUserId",
        targetFieldName="experienceValue",
        conditionGrns={
            {
                targetModelName="Gs2Experience:RateModel",
                targetGrn="grn:gs2:ap-northeast-1:YourOwnerId:exchange:namespace-0001:model:rate-0001",
            }
        },
        rate=1.5,
    },
    priority=2,
    applyPeriodScheduleEventId=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('buff')

api_result_handler = client.update_buff_entry_model_master_async({
    namespaceName="namespace-0001",
    buffEntryName="buff-0001",
    description="description1",
    metadata="BUFF_0001",
    expression="mul",
    targetType="action",
    targetModel=nil,
    targetAction={
        targetActionName="Gs2Experience:AddExperienceByUserId",
        targetFieldName="experienceValue",
        conditionGrns={
            {
                targetModelName="Gs2Experience:RateModel",
                targetGrn="grn:gs2:ap-northeast-1:YourOwnerId:exchange:namespace-0001:model:rate-0001",
            }
        },
        rate=1.5,
    },
    priority=2,
    applyPeriodScheduleEventId=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;

```




---

### deleteBuffEntryModelMaster

バフエントリーモデルマスターを削除<br>

指定されたネームスペースから指定されたバフエントリーモデルマスターを削除します。<br>
削除後、次回のマスターデータ有効化以降、このバフエントリーは利用できなくなります。<br>
この操作はマスターデータにのみ影響し、マスターデータが再有効化されるまで現在有効なモデルは変更されません。



#### Request

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

#### Result

|  | 型 | 説明 |
| --- | --- | --- |
| item | [BuffEntryModelMaster](#buffentrymodelmaster) | 削除したバフエントリーモデルマスター |

#### 実装例




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/buff"
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 := buff.Gs2BuffRestClient{
    Session: &session,
}
result, err := client.DeleteBuffEntryModelMaster(
    &buff.DeleteBuffEntryModelMasterRequest {
        NamespaceName: pointy.String("namespace-0001"),
        BuffEntryName: pointy.String("buff-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\Buff\Gs2BuffRestClient;
use Gs2\Buff\Request\DeleteBuffEntryModelMasterRequest;

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

$session->open();

$client = new Gs2BuffRestClient(
    $session
);

try {
    $result = $client->deleteBuffEntryModelMaster(
        (new DeleteBuffEntryModelMasterRequest())
            ->withNamespaceName("namespace-0001")
            ->withBuffEntryName("buff-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.buff.rest.Gs2BuffRestClient;
import io.gs2.buff.request.DeleteBuffEntryModelMasterRequest;
import io.gs2.buff.result.DeleteBuffEntryModelMasterResult;

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

try {
    DeleteBuffEntryModelMasterResult result = client.deleteBuffEntryModelMaster(
        new DeleteBuffEntryModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withBuffEntryName("buff-0001")
    );
    BuffEntryModelMaster 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 Gs2BuffRestClient(session);

AsyncResult<Gs2.Gs2Buff.Result.DeleteBuffEntryModelMasterResult> asyncResult = null;
yield return client.DeleteBuffEntryModelMaster(
    new Gs2.Gs2Buff.Request.DeleteBuffEntryModelMasterRequest()
        .WithNamespaceName("namespace-0001")
        .WithBuffEntryName("buff-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 Gs2Buff from '@/gs2/buff';

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

try {
    const result = await client.deleteBuffEntryModelMaster(
        new Gs2Buff.DeleteBuffEntryModelMasterRequest()
            .withNamespaceName("namespace-0001")
            .withBuffEntryName("buff-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import buff

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

try:
    result = client.delete_buff_entry_model_master(
        buff.DeleteBuffEntryModelMasterRequest()
            .with_namespace_name('namespace-0001')
            .with_buff_entry_name('buff-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('buff')

api_result = client.delete_buff_entry_model_master({
    namespaceName="namespace-0001",
    buffEntryName="buff-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('buff')

api_result_handler = client.delete_buff_entry_model_master_async({
    namespaceName="namespace-0001",
    buffEntryName="buff-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;

```




---



