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/Optional.cs

48lines · modecode

1// <auto-generated/>
2
3#nullable disable
4
5using System.Collections.Generic;
6using System.Text.Json;
7
8namespace OpenAI
9{
10 internal static class Optional
11 {
12 public static bool IsCollectionDefined<T>(IEnumerable<T> collection)
13 {
14 return !(collection is ChangeTrackingList<T> changeTrackingList && changeTrackingList.IsUndefined);
15 }
16
17 public static bool IsCollectionDefined<TKey, TValue>(IDictionary<TKey, TValue> collection)
18 {
19 return !(collection is ChangeTrackingDictionary<TKey, TValue> changeTrackingDictionary && changeTrackingDictionary.IsUndefined);
20 }
21
22 public static bool IsCollectionDefined<TKey, TValue>(IReadOnlyDictionary<TKey, TValue> collection)
23 {
24 return !(collection is ChangeTrackingDictionary<TKey, TValue> changeTrackingDictionary && changeTrackingDictionary.IsUndefined);
25 }
26
27 public static bool IsDefined<T>(T? value)
28 where T : struct
29 {
30 return value.HasValue;
31 }
32
33 public static bool IsDefined(object value)
34 {
35 return value != null;
36 }
37
38 public static bool IsDefined(JsonElement value)
39 {
40 return value.ValueKind != JsonValueKind.Undefined;
41 }
42
43 public static bool IsDefined(string value)
44 {
45 return value != null;
46 }
47 }
48}
49