From 7b8cc4994f06e303b50889b1484663ed1e1c0d65 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 30 Sep 2024 14:17:41 +0000 Subject: [PATCH] [RELEASE] 2.0.19 --- .../csharp/.openapi-generator/FILES | 3 + automation-api-clients/csharp/spec.json | 71 ++++ .../BeamAutomationClient/Api/MigrationApi.cs | 386 ++++++++++++++++++ .../Client/HostConfiguration.cs | 5 + .../AutomationConvertTokenRequestInput.cs | 33 +- .../Model/AutomationMigrateRequestInput.cs | 215 ++++++++++ .../Model/AutomationMigrateResponse.cs | 162 ++++++++ .../typescript-node/package.json | 2 +- .../src/generated/ApiClient.ts | 3 + .../typescript-node/src/generated/index.ts | 3 + .../models/ConvertTokenRequestInput.ts | 1 + .../generated/models/MigrateRequestInput.ts | 10 + .../src/generated/models/MigrateResponse.ts | 8 + .../src/generated/models/index.ts | 2 + .../generated/services/MigrationService.ts | 30 ++ player-api-clients/csharp/spec.json | 7 + .../Model/PlayerConvertTokenRequestInput.cs | 33 +- .../PlayerGenerateSessionUrlRequestInput.cs | 36 +- .../typescript-node/package.json | 2 +- .../models/ConvertTokenRequestInput.ts | 1 + .../models/GenerateSessionUrlRequestInput.ts | 1 + 21 files changed, 1006 insertions(+), 8 deletions(-) create mode 100644 automation-api-clients/csharp/src/BeamAutomationClient/Api/MigrationApi.cs create mode 100644 automation-api-clients/csharp/src/BeamAutomationClient/Model/AutomationMigrateRequestInput.cs create mode 100644 automation-api-clients/csharp/src/BeamAutomationClient/Model/AutomationMigrateResponse.cs create mode 100644 automation-api-clients/typescript-node/src/generated/models/MigrateRequestInput.ts create mode 100644 automation-api-clients/typescript-node/src/generated/models/MigrateResponse.ts create mode 100644 automation-api-clients/typescript-node/src/generated/services/MigrationService.ts diff --git a/automation-api-clients/csharp/.openapi-generator/FILES b/automation-api-clients/csharp/.openapi-generator/FILES index ee1b00e..5d66f4c 100644 --- a/automation-api-clients/csharp/.openapi-generator/FILES +++ b/automation-api-clients/csharp/.openapi-generator/FILES @@ -11,6 +11,7 @@ src/BeamAutomationClient/Api/GameApi.cs src/BeamAutomationClient/Api/HealthApi.cs src/BeamAutomationClient/Api/IApi.cs src/BeamAutomationClient/Api/MarketplaceV2Api.cs +src/BeamAutomationClient/Api/MigrationApi.cs src/BeamAutomationClient/Api/PolicyApi.cs src/BeamAutomationClient/Api/ProfilesApi.cs src/BeamAutomationClient/Api/ReportingApi.cs @@ -120,6 +121,8 @@ src/BeamAutomationClient/Model/AutomationGetTransactionsResponseV2.cs src/BeamAutomationClient/Model/AutomationGetTransactionsResponseV2DataInner.cs src/BeamAutomationClient/Model/AutomationGetWebhooksForGameResponse.cs src/BeamAutomationClient/Model/AutomationGetWebhooksForGameResponseWebhooksInner.cs +src/BeamAutomationClient/Model/AutomationMigrateRequestInput.cs +src/BeamAutomationClient/Model/AutomationMigrateResponse.cs src/BeamAutomationClient/Model/AutomationRefreshContractRequestBody.cs src/BeamAutomationClient/Model/AutomationRefreshTokenRequestBody.cs src/BeamAutomationClient/Model/AutomationRegenerateGameApiKeysResponse.cs diff --git a/automation-api-clients/csharp/spec.json b/automation-api-clients/csharp/spec.json index 30d52ae..d345d49 100644 --- a/automation-api-clients/csharp/spec.json +++ b/automation-api-clients/csharp/spec.json @@ -2688,6 +2688,43 @@ } ] } + }, + "/v1/migration/migrate": { + "post": { + "operationId": "migrateProfileAssets", + "summary": "Migrate all the native token, ERC20 tokens and NFTs registered for your game from an Automation API profile to a Player API user", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AutomationMigrateRequestInput" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AutomationMigrateResponse" + } + } + } + } + }, + "tags": [ + "Migration" + ], + "security": [ + { + "beam-api-key": [] + } + ] + } } }, "info": { @@ -3760,6 +3797,9 @@ "receiverEntityId": { "type": "string" }, + "receiverWalletAddress": { + "type": "string" + }, "optimistic": { "default": false, "type": "boolean" @@ -6482,6 +6522,37 @@ "nullable": true } } + }, + "AutomationMigrateRequestInput": { + "type": "object", + "properties": { + "profileEntityId": { + "type": "string" + }, + "userEntityId": { + "type": "string" + }, + "chainId": { + "default": 13337, + "type": "integer", + "format": "int64" + } + }, + "required": [ + "profileEntityId", + "userEntityId" + ] + }, + "AutomationMigrateResponse": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + } + }, + "required": [ + "success" + ] } } } diff --git a/automation-api-clients/csharp/src/BeamAutomationClient/Api/MigrationApi.cs b/automation-api-clients/csharp/src/BeamAutomationClient/Api/MigrationApi.cs new file mode 100644 index 0000000..eb4bdae --- /dev/null +++ b/automation-api-clients/csharp/src/BeamAutomationClient/Api/MigrationApi.cs @@ -0,0 +1,386 @@ +// +/* + * Automation API + * + * The Automation API is a service to integrate your game with Beam + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using BeamAutomationClient.Client; +using BeamAutomationClient.Model; +using System.Diagnostics.CodeAnalysis; + +namespace BeamAutomationClient.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IAutomationMigrationApi : IAutomationApi + { + /// + /// The class containing the events + /// + AutomationMigrationApiEvents Events { get; } + + /// + /// Migrate all the native token, ERC20 tokens and NFTs registered for your game from an Automation API profile to a Player API user + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// <> + Task MigrateProfileAssetsAsync(AutomationMigrateRequestInput automationMigrateRequestInput, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Migrate all the native token, ERC20 tokens and NFTs registered for your game from an Automation API profile to a Player API user + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task MigrateProfileAssetsOrDefaultAsync(AutomationMigrateRequestInput automationMigrateRequestInput, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IMigrateProfileAssetsApiResponse : BeamAutomationClient.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class AutomationMigrationApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnMigrateProfileAssets; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorMigrateProfileAssets; + + internal void ExecuteOnMigrateProfileAssets(AutomationMigrationApi.MigrateProfileAssetsApiResponse apiResponse) + { + OnMigrateProfileAssets?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorMigrateProfileAssets(Exception exception) + { + OnErrorMigrateProfileAssets?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class AutomationMigrationApi : IAutomationMigrationApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public AutomationMigrationApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public AutomationMigrationApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, AutomationJsonSerializerOptionsProvider jsonSerializerOptionsProvider, AutomationMigrationApiEvents automationMigrationApiEvents, + TokenProvider apiKeyProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = automationMigrationApiEvents; + ApiKeyProvider = apiKeyProvider; + } + + partial void FormatMigrateProfileAssets(AutomationMigrateRequestInput automationMigrateRequestInput); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateMigrateProfileAssets(AutomationMigrateRequestInput automationMigrateRequestInput) + { + if (automationMigrateRequestInput == null) + throw new ArgumentNullException(nameof(automationMigrateRequestInput)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterMigrateProfileAssetsDefaultImplementation(IMigrateProfileAssetsApiResponse apiResponseLocalVar, AutomationMigrateRequestInput automationMigrateRequestInput) + { + bool suppressDefaultLog = false; + AfterMigrateProfileAssets(ref suppressDefaultLog, apiResponseLocalVar, automationMigrateRequestInput); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterMigrateProfileAssets(ref bool suppressDefaultLog, IMigrateProfileAssetsApiResponse apiResponseLocalVar, AutomationMigrateRequestInput automationMigrateRequestInput); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorMigrateProfileAssetsDefaultImplementation(Exception exception, string pathFormat, string path, AutomationMigrateRequestInput automationMigrateRequestInput) + { + bool suppressDefaultLog = false; + OnErrorMigrateProfileAssets(ref suppressDefaultLog, exception, pathFormat, path, automationMigrateRequestInput); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorMigrateProfileAssets(ref bool suppressDefaultLog, Exception exception, string pathFormat, string path, AutomationMigrateRequestInput automationMigrateRequestInput); + + /// + /// Migrate all the native token, ERC20 tokens and NFTs registered for your game from an Automation API profile to a Player API user + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task MigrateProfileAssetsOrDefaultAsync(AutomationMigrateRequestInput automationMigrateRequestInput, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await MigrateProfileAssetsAsync(automationMigrateRequestInput, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Migrate all the native token, ERC20 tokens and NFTs registered for your game from an Automation API profile to a Player API user + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task MigrateProfileAssetsAsync(AutomationMigrateRequestInput automationMigrateRequestInput, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateMigrateProfileAssets(automationMigrateRequestInput); + + FormatMigrateProfileAssets(automationMigrateRequestInput); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/v1/migration/migrate"; + + httpRequestMessageLocalVar.Content = (automationMigrateRequestInput as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(automationMigrateRequestInput, _jsonSerializerOptions)); + + List tokenBaseLocalVars = new List(); + AutomationApiKeyToken apiKeyTokenLocalVar1 = (AutomationApiKeyToken) await ApiKeyProvider.GetAsync("x-api-key", cancellationToken).ConfigureAwait(false); + tokenBaseLocalVars.Add(apiKeyTokenLocalVar1); + apiKeyTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + MigrateProfileAssetsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/v1/migration/migrate", requestedAtLocalVar, _jsonSerializerOptions); + + AfterMigrateProfileAssetsDefaultImplementation(apiResponseLocalVar, automationMigrateRequestInput); + + Events.ExecuteOnMigrateProfileAssets(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorMigrateProfileAssetsDefaultImplementation(e, "/v1/migration/migrate", uriBuilderLocalVar.Path, automationMigrateRequestInput); + Events.ExecuteOnErrorMigrateProfileAssets(e); + throw; + } + } + + /// + /// The + /// + public partial class MigrateProfileAssetsApiResponse : BeamAutomationClient.Client.ApiResponse, IMigrateProfileAssetsApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public MigrateProfileAssetsApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public BeamAutomationClient.Model.AutomationMigrateResponse? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out BeamAutomationClient.Model.AutomationMigrateResponse? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/automation-api-clients/csharp/src/BeamAutomationClient/Client/HostConfiguration.cs b/automation-api-clients/csharp/src/BeamAutomationClient/Client/HostConfiguration.cs index bff99ad..d39401b 100644 --- a/automation-api-clients/csharp/src/BeamAutomationClient/Client/HostConfiguration.cs +++ b/automation-api-clients/csharp/src/BeamAutomationClient/Client/HostConfiguration.cs @@ -122,6 +122,8 @@ public AutomationHostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new AutomationGetTransactionsResponseV2DataInnerJsonConverter()); _jsonOptions.Converters.Add(new AutomationGetWebhooksForGameResponseJsonConverter()); _jsonOptions.Converters.Add(new AutomationGetWebhooksForGameResponseWebhooksInnerJsonConverter()); + _jsonOptions.Converters.Add(new AutomationMigrateRequestInputJsonConverter()); + _jsonOptions.Converters.Add(new AutomationMigrateResponseJsonConverter()); _jsonOptions.Converters.Add(new AutomationRefreshContractRequestBodyJsonConverter()); _jsonOptions.Converters.Add(new AutomationRefreshTokenRequestBodyJsonConverter()); _jsonOptions.Converters.Add(new AutomationRegenerateGameApiKeysResponseJsonConverter()); @@ -168,6 +170,8 @@ public AutomationHostConfiguration(IServiceCollection services) _services.AddTransient(); _services.AddSingleton(); _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); _services.AddSingleton(); _services.AddTransient(); _services.AddSingleton(); @@ -206,6 +210,7 @@ public AutomationHostConfiguration AddBeamAutomationApiHttpClients builders.Add(_services.AddHttpClient(client)); builders.Add(_services.AddHttpClient(client)); builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); builders.Add(_services.AddHttpClient(client)); builders.Add(_services.AddHttpClient(client)); builders.Add(_services.AddHttpClient(client)); diff --git a/automation-api-clients/csharp/src/BeamAutomationClient/Model/AutomationConvertTokenRequestInput.cs b/automation-api-clients/csharp/src/BeamAutomationClient/Model/AutomationConvertTokenRequestInput.cs index 20aa8bb..f3cf51d 100644 --- a/automation-api-clients/csharp/src/BeamAutomationClient/Model/AutomationConvertTokenRequestInput.cs +++ b/automation-api-clients/csharp/src/BeamAutomationClient/Model/AutomationConvertTokenRequestInput.cs @@ -42,9 +42,10 @@ public partial class AutomationConvertTokenRequestInput : IValidatableObject /// optimistic (default to false) /// policyId /// receiverEntityId + /// receiverWalletAddress /// sponsor (default to true) [JsonConstructor] - public AutomationConvertTokenRequestInput(string amountIn, string amountOut, string tokenIn, string tokenOut, Option chainId = default, Option optimistic = default, Option policyId = default, Option receiverEntityId = default, Option sponsor = default) + public AutomationConvertTokenRequestInput(string amountIn, string amountOut, string tokenIn, string tokenOut, Option chainId = default, Option optimistic = default, Option policyId = default, Option receiverEntityId = default, Option receiverWalletAddress = default, Option sponsor = default) { AmountIn = amountIn; AmountOut = amountOut; @@ -54,6 +55,7 @@ public AutomationConvertTokenRequestInput(string amountIn, string amountOut, str OptimisticOption = optimistic; PolicyIdOption = policyId; ReceiverEntityIdOption = receiverEntityId; + ReceiverWalletAddressOption = receiverWalletAddress; SponsorOption = sponsor; OnCreated(); } @@ -136,6 +138,19 @@ public AutomationConvertTokenRequestInput(string amountIn, string amountOut, str [JsonPropertyName("receiverEntityId")] public string? ReceiverEntityId { get { return this. ReceiverEntityIdOption; } set { this.ReceiverEntityIdOption = new(value); } } + /// + /// Used to track the state of ReceiverWalletAddress + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option ReceiverWalletAddressOption { get; private set; } + + /// + /// Gets or Sets ReceiverWalletAddress + /// + [JsonPropertyName("receiverWalletAddress")] + public string? ReceiverWalletAddress { get { return this. ReceiverWalletAddressOption; } set { this.ReceiverWalletAddressOption = new(value); } } + /// /// Used to track the state of Sponsor /// @@ -165,6 +180,7 @@ public override string ToString() sb.Append(" Optimistic: ").Append(Optimistic).Append("\n"); sb.Append(" PolicyId: ").Append(PolicyId).Append("\n"); sb.Append(" ReceiverEntityId: ").Append(ReceiverEntityId).Append("\n"); + sb.Append(" ReceiverWalletAddress: ").Append(ReceiverWalletAddress).Append("\n"); sb.Append(" Sponsor: ").Append(Sponsor).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -211,6 +227,7 @@ public override AutomationConvertTokenRequestInput Read(ref Utf8JsonReader utf8J Option optimistic = default; Option policyId = default; Option receiverEntityId = default; + Option receiverWalletAddress = default; Option sponsor = default; while (utf8JsonReader.Read()) @@ -254,6 +271,9 @@ public override AutomationConvertTokenRequestInput Read(ref Utf8JsonReader utf8J case "receiverEntityId": receiverEntityId = new Option(utf8JsonReader.GetString()!); break; + case "receiverWalletAddress": + receiverWalletAddress = new Option(utf8JsonReader.GetString()!); + break; case "sponsor": if (utf8JsonReader.TokenType != JsonTokenType.Null) sponsor = new Option(utf8JsonReader.GetBoolean()); @@ -297,10 +317,13 @@ public override AutomationConvertTokenRequestInput Read(ref Utf8JsonReader utf8J if (receiverEntityId.IsSet && receiverEntityId.Value == null) throw new ArgumentNullException(nameof(receiverEntityId), "Property is not nullable for class AutomationConvertTokenRequestInput."); + if (receiverWalletAddress.IsSet && receiverWalletAddress.Value == null) + throw new ArgumentNullException(nameof(receiverWalletAddress), "Property is not nullable for class AutomationConvertTokenRequestInput."); + if (sponsor.IsSet && sponsor.Value == null) throw new ArgumentNullException(nameof(sponsor), "Property is not nullable for class AutomationConvertTokenRequestInput."); - return new AutomationConvertTokenRequestInput(amountIn.Value!, amountOut.Value!, tokenIn.Value!, tokenOut.Value!, chainId, optimistic, policyId, receiverEntityId, sponsor); + return new AutomationConvertTokenRequestInput(amountIn.Value!, amountOut.Value!, tokenIn.Value!, tokenOut.Value!, chainId, optimistic, policyId, receiverEntityId, receiverWalletAddress, sponsor); } /// @@ -342,6 +365,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, AutomationConvertTokenReq if (automationConvertTokenRequestInput.ReceiverEntityIdOption.IsSet && automationConvertTokenRequestInput.ReceiverEntityId == null) throw new ArgumentNullException(nameof(automationConvertTokenRequestInput.ReceiverEntityId), "Property is required for class AutomationConvertTokenRequestInput."); + if (automationConvertTokenRequestInput.ReceiverWalletAddressOption.IsSet && automationConvertTokenRequestInput.ReceiverWalletAddress == null) + throw new ArgumentNullException(nameof(automationConvertTokenRequestInput.ReceiverWalletAddress), "Property is required for class AutomationConvertTokenRequestInput."); + writer.WriteString("amountIn", automationConvertTokenRequestInput.AmountIn); writer.WriteString("amountOut", automationConvertTokenRequestInput.AmountOut); @@ -365,6 +391,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, AutomationConvertTokenReq if (automationConvertTokenRequestInput.ReceiverEntityIdOption.IsSet) writer.WriteString("receiverEntityId", automationConvertTokenRequestInput.ReceiverEntityId); + if (automationConvertTokenRequestInput.ReceiverWalletAddressOption.IsSet) + writer.WriteString("receiverWalletAddress", automationConvertTokenRequestInput.ReceiverWalletAddress); + if (automationConvertTokenRequestInput.SponsorOption.IsSet) writer.WriteBoolean("sponsor", automationConvertTokenRequestInput.SponsorOption.Value!.Value); } diff --git a/automation-api-clients/csharp/src/BeamAutomationClient/Model/AutomationMigrateRequestInput.cs b/automation-api-clients/csharp/src/BeamAutomationClient/Model/AutomationMigrateRequestInput.cs new file mode 100644 index 0000000..1957d49 --- /dev/null +++ b/automation-api-clients/csharp/src/BeamAutomationClient/Model/AutomationMigrateRequestInput.cs @@ -0,0 +1,215 @@ +// +/* + * Automation API + * + * The Automation API is a service to integrate your game with Beam + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = BeamAutomationClient.Client.ClientUtils; +using BeamAutomationClient.Client; + +namespace BeamAutomationClient.Model +{ + /// + /// AutomationMigrateRequestInput + /// + public partial class AutomationMigrateRequestInput : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// profileEntityId + /// userEntityId + /// chainId (default to 13337) + [JsonConstructor] + public AutomationMigrateRequestInput(string profileEntityId, string userEntityId, Option chainId = default) + { + ProfileEntityId = profileEntityId; + UserEntityId = userEntityId; + ChainIdOption = chainId; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ProfileEntityId + /// + [JsonPropertyName("profileEntityId")] + public string ProfileEntityId { get; set; } + + /// + /// Gets or Sets UserEntityId + /// + [JsonPropertyName("userEntityId")] + public string UserEntityId { get; set; } + + /// + /// Used to track the state of ChainId + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option ChainIdOption { get; private set; } + + /// + /// Gets or Sets ChainId + /// + [JsonPropertyName("chainId")] + public long? ChainId { get { return this. ChainIdOption; } set { this.ChainIdOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AutomationMigrateRequestInput {\n"); + sb.Append(" ProfileEntityId: ").Append(ProfileEntityId).Append("\n"); + sb.Append(" UserEntityId: ").Append(UserEntityId).Append("\n"); + sb.Append(" ChainId: ").Append(ChainId).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AutomationMigrateRequestInputJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override AutomationMigrateRequestInput Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option profileEntityId = default; + Option userEntityId = default; + Option chainId = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "profileEntityId": + profileEntityId = new Option(utf8JsonReader.GetString()!); + break; + case "userEntityId": + userEntityId = new Option(utf8JsonReader.GetString()!); + break; + case "chainId": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + chainId = new Option(utf8JsonReader.GetInt64()); + break; + default: + break; + } + } + } + + if (!profileEntityId.IsSet) + throw new ArgumentException("Property is required for class AutomationMigrateRequestInput.", nameof(profileEntityId)); + + if (!userEntityId.IsSet) + throw new ArgumentException("Property is required for class AutomationMigrateRequestInput.", nameof(userEntityId)); + + if (profileEntityId.IsSet && profileEntityId.Value == null) + throw new ArgumentNullException(nameof(profileEntityId), "Property is not nullable for class AutomationMigrateRequestInput."); + + if (userEntityId.IsSet && userEntityId.Value == null) + throw new ArgumentNullException(nameof(userEntityId), "Property is not nullable for class AutomationMigrateRequestInput."); + + if (chainId.IsSet && chainId.Value == null) + throw new ArgumentNullException(nameof(chainId), "Property is not nullable for class AutomationMigrateRequestInput."); + + return new AutomationMigrateRequestInput(profileEntityId.Value!, userEntityId.Value!, chainId); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, AutomationMigrateRequestInput automationMigrateRequestInput, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(ref writer, automationMigrateRequestInput, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(ref Utf8JsonWriter writer, AutomationMigrateRequestInput automationMigrateRequestInput, JsonSerializerOptions jsonSerializerOptions) + { + if (automationMigrateRequestInput.ProfileEntityId == null) + throw new ArgumentNullException(nameof(automationMigrateRequestInput.ProfileEntityId), "Property is required for class AutomationMigrateRequestInput."); + + if (automationMigrateRequestInput.UserEntityId == null) + throw new ArgumentNullException(nameof(automationMigrateRequestInput.UserEntityId), "Property is required for class AutomationMigrateRequestInput."); + + writer.WriteString("profileEntityId", automationMigrateRequestInput.ProfileEntityId); + + writer.WriteString("userEntityId", automationMigrateRequestInput.UserEntityId); + + if (automationMigrateRequestInput.ChainIdOption.IsSet) + writer.WriteNumber("chainId", automationMigrateRequestInput.ChainIdOption.Value!.Value); + } + } +} \ No newline at end of file diff --git a/automation-api-clients/csharp/src/BeamAutomationClient/Model/AutomationMigrateResponse.cs b/automation-api-clients/csharp/src/BeamAutomationClient/Model/AutomationMigrateResponse.cs new file mode 100644 index 0000000..dab1ccf --- /dev/null +++ b/automation-api-clients/csharp/src/BeamAutomationClient/Model/AutomationMigrateResponse.cs @@ -0,0 +1,162 @@ +// +/* + * Automation API + * + * The Automation API is a service to integrate your game with Beam + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = BeamAutomationClient.Client.ClientUtils; +using BeamAutomationClient.Client; + +namespace BeamAutomationClient.Model +{ + /// + /// AutomationMigrateResponse + /// + public partial class AutomationMigrateResponse : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// success + [JsonConstructor] + public AutomationMigrateResponse(bool success) + { + Success = success; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Success + /// + [JsonPropertyName("success")] + public bool Success { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AutomationMigrateResponse {\n"); + sb.Append(" Success: ").Append(Success).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AutomationMigrateResponseJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override AutomationMigrateResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option success = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "success": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + success = new Option(utf8JsonReader.GetBoolean()); + break; + default: + break; + } + } + } + + if (!success.IsSet) + throw new ArgumentException("Property is required for class AutomationMigrateResponse.", nameof(success)); + + if (success.IsSet && success.Value == null) + throw new ArgumentNullException(nameof(success), "Property is not nullable for class AutomationMigrateResponse."); + + return new AutomationMigrateResponse(success.Value!.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, AutomationMigrateResponse automationMigrateResponse, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(ref writer, automationMigrateResponse, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(ref Utf8JsonWriter writer, AutomationMigrateResponse automationMigrateResponse, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteBoolean("success", automationMigrateResponse.Success); + } + } +} \ No newline at end of file diff --git a/automation-api-clients/typescript-node/package.json b/automation-api-clients/typescript-node/package.json index 3279712..1258b09 100644 --- a/automation-api-clients/typescript-node/package.json +++ b/automation-api-clients/typescript-node/package.json @@ -29,5 +29,5 @@ "form-data": "^4.0.0", "node-fetch": "^3.3.1" }, - "version": "2.0.17" + "version": "2.0.19" } diff --git a/automation-api-clients/typescript-node/src/generated/ApiClient.ts b/automation-api-clients/typescript-node/src/generated/ApiClient.ts index 55a199b..d03bb41 100644 --- a/automation-api-clients/typescript-node/src/generated/ApiClient.ts +++ b/automation-api-clients/typescript-node/src/generated/ApiClient.ts @@ -13,6 +13,7 @@ import { ExchangeService } from './services/ExchangeService'; import { GameService } from './services/GameService'; import { HealthService } from './services/HealthService'; import { MarketplaceV2Service } from './services/MarketplaceV2Service'; +import { MigrationService } from './services/MigrationService'; import { PolicyService } from './services/PolicyService'; import { ProfilesService } from './services/ProfilesService'; import { ReportingService } from './services/ReportingService'; @@ -31,6 +32,7 @@ export class ApiClient { public readonly game: GameService; public readonly health: HealthService; public readonly marketplaceV2: MarketplaceV2Service; + public readonly migration: MigrationService; public readonly policy: PolicyService; public readonly profiles: ProfilesService; public readonly reporting: ReportingService; @@ -64,6 +66,7 @@ export class ApiClient { this.game = new GameService(this.request); this.health = new HealthService(this.request); this.marketplaceV2 = new MarketplaceV2Service(this.request); + this.migration = new MigrationService(this.request); this.policy = new PolicyService(this.request); this.profiles = new ProfilesService(this.request); this.reporting = new ReportingService(this.request); diff --git a/automation-api-clients/typescript-node/src/generated/index.ts b/automation-api-clients/typescript-node/src/generated/index.ts index 19d6b29..bbd457c 100644 --- a/automation-api-clients/typescript-node/src/generated/index.ts +++ b/automation-api-clients/typescript-node/src/generated/index.ts @@ -56,6 +56,8 @@ export type { GetProfileResponse } from './models/GetProfileResponse'; export type { GetQuoteResponse } from './models/GetQuoteResponse'; export type { GetTransactionsResponseV2 } from './models/GetTransactionsResponseV2'; export type { GetWebhooksForGameResponse } from './models/GetWebhooksForGameResponse'; +export type { MigrateRequestInput } from './models/MigrateRequestInput'; +export type { MigrateResponse } from './models/MigrateResponse'; export type { RefreshContractRequestBody } from './models/RefreshContractRequestBody'; export type { RefreshTokenRequestBody } from './models/RefreshTokenRequestBody'; export { RegenerateGameApiKeysResponse } from './models/RegenerateGameApiKeysResponse'; @@ -79,6 +81,7 @@ export { ExchangeService } from './services/ExchangeService'; export { GameService } from './services/GameService'; export { HealthService } from './services/HealthService'; export { MarketplaceV2Service } from './services/MarketplaceV2Service'; +export { MigrationService } from './services/MigrationService'; export { PolicyService } from './services/PolicyService'; export { ProfilesService } from './services/ProfilesService'; export { ReportingService } from './services/ReportingService'; diff --git a/automation-api-clients/typescript-node/src/generated/models/ConvertTokenRequestInput.ts b/automation-api-clients/typescript-node/src/generated/models/ConvertTokenRequestInput.ts index 3b83eaa..19f6e7a 100644 --- a/automation-api-clients/typescript-node/src/generated/models/ConvertTokenRequestInput.ts +++ b/automation-api-clients/typescript-node/src/generated/models/ConvertTokenRequestInput.ts @@ -9,6 +9,7 @@ export type ConvertTokenRequestInput = { amountIn: string; amountOut: string; receiverEntityId?: string; + receiverWalletAddress?: string; optimistic?: boolean; sponsor?: boolean; policyId?: string | null; diff --git a/automation-api-clients/typescript-node/src/generated/models/MigrateRequestInput.ts b/automation-api-clients/typescript-node/src/generated/models/MigrateRequestInput.ts new file mode 100644 index 0000000..e69a364 --- /dev/null +++ b/automation-api-clients/typescript-node/src/generated/models/MigrateRequestInput.ts @@ -0,0 +1,10 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type MigrateRequestInput = { + profileEntityId: string; + userEntityId: string; + chainId?: number; +}; diff --git a/automation-api-clients/typescript-node/src/generated/models/MigrateResponse.ts b/automation-api-clients/typescript-node/src/generated/models/MigrateResponse.ts new file mode 100644 index 0000000..661c30c --- /dev/null +++ b/automation-api-clients/typescript-node/src/generated/models/MigrateResponse.ts @@ -0,0 +1,8 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type MigrateResponse = { + success: boolean; +}; diff --git a/automation-api-clients/typescript-node/src/generated/models/index.ts b/automation-api-clients/typescript-node/src/generated/models/index.ts index c746a04..4530f57 100644 --- a/automation-api-clients/typescript-node/src/generated/models/index.ts +++ b/automation-api-clients/typescript-node/src/generated/models/index.ts @@ -48,6 +48,8 @@ export * from './GetProfileResponse'; export * from './GetQuoteResponse'; export * from './GetTransactionsResponseV2'; export * from './GetWebhooksForGameResponse'; +export * from './MigrateRequestInput'; +export * from './MigrateResponse'; export * from './RefreshContractRequestBody'; export * from './RefreshTokenRequestBody'; export * from './RegenerateGameApiKeysResponse'; diff --git a/automation-api-clients/typescript-node/src/generated/services/MigrationService.ts b/automation-api-clients/typescript-node/src/generated/services/MigrationService.ts new file mode 100644 index 0000000..7622c9e --- /dev/null +++ b/automation-api-clients/typescript-node/src/generated/services/MigrationService.ts @@ -0,0 +1,30 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { MigrateRequestInput } from '../models/MigrateRequestInput'; +import type { MigrateResponse } from '../models/MigrateResponse'; + +import type { BaseHttpRequest } from '../core/BaseHttpRequest'; +import type { CancelablePromise } from '../core/CancelablePromise'; + +export class MigrationService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * Migrate all the native token, ERC20 tokens and NFTs registered for your game from an Automation API profile to a Player API user + * @param requestBody + * @returns MigrateResponse + * @throws ApiError + */ + public migrateProfileAssets( + requestBody: MigrateRequestInput, + ): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/v1/migration/migrate', + body: requestBody, + mediaType: 'application/json', + }); + } +} diff --git a/player-api-clients/csharp/spec.json b/player-api-clients/csharp/spec.json index 5247dff..b208d48 100644 --- a/player-api-clients/csharp/spec.json +++ b/player-api-clients/csharp/spec.json @@ -5231,6 +5231,9 @@ "receiverEntityId": { "type": "string" }, + "receiverWalletAddress": { + "type": "string" + }, "optimistic": { "default": false, "type": "boolean" @@ -5360,6 +5363,10 @@ "address": { "type": "string" }, + "suggestedExpiry": { + "type": "string", + "format": "date-time" + }, "chainId": { "default": 13337, "type": "integer", diff --git a/player-api-clients/csharp/src/BeamPlayerClient/Model/PlayerConvertTokenRequestInput.cs b/player-api-clients/csharp/src/BeamPlayerClient/Model/PlayerConvertTokenRequestInput.cs index 4a898ea..c101d4e 100644 --- a/player-api-clients/csharp/src/BeamPlayerClient/Model/PlayerConvertTokenRequestInput.cs +++ b/player-api-clients/csharp/src/BeamPlayerClient/Model/PlayerConvertTokenRequestInput.cs @@ -44,9 +44,10 @@ public partial class PlayerConvertTokenRequestInput : IValidatableObject /// optimistic (default to false) /// policyId /// receiverEntityId + /// receiverWalletAddress /// sponsor (default to true) [JsonConstructor] - public PlayerConvertTokenRequestInput(string amountIn, string amountOut, string tokenIn, string tokenOut, Option chainId = default, Option operationId = default, Option operationProcessing = default, Option optimistic = default, Option policyId = default, Option receiverEntityId = default, Option sponsor = default) + public PlayerConvertTokenRequestInput(string amountIn, string amountOut, string tokenIn, string tokenOut, Option chainId = default, Option operationId = default, Option operationProcessing = default, Option optimistic = default, Option policyId = default, Option receiverEntityId = default, Option receiverWalletAddress = default, Option sponsor = default) { AmountIn = amountIn; AmountOut = amountOut; @@ -58,6 +59,7 @@ public PlayerConvertTokenRequestInput(string amountIn, string amountOut, string OptimisticOption = optimistic; PolicyIdOption = policyId; ReceiverEntityIdOption = receiverEntityId; + ReceiverWalletAddressOption = receiverWalletAddress; SponsorOption = sponsor; OnCreated(); } @@ -327,6 +329,19 @@ public override void Write(Utf8JsonWriter writer, OperationProcessingEnum operat [JsonPropertyName("receiverEntityId")] public string? ReceiverEntityId { get { return this. ReceiverEntityIdOption; } set { this.ReceiverEntityIdOption = new(value); } } + /// + /// Used to track the state of ReceiverWalletAddress + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option ReceiverWalletAddressOption { get; private set; } + + /// + /// Gets or Sets ReceiverWalletAddress + /// + [JsonPropertyName("receiverWalletAddress")] + public string? ReceiverWalletAddress { get { return this. ReceiverWalletAddressOption; } set { this.ReceiverWalletAddressOption = new(value); } } + /// /// Used to track the state of Sponsor /// @@ -358,6 +373,7 @@ public override string ToString() sb.Append(" Optimistic: ").Append(Optimistic).Append("\n"); sb.Append(" PolicyId: ").Append(PolicyId).Append("\n"); sb.Append(" ReceiverEntityId: ").Append(ReceiverEntityId).Append("\n"); + sb.Append(" ReceiverWalletAddress: ").Append(ReceiverWalletAddress).Append("\n"); sb.Append(" Sponsor: ").Append(Sponsor).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -406,6 +422,7 @@ public override PlayerConvertTokenRequestInput Read(ref Utf8JsonReader utf8JsonR Option optimistic = default; Option policyId = default; Option receiverEntityId = default; + Option receiverWalletAddress = default; Option sponsor = default; while (utf8JsonReader.Read()) @@ -457,6 +474,9 @@ public override PlayerConvertTokenRequestInput Read(ref Utf8JsonReader utf8JsonR case "receiverEntityId": receiverEntityId = new Option(utf8JsonReader.GetString()!); break; + case "receiverWalletAddress": + receiverWalletAddress = new Option(utf8JsonReader.GetString()!); + break; case "sponsor": if (utf8JsonReader.TokenType != JsonTokenType.Null) sponsor = new Option(utf8JsonReader.GetBoolean()); @@ -503,10 +523,13 @@ public override PlayerConvertTokenRequestInput Read(ref Utf8JsonReader utf8JsonR if (receiverEntityId.IsSet && receiverEntityId.Value == null) throw new ArgumentNullException(nameof(receiverEntityId), "Property is not nullable for class PlayerConvertTokenRequestInput."); + if (receiverWalletAddress.IsSet && receiverWalletAddress.Value == null) + throw new ArgumentNullException(nameof(receiverWalletAddress), "Property is not nullable for class PlayerConvertTokenRequestInput."); + if (sponsor.IsSet && sponsor.Value == null) throw new ArgumentNullException(nameof(sponsor), "Property is not nullable for class PlayerConvertTokenRequestInput."); - return new PlayerConvertTokenRequestInput(amountIn.Value!, amountOut.Value!, tokenIn.Value!, tokenOut.Value!, chainId, operationId, operationProcessing, optimistic, policyId, receiverEntityId, sponsor); + return new PlayerConvertTokenRequestInput(amountIn.Value!, amountOut.Value!, tokenIn.Value!, tokenOut.Value!, chainId, operationId, operationProcessing, optimistic, policyId, receiverEntityId, receiverWalletAddress, sponsor); } /// @@ -548,6 +571,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, PlayerConvertTokenRequest if (playerConvertTokenRequestInput.ReceiverEntityIdOption.IsSet && playerConvertTokenRequestInput.ReceiverEntityId == null) throw new ArgumentNullException(nameof(playerConvertTokenRequestInput.ReceiverEntityId), "Property is required for class PlayerConvertTokenRequestInput."); + if (playerConvertTokenRequestInput.ReceiverWalletAddressOption.IsSet && playerConvertTokenRequestInput.ReceiverWalletAddress == null) + throw new ArgumentNullException(nameof(playerConvertTokenRequestInput.ReceiverWalletAddress), "Property is required for class PlayerConvertTokenRequestInput."); + writer.WriteString("amountIn", playerConvertTokenRequestInput.AmountIn); writer.WriteString("amountOut", playerConvertTokenRequestInput.AmountOut); @@ -579,6 +605,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, PlayerConvertTokenRequest if (playerConvertTokenRequestInput.ReceiverEntityIdOption.IsSet) writer.WriteString("receiverEntityId", playerConvertTokenRequestInput.ReceiverEntityId); + if (playerConvertTokenRequestInput.ReceiverWalletAddressOption.IsSet) + writer.WriteString("receiverWalletAddress", playerConvertTokenRequestInput.ReceiverWalletAddress); + if (playerConvertTokenRequestInput.SponsorOption.IsSet) writer.WriteBoolean("sponsor", playerConvertTokenRequestInput.SponsorOption.Value!.Value); } diff --git a/player-api-clients/csharp/src/BeamPlayerClient/Model/PlayerGenerateSessionUrlRequestInput.cs b/player-api-clients/csharp/src/BeamPlayerClient/Model/PlayerGenerateSessionUrlRequestInput.cs index 4766725..443630e 100644 --- a/player-api-clients/csharp/src/BeamPlayerClient/Model/PlayerGenerateSessionUrlRequestInput.cs +++ b/player-api-clients/csharp/src/BeamPlayerClient/Model/PlayerGenerateSessionUrlRequestInput.cs @@ -36,11 +36,13 @@ public partial class PlayerGenerateSessionUrlRequestInput : IValidatableObject /// /// address /// chainId (default to 13337) + /// suggestedExpiry [JsonConstructor] - public PlayerGenerateSessionUrlRequestInput(string address, Option chainId = default) + public PlayerGenerateSessionUrlRequestInput(string address, Option chainId = default, Option suggestedExpiry = default) { Address = address; ChainIdOption = chainId; + SuggestedExpiryOption = suggestedExpiry; OnCreated(); } @@ -65,6 +67,19 @@ public PlayerGenerateSessionUrlRequestInput(string address, Option chainI [JsonPropertyName("chainId")] public long? ChainId { get { return this. ChainIdOption; } set { this.ChainIdOption = new(value); } } + /// + /// Used to track the state of SuggestedExpiry + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option SuggestedExpiryOption { get; private set; } + + /// + /// Gets or Sets SuggestedExpiry + /// + [JsonPropertyName("suggestedExpiry")] + public DateTime? SuggestedExpiry { get { return this. SuggestedExpiryOption; } set { this.SuggestedExpiryOption = new(value); } } + /// /// Returns the string presentation of the object /// @@ -75,6 +90,7 @@ public override string ToString() sb.Append("class PlayerGenerateSessionUrlRequestInput {\n"); sb.Append(" Address: ").Append(Address).Append("\n"); sb.Append(" ChainId: ").Append(ChainId).Append("\n"); + sb.Append(" SuggestedExpiry: ").Append(SuggestedExpiry).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -95,6 +111,11 @@ public override string ToString() /// public class PlayerGenerateSessionUrlRequestInputJsonConverter : JsonConverter { + /// + /// The format to use to serialize SuggestedExpiry + /// + public static string SuggestedExpiryFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + /// /// Deserializes json to /// @@ -114,6 +135,7 @@ public override PlayerGenerateSessionUrlRequestInput Read(ref Utf8JsonReader utf Option address = default; Option chainId = default; + Option suggestedExpiry = default; while (utf8JsonReader.Read()) { @@ -137,6 +159,10 @@ public override PlayerGenerateSessionUrlRequestInput Read(ref Utf8JsonReader utf if (utf8JsonReader.TokenType != JsonTokenType.Null) chainId = new Option(utf8JsonReader.GetInt64()); break; + case "suggestedExpiry": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + suggestedExpiry = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; default: break; } @@ -152,7 +178,10 @@ public override PlayerGenerateSessionUrlRequestInput Read(ref Utf8JsonReader utf if (chainId.IsSet && chainId.Value == null) throw new ArgumentNullException(nameof(chainId), "Property is not nullable for class PlayerGenerateSessionUrlRequestInput."); - return new PlayerGenerateSessionUrlRequestInput(address.Value!, chainId); + if (suggestedExpiry.IsSet && suggestedExpiry.Value == null) + throw new ArgumentNullException(nameof(suggestedExpiry), "Property is not nullable for class PlayerGenerateSessionUrlRequestInput."); + + return new PlayerGenerateSessionUrlRequestInput(address.Value!, chainId, suggestedExpiry); } /// @@ -186,6 +215,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, PlayerGenerateSessionUrlR if (playerGenerateSessionUrlRequestInput.ChainIdOption.IsSet) writer.WriteNumber("chainId", playerGenerateSessionUrlRequestInput.ChainIdOption.Value!.Value); + + if (playerGenerateSessionUrlRequestInput.SuggestedExpiryOption.IsSet) + writer.WriteString("suggestedExpiry", playerGenerateSessionUrlRequestInput.SuggestedExpiryOption.Value!.Value.ToString(SuggestedExpiryFormat)); } } } \ No newline at end of file diff --git a/player-api-clients/typescript-node/package.json b/player-api-clients/typescript-node/package.json index 6b2cb6c..6b524f2 100644 --- a/player-api-clients/typescript-node/package.json +++ b/player-api-clients/typescript-node/package.json @@ -29,5 +29,5 @@ "form-data": "^4.0.0", "node-fetch": "^3.3.1" }, - "version": "2.0.17" + "version": "2.0.19" } diff --git a/player-api-clients/typescript-node/src/generated/models/ConvertTokenRequestInput.ts b/player-api-clients/typescript-node/src/generated/models/ConvertTokenRequestInput.ts index 3ff6a30..efe56a0 100644 --- a/player-api-clients/typescript-node/src/generated/models/ConvertTokenRequestInput.ts +++ b/player-api-clients/typescript-node/src/generated/models/ConvertTokenRequestInput.ts @@ -9,6 +9,7 @@ export type ConvertTokenRequestInput = { amountIn: string; amountOut: string; receiverEntityId?: string; + receiverWalletAddress?: string; optimistic?: boolean; sponsor?: boolean; policyId?: string | null; diff --git a/player-api-clients/typescript-node/src/generated/models/GenerateSessionUrlRequestInput.ts b/player-api-clients/typescript-node/src/generated/models/GenerateSessionUrlRequestInput.ts index 5fc24a6..e3e23da 100644 --- a/player-api-clients/typescript-node/src/generated/models/GenerateSessionUrlRequestInput.ts +++ b/player-api-clients/typescript-node/src/generated/models/GenerateSessionUrlRequestInput.ts @@ -5,5 +5,6 @@ export type GenerateSessionUrlRequestInput = { address: string; + suggestedExpiry?: string; chainId?: number; };