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 23, 2024
1 parent 3da54c9 commit 421dbd0
Show file tree
Hide file tree
Showing 50 changed files with 1,461 additions and 1,286 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public void AuthorizeUsingBearer(
{
apiKey = apiKey ?? throw new global::System.ArgumentNullException(nameof(apiKey));

_authorizations.Clear();
_authorizations.Add(new global::Cohere.EndPointAuthorization
Authorizations.Clear();
Authorizations.Add(new global::Cohere.EndPointAuthorization
{
Type = "Http",
Location = "Header",
Expand Down
72 changes: 36 additions & 36 deletions src/libs/Cohere/Generated/Cohere.CohereApi.Chat.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,93 +44,93 @@ partial void ProcessChatResponseContent(
request = request ?? throw new global::System.ArgumentNullException(nameof(request));

PrepareArguments(
client: _httpClient);
client: HttpClient);
PrepareChatArguments(
httpClient: _httpClient,
httpClient: HttpClient,
xClientName: ref xClientName,
accepts: ref accepts,
request: request);

var __pathBuilder = new PathBuilder(
path: "/v1/chat",
baseUri: _httpClient.BaseAddress);
baseUri: HttpClient.BaseAddress);
var __path = __pathBuilder.ToString();
using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Post,
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));

foreach (var _authorization in _authorizations)
foreach (var __authorization in Authorizations)
{
if (_authorization.Type == "Http" ||
_authorization.Type == "OAuth2")
if (__authorization.Type == "Http" ||
__authorization.Type == "OAuth2")
{
httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: _authorization.Name,
parameter: _authorization.Value);
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
parameter: __authorization.Value);
}
else if (_authorization.Type == "ApiKey" &&
_authorization.Location == "Header")
else if (__authorization.Type == "ApiKey" &&
__authorization.Location == "Header")
{
httpRequest.Headers.Add(_authorization.Name, _authorization.Value);
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
}
}

if (xClientName != default)
{
httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString());
__httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString());
}
if (accepts != default)
{
httpRequest.Headers.TryAddWithoutValidation("Accepts", accepts?.ToValueString() ?? string.Empty);
__httpRequest.Headers.TryAddWithoutValidation("Accepts", accepts?.ToValueString() ?? string.Empty);
}

var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
var __httpRequestContent = new global::System.Net.Http.StringContent(
content: __httpRequestContentBody,
encoding: global::System.Text.Encoding.UTF8,
mediaType: "application/json");
httpRequest.Content = __httpRequestContent;
__httpRequest.Content = __httpRequestContent;

PrepareRequest(
client: _httpClient,
request: httpRequest);
client: HttpClient,
request: __httpRequest);
PrepareChatRequest(
httpClient: _httpClient,
httpRequestMessage: httpRequest,
httpClient: HttpClient,
httpRequestMessage: __httpRequest,
xClientName: xClientName,
accepts: accepts,
request: request);

using var response = await _httpClient.SendAsync(
request: httpRequest,
using var __response = await HttpClient.SendAsync(
request: __httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);

ProcessResponse(
client: _httpClient,
response: response);
client: HttpClient,
response: __response);
ProcessChatResponse(
httpClient: _httpClient,
httpResponseMessage: response);
httpClient: HttpClient,
httpResponseMessage: __response);

var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

ProcessResponseContent(
client: _httpClient,
response: response,
client: HttpClient,
response: __response,
content: ref __content);
ProcessChatResponseContent(
httpClient: _httpClient,
httpResponseMessage: response,
httpClient: HttpClient,
httpResponseMessage: __response,
content: ref __content);

try
{
response.EnsureSuccessStatusCode();
__response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException ex)
catch (global::System.Net.Http.HttpRequestException __ex)
{
throw new global::System.InvalidOperationException(__content, ex);
throw new global::System.InvalidOperationException(__content, __ex);
}

return
Expand Down Expand Up @@ -349,7 +349,7 @@ partial void ProcessChatResponseContent(
global::Cohere.ChatRequestSafetyMode? safetyMode = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var request = new global::Cohere.ChatRequest
var __request = new global::Cohere.ChatRequest
{
Message = message,
Model = model,
Expand Down Expand Up @@ -381,7 +381,7 @@ partial void ProcessChatResponseContent(
return await ChatAsync(
xClientName: xClientName,
accepts: accepts,
request: request,
request: __request,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
Expand Down
70 changes: 35 additions & 35 deletions src/libs/Cohere/Generated/Cohere.CohereApi.Chatv2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,87 +40,87 @@ partial void ProcessChatv2ResponseContent(
request = request ?? throw new global::System.ArgumentNullException(nameof(request));

PrepareArguments(
client: _httpClient);
client: HttpClient);
PrepareChatv2Arguments(
httpClient: _httpClient,
httpClient: HttpClient,
xClientName: ref xClientName,
request: request);

var __pathBuilder = new PathBuilder(
path: "/v2/chat",
baseUri: _httpClient.BaseAddress);
baseUri: HttpClient.BaseAddress);
var __path = __pathBuilder.ToString();
using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Post,
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));

foreach (var _authorization in _authorizations)
foreach (var __authorization in Authorizations)
{
if (_authorization.Type == "Http" ||
_authorization.Type == "OAuth2")
if (__authorization.Type == "Http" ||
__authorization.Type == "OAuth2")
{
httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: _authorization.Name,
parameter: _authorization.Value);
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
parameter: __authorization.Value);
}
else if (_authorization.Type == "ApiKey" &&
_authorization.Location == "Header")
else if (__authorization.Type == "ApiKey" &&
__authorization.Location == "Header")
{
httpRequest.Headers.Add(_authorization.Name, _authorization.Value);
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
}
}

if (xClientName != default)
{
httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString());
__httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString());
}

var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
var __httpRequestContent = new global::System.Net.Http.StringContent(
content: __httpRequestContentBody,
encoding: global::System.Text.Encoding.UTF8,
mediaType: "application/json");
httpRequest.Content = __httpRequestContent;
__httpRequest.Content = __httpRequestContent;

PrepareRequest(
client: _httpClient,
request: httpRequest);
client: HttpClient,
request: __httpRequest);
PrepareChatv2Request(
httpClient: _httpClient,
httpRequestMessage: httpRequest,
httpClient: HttpClient,
httpRequestMessage: __httpRequest,
xClientName: xClientName,
request: request);

using var response = await _httpClient.SendAsync(
request: httpRequest,
using var __response = await HttpClient.SendAsync(
request: __httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);

ProcessResponse(
client: _httpClient,
response: response);
client: HttpClient,
response: __response);
ProcessChatv2Response(
httpClient: _httpClient,
httpResponseMessage: response);
httpClient: HttpClient,
httpResponseMessage: __response);

var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

ProcessResponseContent(
client: _httpClient,
response: response,
client: HttpClient,
response: __response,
content: ref __content);
ProcessChatv2ResponseContent(
httpClient: _httpClient,
httpResponseMessage: response,
httpClient: HttpClient,
httpResponseMessage: __response,
content: ref __content);

try
{
response.EnsureSuccessStatusCode();
__response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException ex)
catch (global::System.Net.Http.HttpRequestException __ex)
{
throw new global::System.InvalidOperationException(__content, ex);
throw new global::System.InvalidOperationException(__content, __ex);
}

return
Expand Down Expand Up @@ -222,7 +222,7 @@ partial void ProcessChatv2ResponseContent(
float? p = 0.75F,
global::System.Threading.CancellationToken cancellationToken = default)
{
var request = new global::Cohere.Chatv2Request
var __request = new global::Cohere.Chatv2Request
{
Model = model,
Messages = messages,
Expand All @@ -243,7 +243,7 @@ partial void ProcessChatv2ResponseContent(

return await Chatv2Async(
xClientName: xClientName,
request: request,
request: __request,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
Expand Down
Loading

0 comments on commit 421dbd0

Please sign in to comment.