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] authored and HavenDV committed Jul 18, 2024
1 parent d5fe2ab commit 55a7198
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 13 deletions.
19 changes: 16 additions & 3 deletions src/libs/OpenAI/Generated/OpenAI.UploadsClient.AddUploadPart.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ public partial class UploadsClient
{
partial void PrepareAddUploadPartArguments(
global::System.Net.Http.HttpClient httpClient,
ref string uploadId,
global::OpenAI.AddUploadPartRequest request);
partial void PrepareAddUploadPartRequest(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
string uploadId,
global::OpenAI.AddUploadPartRequest request);
partial void ProcessAddUploadPartResponse(
global::System.Net.Http.HttpClient httpClient,
Expand All @@ -23,13 +25,17 @@ partial void ProcessAddUploadPartResponseContent(

/// <summary>
/// Adds a [Part](/docs/api-reference/uploads/part-object) to an [Upload](/docs/api-reference/uploads/object) object. A Part represents a chunk of bytes from the file you are trying to upload. <br/>
/// Each Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 10 GB.<br/>
/// Each Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB.<br/>
/// It is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you [complete the Upload](/docs/api-reference/uploads/complete).
/// </summary>
/// <param name="uploadId">
/// Example: upload_abc123
/// </param>
/// <param name="request"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::OpenAI.UploadPart> AddUploadPartAsync(
string uploadId,
global::OpenAI.AddUploadPartRequest request,
global::System.Threading.CancellationToken cancellationToken = default)
{
Expand All @@ -39,11 +45,12 @@ partial void ProcessAddUploadPartResponseContent(
client: _httpClient);
PrepareAddUploadPartArguments(
httpClient: _httpClient,
uploadId: ref uploadId,
request: request);

using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Post,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/uploads/{upload_id}/part", global::System.UriKind.RelativeOrAbsolute));
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/uploads/{uploadId}/part", global::System.UriKind.RelativeOrAbsolute));
var __json = global::System.Text.Json.JsonSerializer.Serialize(request, global::OpenAI.SourceGenerationContext.Default.AddUploadPartRequest);
httpRequest.Content = new global::System.Net.Http.StringContent(
content: __json,
Expand All @@ -56,6 +63,7 @@ partial void ProcessAddUploadPartResponseContent(
PrepareAddUploadPartRequest(
httpClient: _httpClient,
httpRequestMessage: httpRequest,
uploadId: uploadId,
request: request);

using var response = await _httpClient.SendAsync(
Expand Down Expand Up @@ -97,15 +105,19 @@ partial void ProcessAddUploadPartResponseContent(

/// <summary>
/// Adds a [Part](/docs/api-reference/uploads/part-object) to an [Upload](/docs/api-reference/uploads/object) object. A Part represents a chunk of bytes from the file you are trying to upload. <br/>
/// Each Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 10 GB.<br/>
/// Each Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB.<br/>
/// It is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you [complete the Upload](/docs/api-reference/uploads/complete).
/// </summary>
/// <param name="uploadId">
/// Example: upload_abc123
/// </param>
/// <param name="data">
/// The chunk of bytes for this Part.
/// </param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::OpenAI.UploadPart> AddUploadPartAsync(
string uploadId,
string data,
global::System.Threading.CancellationToken cancellationToken = default)
{
Expand All @@ -115,6 +127,7 @@ partial void ProcessAddUploadPartResponseContent(
};

return await AddUploadPartAsync(
uploadId: uploadId,
request: request,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
Expand Down
18 changes: 13 additions & 5 deletions src/libs/OpenAI/Generated/OpenAI.UploadsClient.CancelUpload.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ namespace OpenAI
public partial class UploadsClient
{
partial void PrepareCancelUploadArguments(
global::System.Net.Http.HttpClient httpClient);
global::System.Net.Http.HttpClient httpClient,
ref string uploadId);
partial void PrepareCancelUploadRequest(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage);
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
string uploadId);
partial void ProcessCancelUploadResponse(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage);
Expand All @@ -22,26 +24,32 @@ partial void ProcessCancelUploadResponseContent(
/// <summary>
/// Cancels the Upload. No Parts may be added after an Upload is cancelled.
/// </summary>
/// <param name="uploadId">
/// Example: upload_abc123
/// </param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::OpenAI.Upload> CancelUploadAsync(
string uploadId,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: _httpClient);
PrepareCancelUploadArguments(
httpClient: _httpClient);
httpClient: _httpClient,
uploadId: ref uploadId);

using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Post,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/uploads/{upload_id}/cancel", global::System.UriKind.RelativeOrAbsolute));
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/uploads/{uploadId}/cancel", global::System.UriKind.RelativeOrAbsolute));

PrepareRequest(
client: _httpClient,
request: httpRequest);
PrepareCancelUploadRequest(
httpClient: _httpClient,
httpRequestMessage: httpRequest);
httpRequestMessage: httpRequest,
uploadId: uploadId);

using var response = await _httpClient.SendAsync(
request: httpRequest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ public partial class UploadsClient
{
partial void PrepareCompleteUploadArguments(
global::System.Net.Http.HttpClient httpClient,
ref string uploadId,
global::OpenAI.CompleteUploadRequest request);
partial void PrepareCompleteUploadRequest(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
string uploadId,
global::OpenAI.CompleteUploadRequest request);
partial void ProcessCompleteUploadResponse(
global::System.Net.Http.HttpClient httpClient,
Expand All @@ -26,10 +28,14 @@ partial void ProcessCompleteUploadResponseContent(
/// You can specify the order of the Parts by passing in an ordered list of the Part IDs.<br/>
/// The number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed.
/// </summary>
/// <param name="uploadId">
/// Example: upload_abc123
/// </param>
/// <param name="request"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::OpenAI.Upload> CompleteUploadAsync(
string uploadId,
global::OpenAI.CompleteUploadRequest request,
global::System.Threading.CancellationToken cancellationToken = default)
{
Expand All @@ -39,11 +45,12 @@ partial void ProcessCompleteUploadResponseContent(
client: _httpClient);
PrepareCompleteUploadArguments(
httpClient: _httpClient,
uploadId: ref uploadId,
request: request);

using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Post,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/uploads/{upload_id}/complete", global::System.UriKind.RelativeOrAbsolute));
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/uploads/{uploadId}/complete", global::System.UriKind.RelativeOrAbsolute));
var __json = global::System.Text.Json.JsonSerializer.Serialize(request, global::OpenAI.SourceGenerationContext.Default.CompleteUploadRequest);
httpRequest.Content = new global::System.Net.Http.StringContent(
content: __json,
Expand All @@ -56,6 +63,7 @@ partial void ProcessCompleteUploadResponseContent(
PrepareCompleteUploadRequest(
httpClient: _httpClient,
httpRequestMessage: httpRequest,
uploadId: uploadId,
request: request);

using var response = await _httpClient.SendAsync(
Expand Down Expand Up @@ -100,6 +108,9 @@ partial void ProcessCompleteUploadResponseContent(
/// You can specify the order of the Parts by passing in an ordered list of the Part IDs.<br/>
/// The number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed.
/// </summary>
/// <param name="uploadId">
/// Example: upload_abc123
/// </param>
/// <param name="partIds">
/// The ordered list of Part IDs.
/// </param>
Expand All @@ -109,6 +120,7 @@ partial void ProcessCompleteUploadResponseContent(
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::OpenAI.Upload> CompleteUploadAsync(
string uploadId,
global::System.Collections.Generic.IList<string> partIds,
string? md5 = default,
global::System.Threading.CancellationToken cancellationToken = default)
Expand All @@ -120,6 +132,7 @@ partial void ProcessCompleteUploadResponseContent(
};

return await CompleteUploadAsync(
uploadId: uploadId,
request: request,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ partial void ProcessCreateUploadResponseContent(
ref string content);

/// <summary>
/// Creates an intermediate [Upload](/docs/api-reference/uploads/object) object that you can add [Parts](/docs/api-reference/uploads/part-object) to. Currently, an Upload can accept at most 10 GB in total and expires after an hour after you create it.<br/>
/// Creates an intermediate [Upload](/docs/api-reference/uploads/object) object that you can add [Parts](/docs/api-reference/uploads/part-object) to. Currently, an Upload can accept at most 8 GB in total and expires after an hour after you create it.<br/>
/// Once you complete the Upload, we will create a [File](/docs/api-reference/files/object) object that contains all the parts you uploaded. This File is usable in the rest of our platform as a regular File object.<br/>
/// For certain `purpose`s, the correct `mime_type` must be specified. Please refer to documentation for the supported MIME types for your use case:<br/>
/// - [Assistants](/docs/assistants/tools/file-search/supported-files)<br/>
Expand Down Expand Up @@ -98,7 +98,7 @@ partial void ProcessCreateUploadResponseContent(
}

/// <summary>
/// Creates an intermediate [Upload](/docs/api-reference/uploads/object) object that you can add [Parts](/docs/api-reference/uploads/part-object) to. Currently, an Upload can accept at most 10 GB in total and expires after an hour after you create it.<br/>
/// Creates an intermediate [Upload](/docs/api-reference/uploads/object) object that you can add [Parts](/docs/api-reference/uploads/part-object) to. Currently, an Upload can accept at most 8 GB in total and expires after an hour after you create it.<br/>
/// Once you complete the Upload, we will create a [File](/docs/api-reference/files/object) object that contains all the parts you uploaded. This File is usable in the rest of our platform as a regular File object.<br/>
/// For certain `purpose`s, the correct `mime_type` must be specified. Please refer to documentation for the supported MIME types for your use case:<br/>
/// - [Assistants](/docs/assistants/tools/file-search/supported-files)<br/>
Expand Down
28 changes: 26 additions & 2 deletions src/libs/OpenAI/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ paths:
post:
tags:
- Uploads
summary: "Creates an intermediate [Upload](/docs/api-reference/uploads/object) object that you can add [Parts](/docs/api-reference/uploads/part-object) to. Currently, an Upload can accept at most 10 GB in total and expires after an hour after you create it.\n\nOnce you complete the Upload, we will create a [File](/docs/api-reference/files/object) object that contains all the parts you uploaded. This File is usable in the rest of our platform as a regular File object.\n\nFor certain `purpose`s, the correct `mime_type` must be specified. Please refer to documentation for the supported MIME types for your use case:\n- [Assistants](/docs/assistants/tools/file-search/supported-files)\n\nFor guidance on the proper filename extensions for each purpose, please follow the documentation on [creating a File](/docs/api-reference/files/create).\n"
summary: "Creates an intermediate [Upload](/docs/api-reference/uploads/object) object that you can add [Parts](/docs/api-reference/uploads/part-object) to. Currently, an Upload can accept at most 8 GB in total and expires after an hour after you create it.\n\nOnce you complete the Upload, we will create a [File](/docs/api-reference/files/object) object that contains all the parts you uploaded. This File is usable in the rest of our platform as a regular File object.\n\nFor certain `purpose`s, the correct `mime_type` must be specified. Please refer to documentation for the supported MIME types for your use case:\n- [Assistants](/docs/assistants/tools/file-search/supported-files)\n\nFor guidance on the proper filename extensions for each purpose, please follow the documentation on [creating a File](/docs/api-reference/files/create).\n"
operationId: createUpload
requestBody:
content:
Expand All @@ -506,8 +506,16 @@ paths:
post:
tags:
- Uploads
summary: "Adds a [Part](/docs/api-reference/uploads/part-object) to an [Upload](/docs/api-reference/uploads/object) object. A Part represents a chunk of bytes from the file you are trying to upload. \n\nEach Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 10 GB.\n\nIt is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you [complete the Upload](/docs/api-reference/uploads/complete).\n"
summary: "Adds a [Part](/docs/api-reference/uploads/part-object) to an [Upload](/docs/api-reference/uploads/object) object. A Part represents a chunk of bytes from the file you are trying to upload. \n\nEach Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB.\n\nIt is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you [complete the Upload](/docs/api-reference/uploads/complete).\n"
operationId: addUploadPart
parameters:
- name: upload_id
in: path
description: "The ID of the Upload.\n"
required: true
schema:
type: string
example: upload_abc123
requestBody:
content:
multipart/form-data:
Expand Down Expand Up @@ -535,6 +543,14 @@ paths:
- Uploads
summary: "Completes the [Upload](/docs/api-reference/uploads/object) and returns a [File](/docs/api-reference/files/object) object that is ready to use in the rest of the platform.\n\nYou can specify the order of the Parts by passing in an ordered list of the Part IDs.\n\nThe number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed.\n"
operationId: completeUpload
parameters:
- name: upload_id
in: path
description: "The ID of the Upload.\n"
required: true
schema:
type: string
example: upload_abc123
requestBody:
content:
application/json:
Expand Down Expand Up @@ -562,6 +578,14 @@ paths:
- Uploads
summary: "Cancels the Upload. No Parts may be added after an Upload is cancelled.\n"
operationId: cancelUpload
parameters:
- name: upload_id
in: path
description: "The ID of the Upload.\n"
required: true
schema:
type: string
example: upload_abc123
responses:
'200':
description: OK
Expand Down

0 comments on commit 55a7198

Please sign in to comment.