openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
src/Custom/Files/OpenAIFilesModelFactory.cs
48lines · modecode
| 1 | using System; |
| 2 | using System.Collections.Generic; |
| 3 | using System.Linq; |
| 4 | |
| 5 | namespace OpenAI.Files; |
| 6 | |
| 7 | /// <summary> Model factory for models. </summary> |
| 8 | public static partial class OpenAIFilesModelFactory |
| 9 | { |
| 10 | /// <summary> Initializes a new instance of <see cref="OpenAI.Files.FileDeletionResult"/>. </summary> |
| 11 | /// <returns> A new <see cref="OpenAI.Files.FileDeletionResult"/> instance for mocking. </returns> |
| 12 | public static FileDeletionResult FileDeletionResult(string fileId = null, bool deleted = default) |
| 13 | { |
| 14 | return new FileDeletionResult( |
| 15 | fileId, |
| 16 | InternalDeleteFileResponseObject.File, |
| 17 | deleted, |
| 18 | serializedAdditionalRawData: null); |
| 19 | } |
| 20 | |
| 21 | /// <summary> Initializes a new instance of <see cref="OpenAI.Files.OpenAIFileInfo"/>. </summary> |
| 22 | /// <returns> A new <see cref="OpenAI.Files.OpenAIFileInfo"/> instance for mocking. </returns> |
| 23 | public static OpenAIFileInfo OpenAIFileInfo(string id = null, int? sizeInBytes = null, DateTimeOffset createdAt = default, string filename = null, OpenAIFilePurpose purpose = default, OpenAIFileStatus status = default, string statusDetails = null) |
| 24 | { |
| 25 | return new OpenAIFileInfo( |
| 26 | id, |
| 27 | sizeInBytes, |
| 28 | createdAt, |
| 29 | filename, |
| 30 | @object: InternalOpenAIFileObject.File, |
| 31 | purpose, |
| 32 | status, |
| 33 | statusDetails, |
| 34 | serializedAdditionalRawData: null); |
| 35 | } |
| 36 | |
| 37 | /// <summary> Initializes a new instance of <see cref="OpenAI.Files.OpenAIFileInfoCollection"/>. </summary> |
| 38 | /// <returns> A new <see cref="OpenAI.Files.OpenAIFileInfoCollection"/> instance for mocking. </returns> |
| 39 | public static OpenAIFileInfoCollection OpenAIFileInfoCollection(IEnumerable<OpenAIFileInfo> items = null) |
| 40 | { |
| 41 | items ??= new List<OpenAIFileInfo>(); |
| 42 | |
| 43 | return new OpenAIFileInfoCollection( |
| 44 | items.ToList(), |
| 45 | InternalListFilesResponseObject.List, |
| 46 | serializedAdditionalRawData: null); |
| 47 | } |
| 48 | } |
| 49 | |