diff --git a/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.Authorizations.Bearer.g.cs b/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.Authorizations.Bearer.g.cs
index af20015..383fbc0 100644
--- a/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.Authorizations.Bearer.g.cs
+++ b/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.Authorizations.Bearer.g.cs
@@ -5,13 +5,23 @@ namespace Creatomate
{
public sealed partial class CreatomateClient
{
+
///
public void AuthorizeUsingBearer(
string apiKey)
{
apiKey = apiKey ?? throw new global::System.ArgumentNullException(nameof(apiKey));
- Authorizations.Clear();
+ for (var i = Authorizations.Count - 1; i >= 0; i--)
+ {
+ var __authorization = Authorizations[i];
+ if (__authorization.Type == "Http" &&
+ __authorization.Name == "Bearer")
+ {
+ Authorizations.RemoveAt(i);
+ }
+ }
+
Authorizations.Add(new global::Creatomate.EndPointAuthorization
{
Type = "Http",
diff --git a/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.Constructors.Bearer.g.cs b/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.Constructors.Bearer.g.cs
index 59172e3..43739c5 100644
--- a/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.Constructors.Bearer.g.cs
+++ b/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.Constructors.Bearer.g.cs
@@ -6,6 +6,7 @@ namespace Creatomate
public sealed partial class CreatomateClient
{
///
+
public CreatomateClient(
string apiKey,
global::System.Net.Http.HttpClient? httpClient = null,
diff --git a/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.CreateRender.g.cs b/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.CreateRender.g.cs
index 332c776..bf3dcf6 100644
--- a/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.CreateRender.g.cs
+++ b/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.CreateRender.g.cs
@@ -5,6 +5,25 @@ namespace Creatomate
{
public partial class CreatomateClient
{
+
+
+ private static readonly global::Creatomate.EndPointSecurityRequirement s_CreateRenderSecurityRequirement0 =
+ new global::Creatomate.EndPointSecurityRequirement
+ {
+ Authorizations = new global::Creatomate.EndPointAuthorizationRequirement[]
+ { new global::Creatomate.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::Creatomate.EndPointSecurityRequirement[] s_CreateRenderSecurityRequirements =
+ new global::Creatomate.EndPointSecurityRequirement[]
+ { s_CreateRenderSecurityRequirement0,
+ };
partial void PrepareCreateRenderArguments(
global::System.Net.Http.HttpClient httpClient,
global::Creatomate.CreateRenderRequest request);
@@ -43,9 +62,15 @@ partial void ProcessCreateRenderResponseContent(
httpClient: HttpClient,
request: request);
+
+ var __authorizations = global::Creatomate.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_CreateRenderSecurityRequirements,
+ operationName: "CreateRenderAsync");
+
var __pathBuilder = new global::Creatomate.PathBuilder(
path: "/renders",
- baseUri: HttpClient.BaseAddress);
+ baseUri: HttpClient.BaseAddress);
var __path = __pathBuilder.ToString();
using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Post,
@@ -55,7 +80,7 @@ partial void ProcessCreateRenderResponseContent(
__httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
- foreach (var __authorization in Authorizations)
+ foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
__authorization.Type == "OAuth2")
diff --git a/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.GetRender.g.cs b/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.GetRender.g.cs
index b533f37..ad52dc0 100644
--- a/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.GetRender.g.cs
+++ b/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.GetRender.g.cs
@@ -5,6 +5,25 @@ namespace Creatomate
{
public partial class CreatomateClient
{
+
+
+ private static readonly global::Creatomate.EndPointSecurityRequirement s_GetRenderSecurityRequirement0 =
+ new global::Creatomate.EndPointSecurityRequirement
+ {
+ Authorizations = new global::Creatomate.EndPointAuthorizationRequirement[]
+ { new global::Creatomate.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::Creatomate.EndPointSecurityRequirement[] s_GetRenderSecurityRequirements =
+ new global::Creatomate.EndPointSecurityRequirement[]
+ { s_GetRenderSecurityRequirement0,
+ };
partial void PrepareGetRenderArguments(
global::System.Net.Http.HttpClient httpClient,
ref global::System.Guid renderId);
@@ -40,9 +59,15 @@ partial void ProcessGetRenderResponseContent(
httpClient: HttpClient,
renderId: ref renderId);
+
+ var __authorizations = global::Creatomate.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_GetRenderSecurityRequirements,
+ operationName: "GetRenderAsync");
+
var __pathBuilder = new global::Creatomate.PathBuilder(
path: $"/renders/{renderId}",
- baseUri: HttpClient.BaseAddress);
+ baseUri: HttpClient.BaseAddress);
var __path = __pathBuilder.ToString();
using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Get,
@@ -52,7 +77,7 @@ partial void ProcessGetRenderResponseContent(
__httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
- foreach (var __authorization in Authorizations)
+ foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
__authorization.Type == "OAuth2")
diff --git a/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.GetTemplate.g.cs b/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.GetTemplate.g.cs
index 9c1f330..4378193 100644
--- a/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.GetTemplate.g.cs
+++ b/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.GetTemplate.g.cs
@@ -5,6 +5,25 @@ namespace Creatomate
{
public partial class CreatomateClient
{
+
+
+ private static readonly global::Creatomate.EndPointSecurityRequirement s_GetTemplateSecurityRequirement0 =
+ new global::Creatomate.EndPointSecurityRequirement
+ {
+ Authorizations = new global::Creatomate.EndPointAuthorizationRequirement[]
+ { new global::Creatomate.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::Creatomate.EndPointSecurityRequirement[] s_GetTemplateSecurityRequirements =
+ new global::Creatomate.EndPointSecurityRequirement[]
+ { s_GetTemplateSecurityRequirement0,
+ };
partial void PrepareGetTemplateArguments(
global::System.Net.Http.HttpClient httpClient,
ref global::System.Guid templateId);
@@ -40,9 +59,15 @@ partial void ProcessGetTemplateResponseContent(
httpClient: HttpClient,
templateId: ref templateId);
+
+ var __authorizations = global::Creatomate.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_GetTemplateSecurityRequirements,
+ operationName: "GetTemplateAsync");
+
var __pathBuilder = new global::Creatomate.PathBuilder(
path: $"/templates/{templateId}",
- baseUri: HttpClient.BaseAddress);
+ baseUri: HttpClient.BaseAddress);
var __path = __pathBuilder.ToString();
using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Get,
@@ -52,7 +77,7 @@ partial void ProcessGetTemplateResponseContent(
__httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
- foreach (var __authorization in Authorizations)
+ foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
__authorization.Type == "OAuth2")
diff --git a/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.ListTemplates.g.cs b/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.ListTemplates.g.cs
index 170b366..febbae4 100644
--- a/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.ListTemplates.g.cs
+++ b/src/libs/Creatomate/Generated/Creatomate.CreatomateClient.ListTemplates.g.cs
@@ -5,6 +5,25 @@ namespace Creatomate
{
public partial class CreatomateClient
{
+
+
+ private static readonly global::Creatomate.EndPointSecurityRequirement s_ListTemplatesSecurityRequirement0 =
+ new global::Creatomate.EndPointSecurityRequirement
+ {
+ Authorizations = new global::Creatomate.EndPointAuthorizationRequirement[]
+ { new global::Creatomate.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::Creatomate.EndPointSecurityRequirement[] s_ListTemplatesSecurityRequirements =
+ new global::Creatomate.EndPointSecurityRequirement[]
+ { s_ListTemplatesSecurityRequirement0,
+ };
partial void PrepareListTemplatesArguments(
global::System.Net.Http.HttpClient httpClient);
partial void PrepareListTemplatesRequest(
@@ -35,9 +54,15 @@ partial void ProcessListTemplatesResponseContent(
PrepareListTemplatesArguments(
httpClient: HttpClient);
+
+ var __authorizations = global::Creatomate.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_ListTemplatesSecurityRequirements,
+ operationName: "ListTemplatesAsync");
+
var __pathBuilder = new global::Creatomate.PathBuilder(
path: "/templates",
- baseUri: HttpClient.BaseAddress);
+ baseUri: HttpClient.BaseAddress);
var __path = __pathBuilder.ToString();
using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Get,
@@ -47,7 +72,7 @@ partial void ProcessListTemplatesResponseContent(
__httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
- foreach (var __authorization in Authorizations)
+ foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
__authorization.Type == "OAuth2")
diff --git a/src/libs/Creatomate/Generated/Creatomate.ICreatomateClient.Authorizations.Bearer.g.cs b/src/libs/Creatomate/Generated/Creatomate.ICreatomateClient.Authorizations.Bearer.g.cs
index 54e90ee..e795033 100644
--- a/src/libs/Creatomate/Generated/Creatomate.ICreatomateClient.Authorizations.Bearer.g.cs
+++ b/src/libs/Creatomate/Generated/Creatomate.ICreatomateClient.Authorizations.Bearer.g.cs
@@ -9,6 +9,7 @@ public partial interface ICreatomateClient
/// Authorize using bearer authentication.
///
///
+
public void AuthorizeUsingBearer(
string apiKey);
}
diff --git a/src/libs/Creatomate/Generated/Creatomate.PathBuilder.g.cs b/src/libs/Creatomate/Generated/Creatomate.PathBuilder.g.cs
index 2781812..11ecd24 100644
--- a/src/libs/Creatomate/Generated/Creatomate.PathBuilder.g.cs
+++ b/src/libs/Creatomate/Generated/Creatomate.PathBuilder.g.cs
@@ -224,6 +224,40 @@ public PathBuilder AddOptionalParameter(
return this;
}
+ ///
+ /// Adds a pre-serialized query string fragment to the URL.
+ ///
+ /// The serialized query string value.
+ /// The current instance.
+ public PathBuilder AddRawQueryString(
+ string value)
+ {
+ if (string.IsNullOrWhiteSpace(value))
+ {
+ return this;
+ }
+
+ value = value.TrimStart('?', '&');
+ if (value.Length == 0)
+ {
+ return this;
+ }
+
+ if (_firstParameter)
+ {
+ _stringBuilder.Append('?');
+ _firstParameter = false;
+ }
+ else
+ {
+ _stringBuilder.Append('&');
+ }
+
+ _stringBuilder.Append(value);
+
+ return this;
+ }
+
///
/// Returns the constructed URL as a string.
///
diff --git a/src/libs/Creatomate/Generated/Creatomate.Security.g.cs b/src/libs/Creatomate/Generated/Creatomate.Security.g.cs
new file mode 100644
index 0000000..e1f4150
--- /dev/null
+++ b/src/libs/Creatomate/Generated/Creatomate.Security.g.cs
@@ -0,0 +1,145 @@
+#nullable enable
+
+namespace Creatomate
+{
+ internal sealed class EndPointAuthorizationRequirement
+ {
+ internal string Type { get; set; } = string.Empty;
+
+ internal string Location { get; set; } = string.Empty;
+
+ internal string Name { get; set; } = string.Empty;
+
+ internal string FriendlyName { get; set; } = string.Empty;
+ }
+
+ internal sealed class EndPointSecurityRequirement
+ {
+ internal global::System.Collections.Generic.IReadOnlyList Authorizations { get; set; } =
+ global::System.Array.Empty();
+ }
+
+ internal static class EndPointSecurityResolver
+ {
+ internal static global::System.Collections.Generic.List ResolveAuthorizations(
+ global::System.Collections.Generic.IReadOnlyList availableAuthorizations,
+ global::System.Collections.Generic.IReadOnlyList securityRequirements,
+ string operationName)
+ {
+ availableAuthorizations = availableAuthorizations ?? throw new global::System.ArgumentNullException(nameof(availableAuthorizations));
+ securityRequirements = securityRequirements ?? throw new global::System.ArgumentNullException(nameof(securityRequirements));
+ operationName = operationName ?? throw new global::System.ArgumentNullException(nameof(operationName));
+
+ if (securityRequirements.Count == 0)
+ {
+ return new global::System.Collections.Generic.List();
+ }
+
+ var allowsAnonymous = false;
+
+ foreach (var requirement in securityRequirements)
+ {
+ if (requirement.Authorizations.Count == 0)
+ {
+ allowsAnonymous = true;
+ continue;
+ }
+
+ var selected = new global::System.Collections.Generic.List(requirement.Authorizations.Count);
+ var satisfied = true;
+
+ foreach (var requiredAuthorization in requirement.Authorizations)
+ {
+ var found = false;
+
+ for (var i = 0; i < availableAuthorizations.Count; i++)
+ {
+ if (!Matches(availableAuthorizations[i], requiredAuthorization))
+ {
+ continue;
+ }
+
+ selected.Add(availableAuthorizations[i]);
+ found = true;
+ break;
+ }
+
+ if (!found)
+ {
+ satisfied = false;
+ break;
+ }
+ }
+
+ if (satisfied)
+ {
+ return selected;
+ }
+ }
+
+ if (allowsAnonymous)
+ {
+ return new global::System.Collections.Generic.List();
+ }
+
+ throw new global::System.InvalidOperationException(
+ $"Operation '{operationName}' requires one of the configured security alternatives: {DescribeRequirements(securityRequirements)}.");
+ }
+
+ private static bool Matches(
+ EndPointAuthorization availableAuthorization,
+ EndPointAuthorizationRequirement requiredAuthorization)
+ {
+ if (!string.Equals(availableAuthorization.Type, requiredAuthorization.Type, global::System.StringComparison.Ordinal))
+ {
+ return false;
+ }
+
+ return requiredAuthorization.Type switch
+ {
+ "OAuth2" => true,
+ "Http" => string.Equals(
+ availableAuthorization.Name,
+ requiredAuthorization.Name,
+ global::System.StringComparison.Ordinal),
+ "ApiKey" => string.Equals(
+ availableAuthorization.Location,
+ requiredAuthorization.Location,
+ global::System.StringComparison.Ordinal) &&
+ string.Equals(
+ availableAuthorization.Name,
+ requiredAuthorization.Name,
+ global::System.StringComparison.Ordinal),
+ _ => string.Equals(
+ availableAuthorization.Location,
+ requiredAuthorization.Location,
+ global::System.StringComparison.Ordinal) &&
+ string.Equals(
+ availableAuthorization.Name,
+ requiredAuthorization.Name,
+ global::System.StringComparison.Ordinal),
+ };
+ }
+
+ private static string DescribeRequirements(
+ global::System.Collections.Generic.IReadOnlyList securityRequirements)
+ {
+ var parts = new global::System.Collections.Generic.List(securityRequirements.Count);
+
+ foreach (var requirement in securityRequirements)
+ {
+ if (requirement.Authorizations.Count == 0)
+ {
+ parts.Add("anonymous");
+ continue;
+ }
+
+ parts.Add(string.Join(
+ " + ",
+ global::System.Linq.Enumerable.Select(requirement.Authorizations, static x => x.FriendlyName)));
+ }
+
+ return string.Join(" or ", parts);
+ }
+ }
+}
\ No newline at end of file