-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtryAGI.OpenAI.ConversationsClient.g.cs
More file actions
137 lines (121 loc) · 6.33 KB
/
Copy pathtryAGI.OpenAI.ConversationsClient.g.cs
File metadata and controls
137 lines (121 loc) · 6.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#nullable enable
namespace tryAGI.OpenAI
{
/// <summary>
/// Manage conversations and conversation items.<br/>
/// If no httpClient is provided, a new one will be created.<br/>
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
/// </summary>
public sealed partial class ConversationsClient : global::tryAGI.OpenAI.IConversationsClient, global::System.IDisposable
{
/// <summary>
///
/// </summary>
public const string DefaultBaseUrl = "https://api.openai.com/v1";
private bool _disposeHttpClient = true;
/// <inheritdoc/>
public global::System.Net.Http.HttpClient HttpClient { get; }
/// <inheritdoc/>
public System.Uri? BaseUri => HttpClient.BaseAddress;
/// <inheritdoc/>
public global::System.Collections.Generic.List<global::tryAGI.OpenAI.EndPointAuthorization> Authorizations { get; }
/// <inheritdoc/>
public bool ReadResponseAsString { get; set; }
#if DEBUG
= true;
#endif
/// <inheritdoc/>
public global::tryAGI.OpenAI.AutoSDKClientOptions Options { get; }
/// <summary>
///
/// </summary>
public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::tryAGI.OpenAI.SourceGenerationContext.Default;
/// <summary>
/// Creates a new instance of the ConversationsClient.
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
/// </summary>
/// <param name="httpClient">The HttpClient instance. If not provided, a new one will be created.</param>
/// <param name="baseUri">The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.</param>
/// <param name="authorizations">The authorizations to use for the requests.</param>
/// <param name="disposeHttpClient">Dispose the HttpClient when the instance is disposed. True by default.</param>
public ConversationsClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List<global::tryAGI.OpenAI.EndPointAuthorization>? authorizations = null,
bool disposeHttpClient = true) : this(
httpClient,
baseUri,
authorizations,
options: null,
disposeHttpClient: disposeHttpClient)
{
}
/// <summary>
/// Creates a new instance of the ConversationsClient with explicit options but no base URL override.
/// Skips passing <c>baseUri</c> so the default base URL from the OpenAPI spec applies.
/// </summary>
/// <param name="httpClient">The HttpClient instance. If not provided, a new one will be created.</param>
/// <param name="authorizations">The authorizations to use for the requests.</param>
/// <param name="options">Client-wide request defaults such as headers, query parameters, retries, and timeout.</param>
/// <param name="disposeHttpClient">Dispose the HttpClient when the instance is disposed. True by default.</param>
public ConversationsClient(
global::System.Net.Http.HttpClient? httpClient,
global::System.Collections.Generic.List<global::tryAGI.OpenAI.EndPointAuthorization>? authorizations,
global::tryAGI.OpenAI.AutoSDKClientOptions? options,
bool disposeHttpClient = true) : this(
httpClient,
baseUri: null,
authorizations,
options,
disposeHttpClient: disposeHttpClient)
{
}
/// <summary>
/// Creates a new instance of the ConversationsClient.
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
/// </summary>
/// <param name="httpClient">The HttpClient instance. If not provided, a new one will be created.</param>
/// <param name="baseUri">The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.</param>
/// <param name="authorizations">The authorizations to use for the requests.</param>
/// <param name="options">Client-wide request defaults such as headers, query parameters, retries, and timeout.</param>
/// <param name="disposeHttpClient">Dispose the HttpClient when the instance is disposed. True by default.</param>
public ConversationsClient(
global::System.Net.Http.HttpClient? httpClient,
global::System.Uri? baseUri,
global::System.Collections.Generic.List<global::tryAGI.OpenAI.EndPointAuthorization>? authorizations,
global::tryAGI.OpenAI.AutoSDKClientOptions? options,
bool disposeHttpClient = true)
{
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List<global::tryAGI.OpenAI.EndPointAuthorization>();
Options = options ?? new global::tryAGI.OpenAI.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;
Initialized(HttpClient);
}
/// <inheritdoc/>
public void Dispose()
{
if (_disposeHttpClient)
{
HttpClient.Dispose();
}
}
partial void Initialized(
global::System.Net.Http.HttpClient client);
partial void PrepareArguments(
global::System.Net.Http.HttpClient client);
partial void PrepareRequest(
global::System.Net.Http.HttpClient client,
global::System.Net.Http.HttpRequestMessage request);
partial void ProcessResponse(
global::System.Net.Http.HttpClient client,
global::System.Net.Http.HttpResponseMessage response);
partial void ProcessResponseContent(
global::System.Net.Http.HttpClient client,
global::System.Net.Http.HttpResponseMessage response,
ref string content);
}
}