openai/openai-dotnet

Public

mirrored from https://github.com/openai/openai-dotnetAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
OpenAI_2.0.0-beta.12

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/Custom/Files/Internal/InternalUploadsClient.cs

53lines · modecode

1using System;
2using System.ClientModel;
3using System.ClientModel.Primitives;
4
5namespace OpenAI.Files;
6
7[CodeGenClient("Uploads")]
8[CodeGenSuppress("InternalUploadsClient", typeof(ClientPipeline), typeof(ApiKeyCredential), typeof(Uri))]
9internal 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