Repository URL to install this package:
Version:
2024.6.10 ▾
|
/*
* Copyright 2016 Game Server Services, Inc. or its affiliates. All Rights
* Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using Gs2.Core.Control;
using Gs2.Core.Model;
using Gs2.Gs2Lottery.Model;
using Gs2.Util.LitJson;
#if UNITY_2017_1_OR_NEWER
using UnityEngine.Scripting;
#endif
namespace Gs2.Gs2Lottery.Request
{
#if UNITY_2017_1_OR_NEWER
[Preserve]
#endif
[System.Serializable]
public class UpdateNamespaceRequest : Gs2Request<UpdateNamespaceRequest>
{
public string NamespaceName { set; get; } = null!;
public string Description { set; get; } = null!;
public Gs2.Gs2Lottery.Model.TransactionSetting TransactionSetting { set; get; } = null!;
public string LotteryTriggerScriptId { set; get; } = null!;
public string ChoicePrizeTableScriptId { set; get; } = null!;
public Gs2.Gs2Lottery.Model.LogSetting LogSetting { set; get; } = null!;
[Obsolete("This method is deprecated")]
public string QueueNamespaceId { set; get; } = null!;
[Obsolete("This method is deprecated")]
public string KeyId { set; get; } = null!;
public UpdateNamespaceRequest WithNamespaceName(string namespaceName) {
this.NamespaceName = namespaceName;
return this;
}
public UpdateNamespaceRequest WithDescription(string description) {
this.Description = description;
return this;
}
public UpdateNamespaceRequest WithTransactionSetting(Gs2.Gs2Lottery.Model.TransactionSetting transactionSetting) {
this.TransactionSetting = transactionSetting;
return this;
}
public UpdateNamespaceRequest WithLotteryTriggerScriptId(string lotteryTriggerScriptId) {
this.LotteryTriggerScriptId = lotteryTriggerScriptId;
return this;
}
public UpdateNamespaceRequest WithChoicePrizeTableScriptId(string choicePrizeTableScriptId) {
this.ChoicePrizeTableScriptId = choicePrizeTableScriptId;
return this;
}
public UpdateNamespaceRequest WithLogSetting(Gs2.Gs2Lottery.Model.LogSetting logSetting) {
this.LogSetting = logSetting;
return this;
}
[Obsolete("This method is deprecated")]
public UpdateNamespaceRequest WithQueueNamespaceId(string queueNamespaceId) {
this.QueueNamespaceId = queueNamespaceId;
return this;
}
[Obsolete("This method is deprecated")]
public UpdateNamespaceRequest WithKeyId(string keyId) {
this.KeyId = keyId;
return this;
}
#if UNITY_2017_1_OR_NEWER
[Preserve]
#endif
public static UpdateNamespaceRequest FromJson(JsonData data)
{
if (data == null) {
return null;
}
return new UpdateNamespaceRequest()
.WithNamespaceName(!data.Keys.Contains("namespaceName") || data["namespaceName"] == null ? null : data["namespaceName"].ToString())
.WithDescription(!data.Keys.Contains("description") || data["description"] == null ? null : data["description"].ToString())
.WithTransactionSetting(!data.Keys.Contains("transactionSetting") || data["transactionSetting"] == null ? null : Gs2.Gs2Lottery.Model.TransactionSetting.FromJson(data["transactionSetting"]))
.WithLotteryTriggerScriptId(!data.Keys.Contains("lotteryTriggerScriptId") || data["lotteryTriggerScriptId"] == null ? null : data["lotteryTriggerScriptId"].ToString())
.WithChoicePrizeTableScriptId(!data.Keys.Contains("choicePrizeTableScriptId") || data["choicePrizeTableScriptId"] == null ? null : data["choicePrizeTableScriptId"].ToString())
.WithLogSetting(!data.Keys.Contains("logSetting") || data["logSetting"] == null ? null : Gs2.Gs2Lottery.Model.LogSetting.FromJson(data["logSetting"]));
}
public override JsonData ToJson()
{
return new JsonData {
["namespaceName"] = NamespaceName,
["description"] = Description,
["transactionSetting"] = TransactionSetting?.ToJson(),
["lotteryTriggerScriptId"] = LotteryTriggerScriptId,
["choicePrizeTableScriptId"] = ChoicePrizeTableScriptId,
["logSetting"] = LogSetting?.ToJson(),
};
}
public void WriteJson(JsonWriter writer)
{
writer.WriteObjectStart();
if (NamespaceName != null) {
writer.WritePropertyName("namespaceName");
writer.Write(NamespaceName.ToString());
}
if (Description != null) {
writer.WritePropertyName("description");
writer.Write(Description.ToString());
}
if (TransactionSetting != null) {
TransactionSetting.WriteJson(writer);
}
if (LotteryTriggerScriptId != null) {
writer.WritePropertyName("lotteryTriggerScriptId");
writer.Write(LotteryTriggerScriptId.ToString());
}
if (ChoicePrizeTableScriptId != null) {
writer.WritePropertyName("choicePrizeTableScriptId");
writer.Write(ChoicePrizeTableScriptId.ToString());
}
if (LogSetting != null) {
LogSetting.WriteJson(writer);
}
if (QueueNamespaceId != null) {
writer.WritePropertyName("queueNamespaceId");
writer.Write(QueueNamespaceId.ToString());
}
if (KeyId != null) {
writer.WritePropertyName("keyId");
writer.Write(KeyId.ToString());
}
writer.WriteObjectEnd();
}
public override string UniqueKey() {
var key = "";
key += NamespaceName + ":";
key += Description + ":";
key += TransactionSetting + ":";
key += LotteryTriggerScriptId + ":";
key += ChoicePrizeTableScriptId + ":";
key += LogSetting + ":";
return key;
}
}
}