openai/openai-dotnet

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
OpenAI_2.0.0-beta.1

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/Generated/Internal/ClientPipelineExtensions.cs

41lines · modecode

1// <auto-generated/>
2
3#nullable disable
4
5using System.ClientModel;
6using System.ClientModel.Primitives;
7using System.Threading.Tasks;
8
9namespace OpenAI
10{
11 internal static partial class ClientPipelineExtensions
12 {
13 public static async ValueTask<ClientResult<bool>> ProcessHeadAsBoolMessageAsync(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options)
14 {
15 PipelineResponse response = await pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false);
16 switch (response.Status)
17 {
18 case >= 200 and < 300:
19 return ClientResult.FromValue(true, response);
20 case >= 400 and < 500:
21 return ClientResult.FromValue(false, response);
22 default:
23 return new ErrorResult<bool>(response, new ClientResultException(response));
24 }
25 }
26
27 public static ClientResult<bool> ProcessHeadAsBoolMessage(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options)
28 {
29 PipelineResponse response = pipeline.ProcessMessage(message, options);
30 switch (response.Status)
31 {
32 case >= 200 and < 300:
33 return ClientResult.FromValue(true, response);
34 case >= 400 and < 500:
35 return ClientResult.FromValue(false, response);
36 default:
37 return new ErrorResult<bool>(response, new ClientResultException(response));
38 }
39 }
40 }
41}
42