openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
src/Custom/Assistants/AssistantCollectionOrder.cs
40lines · modeblame
0ca4c062Jose Arriaga Maldonado1 years ago | 1 | using System; |
| 2 | using System.ComponentModel; | |
| 3 | using System.Diagnostics.CodeAnalysis; | |
2ab1a942Jose Arriaga Maldonado1 years ago | 4 | |
| 5 | namespace OpenAI.Assistants; | |
| 6 | | |
| 7 | [Experimental("OPENAI001")] | |
0ca4c062Jose Arriaga Maldonado1 years ago | 8 | public readonly partial struct AssistantCollectionOrder: IEquatable<AssistantCollectionOrder> |
2ab1a942Jose Arriaga Maldonado1 years ago | 9 | { |
0ca4c062Jose Arriaga Maldonado1 years ago | 10 | public static AssistantCollectionOrder Ascending { get; } = new AssistantCollectionOrder("asc"); |
2ab1a942Jose Arriaga Maldonado1 years ago | 11 | |
0ca4c062Jose Arriaga Maldonado1 years ago | 12 | public static AssistantCollectionOrder Descending { get; } = new AssistantCollectionOrder("desc"); |
| 13 | | |
| 14 | private readonly string _value; | |
| 15 | private const string AscValue = "asc"; | |
| 16 | private const string DescValue = "desc"; | |
| 17 | | |
| 18 | public AssistantCollectionOrder(string value) | |
| 19 | { | |
| 20 | Argument.AssertNotNull(value, nameof(value)); | |
| 21 | | |
| 22 | _value = value; | |
| 23 | } | |
| 24 | | |
| 25 | public static bool operator ==(AssistantCollectionOrder left, AssistantCollectionOrder right) => left.Equals(right); | |
| 26 | | |
| 27 | public static bool operator !=(AssistantCollectionOrder left, AssistantCollectionOrder right) => !left.Equals(right); | |
| 28 | | |
| 29 | public static implicit operator AssistantCollectionOrder(string value) => new AssistantCollectionOrder(value); | |
| 30 | | |
| 31 | [EditorBrowsable(EditorBrowsableState.Never)] | |
| 32 | public override bool Equals(object obj) => obj is AssistantCollectionOrder other && Equals(other); | |
| 33 | | |
| 34 | public bool Equals(AssistantCollectionOrder other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); | |
| 35 | | |
| 36 | [EditorBrowsable(EditorBrowsableState.Never)] | |
| 37 | public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; | |
| 38 | | |
| 39 | public override string ToString() => _value; | |
2ab1a942Jose Arriaga Maldonado1 years ago | 40 | } |