Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,23 @@ namespace Creatomate
{
public sealed partial class CreatomateClient
{

/// <inheritdoc/>
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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace Creatomate
public sealed partial class CreatomateClient
{
/// <inheritdoc cref="CreatomateClient(global::System.Net.Http.HttpClient?, global::System.Uri?, global::System.Collections.Generic.List{global::Creatomate.EndPointAuthorization}?, bool)"/>

public CreatomateClient(
string apiKey,
global::System.Net.Http.HttpClient? httpClient = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand All @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand All @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand All @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand All @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public partial interface ICreatomateClient
/// Authorize using bearer authentication.
/// </summary>
/// <param name="apiKey"></param>

public void AuthorizeUsingBearer(
string apiKey);
}
Expand Down
34 changes: 34 additions & 0 deletions src/libs/Creatomate/Generated/Creatomate.PathBuilder.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,40 @@ public PathBuilder AddOptionalParameter<T>(
return this;
}

/// <summary>
/// Adds a pre-serialized query string fragment to the URL.
/// </summary>
/// <param name="value">The serialized query string value.</param>
/// <returns>The current <see cref="PathBuilder"/> instance.</returns>
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;
}

/// <summary>
/// Returns the constructed URL as a string.
/// </summary>
Expand Down
Loading