openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
OpenAI/src/Generated/BatchClient.cs
62lines · modecode
| 1 | // <auto-generated/> |
| 2 | |
| 3 | #nullable disable |
| 4 | |
| 5 | using System; |
| 6 | using System.ClientModel; |
| 7 | using System.ClientModel.Primitives; |
| 8 | using System.Diagnostics.CodeAnalysis; |
| 9 | using System.Threading; |
| 10 | using System.Threading.Tasks; |
| 11 | using OpenAI; |
| 12 | |
| 13 | namespace OpenAI.Batch |
| 14 | { |
| 15 | [Experimental("OPENAI001")] |
| 16 | public partial class BatchClient |
| 17 | { |
| 18 | private readonly Uri _endpoint; |
| 19 | |
| 20 | protected BatchClient() |
| 21 | { |
| 22 | } |
| 23 | |
| 24 | public ClientPipeline Pipeline { get; } |
| 25 | |
| 26 | public virtual CollectionResult GetBatches(string after, int? limit, RequestOptions options) |
| 27 | { |
| 28 | return new BatchClientGetBatchesCollectionResult(this, after, limit, options); |
| 29 | } |
| 30 | |
| 31 | public virtual AsyncCollectionResult GetBatchesAsync(string after, int? limit, RequestOptions options) |
| 32 | { |
| 33 | return new BatchClientGetBatchesAsyncCollectionResult(this, after, limit, options); |
| 34 | } |
| 35 | |
| 36 | public virtual CollectionResult<BatchJob> GetBatches(BatchCollectionOptions options = default, CancellationToken cancellationToken = default) |
| 37 | { |
| 38 | return new BatchClientGetBatchesCollectionResultOfT(this, options?.AfterId, options?.PageSizeLimit, cancellationToken.ToRequestOptions()); |
| 39 | } |
| 40 | |
| 41 | public virtual AsyncCollectionResult<BatchJob> GetBatchesAsync(BatchCollectionOptions options = default, CancellationToken cancellationToken = default) |
| 42 | { |
| 43 | return new BatchClientGetBatchesAsyncCollectionResultOfT(this, options?.AfterId, options?.PageSizeLimit, cancellationToken.ToRequestOptions()); |
| 44 | } |
| 45 | |
| 46 | public virtual ClientResult GetBatch(string batchId, RequestOptions options) |
| 47 | { |
| 48 | Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); |
| 49 | |
| 50 | using PipelineMessage message = CreateGetBatchRequest(batchId, options); |
| 51 | return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); |
| 52 | } |
| 53 | |
| 54 | public virtual async Task<ClientResult> GetBatchAsync(string batchId, RequestOptions options) |
| 55 | { |
| 56 | Argument.AssertNotNullOrEmpty(batchId, nameof(batchId)); |
| 57 | |
| 58 | using PipelineMessage message = CreateGetBatchRequest(batchId, options); |
| 59 | return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | |