openai/openai-dotnet

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
achandmsft-patch-1

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/Custom/Assistants/AssistantCollectionOrder.cs

40lines · modecode

1using System;
2using System.ComponentModel;
3using System.Diagnostics.CodeAnalysis;
4
5namespace OpenAI.Assistants;
6
7[Experimental("OPENAI001")]
8public readonly partial struct AssistantCollectionOrder: IEquatable<AssistantCollectionOrder>
9{
10 public static AssistantCollectionOrder Ascending { get; } = new AssistantCollectionOrder("asc");
11
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;
40}
41