From d1126fdd4f78b29c6041f8159f4fd2a466e4728e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 11 Apr 2026 01:52:16 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- .../HeyGen.AssetsClient.V1AssetUpload.g.cs | 17 +- .../HeyGen/Generated/HeyGen.AssetsClient.g.cs | 149 ++++++++++++++++- ...en.CreateVideoApiClient.V1VideoDelete.g.cs | 17 +- ....CreateVideoApiClient.V2VideoGenerate.g.cs | 17 +- .../HeyGen.CreateVideoApiClient.g.cs | 149 ++++++++++++++++- .../HeyGen.HeyGenClient.V1VideoStatusGet.g.cs | 17 +- .../HeyGen/Generated/HeyGen.HeyGenClient.g.cs | 157 +++++++++++++++++- .../Generated/HeyGen.IAssetsClient.g.cs | 23 ++- .../HeyGen.ICreateVideoApiClient.g.cs | 23 ++- .../Generated/HeyGen.IHeyGenClient.g.cs | 21 +++ .../HeyGen/Generated/HeyGen.IListsClient.g.cs | 21 +++ .../HeyGen.IPersonalizedVideoClient.g.cs | 23 ++- .../Generated/HeyGen.IStreamingApiClient.g.cs | 23 ++- .../Generated/HeyGen.ITalkingPhotoClient.g.cs | 23 ++- .../Generated/HeyGen.ITemplateApiClient.g.cs | 23 ++- .../HeyGen/Generated/HeyGen.IUserClient.g.cs | 23 ++- .../HeyGen.IVideoTranslateApiClient.g.cs | 23 ++- .../Generated/HeyGen.IWebhooksClient.g.cs | 23 ++- .../HeyGen.ListsClient.V1AvatarList.g.cs | 17 +- .../HeyGen.ListsClient.V1VideoList.g.cs | 17 +- .../HeyGen.ListsClient.V1VoiceList.g.cs | 17 +- .../HeyGen.ListsClient.V2Avatars.g.cs | 17 +- .../HeyGen.ListsClient.V2Voices.g.cs | 17 +- .../HeyGen/Generated/HeyGen.ListsClient.g.cs | 147 +++++++++++++++- ...deoClient.PersonalizedVideoAddContact.g.cs | 17 +- ...lient.PersonalizedVideoAudienceDetail.g.cs | 17 +- ...Client.PersonalizedVideoProjectDetail.g.cs | 17 +- .../HeyGen.PersonalizedVideoClient.g.cs | 149 ++++++++++++++++- .../Generated/HeyGen.ServerSelection.g.cs | 57 +++++++ ...treamingApiClient.StreamingAvatarList.g.cs | 17 +- ...reamingApiClient.StreamingCreateToken.g.cs | 17 +- ...eyGen.StreamingApiClient.StreamingIce.g.cs | 17 +- ...StreamingApiClient.StreamingInterrupt.g.cs | 17 +- ...yGen.StreamingApiClient.StreamingList.g.cs | 17 +- ...eyGen.StreamingApiClient.StreamingNew.g.cs | 17 +- ...Gen.StreamingApiClient.StreamingStart.g.cs | 17 +- ...yGen.StreamingApiClient.StreamingStop.g.cs | 17 +- ...yGen.StreamingApiClient.StreamingTask.g.cs | 17 +- .../Generated/HeyGen.StreamingApiClient.g.cs | 149 ++++++++++++++++- ...TalkingPhotoClient.V1TalkingPhotoList.g.cs | 17 +- ...lkingPhotoClient.V1TalkingPhotoUpload.g.cs | 17 +- ...ingPhotoClient.V2TalkingPhotoIdDelete.g.cs | 17 +- .../Generated/HeyGen.TalkingPhotoClient.g.cs | 149 ++++++++++++++++- ....TemplateApiClient.V2TemplateGenerate.g.cs | 17 +- ...HeyGen.TemplateApiClient.V2TemplateId.g.cs | 17 +- .../HeyGen.TemplateApiClient.V2Templates.g.cs | 17 +- .../Generated/HeyGen.TemplateApiClient.g.cs | 149 ++++++++++++++++- ...eyGen.UserClient.V2UserRemainingQuota.g.cs | 17 +- .../HeyGen/Generated/HeyGen.UserClient.g.cs | 149 ++++++++++++++++- ...eoTranslateApiClient.V2VideoTranslate.g.cs | 17 +- ...ateApiClient.V2VideoTranslateIdStatus.g.cs | 17 +- ...lient.V2VideoTranslateTargetLanguages.g.cs | 17 +- .../HeyGen.VideoTranslateApiClient.g.cs | 149 ++++++++++++++++- ...n.WebhooksClient.V1WebhookEndpointAdd.g.cs | 17 +- ...ebhooksClient.V1WebhookEndpointDelete.g.cs | 17 +- ....WebhooksClient.V1WebhookEndpointList.g.cs | 17 +- ...n.WebhooksClient.V1WebhookWebhookList.g.cs | 17 +- .../Generated/HeyGen.WebhooksClient.g.cs | 149 ++++++++++++++++- 58 files changed, 2482 insertions(+), 64 deletions(-) create mode 100644 src/libs/HeyGen/Generated/HeyGen.ServerSelection.g.cs diff --git a/src/libs/HeyGen/Generated/HeyGen.AssetsClient.V1AssetUpload.g.cs b/src/libs/HeyGen/Generated/HeyGen.AssetsClient.V1AssetUpload.g.cs index 9623131..cc22cc8 100644 --- a/src/libs/HeyGen/Generated/HeyGen.AssetsClient.V1AssetUpload.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.AssetsClient.V1AssetUpload.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class AssetsClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V1AssetUploadServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V1AssetUploadSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -74,7 +87,9 @@ partial void ProcessV1AssetUploadResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/asset", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V1AssetUploadServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.AssetsClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.AssetsClient.g.cs index 4a5b8fe..8ea640b 100644 --- a/src/libs/HeyGen/Generated/HeyGen.AssetsClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.AssetsClient.g.cs @@ -5,7 +5,7 @@ namespace HeyGen { /// /// Upload an image or video asset to your account.
- /// **Reference**: [https://docs.heygen.com/reference/upload-asset-1](https://docs.heygen.com/reference/upload-asset-1).
+ /// **Reference**: [https://docs.heygen.com/reference/upload-asset-1](https://docs.heygen.com/reference/upload-asset-1)
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -22,7 +22,7 @@ public sealed partial class AssetsClient : global::HeyGen.IAssetsClient, global: public global::System.Net.Http.HttpClient HttpClient { get; } /// - public System.Uri? BaseUri => HttpClient.BaseAddress; + public System.Uri? BaseUri => ResolveDisplayedBaseUri(); /// public global::System.Collections.Generic.List Authorizations { get; } @@ -35,12 +35,43 @@ public sealed partial class AssetsClient : global::HeyGen.IAssetsClient, global: /// public global::HeyGen.AutoSDKClientOptions Options { get; } + + + internal global::HeyGen.AutoSDKServerConfiguration AutoSDKServerConfiguration { get; set; } = new global::HeyGen.AutoSDKServerConfiguration(); /// /// /// public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::HeyGen.SourceGenerationContext.Default; + + private static readonly global::HeyGen.AutoSDKServer[] s_availableServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers => s_availableServers; + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer + { + get => ResolveSelectedServer(); + set => SelectServer(value); + } + /// /// Creates a new instance of the AssetsClient. /// If no httpClient is provided, a new one will be created. @@ -87,6 +118,8 @@ public AssetsClient( Options = options ?? new global::HeyGen.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; + AutoSDKServerConfiguration.ExplicitBaseUri = baseUri ?? httpClient?.BaseAddress; + Initialized(HttpClient); } @@ -113,5 +146,117 @@ partial void ProcessResponseContent( global::System.Net.Http.HttpClient client, global::System.Net.Http.HttpResponseMessage response, ref string content); + + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId) + { + if (string.IsNullOrWhiteSpace(serverId)) + { + return false; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, serverId, global::System.StringComparison.OrdinalIgnoreCase)) + { + AutoSDKServerConfiguration.SelectedServer = server; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return true; + } + } + + return false; + } + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer() + { + AutoSDKServerConfiguration.SelectedServer = null; + } + + private global::HeyGen.AutoSDKServer? ResolveSelectedServer() + { + var selectedServer = AutoSDKServerConfiguration.SelectedServer; + if (selectedServer is null) + { + return null; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server; + } + } + + return null; + } + + private void SelectServer(global::HeyGen.AutoSDKServer? server) + { + if (server is null) + { + AutoSDKServerConfiguration.SelectedServer = null; + return; + } + + foreach (var candidate in s_availableServers) + { + if (string.Equals(candidate.Id, server.Id, global::System.StringComparison.Ordinal)) + { + AutoSDKServerConfiguration.SelectedServer = candidate; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return; + } + } + + throw new global::System.ArgumentException("The provided server is not available for this client.", nameof(server)); + } + + private global::System.Uri? ResolveDisplayedBaseUri() + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + return ResolveSelectedServer()?.Uri ?? HttpClient.BaseAddress; + } + + private global::System.Uri? ResolveBaseUri( + global::HeyGen.AutoSDKServer[] servers, + string defaultBaseUrl) + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + if (AutoSDKServerConfiguration.SelectedServer is global::HeyGen.AutoSDKServer selectedServer) + { + foreach (var server in servers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server.Uri; + } + } + } + + if (servers.Length > 0) + { + return servers[0].Uri; + } + + return string.IsNullOrWhiteSpace(defaultBaseUrl) + ? HttpClient.BaseAddress + : new global::System.Uri(defaultBaseUrl, global::System.UriKind.RelativeOrAbsolute); + } } } \ No newline at end of file diff --git a/src/libs/HeyGen/Generated/HeyGen.CreateVideoApiClient.V1VideoDelete.g.cs b/src/libs/HeyGen/Generated/HeyGen.CreateVideoApiClient.V1VideoDelete.g.cs index 61d2795..acfe31f 100644 --- a/src/libs/HeyGen/Generated/HeyGen.CreateVideoApiClient.V1VideoDelete.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.CreateVideoApiClient.V1VideoDelete.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class CreateVideoApiClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V1VideoDeleteServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V1VideoDeleteSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -81,7 +94,9 @@ partial void ProcessV1VideoDeleteResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/video.delete", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V1VideoDeleteServers, + defaultBaseUrl: "https://api.heygen.com/")); __pathBuilder .AddOptionalParameter("video_id", videoId) ; diff --git a/src/libs/HeyGen/Generated/HeyGen.CreateVideoApiClient.V2VideoGenerate.g.cs b/src/libs/HeyGen/Generated/HeyGen.CreateVideoApiClient.V2VideoGenerate.g.cs index 654feaa..43f9f60 100644 --- a/src/libs/HeyGen/Generated/HeyGen.CreateVideoApiClient.V2VideoGenerate.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.CreateVideoApiClient.V2VideoGenerate.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class CreateVideoApiClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V2VideoGenerateServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V2VideoGenerateSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -83,7 +96,9 @@ partial void ProcessV2VideoGenerateResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v2/video/generate", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V2VideoGenerateServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.CreateVideoApiClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.CreateVideoApiClient.g.cs index 5b06160..3c7e511 100644 --- a/src/libs/HeyGen/Generated/HeyGen.CreateVideoApiClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.CreateVideoApiClient.g.cs @@ -5,7 +5,7 @@ namespace HeyGen { /// /// Create personalized avatar videos with ease using the **HeyGen API**. By selecting an avatar and a voice, you can create engaging videos for various purposes. 🌟
- /// **Guide**: [https://docs.heygen.com/docs/create-video](https://docs.heygen.com/docs/create-video)**Reference**: [https://docs.heygen.com/reference/create-an-avatar-video-v2](https://docs.heygen.com/reference/create-an-avatar-video-v2).
+ /// **Guide**: [https://docs.heygen.com/docs/create-video](https://docs.heygen.com/docs/create-video)**Reference**: [https://docs.heygen.com/reference/create-an-avatar-video-v2](https://docs.heygen.com/reference/create-an-avatar-video-v2)
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -22,7 +22,7 @@ public sealed partial class CreateVideoApiClient : global::HeyGen.ICreateVideoAp public global::System.Net.Http.HttpClient HttpClient { get; } /// - public System.Uri? BaseUri => HttpClient.BaseAddress; + public System.Uri? BaseUri => ResolveDisplayedBaseUri(); /// public global::System.Collections.Generic.List Authorizations { get; } @@ -35,12 +35,43 @@ public sealed partial class CreateVideoApiClient : global::HeyGen.ICreateVideoAp /// public global::HeyGen.AutoSDKClientOptions Options { get; } + + + internal global::HeyGen.AutoSDKServerConfiguration AutoSDKServerConfiguration { get; set; } = new global::HeyGen.AutoSDKServerConfiguration(); /// /// /// public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::HeyGen.SourceGenerationContext.Default; + + private static readonly global::HeyGen.AutoSDKServer[] s_availableServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers => s_availableServers; + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer + { + get => ResolveSelectedServer(); + set => SelectServer(value); + } + /// /// Creates a new instance of the CreateVideoApiClient. /// If no httpClient is provided, a new one will be created. @@ -87,6 +118,8 @@ public CreateVideoApiClient( Options = options ?? new global::HeyGen.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; + AutoSDKServerConfiguration.ExplicitBaseUri = baseUri ?? httpClient?.BaseAddress; + Initialized(HttpClient); } @@ -113,5 +146,117 @@ partial void ProcessResponseContent( global::System.Net.Http.HttpClient client, global::System.Net.Http.HttpResponseMessage response, ref string content); + + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId) + { + if (string.IsNullOrWhiteSpace(serverId)) + { + return false; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, serverId, global::System.StringComparison.OrdinalIgnoreCase)) + { + AutoSDKServerConfiguration.SelectedServer = server; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return true; + } + } + + return false; + } + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer() + { + AutoSDKServerConfiguration.SelectedServer = null; + } + + private global::HeyGen.AutoSDKServer? ResolveSelectedServer() + { + var selectedServer = AutoSDKServerConfiguration.SelectedServer; + if (selectedServer is null) + { + return null; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server; + } + } + + return null; + } + + private void SelectServer(global::HeyGen.AutoSDKServer? server) + { + if (server is null) + { + AutoSDKServerConfiguration.SelectedServer = null; + return; + } + + foreach (var candidate in s_availableServers) + { + if (string.Equals(candidate.Id, server.Id, global::System.StringComparison.Ordinal)) + { + AutoSDKServerConfiguration.SelectedServer = candidate; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return; + } + } + + throw new global::System.ArgumentException("The provided server is not available for this client.", nameof(server)); + } + + private global::System.Uri? ResolveDisplayedBaseUri() + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + return ResolveSelectedServer()?.Uri ?? HttpClient.BaseAddress; + } + + private global::System.Uri? ResolveBaseUri( + global::HeyGen.AutoSDKServer[] servers, + string defaultBaseUrl) + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + if (AutoSDKServerConfiguration.SelectedServer is global::HeyGen.AutoSDKServer selectedServer) + { + foreach (var server in servers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server.Uri; + } + } + } + + if (servers.Length > 0) + { + return servers[0].Uri; + } + + return string.IsNullOrWhiteSpace(defaultBaseUrl) + ? HttpClient.BaseAddress + : new global::System.Uri(defaultBaseUrl, global::System.UriKind.RelativeOrAbsolute); + } } } \ No newline at end of file diff --git a/src/libs/HeyGen/Generated/HeyGen.HeyGenClient.V1VideoStatusGet.g.cs b/src/libs/HeyGen/Generated/HeyGen.HeyGenClient.V1VideoStatusGet.g.cs index c86f6e0..c4cf854 100644 --- a/src/libs/HeyGen/Generated/HeyGen.HeyGenClient.V1VideoStatusGet.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.HeyGenClient.V1VideoStatusGet.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class HeyGenClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V1VideoStatusGetServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V1VideoStatusGetSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -81,7 +94,9 @@ partial void ProcessV1VideoStatusGetResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/video_status.get", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V1VideoStatusGetServers, + defaultBaseUrl: "https://api.heygen.com/")); __pathBuilder .AddOptionalParameter("video_id", videoId) ; diff --git a/src/libs/HeyGen/Generated/HeyGen.HeyGenClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.HeyGenClient.g.cs index bf58e07..dff6349 100644 --- a/src/libs/HeyGen/Generated/HeyGen.HeyGenClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.HeyGenClient.g.cs @@ -42,7 +42,7 @@ public sealed partial class HeyGenClient : global::HeyGen.IHeyGenClient, global: public global::System.Net.Http.HttpClient HttpClient { get; } /// - public System.Uri? BaseUri => HttpClient.BaseAddress; + public System.Uri? BaseUri => ResolveDisplayedBaseUri(); /// public global::System.Collections.Generic.List Authorizations { get; } @@ -55,6 +55,9 @@ public sealed partial class HeyGenClient : global::HeyGen.IHeyGenClient, global: /// public global::HeyGen.AutoSDKClientOptions Options { get; } + + + internal global::HeyGen.AutoSDKServerConfiguration AutoSDKServerConfiguration { get; set; } = new global::HeyGen.AutoSDKServerConfiguration(); /// /// /// @@ -69,6 +72,7 @@ public sealed partial class HeyGenClient : global::HeyGen.IHeyGenClient, global: { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, + AutoSDKServerConfiguration = AutoSDKServerConfiguration, }; /// @@ -79,6 +83,7 @@ public sealed partial class HeyGenClient : global::HeyGen.IHeyGenClient, global: { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, + AutoSDKServerConfiguration = AutoSDKServerConfiguration, }; /// @@ -88,6 +93,7 @@ public sealed partial class HeyGenClient : global::HeyGen.IHeyGenClient, global: { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, + AutoSDKServerConfiguration = AutoSDKServerConfiguration, }; /// @@ -99,6 +105,7 @@ public sealed partial class HeyGenClient : global::HeyGen.IHeyGenClient, global: { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, + AutoSDKServerConfiguration = AutoSDKServerConfiguration, }; /// @@ -109,6 +116,7 @@ public sealed partial class HeyGenClient : global::HeyGen.IHeyGenClient, global: { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, + AutoSDKServerConfiguration = AutoSDKServerConfiguration, }; /// @@ -119,6 +127,7 @@ public sealed partial class HeyGenClient : global::HeyGen.IHeyGenClient, global: { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, + AutoSDKServerConfiguration = AutoSDKServerConfiguration, }; /// @@ -135,6 +144,7 @@ public sealed partial class HeyGenClient : global::HeyGen.IHeyGenClient, global: { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, + AutoSDKServerConfiguration = AutoSDKServerConfiguration, }; /// @@ -145,6 +155,7 @@ public sealed partial class HeyGenClient : global::HeyGen.IHeyGenClient, global: { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, + AutoSDKServerConfiguration = AutoSDKServerConfiguration, }; /// @@ -155,6 +166,7 @@ public sealed partial class HeyGenClient : global::HeyGen.IHeyGenClient, global: { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, + AutoSDKServerConfiguration = AutoSDKServerConfiguration, }; /// @@ -165,8 +177,37 @@ public sealed partial class HeyGenClient : global::HeyGen.IHeyGenClient, global: { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, + AutoSDKServerConfiguration = AutoSDKServerConfiguration, + }; + + + private static readonly global::HeyGen.AutoSDKServer[] s_availableServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), }; + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers => s_availableServers; + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer + { + get => ResolveSelectedServer(); + set => SelectServer(value); + } + /// /// Creates a new instance of the HeyGenClient. /// If no httpClient is provided, a new one will be created. @@ -213,6 +254,8 @@ public HeyGenClient( Options = options ?? new global::HeyGen.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; + AutoSDKServerConfiguration.ExplicitBaseUri = baseUri ?? httpClient?.BaseAddress; + Initialized(HttpClient); } @@ -239,5 +282,117 @@ partial void ProcessResponseContent( global::System.Net.Http.HttpClient client, global::System.Net.Http.HttpResponseMessage response, ref string content); + + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId) + { + if (string.IsNullOrWhiteSpace(serverId)) + { + return false; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, serverId, global::System.StringComparison.OrdinalIgnoreCase)) + { + AutoSDKServerConfiguration.SelectedServer = server; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return true; + } + } + + return false; + } + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer() + { + AutoSDKServerConfiguration.SelectedServer = null; + } + + private global::HeyGen.AutoSDKServer? ResolveSelectedServer() + { + var selectedServer = AutoSDKServerConfiguration.SelectedServer; + if (selectedServer is null) + { + return null; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server; + } + } + + return null; + } + + private void SelectServer(global::HeyGen.AutoSDKServer? server) + { + if (server is null) + { + AutoSDKServerConfiguration.SelectedServer = null; + return; + } + + foreach (var candidate in s_availableServers) + { + if (string.Equals(candidate.Id, server.Id, global::System.StringComparison.Ordinal)) + { + AutoSDKServerConfiguration.SelectedServer = candidate; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return; + } + } + + throw new global::System.ArgumentException("The provided server is not available for this client.", nameof(server)); + } + + private global::System.Uri? ResolveDisplayedBaseUri() + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + return ResolveSelectedServer()?.Uri ?? HttpClient.BaseAddress; + } + + private global::System.Uri? ResolveBaseUri( + global::HeyGen.AutoSDKServer[] servers, + string defaultBaseUrl) + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + if (AutoSDKServerConfiguration.SelectedServer is global::HeyGen.AutoSDKServer selectedServer) + { + foreach (var server in servers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server.Uri; + } + } + } + + if (servers.Length > 0) + { + return servers[0].Uri; + } + + return string.IsNullOrWhiteSpace(defaultBaseUrl) + ? HttpClient.BaseAddress + : new global::System.Uri(defaultBaseUrl, global::System.UriKind.RelativeOrAbsolute); + } } } \ No newline at end of file diff --git a/src/libs/HeyGen/Generated/HeyGen.IAssetsClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.IAssetsClient.g.cs index bc23284..8f34c97 100644 --- a/src/libs/HeyGen/Generated/HeyGen.IAssetsClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.IAssetsClient.g.cs @@ -5,7 +5,7 @@ namespace HeyGen { /// /// Upload an image or video asset to your account.
- /// **Reference**: [https://docs.heygen.com/reference/upload-asset-1](https://docs.heygen.com/reference/upload-asset-1).
+ /// **Reference**: [https://docs.heygen.com/reference/upload-asset-1](https://docs.heygen.com/reference/upload-asset-1)
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -21,6 +21,27 @@ public partial interface IAssetsClient : global::System.IDisposable ///
public System.Uri? BaseUri { get; } + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers { get; } + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer { get; set; } + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId); + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer(); + /// /// The authorizations to use for the requests. /// diff --git a/src/libs/HeyGen/Generated/HeyGen.ICreateVideoApiClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.ICreateVideoApiClient.g.cs index 75b6040..363e39c 100644 --- a/src/libs/HeyGen/Generated/HeyGen.ICreateVideoApiClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.ICreateVideoApiClient.g.cs @@ -5,7 +5,7 @@ namespace HeyGen { /// /// Create personalized avatar videos with ease using the **HeyGen API**. By selecting an avatar and a voice, you can create engaging videos for various purposes. 🌟
- /// **Guide**: [https://docs.heygen.com/docs/create-video](https://docs.heygen.com/docs/create-video)**Reference**: [https://docs.heygen.com/reference/create-an-avatar-video-v2](https://docs.heygen.com/reference/create-an-avatar-video-v2).
+ /// **Guide**: [https://docs.heygen.com/docs/create-video](https://docs.heygen.com/docs/create-video)**Reference**: [https://docs.heygen.com/reference/create-an-avatar-video-v2](https://docs.heygen.com/reference/create-an-avatar-video-v2)
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -21,6 +21,27 @@ public partial interface ICreateVideoApiClient : global::System.IDisposable ///
public System.Uri? BaseUri { get; } + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers { get; } + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer { get; set; } + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId); + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer(); + /// /// The authorizations to use for the requests. /// diff --git a/src/libs/HeyGen/Generated/HeyGen.IHeyGenClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.IHeyGenClient.g.cs index 013a721..6b43ca4 100644 --- a/src/libs/HeyGen/Generated/HeyGen.IHeyGenClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.IHeyGenClient.g.cs @@ -41,6 +41,27 @@ public partial interface IHeyGenClient : global::System.IDisposable ///
public System.Uri? BaseUri { get; } + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers { get; } + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer { get; set; } + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId); + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer(); + /// /// The authorizations to use for the requests. /// diff --git a/src/libs/HeyGen/Generated/HeyGen.IListsClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.IListsClient.g.cs index e2e2801..5376427 100644 --- a/src/libs/HeyGen/Generated/HeyGen.IListsClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.IListsClient.g.cs @@ -19,6 +19,27 @@ public partial interface IListsClient : global::System.IDisposable ///
public System.Uri? BaseUri { get; } + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers { get; } + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer { get; set; } + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId); + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer(); + /// /// The authorizations to use for the requests. /// diff --git a/src/libs/HeyGen/Generated/HeyGen.IPersonalizedVideoClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.IPersonalizedVideoClient.g.cs index 6d4afd6..01ab57e 100644 --- a/src/libs/HeyGen/Generated/HeyGen.IPersonalizedVideoClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.IPersonalizedVideoClient.g.cs @@ -6,7 +6,7 @@ namespace HeyGen /// /// Import contacts into your HeyGen **Personalized Video** campaign. 
/// **Guide**: [https://docs.heygen.com/docs/import-contacts-via-api](https://docs.heygen.com/docs/import-contacts-via-api)
- /// Reference: [https://docs.heygen.com/reference/add-contact](https://docs.heygen.com/reference/add-contact).
+ /// Reference: [https://docs.heygen.com/reference/add-contact](https://docs.heygen.com/reference/add-contact)
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -22,6 +22,27 @@ public partial interface IPersonalizedVideoClient : global::System.IDisposable ///
public System.Uri? BaseUri { get; } + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers { get; } + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer { get; set; } + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId); + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer(); + /// /// The authorizations to use for the requests. /// diff --git a/src/libs/HeyGen/Generated/HeyGen.IStreamingApiClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.IStreamingApiClient.g.cs index bdb9cb7..c4c5385 100644 --- a/src/libs/HeyGen/Generated/HeyGen.IStreamingApiClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.IStreamingApiClient.g.cs @@ -5,7 +5,7 @@ namespace HeyGen { /// /// HeyGen's **Streaming API** allows developers to seamlessly integrate dynamic digital avatars into their applications for immersive and interactive user experiences. With this API, you can create _virtual assistants, real-time training simulations,_ and more, with a focus on real-time, low-latency communication between _users_ and _avatars_ with power of WebRTC.
- /// **Guide**: [https://docs.heygen.com/docs/streaming-api](https://docs.heygen.com/docs/streaming-api)**Reference**: [https://docs.heygen.com/reference/new-session](https://docs.heygen.com/reference/new-session).
+ /// **Guide**: [https://docs.heygen.com/docs/streaming-api](https://docs.heygen.com/docs/streaming-api)**Reference**: [https://docs.heygen.com/reference/new-session](https://docs.heygen.com/reference/new-session)
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -21,6 +21,27 @@ public partial interface IStreamingApiClient : global::System.IDisposable ///
public System.Uri? BaseUri { get; } + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers { get; } + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer { get; set; } + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId); + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer(); + /// /// The authorizations to use for the requests. /// diff --git a/src/libs/HeyGen/Generated/HeyGen.ITalkingPhotoClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.ITalkingPhotoClient.g.cs index 8481f14..319d150 100644 --- a/src/libs/HeyGen/Generated/HeyGen.ITalkingPhotoClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.ITalkingPhotoClient.g.cs @@ -5,7 +5,7 @@ namespace HeyGen { /// /// These API endpoints allow you to manage photo avatars in your account.
- /// **Reference**: [https://docs.heygen.com/reference/upload-talking-photo](https://docs.heygen.com/reference/upload-talking-photo).
+ /// **Reference**: [https://docs.heygen.com/reference/upload-talking-photo](https://docs.heygen.com/reference/upload-talking-photo)
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -21,6 +21,27 @@ public partial interface ITalkingPhotoClient : global::System.IDisposable ///
public System.Uri? BaseUri { get; } + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers { get; } + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer { get; set; } + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId); + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer(); + /// /// The authorizations to use for the requests. /// diff --git a/src/libs/HeyGen/Generated/HeyGen.ITemplateApiClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.ITemplateApiClient.g.cs index b19b559..1a69b19 100644 --- a/src/libs/HeyGen/Generated/HeyGen.ITemplateApiClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.ITemplateApiClient.g.cs @@ -11,7 +11,7 @@ namespace HeyGen /// - **Template Videos:** In contrast, template videos offer a wide canvas for creativity. They enable you to customize existing text, images, videos, audios, voices and avatars seamlessly. If you need a richer, more versatile content format for your workflow, templates are the perfect choice.
///
/// **Guide**: [https://docs.heygen.com/docs/generate-video-from-template-v2](https://docs.heygen.com/docs/generate-video-from-template-v2)
- /// **Reference**: [https://docs.heygen.com/reference/generate-from-template-v2](https://docs.heygen.com/reference/generate-from-template-v2)[](https://docs.heygen.com/reference/create-an-avatar-video-v2).
+ /// **Reference**: [https://docs.heygen.com/reference/generate-from-template-v2](https://docs.heygen.com/reference/generate-from-template-v2)[](https://docs.heygen.com/reference/create-an-avatar-video-v2)
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -27,6 +27,27 @@ public partial interface ITemplateApiClient : global::System.IDisposable ///
public System.Uri? BaseUri { get; } + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers { get; } + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer { get; set; } + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId); + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer(); + /// /// The authorizations to use for the requests. /// diff --git a/src/libs/HeyGen/Generated/HeyGen.IUserClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.IUserClient.g.cs index 84e5262..9daa95b 100644 --- a/src/libs/HeyGen/Generated/HeyGen.IUserClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.IUserClient.g.cs @@ -5,7 +5,7 @@ namespace HeyGen { /// /// Obtain information about your account.
- /// **Reference**: [https://docs.heygen.com/reference/get-remaining-quota-v2](https://docs.heygen.com/reference/get-remaining-quota-v2).
+ /// **Reference**: [https://docs.heygen.com/reference/get-remaining-quota-v2](https://docs.heygen.com/reference/get-remaining-quota-v2)
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -21,6 +21,27 @@ public partial interface IUserClient : global::System.IDisposable ///
public System.Uri? BaseUri { get; } + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers { get; } + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer { get; set; } + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId); + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer(); + /// /// The authorizations to use for the requests. /// diff --git a/src/libs/HeyGen/Generated/HeyGen.IVideoTranslateApiClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.IVideoTranslateApiClient.g.cs index 88d19fe..df77edc 100644 --- a/src/libs/HeyGen/Generated/HeyGen.IVideoTranslateApiClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.IVideoTranslateApiClient.g.cs @@ -5,7 +5,7 @@ namespace HeyGen { /// /// The [Video Translate](https://labs.heygen.com/video-translate) by HeyGen provides a powerful solution for effortlessly translating videos, integrating natural voice cloning and authentic speaking styles seamlessly. Now, you can harness its capabilities programmatically through the **Video Translate API**!
- /// **Guide**: [https://docs.heygen.com/docs/video-translate-api](https://docs.heygen.com/docs/video-translate-api)**Reference**: [https://docs.heygen.com/reference/video-translate](https://docs.heygen.com/reference/video-translate).
+ /// **Guide**: [https://docs.heygen.com/docs/video-translate-api](https://docs.heygen.com/docs/video-translate-api)**Reference**: [https://docs.heygen.com/reference/video-translate](https://docs.heygen.com/reference/video-translate)
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -21,6 +21,27 @@ public partial interface IVideoTranslateApiClient : global::System.IDisposable ///
public System.Uri? BaseUri { get; } + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers { get; } + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer { get; set; } + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId); + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer(); + /// /// The authorizations to use for the requests. /// diff --git a/src/libs/HeyGen/Generated/HeyGen.IWebhooksClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.IWebhooksClient.g.cs index 88afb07..71f375f 100644 --- a/src/libs/HeyGen/Generated/HeyGen.IWebhooksClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.IWebhooksClient.g.cs @@ -5,7 +5,7 @@ namespace HeyGen { /// /// Webhook events are how the **HeyGen** notifies your _endpoints_ when a variety of interactions or events happen, including when avatar video processing _succeeds_ or _fails_. Webhook events are sent by HeyGen as POST requests to your webhook endpoint.
- /// **Guide**: [https://docs.heygen.com/docs/using-heygens-webhook-events](https://docs.heygen.com/docs/using-heygens-webhook-events)**Reference**: [https://docs.heygen.com/reference/add-a-webhook-endpoint](https://docs.heygen.com/reference/add-a-webhook-endpoint).
+ /// **Guide**: [https://docs.heygen.com/docs/using-heygens-webhook-events](https://docs.heygen.com/docs/using-heygens-webhook-events)**Reference**: [https://docs.heygen.com/reference/add-a-webhook-endpoint](https://docs.heygen.com/reference/add-a-webhook-endpoint)
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -21,6 +21,27 @@ public partial interface IWebhooksClient : global::System.IDisposable ///
public System.Uri? BaseUri { get; } + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers { get; } + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer { get; set; } + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId); + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer(); + /// /// The authorizations to use for the requests. /// diff --git a/src/libs/HeyGen/Generated/HeyGen.ListsClient.V1AvatarList.g.cs b/src/libs/HeyGen/Generated/HeyGen.ListsClient.V1AvatarList.g.cs index ab36137..c9636be 100644 --- a/src/libs/HeyGen/Generated/HeyGen.ListsClient.V1AvatarList.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.ListsClient.V1AvatarList.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class ListsClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V1AvatarListServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V1AvatarListSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -74,7 +87,9 @@ partial void ProcessV1AvatarListResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/avatar.list", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V1AvatarListServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.ListsClient.V1VideoList.g.cs b/src/libs/HeyGen/Generated/HeyGen.ListsClient.V1VideoList.g.cs index de02f71..264c9c3 100644 --- a/src/libs/HeyGen/Generated/HeyGen.ListsClient.V1VideoList.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.ListsClient.V1VideoList.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class ListsClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V1VideoListServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V1VideoListSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -74,7 +87,9 @@ partial void ProcessV1VideoListResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/video.list", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V1VideoListServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.ListsClient.V1VoiceList.g.cs b/src/libs/HeyGen/Generated/HeyGen.ListsClient.V1VoiceList.g.cs index 9a92671..81332f5 100644 --- a/src/libs/HeyGen/Generated/HeyGen.ListsClient.V1VoiceList.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.ListsClient.V1VoiceList.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class ListsClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V1VoiceListServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V1VoiceListSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -74,7 +87,9 @@ partial void ProcessV1VoiceListResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/voice.list", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V1VoiceListServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.ListsClient.V2Avatars.g.cs b/src/libs/HeyGen/Generated/HeyGen.ListsClient.V2Avatars.g.cs index 4919be9..9068e77 100644 --- a/src/libs/HeyGen/Generated/HeyGen.ListsClient.V2Avatars.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.ListsClient.V2Avatars.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class ListsClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V2AvatarsServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V2AvatarsSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -74,7 +87,9 @@ partial void ProcessV2AvatarsResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v2/avatars", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V2AvatarsServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.ListsClient.V2Voices.g.cs b/src/libs/HeyGen/Generated/HeyGen.ListsClient.V2Voices.g.cs index abb2bb3..789a03a 100644 --- a/src/libs/HeyGen/Generated/HeyGen.ListsClient.V2Voices.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.ListsClient.V2Voices.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class ListsClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V2VoicesServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V2VoicesSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -74,7 +87,9 @@ partial void ProcessV2VoicesResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v2/voices", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V2VoicesServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.ListsClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.ListsClient.g.cs index d39359c..c907681 100644 --- a/src/libs/HeyGen/Generated/HeyGen.ListsClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.ListsClient.g.cs @@ -20,7 +20,7 @@ public sealed partial class ListsClient : global::HeyGen.IListsClient, global::S public global::System.Net.Http.HttpClient HttpClient { get; } /// - public System.Uri? BaseUri => HttpClient.BaseAddress; + public System.Uri? BaseUri => ResolveDisplayedBaseUri(); /// public global::System.Collections.Generic.List Authorizations { get; } @@ -33,12 +33,43 @@ public sealed partial class ListsClient : global::HeyGen.IListsClient, global::S /// public global::HeyGen.AutoSDKClientOptions Options { get; } + + + internal global::HeyGen.AutoSDKServerConfiguration AutoSDKServerConfiguration { get; set; } = new global::HeyGen.AutoSDKServerConfiguration(); /// /// /// public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::HeyGen.SourceGenerationContext.Default; + + private static readonly global::HeyGen.AutoSDKServer[] s_availableServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers => s_availableServers; + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer + { + get => ResolveSelectedServer(); + set => SelectServer(value); + } + /// /// Creates a new instance of the ListsClient. /// If no httpClient is provided, a new one will be created. @@ -85,6 +116,8 @@ public ListsClient( Options = options ?? new global::HeyGen.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; + AutoSDKServerConfiguration.ExplicitBaseUri = baseUri ?? httpClient?.BaseAddress; + Initialized(HttpClient); } @@ -111,5 +144,117 @@ partial void ProcessResponseContent( global::System.Net.Http.HttpClient client, global::System.Net.Http.HttpResponseMessage response, ref string content); + + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId) + { + if (string.IsNullOrWhiteSpace(serverId)) + { + return false; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, serverId, global::System.StringComparison.OrdinalIgnoreCase)) + { + AutoSDKServerConfiguration.SelectedServer = server; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return true; + } + } + + return false; + } + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer() + { + AutoSDKServerConfiguration.SelectedServer = null; + } + + private global::HeyGen.AutoSDKServer? ResolveSelectedServer() + { + var selectedServer = AutoSDKServerConfiguration.SelectedServer; + if (selectedServer is null) + { + return null; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server; + } + } + + return null; + } + + private void SelectServer(global::HeyGen.AutoSDKServer? server) + { + if (server is null) + { + AutoSDKServerConfiguration.SelectedServer = null; + return; + } + + foreach (var candidate in s_availableServers) + { + if (string.Equals(candidate.Id, server.Id, global::System.StringComparison.Ordinal)) + { + AutoSDKServerConfiguration.SelectedServer = candidate; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return; + } + } + + throw new global::System.ArgumentException("The provided server is not available for this client.", nameof(server)); + } + + private global::System.Uri? ResolveDisplayedBaseUri() + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + return ResolveSelectedServer()?.Uri ?? HttpClient.BaseAddress; + } + + private global::System.Uri? ResolveBaseUri( + global::HeyGen.AutoSDKServer[] servers, + string defaultBaseUrl) + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + if (AutoSDKServerConfiguration.SelectedServer is global::HeyGen.AutoSDKServer selectedServer) + { + foreach (var server in servers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server.Uri; + } + } + } + + if (servers.Length > 0) + { + return servers[0].Uri; + } + + return string.IsNullOrWhiteSpace(defaultBaseUrl) + ? HttpClient.BaseAddress + : new global::System.Uri(defaultBaseUrl, global::System.UriKind.RelativeOrAbsolute); + } } } \ No newline at end of file diff --git a/src/libs/HeyGen/Generated/HeyGen.PersonalizedVideoClient.PersonalizedVideoAddContact.g.cs b/src/libs/HeyGen/Generated/HeyGen.PersonalizedVideoClient.PersonalizedVideoAddContact.g.cs index 9229040..177497f 100644 --- a/src/libs/HeyGen/Generated/HeyGen.PersonalizedVideoClient.PersonalizedVideoAddContact.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.PersonalizedVideoClient.PersonalizedVideoAddContact.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class PersonalizedVideoClient { + private static readonly global::HeyGen.AutoSDKServer[] s_PersonalizedVideoAddContactServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_PersonalizedVideoAddContactSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -82,7 +95,9 @@ partial void ProcessPersonalizedVideoAddContactResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/personalized_video/add_contact", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_PersonalizedVideoAddContactServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.PersonalizedVideoClient.PersonalizedVideoAudienceDetail.g.cs b/src/libs/HeyGen/Generated/HeyGen.PersonalizedVideoClient.PersonalizedVideoAudienceDetail.g.cs index 8eb5dff..208bcff 100644 --- a/src/libs/HeyGen/Generated/HeyGen.PersonalizedVideoClient.PersonalizedVideoAudienceDetail.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.PersonalizedVideoClient.PersonalizedVideoAudienceDetail.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class PersonalizedVideoClient { + private static readonly global::HeyGen.AutoSDKServer[] s_PersonalizedVideoAudienceDetailServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_PersonalizedVideoAudienceDetailSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -81,7 +94,9 @@ partial void ProcessPersonalizedVideoAudienceDetailResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/personalized_video/audience/detail", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_PersonalizedVideoAudienceDetailServers, + defaultBaseUrl: "https://api.heygen.com/")); __pathBuilder .AddOptionalParameter("id", id) ; diff --git a/src/libs/HeyGen/Generated/HeyGen.PersonalizedVideoClient.PersonalizedVideoProjectDetail.g.cs b/src/libs/HeyGen/Generated/HeyGen.PersonalizedVideoClient.PersonalizedVideoProjectDetail.g.cs index 04bba6d..3fe24d2 100644 --- a/src/libs/HeyGen/Generated/HeyGen.PersonalizedVideoClient.PersonalizedVideoProjectDetail.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.PersonalizedVideoClient.PersonalizedVideoProjectDetail.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class PersonalizedVideoClient { + private static readonly global::HeyGen.AutoSDKServer[] s_PersonalizedVideoProjectDetailServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_PersonalizedVideoProjectDetailSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -81,7 +94,9 @@ partial void ProcessPersonalizedVideoProjectDetailResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/personalized_video/project/detail", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_PersonalizedVideoProjectDetailServers, + defaultBaseUrl: "https://api.heygen.com/")); __pathBuilder .AddOptionalParameter("id", id) ; diff --git a/src/libs/HeyGen/Generated/HeyGen.PersonalizedVideoClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.PersonalizedVideoClient.g.cs index 444e817..fffab2b 100644 --- a/src/libs/HeyGen/Generated/HeyGen.PersonalizedVideoClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.PersonalizedVideoClient.g.cs @@ -6,7 +6,7 @@ namespace HeyGen /// /// Import contacts into your HeyGen **Personalized Video** campaign. 
/// **Guide**: [https://docs.heygen.com/docs/import-contacts-via-api](https://docs.heygen.com/docs/import-contacts-via-api)
- /// Reference: [https://docs.heygen.com/reference/add-contact](https://docs.heygen.com/reference/add-contact).
+ /// Reference: [https://docs.heygen.com/reference/add-contact](https://docs.heygen.com/reference/add-contact)
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -23,7 +23,7 @@ public sealed partial class PersonalizedVideoClient : global::HeyGen.IPersonaliz public global::System.Net.Http.HttpClient HttpClient { get; } /// - public System.Uri? BaseUri => HttpClient.BaseAddress; + public System.Uri? BaseUri => ResolveDisplayedBaseUri(); /// public global::System.Collections.Generic.List Authorizations { get; } @@ -36,12 +36,43 @@ public sealed partial class PersonalizedVideoClient : global::HeyGen.IPersonaliz /// public global::HeyGen.AutoSDKClientOptions Options { get; } + + + internal global::HeyGen.AutoSDKServerConfiguration AutoSDKServerConfiguration { get; set; } = new global::HeyGen.AutoSDKServerConfiguration(); /// /// /// public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::HeyGen.SourceGenerationContext.Default; + + private static readonly global::HeyGen.AutoSDKServer[] s_availableServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers => s_availableServers; + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer + { + get => ResolveSelectedServer(); + set => SelectServer(value); + } + /// /// Creates a new instance of the PersonalizedVideoClient. /// If no httpClient is provided, a new one will be created. @@ -88,6 +119,8 @@ public PersonalizedVideoClient( Options = options ?? new global::HeyGen.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; + AutoSDKServerConfiguration.ExplicitBaseUri = baseUri ?? httpClient?.BaseAddress; + Initialized(HttpClient); } @@ -114,5 +147,117 @@ partial void ProcessResponseContent( global::System.Net.Http.HttpClient client, global::System.Net.Http.HttpResponseMessage response, ref string content); + + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId) + { + if (string.IsNullOrWhiteSpace(serverId)) + { + return false; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, serverId, global::System.StringComparison.OrdinalIgnoreCase)) + { + AutoSDKServerConfiguration.SelectedServer = server; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return true; + } + } + + return false; + } + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer() + { + AutoSDKServerConfiguration.SelectedServer = null; + } + + private global::HeyGen.AutoSDKServer? ResolveSelectedServer() + { + var selectedServer = AutoSDKServerConfiguration.SelectedServer; + if (selectedServer is null) + { + return null; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server; + } + } + + return null; + } + + private void SelectServer(global::HeyGen.AutoSDKServer? server) + { + if (server is null) + { + AutoSDKServerConfiguration.SelectedServer = null; + return; + } + + foreach (var candidate in s_availableServers) + { + if (string.Equals(candidate.Id, server.Id, global::System.StringComparison.Ordinal)) + { + AutoSDKServerConfiguration.SelectedServer = candidate; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return; + } + } + + throw new global::System.ArgumentException("The provided server is not available for this client.", nameof(server)); + } + + private global::System.Uri? ResolveDisplayedBaseUri() + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + return ResolveSelectedServer()?.Uri ?? HttpClient.BaseAddress; + } + + private global::System.Uri? ResolveBaseUri( + global::HeyGen.AutoSDKServer[] servers, + string defaultBaseUrl) + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + if (AutoSDKServerConfiguration.SelectedServer is global::HeyGen.AutoSDKServer selectedServer) + { + foreach (var server in servers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server.Uri; + } + } + } + + if (servers.Length > 0) + { + return servers[0].Uri; + } + + return string.IsNullOrWhiteSpace(defaultBaseUrl) + ? HttpClient.BaseAddress + : new global::System.Uri(defaultBaseUrl, global::System.UriKind.RelativeOrAbsolute); + } } } \ No newline at end of file diff --git a/src/libs/HeyGen/Generated/HeyGen.ServerSelection.g.cs b/src/libs/HeyGen/Generated/HeyGen.ServerSelection.g.cs new file mode 100644 index 0000000..4cce9e9 --- /dev/null +++ b/src/libs/HeyGen/Generated/HeyGen.ServerSelection.g.cs @@ -0,0 +1,57 @@ +#nullable enable + +namespace HeyGen +{ + /// + /// Represents a concrete OpenAPI server option. + /// + public sealed class AutoSDKServer + { + /// + /// Initializes a new instance of the class. + /// + /// The stable identifier for this server option. + /// The display name for this server option. + /// The server URL. + /// The server description. + public AutoSDKServer( + string id, + string name, + string url, + string description) + { + Id = id ?? throw new global::System.ArgumentNullException(nameof(id)); + Name = name ?? string.Empty; + Url = url ?? throw new global::System.ArgumentNullException(nameof(url)); + Description = description ?? string.Empty; + Uri = new global::System.Uri(url, global::System.UriKind.RelativeOrAbsolute); + } + + /// + /// Gets the stable identifier for this server option. + /// + public string Id { get; } + /// + /// Gets the display name for this server option. + /// + public string Name { get; } + /// + /// Gets the server URL. + /// + public string Url { get; } + /// + /// Gets the server description. + /// + public string Description { get; } + /// + /// Gets the parsed server URI. + /// + public global::System.Uri Uri { get; } + } + + internal sealed class AutoSDKServerConfiguration + { + public global::System.Uri? ExplicitBaseUri { get; set; } + public global::HeyGen.AutoSDKServer? SelectedServer { get; set; } + } +} \ No newline at end of file diff --git a/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingAvatarList.g.cs b/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingAvatarList.g.cs index 559f1d6..5cfbb9b 100644 --- a/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingAvatarList.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingAvatarList.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class StreamingApiClient { + private static readonly global::HeyGen.AutoSDKServer[] s_StreamingAvatarListServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_StreamingAvatarListSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -74,7 +87,9 @@ partial void ProcessStreamingAvatarListResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/streaming/avatar.list", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_StreamingAvatarListServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingCreateToken.g.cs b/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingCreateToken.g.cs index 0151437..a43b2b0 100644 --- a/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingCreateToken.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingCreateToken.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class StreamingApiClient { + private static readonly global::HeyGen.AutoSDKServer[] s_StreamingCreateTokenServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_StreamingCreateTokenSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -82,7 +95,9 @@ partial void ProcessStreamingCreateTokenResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/streaming.create_token", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_StreamingCreateTokenServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingIce.g.cs b/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingIce.g.cs index e733100..4d9f9b1 100644 --- a/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingIce.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingIce.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class StreamingApiClient { + private static readonly global::HeyGen.AutoSDKServer[] s_StreamingIceServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_StreamingIceSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -82,7 +95,9 @@ partial void ProcessStreamingIceResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/streaming.ice", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_StreamingIceServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingInterrupt.g.cs b/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingInterrupt.g.cs index e9dc4ab..79a5ff5 100644 --- a/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingInterrupt.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingInterrupt.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class StreamingApiClient { + private static readonly global::HeyGen.AutoSDKServer[] s_StreamingInterruptServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_StreamingInterruptSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -82,7 +95,9 @@ partial void ProcessStreamingInterruptResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/streaming.interrupt", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_StreamingInterruptServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingList.g.cs b/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingList.g.cs index 21496c0..8e075d7 100644 --- a/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingList.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingList.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class StreamingApiClient { + private static readonly global::HeyGen.AutoSDKServer[] s_StreamingListServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_StreamingListSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -74,7 +87,9 @@ partial void ProcessStreamingListResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/streaming.list", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_StreamingListServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingNew.g.cs b/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingNew.g.cs index 1046cb5..40e5e01 100644 --- a/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingNew.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingNew.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class StreamingApiClient { + private static readonly global::HeyGen.AutoSDKServer[] s_StreamingNewServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_StreamingNewSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -82,7 +95,9 @@ partial void ProcessStreamingNewResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/streaming.new", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_StreamingNewServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingStart.g.cs b/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingStart.g.cs index c79a2a3..987ce05 100644 --- a/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingStart.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingStart.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class StreamingApiClient { + private static readonly global::HeyGen.AutoSDKServer[] s_StreamingStartServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_StreamingStartSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -82,7 +95,9 @@ partial void ProcessStreamingStartResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/streaming.start", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_StreamingStartServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingStop.g.cs b/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingStop.g.cs index 46cb042..ee27c8f 100644 --- a/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingStop.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingStop.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class StreamingApiClient { + private static readonly global::HeyGen.AutoSDKServer[] s_StreamingStopServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_StreamingStopSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -82,7 +95,9 @@ partial void ProcessStreamingStopResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/streaming.stop", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_StreamingStopServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingTask.g.cs b/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingTask.g.cs index a7ac619..ecf8e45 100644 --- a/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingTask.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.StreamingTask.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class StreamingApiClient { + private static readonly global::HeyGen.AutoSDKServer[] s_StreamingTaskServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_StreamingTaskSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -82,7 +95,9 @@ partial void ProcessStreamingTaskResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/streaming.task", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_StreamingTaskServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.g.cs index 8dcb38d..3f477f7 100644 --- a/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.StreamingApiClient.g.cs @@ -5,7 +5,7 @@ namespace HeyGen { /// /// HeyGen's **Streaming API** allows developers to seamlessly integrate dynamic digital avatars into their applications for immersive and interactive user experiences. With this API, you can create _virtual assistants, real-time training simulations,_ and more, with a focus on real-time, low-latency communication between _users_ and _avatars_ with power of WebRTC.
- /// **Guide**: [https://docs.heygen.com/docs/streaming-api](https://docs.heygen.com/docs/streaming-api)**Reference**: [https://docs.heygen.com/reference/new-session](https://docs.heygen.com/reference/new-session).
+ /// **Guide**: [https://docs.heygen.com/docs/streaming-api](https://docs.heygen.com/docs/streaming-api)**Reference**: [https://docs.heygen.com/reference/new-session](https://docs.heygen.com/reference/new-session)
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -22,7 +22,7 @@ public sealed partial class StreamingApiClient : global::HeyGen.IStreamingApiCli public global::System.Net.Http.HttpClient HttpClient { get; } /// - public System.Uri? BaseUri => HttpClient.BaseAddress; + public System.Uri? BaseUri => ResolveDisplayedBaseUri(); /// public global::System.Collections.Generic.List Authorizations { get; } @@ -35,12 +35,43 @@ public sealed partial class StreamingApiClient : global::HeyGen.IStreamingApiCli /// public global::HeyGen.AutoSDKClientOptions Options { get; } + + + internal global::HeyGen.AutoSDKServerConfiguration AutoSDKServerConfiguration { get; set; } = new global::HeyGen.AutoSDKServerConfiguration(); /// /// /// public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::HeyGen.SourceGenerationContext.Default; + + private static readonly global::HeyGen.AutoSDKServer[] s_availableServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers => s_availableServers; + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer + { + get => ResolveSelectedServer(); + set => SelectServer(value); + } + /// /// Creates a new instance of the StreamingApiClient. /// If no httpClient is provided, a new one will be created. @@ -87,6 +118,8 @@ public StreamingApiClient( Options = options ?? new global::HeyGen.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; + AutoSDKServerConfiguration.ExplicitBaseUri = baseUri ?? httpClient?.BaseAddress; + Initialized(HttpClient); } @@ -113,5 +146,117 @@ partial void ProcessResponseContent( global::System.Net.Http.HttpClient client, global::System.Net.Http.HttpResponseMessage response, ref string content); + + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId) + { + if (string.IsNullOrWhiteSpace(serverId)) + { + return false; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, serverId, global::System.StringComparison.OrdinalIgnoreCase)) + { + AutoSDKServerConfiguration.SelectedServer = server; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return true; + } + } + + return false; + } + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer() + { + AutoSDKServerConfiguration.SelectedServer = null; + } + + private global::HeyGen.AutoSDKServer? ResolveSelectedServer() + { + var selectedServer = AutoSDKServerConfiguration.SelectedServer; + if (selectedServer is null) + { + return null; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server; + } + } + + return null; + } + + private void SelectServer(global::HeyGen.AutoSDKServer? server) + { + if (server is null) + { + AutoSDKServerConfiguration.SelectedServer = null; + return; + } + + foreach (var candidate in s_availableServers) + { + if (string.Equals(candidate.Id, server.Id, global::System.StringComparison.Ordinal)) + { + AutoSDKServerConfiguration.SelectedServer = candidate; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return; + } + } + + throw new global::System.ArgumentException("The provided server is not available for this client.", nameof(server)); + } + + private global::System.Uri? ResolveDisplayedBaseUri() + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + return ResolveSelectedServer()?.Uri ?? HttpClient.BaseAddress; + } + + private global::System.Uri? ResolveBaseUri( + global::HeyGen.AutoSDKServer[] servers, + string defaultBaseUrl) + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + if (AutoSDKServerConfiguration.SelectedServer is global::HeyGen.AutoSDKServer selectedServer) + { + foreach (var server in servers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server.Uri; + } + } + } + + if (servers.Length > 0) + { + return servers[0].Uri; + } + + return string.IsNullOrWhiteSpace(defaultBaseUrl) + ? HttpClient.BaseAddress + : new global::System.Uri(defaultBaseUrl, global::System.UriKind.RelativeOrAbsolute); + } } } \ No newline at end of file diff --git a/src/libs/HeyGen/Generated/HeyGen.TalkingPhotoClient.V1TalkingPhotoList.g.cs b/src/libs/HeyGen/Generated/HeyGen.TalkingPhotoClient.V1TalkingPhotoList.g.cs index e430c07..e98d3b0 100644 --- a/src/libs/HeyGen/Generated/HeyGen.TalkingPhotoClient.V1TalkingPhotoList.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.TalkingPhotoClient.V1TalkingPhotoList.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class TalkingPhotoClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V1TalkingPhotoListServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V1TalkingPhotoListSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -74,7 +87,9 @@ partial void ProcessV1TalkingPhotoListResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/talking_photo.list", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V1TalkingPhotoListServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.TalkingPhotoClient.V1TalkingPhotoUpload.g.cs b/src/libs/HeyGen/Generated/HeyGen.TalkingPhotoClient.V1TalkingPhotoUpload.g.cs index 97cbb98..e05c7cd 100644 --- a/src/libs/HeyGen/Generated/HeyGen.TalkingPhotoClient.V1TalkingPhotoUpload.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.TalkingPhotoClient.V1TalkingPhotoUpload.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class TalkingPhotoClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V1TalkingPhotoUploadServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V1TalkingPhotoUploadSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -74,7 +87,9 @@ partial void ProcessV1TalkingPhotoUploadResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/talking_photo", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V1TalkingPhotoUploadServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.TalkingPhotoClient.V2TalkingPhotoIdDelete.g.cs b/src/libs/HeyGen/Generated/HeyGen.TalkingPhotoClient.V2TalkingPhotoIdDelete.g.cs index a8fa6df..7aee154 100644 --- a/src/libs/HeyGen/Generated/HeyGen.TalkingPhotoClient.V2TalkingPhotoIdDelete.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.TalkingPhotoClient.V2TalkingPhotoIdDelete.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class TalkingPhotoClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V2TalkingPhotoIdDeleteServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V2TalkingPhotoIdDeleteSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -74,7 +87,9 @@ partial void ProcessV2TalkingPhotoIdDeleteResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v2/talking_photo/", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V2TalkingPhotoIdDeleteServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.TalkingPhotoClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.TalkingPhotoClient.g.cs index b71bbd1..a7519c0 100644 --- a/src/libs/HeyGen/Generated/HeyGen.TalkingPhotoClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.TalkingPhotoClient.g.cs @@ -5,7 +5,7 @@ namespace HeyGen { /// /// These API endpoints allow you to manage photo avatars in your account.
- /// **Reference**: [https://docs.heygen.com/reference/upload-talking-photo](https://docs.heygen.com/reference/upload-talking-photo).
+ /// **Reference**: [https://docs.heygen.com/reference/upload-talking-photo](https://docs.heygen.com/reference/upload-talking-photo)
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -22,7 +22,7 @@ public sealed partial class TalkingPhotoClient : global::HeyGen.ITalkingPhotoCli public global::System.Net.Http.HttpClient HttpClient { get; } /// - public System.Uri? BaseUri => HttpClient.BaseAddress; + public System.Uri? BaseUri => ResolveDisplayedBaseUri(); /// public global::System.Collections.Generic.List Authorizations { get; } @@ -35,12 +35,43 @@ public sealed partial class TalkingPhotoClient : global::HeyGen.ITalkingPhotoCli /// public global::HeyGen.AutoSDKClientOptions Options { get; } + + + internal global::HeyGen.AutoSDKServerConfiguration AutoSDKServerConfiguration { get; set; } = new global::HeyGen.AutoSDKServerConfiguration(); /// /// /// public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::HeyGen.SourceGenerationContext.Default; + + private static readonly global::HeyGen.AutoSDKServer[] s_availableServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers => s_availableServers; + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer + { + get => ResolveSelectedServer(); + set => SelectServer(value); + } + /// /// Creates a new instance of the TalkingPhotoClient. /// If no httpClient is provided, a new one will be created. @@ -87,6 +118,8 @@ public TalkingPhotoClient( Options = options ?? new global::HeyGen.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; + AutoSDKServerConfiguration.ExplicitBaseUri = baseUri ?? httpClient?.BaseAddress; + Initialized(HttpClient); } @@ -113,5 +146,117 @@ partial void ProcessResponseContent( global::System.Net.Http.HttpClient client, global::System.Net.Http.HttpResponseMessage response, ref string content); + + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId) + { + if (string.IsNullOrWhiteSpace(serverId)) + { + return false; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, serverId, global::System.StringComparison.OrdinalIgnoreCase)) + { + AutoSDKServerConfiguration.SelectedServer = server; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return true; + } + } + + return false; + } + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer() + { + AutoSDKServerConfiguration.SelectedServer = null; + } + + private global::HeyGen.AutoSDKServer? ResolveSelectedServer() + { + var selectedServer = AutoSDKServerConfiguration.SelectedServer; + if (selectedServer is null) + { + return null; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server; + } + } + + return null; + } + + private void SelectServer(global::HeyGen.AutoSDKServer? server) + { + if (server is null) + { + AutoSDKServerConfiguration.SelectedServer = null; + return; + } + + foreach (var candidate in s_availableServers) + { + if (string.Equals(candidate.Id, server.Id, global::System.StringComparison.Ordinal)) + { + AutoSDKServerConfiguration.SelectedServer = candidate; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return; + } + } + + throw new global::System.ArgumentException("The provided server is not available for this client.", nameof(server)); + } + + private global::System.Uri? ResolveDisplayedBaseUri() + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + return ResolveSelectedServer()?.Uri ?? HttpClient.BaseAddress; + } + + private global::System.Uri? ResolveBaseUri( + global::HeyGen.AutoSDKServer[] servers, + string defaultBaseUrl) + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + if (AutoSDKServerConfiguration.SelectedServer is global::HeyGen.AutoSDKServer selectedServer) + { + foreach (var server in servers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server.Uri; + } + } + } + + if (servers.Length > 0) + { + return servers[0].Uri; + } + + return string.IsNullOrWhiteSpace(defaultBaseUrl) + ? HttpClient.BaseAddress + : new global::System.Uri(defaultBaseUrl, global::System.UriKind.RelativeOrAbsolute); + } } } \ No newline at end of file diff --git a/src/libs/HeyGen/Generated/HeyGen.TemplateApiClient.V2TemplateGenerate.g.cs b/src/libs/HeyGen/Generated/HeyGen.TemplateApiClient.V2TemplateGenerate.g.cs index d312d12..fab3df4 100644 --- a/src/libs/HeyGen/Generated/HeyGen.TemplateApiClient.V2TemplateGenerate.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.TemplateApiClient.V2TemplateGenerate.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class TemplateApiClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V2TemplateGenerateServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V2TemplateGenerateSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -83,7 +96,9 @@ partial void ProcessV2TemplateGenerateResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v2/template//generate", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V2TemplateGenerateServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.TemplateApiClient.V2TemplateId.g.cs b/src/libs/HeyGen/Generated/HeyGen.TemplateApiClient.V2TemplateId.g.cs index 09192a3..6eba8f4 100644 --- a/src/libs/HeyGen/Generated/HeyGen.TemplateApiClient.V2TemplateId.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.TemplateApiClient.V2TemplateId.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class TemplateApiClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V2TemplateIdServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V2TemplateIdSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -74,7 +87,9 @@ partial void ProcessV2TemplateIdResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v2/template/", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V2TemplateIdServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.TemplateApiClient.V2Templates.g.cs b/src/libs/HeyGen/Generated/HeyGen.TemplateApiClient.V2Templates.g.cs index 3d7c305..626affa 100644 --- a/src/libs/HeyGen/Generated/HeyGen.TemplateApiClient.V2Templates.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.TemplateApiClient.V2Templates.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class TemplateApiClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V2TemplatesServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V2TemplatesSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -74,7 +87,9 @@ partial void ProcessV2TemplatesResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v2/templates", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V2TemplatesServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.TemplateApiClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.TemplateApiClient.g.cs index e1e53be..adb1b1d 100644 --- a/src/libs/HeyGen/Generated/HeyGen.TemplateApiClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.TemplateApiClient.g.cs @@ -11,7 +11,7 @@ namespace HeyGen /// - **Template Videos:** In contrast, template videos offer a wide canvas for creativity. They enable you to customize existing text, images, videos, audios, voices and avatars seamlessly. If you need a richer, more versatile content format for your workflow, templates are the perfect choice.
///
/// **Guide**: [https://docs.heygen.com/docs/generate-video-from-template-v2](https://docs.heygen.com/docs/generate-video-from-template-v2)
- /// **Reference**: [https://docs.heygen.com/reference/generate-from-template-v2](https://docs.heygen.com/reference/generate-from-template-v2)[](https://docs.heygen.com/reference/create-an-avatar-video-v2).
+ /// **Reference**: [https://docs.heygen.com/reference/generate-from-template-v2](https://docs.heygen.com/reference/generate-from-template-v2)[](https://docs.heygen.com/reference/create-an-avatar-video-v2)
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -28,7 +28,7 @@ public sealed partial class TemplateApiClient : global::HeyGen.ITemplateApiClien public global::System.Net.Http.HttpClient HttpClient { get; } /// - public System.Uri? BaseUri => HttpClient.BaseAddress; + public System.Uri? BaseUri => ResolveDisplayedBaseUri(); /// public global::System.Collections.Generic.List Authorizations { get; } @@ -41,12 +41,43 @@ public sealed partial class TemplateApiClient : global::HeyGen.ITemplateApiClien /// public global::HeyGen.AutoSDKClientOptions Options { get; } + + + internal global::HeyGen.AutoSDKServerConfiguration AutoSDKServerConfiguration { get; set; } = new global::HeyGen.AutoSDKServerConfiguration(); /// /// /// public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::HeyGen.SourceGenerationContext.Default; + + private static readonly global::HeyGen.AutoSDKServer[] s_availableServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers => s_availableServers; + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer + { + get => ResolveSelectedServer(); + set => SelectServer(value); + } + /// /// Creates a new instance of the TemplateApiClient. /// If no httpClient is provided, a new one will be created. @@ -93,6 +124,8 @@ public TemplateApiClient( Options = options ?? new global::HeyGen.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; + AutoSDKServerConfiguration.ExplicitBaseUri = baseUri ?? httpClient?.BaseAddress; + Initialized(HttpClient); } @@ -119,5 +152,117 @@ partial void ProcessResponseContent( global::System.Net.Http.HttpClient client, global::System.Net.Http.HttpResponseMessage response, ref string content); + + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId) + { + if (string.IsNullOrWhiteSpace(serverId)) + { + return false; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, serverId, global::System.StringComparison.OrdinalIgnoreCase)) + { + AutoSDKServerConfiguration.SelectedServer = server; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return true; + } + } + + return false; + } + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer() + { + AutoSDKServerConfiguration.SelectedServer = null; + } + + private global::HeyGen.AutoSDKServer? ResolveSelectedServer() + { + var selectedServer = AutoSDKServerConfiguration.SelectedServer; + if (selectedServer is null) + { + return null; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server; + } + } + + return null; + } + + private void SelectServer(global::HeyGen.AutoSDKServer? server) + { + if (server is null) + { + AutoSDKServerConfiguration.SelectedServer = null; + return; + } + + foreach (var candidate in s_availableServers) + { + if (string.Equals(candidate.Id, server.Id, global::System.StringComparison.Ordinal)) + { + AutoSDKServerConfiguration.SelectedServer = candidate; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return; + } + } + + throw new global::System.ArgumentException("The provided server is not available for this client.", nameof(server)); + } + + private global::System.Uri? ResolveDisplayedBaseUri() + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + return ResolveSelectedServer()?.Uri ?? HttpClient.BaseAddress; + } + + private global::System.Uri? ResolveBaseUri( + global::HeyGen.AutoSDKServer[] servers, + string defaultBaseUrl) + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + if (AutoSDKServerConfiguration.SelectedServer is global::HeyGen.AutoSDKServer selectedServer) + { + foreach (var server in servers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server.Uri; + } + } + } + + if (servers.Length > 0) + { + return servers[0].Uri; + } + + return string.IsNullOrWhiteSpace(defaultBaseUrl) + ? HttpClient.BaseAddress + : new global::System.Uri(defaultBaseUrl, global::System.UriKind.RelativeOrAbsolute); + } } } \ No newline at end of file diff --git a/src/libs/HeyGen/Generated/HeyGen.UserClient.V2UserRemainingQuota.g.cs b/src/libs/HeyGen/Generated/HeyGen.UserClient.V2UserRemainingQuota.g.cs index b9e70ec..190daa0 100644 --- a/src/libs/HeyGen/Generated/HeyGen.UserClient.V2UserRemainingQuota.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.UserClient.V2UserRemainingQuota.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class UserClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V2UserRemainingQuotaServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V2UserRemainingQuotaSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -74,7 +87,9 @@ partial void ProcessV2UserRemainingQuotaResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v2/user/remaining_quota", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V2UserRemainingQuotaServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.UserClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.UserClient.g.cs index 3eee3b2..242707a 100644 --- a/src/libs/HeyGen/Generated/HeyGen.UserClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.UserClient.g.cs @@ -5,7 +5,7 @@ namespace HeyGen { /// /// Obtain information about your account.
- /// **Reference**: [https://docs.heygen.com/reference/get-remaining-quota-v2](https://docs.heygen.com/reference/get-remaining-quota-v2).
+ /// **Reference**: [https://docs.heygen.com/reference/get-remaining-quota-v2](https://docs.heygen.com/reference/get-remaining-quota-v2)
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -22,7 +22,7 @@ public sealed partial class UserClient : global::HeyGen.IUserClient, global::Sys public global::System.Net.Http.HttpClient HttpClient { get; } /// - public System.Uri? BaseUri => HttpClient.BaseAddress; + public System.Uri? BaseUri => ResolveDisplayedBaseUri(); /// public global::System.Collections.Generic.List Authorizations { get; } @@ -35,12 +35,43 @@ public sealed partial class UserClient : global::HeyGen.IUserClient, global::Sys /// public global::HeyGen.AutoSDKClientOptions Options { get; } + + + internal global::HeyGen.AutoSDKServerConfiguration AutoSDKServerConfiguration { get; set; } = new global::HeyGen.AutoSDKServerConfiguration(); /// /// /// public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::HeyGen.SourceGenerationContext.Default; + + private static readonly global::HeyGen.AutoSDKServer[] s_availableServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers => s_availableServers; + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer + { + get => ResolveSelectedServer(); + set => SelectServer(value); + } + /// /// Creates a new instance of the UserClient. /// If no httpClient is provided, a new one will be created. @@ -87,6 +118,8 @@ public UserClient( Options = options ?? new global::HeyGen.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; + AutoSDKServerConfiguration.ExplicitBaseUri = baseUri ?? httpClient?.BaseAddress; + Initialized(HttpClient); } @@ -113,5 +146,117 @@ partial void ProcessResponseContent( global::System.Net.Http.HttpClient client, global::System.Net.Http.HttpResponseMessage response, ref string content); + + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId) + { + if (string.IsNullOrWhiteSpace(serverId)) + { + return false; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, serverId, global::System.StringComparison.OrdinalIgnoreCase)) + { + AutoSDKServerConfiguration.SelectedServer = server; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return true; + } + } + + return false; + } + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer() + { + AutoSDKServerConfiguration.SelectedServer = null; + } + + private global::HeyGen.AutoSDKServer? ResolveSelectedServer() + { + var selectedServer = AutoSDKServerConfiguration.SelectedServer; + if (selectedServer is null) + { + return null; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server; + } + } + + return null; + } + + private void SelectServer(global::HeyGen.AutoSDKServer? server) + { + if (server is null) + { + AutoSDKServerConfiguration.SelectedServer = null; + return; + } + + foreach (var candidate in s_availableServers) + { + if (string.Equals(candidate.Id, server.Id, global::System.StringComparison.Ordinal)) + { + AutoSDKServerConfiguration.SelectedServer = candidate; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return; + } + } + + throw new global::System.ArgumentException("The provided server is not available for this client.", nameof(server)); + } + + private global::System.Uri? ResolveDisplayedBaseUri() + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + return ResolveSelectedServer()?.Uri ?? HttpClient.BaseAddress; + } + + private global::System.Uri? ResolveBaseUri( + global::HeyGen.AutoSDKServer[] servers, + string defaultBaseUrl) + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + if (AutoSDKServerConfiguration.SelectedServer is global::HeyGen.AutoSDKServer selectedServer) + { + foreach (var server in servers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server.Uri; + } + } + } + + if (servers.Length > 0) + { + return servers[0].Uri; + } + + return string.IsNullOrWhiteSpace(defaultBaseUrl) + ? HttpClient.BaseAddress + : new global::System.Uri(defaultBaseUrl, global::System.UriKind.RelativeOrAbsolute); + } } } \ No newline at end of file diff --git a/src/libs/HeyGen/Generated/HeyGen.VideoTranslateApiClient.V2VideoTranslate.g.cs b/src/libs/HeyGen/Generated/HeyGen.VideoTranslateApiClient.V2VideoTranslate.g.cs index de43444..ef2924f 100644 --- a/src/libs/HeyGen/Generated/HeyGen.VideoTranslateApiClient.V2VideoTranslate.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.VideoTranslateApiClient.V2VideoTranslate.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class VideoTranslateApiClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V2VideoTranslateServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V2VideoTranslateSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -82,7 +95,9 @@ partial void ProcessV2VideoTranslateResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v2/video_translate", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V2VideoTranslateServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.VideoTranslateApiClient.V2VideoTranslateIdStatus.g.cs b/src/libs/HeyGen/Generated/HeyGen.VideoTranslateApiClient.V2VideoTranslateIdStatus.g.cs index dd6e14d..27d6922 100644 --- a/src/libs/HeyGen/Generated/HeyGen.VideoTranslateApiClient.V2VideoTranslateIdStatus.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.VideoTranslateApiClient.V2VideoTranslateIdStatus.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class VideoTranslateApiClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V2VideoTranslateIdStatusServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V2VideoTranslateIdStatusSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -74,7 +87,9 @@ partial void ProcessV2VideoTranslateIdStatusResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v2/video_translate/", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V2VideoTranslateIdStatusServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.VideoTranslateApiClient.V2VideoTranslateTargetLanguages.g.cs b/src/libs/HeyGen/Generated/HeyGen.VideoTranslateApiClient.V2VideoTranslateTargetLanguages.g.cs index 5d715d8..8d1029c 100644 --- a/src/libs/HeyGen/Generated/HeyGen.VideoTranslateApiClient.V2VideoTranslateTargetLanguages.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.VideoTranslateApiClient.V2VideoTranslateTargetLanguages.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class VideoTranslateApiClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V2VideoTranslateTargetLanguagesServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V2VideoTranslateTargetLanguagesSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -74,7 +87,9 @@ partial void ProcessV2VideoTranslateTargetLanguagesResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v2/video_translate/target_languages", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V2VideoTranslateTargetLanguagesServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.VideoTranslateApiClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.VideoTranslateApiClient.g.cs index 83589bc..3968889 100644 --- a/src/libs/HeyGen/Generated/HeyGen.VideoTranslateApiClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.VideoTranslateApiClient.g.cs @@ -5,7 +5,7 @@ namespace HeyGen { /// /// The [Video Translate](https://labs.heygen.com/video-translate) by HeyGen provides a powerful solution for effortlessly translating videos, integrating natural voice cloning and authentic speaking styles seamlessly. Now, you can harness its capabilities programmatically through the **Video Translate API**!
- /// **Guide**: [https://docs.heygen.com/docs/video-translate-api](https://docs.heygen.com/docs/video-translate-api)**Reference**: [https://docs.heygen.com/reference/video-translate](https://docs.heygen.com/reference/video-translate).
+ /// **Guide**: [https://docs.heygen.com/docs/video-translate-api](https://docs.heygen.com/docs/video-translate-api)**Reference**: [https://docs.heygen.com/reference/video-translate](https://docs.heygen.com/reference/video-translate)
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -22,7 +22,7 @@ public sealed partial class VideoTranslateApiClient : global::HeyGen.IVideoTrans public global::System.Net.Http.HttpClient HttpClient { get; } /// - public System.Uri? BaseUri => HttpClient.BaseAddress; + public System.Uri? BaseUri => ResolveDisplayedBaseUri(); /// public global::System.Collections.Generic.List Authorizations { get; } @@ -35,12 +35,43 @@ public sealed partial class VideoTranslateApiClient : global::HeyGen.IVideoTrans /// public global::HeyGen.AutoSDKClientOptions Options { get; } + + + internal global::HeyGen.AutoSDKServerConfiguration AutoSDKServerConfiguration { get; set; } = new global::HeyGen.AutoSDKServerConfiguration(); /// /// /// public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::HeyGen.SourceGenerationContext.Default; + + private static readonly global::HeyGen.AutoSDKServer[] s_availableServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers => s_availableServers; + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer + { + get => ResolveSelectedServer(); + set => SelectServer(value); + } + /// /// Creates a new instance of the VideoTranslateApiClient. /// If no httpClient is provided, a new one will be created. @@ -87,6 +118,8 @@ public VideoTranslateApiClient( Options = options ?? new global::HeyGen.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; + AutoSDKServerConfiguration.ExplicitBaseUri = baseUri ?? httpClient?.BaseAddress; + Initialized(HttpClient); } @@ -113,5 +146,117 @@ partial void ProcessResponseContent( global::System.Net.Http.HttpClient client, global::System.Net.Http.HttpResponseMessage response, ref string content); + + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId) + { + if (string.IsNullOrWhiteSpace(serverId)) + { + return false; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, serverId, global::System.StringComparison.OrdinalIgnoreCase)) + { + AutoSDKServerConfiguration.SelectedServer = server; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return true; + } + } + + return false; + } + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer() + { + AutoSDKServerConfiguration.SelectedServer = null; + } + + private global::HeyGen.AutoSDKServer? ResolveSelectedServer() + { + var selectedServer = AutoSDKServerConfiguration.SelectedServer; + if (selectedServer is null) + { + return null; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server; + } + } + + return null; + } + + private void SelectServer(global::HeyGen.AutoSDKServer? server) + { + if (server is null) + { + AutoSDKServerConfiguration.SelectedServer = null; + return; + } + + foreach (var candidate in s_availableServers) + { + if (string.Equals(candidate.Id, server.Id, global::System.StringComparison.Ordinal)) + { + AutoSDKServerConfiguration.SelectedServer = candidate; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return; + } + } + + throw new global::System.ArgumentException("The provided server is not available for this client.", nameof(server)); + } + + private global::System.Uri? ResolveDisplayedBaseUri() + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + return ResolveSelectedServer()?.Uri ?? HttpClient.BaseAddress; + } + + private global::System.Uri? ResolveBaseUri( + global::HeyGen.AutoSDKServer[] servers, + string defaultBaseUrl) + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + if (AutoSDKServerConfiguration.SelectedServer is global::HeyGen.AutoSDKServer selectedServer) + { + foreach (var server in servers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server.Uri; + } + } + } + + if (servers.Length > 0) + { + return servers[0].Uri; + } + + return string.IsNullOrWhiteSpace(defaultBaseUrl) + ? HttpClient.BaseAddress + : new global::System.Uri(defaultBaseUrl, global::System.UriKind.RelativeOrAbsolute); + } } } \ No newline at end of file diff --git a/src/libs/HeyGen/Generated/HeyGen.WebhooksClient.V1WebhookEndpointAdd.g.cs b/src/libs/HeyGen/Generated/HeyGen.WebhooksClient.V1WebhookEndpointAdd.g.cs index 156b730..e3015a3 100644 --- a/src/libs/HeyGen/Generated/HeyGen.WebhooksClient.V1WebhookEndpointAdd.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.WebhooksClient.V1WebhookEndpointAdd.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class WebhooksClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V1WebhookEndpointAddServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V1WebhookEndpointAddSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -82,7 +95,9 @@ partial void ProcessV1WebhookEndpointAddResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/webhook/endpoint.add", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V1WebhookEndpointAddServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.WebhooksClient.V1WebhookEndpointDelete.g.cs b/src/libs/HeyGen/Generated/HeyGen.WebhooksClient.V1WebhookEndpointDelete.g.cs index 3919e55..1a7b90a 100644 --- a/src/libs/HeyGen/Generated/HeyGen.WebhooksClient.V1WebhookEndpointDelete.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.WebhooksClient.V1WebhookEndpointDelete.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class WebhooksClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V1WebhookEndpointDeleteServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V1WebhookEndpointDeleteSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -81,7 +94,9 @@ partial void ProcessV1WebhookEndpointDeleteResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/webhook/endpoint.delete", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V1WebhookEndpointDeleteServers, + defaultBaseUrl: "https://api.heygen.com/")); __pathBuilder .AddOptionalParameter("endpoint_id", endpointId) ; diff --git a/src/libs/HeyGen/Generated/HeyGen.WebhooksClient.V1WebhookEndpointList.g.cs b/src/libs/HeyGen/Generated/HeyGen.WebhooksClient.V1WebhookEndpointList.g.cs index 7c25a64..d6a7ef5 100644 --- a/src/libs/HeyGen/Generated/HeyGen.WebhooksClient.V1WebhookEndpointList.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.WebhooksClient.V1WebhookEndpointList.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class WebhooksClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V1WebhookEndpointListServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V1WebhookEndpointListSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -74,7 +87,9 @@ partial void ProcessV1WebhookEndpointListResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/webhook/endpoint.list", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V1WebhookEndpointListServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.WebhooksClient.V1WebhookWebhookList.g.cs b/src/libs/HeyGen/Generated/HeyGen.WebhooksClient.V1WebhookWebhookList.g.cs index 5805277..3821c21 100644 --- a/src/libs/HeyGen/Generated/HeyGen.WebhooksClient.V1WebhookWebhookList.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.WebhooksClient.V1WebhookWebhookList.g.cs @@ -6,6 +6,19 @@ namespace HeyGen public partial class WebhooksClient { + private static readonly global::HeyGen.AutoSDKServer[] s_V1WebhookWebhookListServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + private static readonly global::HeyGen.EndPointSecurityRequirement s_V1WebhookWebhookListSecurityRequirement0 = new global::HeyGen.EndPointSecurityRequirement @@ -74,7 +87,9 @@ partial void ProcessV1WebhookWebhookListResponse( { var __pathBuilder = new global::HeyGen.PathBuilder( path: "/v1/webhook/webhook.list", - baseUri: HttpClient.BaseAddress); + baseUri: ResolveBaseUri( + servers: s_V1WebhookWebhookListServers, + defaultBaseUrl: "https://api.heygen.com/")); var __path = __pathBuilder.ToString(); __path = global::HeyGen.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, diff --git a/src/libs/HeyGen/Generated/HeyGen.WebhooksClient.g.cs b/src/libs/HeyGen/Generated/HeyGen.WebhooksClient.g.cs index 49cb4ab..4416404 100644 --- a/src/libs/HeyGen/Generated/HeyGen.WebhooksClient.g.cs +++ b/src/libs/HeyGen/Generated/HeyGen.WebhooksClient.g.cs @@ -5,7 +5,7 @@ namespace HeyGen { /// /// Webhook events are how the **HeyGen** notifies your _endpoints_ when a variety of interactions or events happen, including when avatar video processing _succeeds_ or _fails_. Webhook events are sent by HeyGen as POST requests to your webhook endpoint.
- /// **Guide**: [https://docs.heygen.com/docs/using-heygens-webhook-events](https://docs.heygen.com/docs/using-heygens-webhook-events)**Reference**: [https://docs.heygen.com/reference/add-a-webhook-endpoint](https://docs.heygen.com/reference/add-a-webhook-endpoint).
+ /// **Guide**: [https://docs.heygen.com/docs/using-heygens-webhook-events](https://docs.heygen.com/docs/using-heygens-webhook-events)**Reference**: [https://docs.heygen.com/reference/add-a-webhook-endpoint](https://docs.heygen.com/reference/add-a-webhook-endpoint)
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -22,7 +22,7 @@ public sealed partial class WebhooksClient : global::HeyGen.IWebhooksClient, glo public global::System.Net.Http.HttpClient HttpClient { get; } /// - public System.Uri? BaseUri => HttpClient.BaseAddress; + public System.Uri? BaseUri => ResolveDisplayedBaseUri(); /// public global::System.Collections.Generic.List Authorizations { get; } @@ -35,12 +35,43 @@ public sealed partial class WebhooksClient : global::HeyGen.IWebhooksClient, glo /// public global::HeyGen.AutoSDKClientOptions Options { get; } + + + internal global::HeyGen.AutoSDKServerConfiguration AutoSDKServerConfiguration { get; set; } = new global::HeyGen.AutoSDKServerConfiguration(); /// /// /// public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::HeyGen.SourceGenerationContext.Default; + + private static readonly global::HeyGen.AutoSDKServer[] s_availableServers = new global::HeyGen.AutoSDKServer[] + { new global::HeyGen.AutoSDKServer( + id: "https-api-heygen-com", + name: "api.heygen.com", + url: "https://api.heygen.com/", + description: ""), + new global::HeyGen.AutoSDKServer( + id: "https-upload-heygen-com", + name: "upload.heygen.com", + url: "https://upload.heygen.com/", + description: ""), + }; + + /// + /// The server options available for this client. + /// + public global::System.Collections.Generic.IReadOnlyList AvailableServers => s_availableServers; + + /// + /// The currently selected server for this client, if any. + /// + public global::HeyGen.AutoSDKServer? SelectedServer + { + get => ResolveSelectedServer(); + set => SelectServer(value); + } + /// /// Creates a new instance of the WebhooksClient. /// If no httpClient is provided, a new one will be created. @@ -87,6 +118,8 @@ public WebhooksClient( Options = options ?? new global::HeyGen.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; + AutoSDKServerConfiguration.ExplicitBaseUri = baseUri ?? httpClient?.BaseAddress; + Initialized(HttpClient); } @@ -113,5 +146,117 @@ partial void ProcessResponseContent( global::System.Net.Http.HttpClient client, global::System.Net.Http.HttpResponseMessage response, ref string content); + + + /// + /// Selects one of the generated server options by id. + /// + public bool TrySelectServer(string serverId) + { + if (string.IsNullOrWhiteSpace(serverId)) + { + return false; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, serverId, global::System.StringComparison.OrdinalIgnoreCase)) + { + AutoSDKServerConfiguration.SelectedServer = server; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return true; + } + } + + return false; + } + + /// + /// Clears the currently selected server. + /// + public void ClearSelectedServer() + { + AutoSDKServerConfiguration.SelectedServer = null; + } + + private global::HeyGen.AutoSDKServer? ResolveSelectedServer() + { + var selectedServer = AutoSDKServerConfiguration.SelectedServer; + if (selectedServer is null) + { + return null; + } + + foreach (var server in s_availableServers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server; + } + } + + return null; + } + + private void SelectServer(global::HeyGen.AutoSDKServer? server) + { + if (server is null) + { + AutoSDKServerConfiguration.SelectedServer = null; + return; + } + + foreach (var candidate in s_availableServers) + { + if (string.Equals(candidate.Id, server.Id, global::System.StringComparison.Ordinal)) + { + AutoSDKServerConfiguration.SelectedServer = candidate; + AutoSDKServerConfiguration.ExplicitBaseUri = null; + return; + } + } + + throw new global::System.ArgumentException("The provided server is not available for this client.", nameof(server)); + } + + private global::System.Uri? ResolveDisplayedBaseUri() + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + return ResolveSelectedServer()?.Uri ?? HttpClient.BaseAddress; + } + + private global::System.Uri? ResolveBaseUri( + global::HeyGen.AutoSDKServer[] servers, + string defaultBaseUrl) + { + if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri) + { + return explicitBaseUri; + } + + if (AutoSDKServerConfiguration.SelectedServer is global::HeyGen.AutoSDKServer selectedServer) + { + foreach (var server in servers) + { + if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal)) + { + return server.Uri; + } + } + } + + if (servers.Length > 0) + { + return servers[0].Uri; + } + + return string.IsNullOrWhiteSpace(defaultBaseUrl) + ? HttpClient.BaseAddress + : new global::System.Uri(defaultBaseUrl, global::System.UriKind.RelativeOrAbsolute); + } } } \ No newline at end of file