Skip to content

Commit 23f814b

Browse files
github-actions[bot]actions-userjorgerangel-msft
authored
Succeeded with Issues: Update @typespec/http-client-csharp to 1.0.0-alpha.20251031.1 (#802)
* Update @typespec/http-client-csharp to 1.0.0-alpha.20251031.1 - Updated @typespec/http-client-csharp from 1.0.0-alpha.20251022.4 to 1.0.0-alpha.20251031.1 - Updated Microsoft.TypeSpec.Generator.ClientModel from 1.0.0-alpha.20251022.4 to 1.0.0-alpha.20251031.1 - Regenerated OpenAI SDK code with new generator version - Updated centrally managed package-lock.json file with new dependency versions * fix partial --------- Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Jorge Rangel <jorgerangel@microsoft.com>
1 parent 90943c6 commit 23f814b

File tree

87 files changed

+176
-138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+176
-138
lines changed

codegen/generator/src/OpenAI.Library.Plugin.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.TypeSpec.Generator.ClientModel" Version="1.0.0-alpha.20251022.4" />
11+
<PackageReference Include="Microsoft.TypeSpec.Generator.ClientModel" Version="1.0.0-alpha.20251031.1" />
1212
</ItemGroup>
1313

1414
<!-- Copy output to package dist path for local execution and -->

codegen/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"dependencies": {
3131
"@open-ai/plugin": "file:",
3232
"@azure-tools/typespec-client-generator-core": "0.61.0",
33-
"@typespec/http-client-csharp": "1.0.0-alpha.20251022.4",
33+
"@typespec/http-client-csharp": "1.0.0-alpha.20251031.1",
3434
"@typespec/http": "1.5.0",
3535
"@typespec/openapi": "1.5.0"
3636
},

package-lock.json

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Custom/Internal/CancellationTokenExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace OpenAI;
55

6-
internal static class CancellationTokenExtensions
6+
internal static partial class CancellationTokenExtensions
77
{
88
public static RequestOptions ToRequestOptions(this CancellationToken cancellationToken, bool streaming = false)
99
{

src/Generated/AssistantClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public virtual CollectionResult<Assistant> GetAssistants(AssistantCollectionOpti
5353
options?.Order?.ToString(),
5454
options?.AfterId,
5555
options?.BeforeId,
56-
cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
56+
cancellationToken.ToRequestOptions());
5757
}
5858

5959
public virtual AsyncCollectionResult<Assistant> GetAssistantsAsync(AssistantCollectionOptions options = default, CancellationToken cancellationToken = default)
@@ -64,7 +64,7 @@ public virtual AsyncCollectionResult<Assistant> GetAssistantsAsync(AssistantColl
6464
options?.Order?.ToString(),
6565
options?.AfterId,
6666
options?.BeforeId,
67-
cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
67+
cancellationToken.ToRequestOptions());
6868
}
6969

7070
public virtual ClientResult CreateAssistant(BinaryContent content, RequestOptions options = null)

src/Generated/BatchClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ public virtual AsyncCollectionResult GetBatchesAsync(string after, int? limit, R
3535

3636
public virtual CollectionResult<BatchJob> GetBatches(BatchCollectionOptions options = default, CancellationToken cancellationToken = default)
3737
{
38-
return new BatchClientGetBatchesCollectionResultOfT(this, options?.AfterId, options?.PageSizeLimit, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
38+
return new BatchClientGetBatchesCollectionResultOfT(this, options?.AfterId, options?.PageSizeLimit, cancellationToken.ToRequestOptions());
3939
}
4040

4141
public virtual AsyncCollectionResult<BatchJob> GetBatchesAsync(BatchCollectionOptions options = default, CancellationToken cancellationToken = default)
4242
{
43-
return new BatchClientGetBatchesAsyncCollectionResultOfT(this, options?.AfterId, options?.PageSizeLimit, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
43+
return new BatchClientGetBatchesAsyncCollectionResultOfT(this, options?.AfterId, options?.PageSizeLimit, cancellationToken.ToRequestOptions());
4444
}
4545

4646
public virtual ClientResult GetBatch(string batchId, RequestOptions options)

src/Generated/ChatClient.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public virtual CollectionResult<ChatCompletion> GetChatCompletions(ChatCompletio
5959
options?.Order?.ToString(),
6060
options?.Metadata,
6161
options?.Model,
62-
cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
62+
cancellationToken.ToRequestOptions());
6363
}
6464

6565
[Experimental("OPENAI001")]
@@ -72,7 +72,7 @@ public virtual AsyncCollectionResult<ChatCompletion> GetChatCompletionsAsync(Cha
7272
options?.Order?.ToString(),
7373
options?.Metadata,
7474
options?.Model,
75-
cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
75+
cancellationToken.ToRequestOptions());
7676
}
7777

7878
public virtual ClientResult CompleteChat(BinaryContent content, RequestOptions options = null)
@@ -186,7 +186,7 @@ public virtual CollectionResult<ChatCompletionMessageListDatum> GetChatCompletio
186186
options?.AfterId,
187187
options?.PageSizeLimit,
188188
options?.Order?.ToString(),
189-
cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
189+
cancellationToken.ToRequestOptions());
190190
}
191191

192192
[Experimental("OPENAI001")]
@@ -200,7 +200,7 @@ public virtual AsyncCollectionResult<ChatCompletionMessageListDatum> GetChatComp
200200
options?.AfterId,
201201
options?.PageSizeLimit,
202202
options?.Order?.ToString(),
203-
cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
203+
cancellationToken.ToRequestOptions());
204204
}
205205
}
206206
}

src/Generated/ContainerClient.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ public virtual AsyncCollectionResult GetContainersAsync(int? limit, string order
3535

3636
public virtual CollectionResult<ContainerResource> GetContainers(ContainerCollectionOptions options = default, CancellationToken cancellationToken = default)
3737
{
38-
return new ContainerClientGetContainersCollectionResultOfT(this, options?.PageSizeLimit, options?.Order?.ToString(), options?.AfterId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
38+
return new ContainerClientGetContainersCollectionResultOfT(this, options?.PageSizeLimit, options?.Order?.ToString(), options?.AfterId, cancellationToken.ToRequestOptions());
3939
}
4040

4141
public virtual AsyncCollectionResult<ContainerResource> GetContainersAsync(ContainerCollectionOptions options = default, CancellationToken cancellationToken = default)
4242
{
43-
return new ContainerClientGetContainersAsyncCollectionResultOfT(this, options?.PageSizeLimit, options?.Order?.ToString(), options?.AfterId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
43+
return new ContainerClientGetContainersAsyncCollectionResultOfT(this, options?.PageSizeLimit, options?.Order?.ToString(), options?.AfterId, cancellationToken.ToRequestOptions());
4444
}
4545

4646
public virtual ClientResult CreateContainer(BinaryContent content, RequestOptions options = null)
@@ -63,15 +63,15 @@ public virtual ClientResult<ContainerResource> CreateContainer(CreateContainerBo
6363
{
6464
Argument.AssertNotNull(body, nameof(body));
6565

66-
ClientResult result = CreateContainer(body, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
66+
ClientResult result = CreateContainer(body, cancellationToken.ToRequestOptions());
6767
return ClientResult.FromValue((ContainerResource)result, result.GetRawResponse());
6868
}
6969

7070
public virtual async Task<ClientResult<ContainerResource>> CreateContainerAsync(CreateContainerBody body, CancellationToken cancellationToken = default)
7171
{
7272
Argument.AssertNotNull(body, nameof(body));
7373

74-
ClientResult result = await CreateContainerAsync(body, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).ConfigureAwait(false);
74+
ClientResult result = await CreateContainerAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
7575
return ClientResult.FromValue((ContainerResource)result, result.GetRawResponse());
7676
}
7777

@@ -95,15 +95,15 @@ public virtual ClientResult<ContainerResource> GetContainer(string containerId,
9595
{
9696
Argument.AssertNotNullOrEmpty(containerId, nameof(containerId));
9797

98-
ClientResult result = GetContainer(containerId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
98+
ClientResult result = GetContainer(containerId, cancellationToken.ToRequestOptions());
9999
return ClientResult.FromValue((ContainerResource)result, result.GetRawResponse());
100100
}
101101

102102
public virtual async Task<ClientResult<ContainerResource>> GetContainerAsync(string containerId, CancellationToken cancellationToken = default)
103103
{
104104
Argument.AssertNotNullOrEmpty(containerId, nameof(containerId));
105105

106-
ClientResult result = await GetContainerAsync(containerId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).ConfigureAwait(false);
106+
ClientResult result = await GetContainerAsync(containerId, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
107107
return ClientResult.FromValue((ContainerResource)result, result.GetRawResponse());
108108
}
109109

@@ -127,15 +127,15 @@ public virtual ClientResult<DeleteContainerResponse> DeleteContainer(string cont
127127
{
128128
Argument.AssertNotNullOrEmpty(containerId, nameof(containerId));
129129

130-
ClientResult result = DeleteContainer(containerId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
130+
ClientResult result = DeleteContainer(containerId, cancellationToken.ToRequestOptions());
131131
return ClientResult.FromValue((DeleteContainerResponse)result, result.GetRawResponse());
132132
}
133133

134134
public virtual async Task<ClientResult<DeleteContainerResponse>> DeleteContainerAsync(string containerId, CancellationToken cancellationToken = default)
135135
{
136136
Argument.AssertNotNullOrEmpty(containerId, nameof(containerId));
137137

138-
ClientResult result = await DeleteContainerAsync(containerId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).ConfigureAwait(false);
138+
ClientResult result = await DeleteContainerAsync(containerId, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
139139
return ClientResult.FromValue((DeleteContainerResponse)result, result.GetRawResponse());
140140
}
141141

@@ -193,7 +193,7 @@ public virtual CollectionResult<ContainerFileResource> GetContainerFiles(string
193193
options?.PageSizeLimit,
194194
options?.Order?.ToString(),
195195
options?.AfterId,
196-
cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
196+
cancellationToken.ToRequestOptions());
197197
}
198198

199199
public virtual AsyncCollectionResult<ContainerFileResource> GetContainerFilesAsync(string containerId, ContainerFileCollectionOptions options = default, CancellationToken cancellationToken = default)
@@ -206,7 +206,7 @@ public virtual AsyncCollectionResult<ContainerFileResource> GetContainerFilesAsy
206206
options?.PageSizeLimit,
207207
options?.Order?.ToString(),
208208
options?.AfterId,
209-
cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
209+
cancellationToken.ToRequestOptions());
210210
}
211211

212212
public virtual ClientResult GetContainerFile(string containerId, string fileId, RequestOptions options)
@@ -232,7 +232,7 @@ public virtual ClientResult<ContainerFileResource> GetContainerFile(string conta
232232
Argument.AssertNotNullOrEmpty(containerId, nameof(containerId));
233233
Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
234234

235-
ClientResult result = GetContainerFile(containerId, fileId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
235+
ClientResult result = GetContainerFile(containerId, fileId, cancellationToken.ToRequestOptions());
236236
return ClientResult.FromValue((ContainerFileResource)result, result.GetRawResponse());
237237
}
238238

@@ -241,7 +241,7 @@ public virtual async Task<ClientResult<ContainerFileResource>> GetContainerFileA
241241
Argument.AssertNotNullOrEmpty(containerId, nameof(containerId));
242242
Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
243243

244-
ClientResult result = await GetContainerFileAsync(containerId, fileId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).ConfigureAwait(false);
244+
ClientResult result = await GetContainerFileAsync(containerId, fileId, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
245245
return ClientResult.FromValue((ContainerFileResource)result, result.GetRawResponse());
246246
}
247247

@@ -268,7 +268,7 @@ public virtual ClientResult<DeleteContainerFileResponse> DeleteContainerFile(str
268268
Argument.AssertNotNullOrEmpty(containerId, nameof(containerId));
269269
Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
270270

271-
ClientResult result = DeleteContainerFile(containerId, fileId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
271+
ClientResult result = DeleteContainerFile(containerId, fileId, cancellationToken.ToRequestOptions());
272272
return ClientResult.FromValue((DeleteContainerFileResponse)result, result.GetRawResponse());
273273
}
274274

@@ -277,7 +277,7 @@ public virtual async Task<ClientResult<DeleteContainerFileResponse>> DeleteConta
277277
Argument.AssertNotNullOrEmpty(containerId, nameof(containerId));
278278
Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
279279

280-
ClientResult result = await DeleteContainerFileAsync(containerId, fileId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).ConfigureAwait(false);
280+
ClientResult result = await DeleteContainerFileAsync(containerId, fileId, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
281281
return ClientResult.FromValue((DeleteContainerFileResponse)result, result.GetRawResponse());
282282
}
283283

@@ -304,7 +304,7 @@ public virtual ClientResult<BinaryData> DownloadContainerFile(string containerId
304304
Argument.AssertNotNullOrEmpty(containerId, nameof(containerId));
305305
Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
306306

307-
ClientResult result = DownloadContainerFile(containerId, fileId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
307+
ClientResult result = DownloadContainerFile(containerId, fileId, cancellationToken.ToRequestOptions());
308308
return ClientResult.FromValue(result.GetRawResponse().Content, result.GetRawResponse());
309309
}
310310

@@ -313,7 +313,7 @@ public virtual async Task<ClientResult<BinaryData>> DownloadContainerFileAsync(s
313313
Argument.AssertNotNullOrEmpty(containerId, nameof(containerId));
314314
Argument.AssertNotNullOrEmpty(fileId, nameof(fileId));
315315

316-
ClientResult result = await DownloadContainerFileAsync(containerId, fileId, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).ConfigureAwait(false);
316+
ClientResult result = await DownloadContainerFileAsync(containerId, fileId, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
317317
return ClientResult.FromValue(result.GetRawResponse().Content, result.GetRawResponse());
318318
}
319319
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// <auto-generated/>
2+
3+
#nullable disable
4+
5+
using System.ClientModel.Primitives;
6+
using System.Threading;
7+
8+
namespace OpenAI
9+
{
10+
internal static partial class CancellationTokenExtensions
11+
{
12+
public static RequestOptions ToRequestOptions(this CancellationToken cancellationToken) => cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null;
13+
}
14+
}

src/Generated/InternalAssistantMessageClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public virtual CollectionResult<ThreadMessage> GetMessages(string threadId, Mess
6565
options?.Order?.ToString(),
6666
options?.AfterId,
6767
options?.BeforeId,
68-
cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
68+
cancellationToken.ToRequestOptions());
6969
}
7070

7171
public virtual AsyncCollectionResult<ThreadMessage> GetMessagesAsync(string threadId, MessageCollectionOptions options = default, CancellationToken cancellationToken = default)
@@ -79,7 +79,7 @@ public virtual AsyncCollectionResult<ThreadMessage> GetMessagesAsync(string thre
7979
options?.Order?.ToString(),
8080
options?.AfterId,
8181
options?.BeforeId,
82-
cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
82+
cancellationToken.ToRequestOptions());
8383
}
8484
}
8585
}

0 commit comments

Comments
 (0)