Skip to content

Commit

Permalink
feat: Updated OpenAPI spec
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 1, 2024
1 parent e629b24 commit fc7430b
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ public void AuthorizeUsingApiKeyInHeader(
{
apiKey = apiKey ?? throw new global::System.ArgumentNullException(nameof(apiKey));

_authorization = new global::Anthropic.EndPointAuthorization
_authorizations.Clear();
_authorizations.Add(new global::Anthropic.EndPointAuthorization
{
Type = "ApiKey",
Location = "Header",
Name = "x-api-key",
Value = apiKey,
};
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ namespace Anthropic
{
public sealed partial class AnthropicApi
{
/// <inheritdoc cref="AnthropicApi(global::System.Net.Http.HttpClient?, global::System.Uri?, global::Anthropic.EndPointAuthorization?)"/>
/// <inheritdoc cref="AnthropicApi(global::System.Net.Http.HttpClient?, global::System.Uri?, global::System.Collections.Generic.List{global::Anthropic.EndPointAuthorization}?)"/>
public AnthropicApi(
string apiKey,
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::Anthropic.EndPointAuthorization? authorization = null) : this(httpClient, baseUri, authorization)
global::System.Collections.Generic.List<global::Anthropic.EndPointAuthorization>? authorizations = null) : this(httpClient, baseUri, authorizations)
{
Authorizing(_httpClient, ref apiKey);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,21 @@ partial void ProcessCreateMessageResponseContent(
method: global::System.Net.Http.HttpMethod.Post,
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));

if (_authorization != null)
{{
httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: _authorization.Name,
parameter: _authorization.Value);
}}
foreach (var _authorization in _authorizations)
{
if (_authorization.Type == "Http" ||
_authorization.Type == "OAuth2")
{
httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: _authorization.Name,
parameter: _authorization.Value);
}
else if (_authorization.Type == "ApiKey" &&
_authorization.Location == "Header")
{
httpRequest.Headers.Add(_authorization.Name, _authorization.Value);
}
}
var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext);
var __httpRequestContent = new global::System.Net.Http.StringContent(
content: __httpRequestContentBody,
Expand Down
8 changes: 4 additions & 4 deletions src/libs/Anthropic/Generated/Anthropic.AnthropicApi.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public sealed partial class AnthropicApi : global::Anthropic.IAnthropicApi, glob
public const string BaseUrl = "https://api.anthropic.com/v1";

private readonly global::System.Net.Http.HttpClient _httpClient;
private global::Anthropic.EndPointAuthorization? _authorization;
private global::System.Collections.Generic.List<global::Anthropic.EndPointAuthorization> _authorizations;

/// <summary>
///
Expand All @@ -31,15 +31,15 @@ public sealed partial class AnthropicApi : global::Anthropic.IAnthropicApi, glob
/// </summary>
/// <param name="httpClient"></param>
/// <param name="baseUri"></param>
/// <param name="authorization"></param>
/// <param name="authorizations"></param>
public AnthropicApi(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::Anthropic.EndPointAuthorization? authorization = null)
global::System.Collections.Generic.List<global::Anthropic.EndPointAuthorization>? authorizations = null)
{
_httpClient = httpClient ?? new global::System.Net.Http.HttpClient();
_httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl);
_authorization = authorization;
_authorizations = authorizations ?? new global::System.Collections.Generic.List<global::Anthropic.EndPointAuthorization>();

Initialized(_httpClient);
}
Expand Down
10 changes: 10 additions & 0 deletions src/libs/Anthropic/Generated/Anthropic.PathBuilder.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,16 @@ public PathBuilder AddOptionalParameter<T>(
/// </summary>
public class EndPointAuthorization
{
/// <summary>
///
/// </summary>
public string Type { get; set; } = string.Empty;

/// <summary>
///
/// </summary>
public string Location { get; set; } = string.Empty;

/// <summary>
///
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions src/libs/Anthropic/Generated/JsonSerializerContextTypes.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ namespace Anthropic
/// </summary>
public sealed partial class JsonSerializerContextTypes
{
/// <summary>
///
/// </summary>
public global::System.Collections.Generic.Dictionary<string, string>? StringStringDictionary { get; set; }

/// <summary>
///
/// </summary>
Expand Down

0 comments on commit fc7430b

Please sign in to comment.