openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
src/Custom/Files/Internal/InternalUploadsClient.cs
53lines · modecode
| 1 | using System; |
| 2 | using System.ClientModel; |
| 3 | using System.ClientModel.Primitives; |
| 4 | |
| 5 | namespace OpenAI.Files; |
| 6 | |
| 7 | [CodeGenClient("Uploads")] |
| 8 | [CodeGenSuppress("InternalUploadsClient", typeof(ClientPipeline), typeof(ApiKeyCredential), typeof(Uri))] |
| 9 | internal partial class InternalUploadsClient |
| 10 | { |
| 11 | // CUSTOM: |
| 12 | // - Used a custom pipeline. |
| 13 | // - Demoted the endpoint parameter to be a property in the options class. |
| 14 | /// <summary> Initializes a new instance of <see cref="InternalUploadsClient">. </summary> |
| 15 | /// <param name="credential"> The API key to authenticate with the service. </param> |
| 16 | /// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception> |
| 17 | internal InternalUploadsClient(ApiKeyCredential credential) : this(credential, new OpenAIClientOptions()) |
| 18 | { |
| 19 | } |
| 20 | |
| 21 | // CUSTOM: |
| 22 | // - Used a custom pipeline. |
| 23 | // - Demoted the endpoint parameter to be a property in the options class. |
| 24 | /// <summary> Initializes a new instance of <see cref="InternalUploadsClient">. </summary> |
| 25 | /// <param name="credential"> The API key to authenticate with the service. </param> |
| 26 | /// <param name="options"> The options to configure the client. </param> |
| 27 | /// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception> |
| 28 | internal InternalUploadsClient(ApiKeyCredential credential, OpenAIClientOptions options) |
| 29 | { |
| 30 | Argument.AssertNotNull(credential, nameof(credential)); |
| 31 | options ??= new OpenAIClientOptions(); |
| 32 | |
| 33 | _pipeline = OpenAIClient.CreatePipeline(credential, options); |
| 34 | _endpoint = OpenAIClient.GetEndpoint(options); |
| 35 | } |
| 36 | |
| 37 | // CUSTOM: |
| 38 | // - Used a custom pipeline. |
| 39 | // - Demoted the endpoint parameter to be a property in the options class. |
| 40 | // - Made protected. |
| 41 | /// <summary> Initializes a new instance of <see cref="InternalUploadsClient">. </summary> |
| 42 | /// <param name="pipeline"> The HTTP pipeline to send and receive REST requests and responses. </param> |
| 43 | /// <param name="options"> The options to configure the client. </param> |
| 44 | /// <exception cref="ArgumentNullException"> <paramref name="pipeline"/> is null. </exception> |
| 45 | protected internal InternalUploadsClient(ClientPipeline pipeline, OpenAIClientOptions options) |
| 46 | { |
| 47 | Argument.AssertNotNull(pipeline, nameof(pipeline)); |
| 48 | options ??= new OpenAIClientOptions(); |
| 49 | |
| 50 | _pipeline = pipeline; |
| 51 | _endpoint = OpenAIClient.GetEndpoint(options); |
| 52 | } |
| 53 | } |
| 54 | |