Skip to content

Commit eec04af

Browse files
committed
#49 IMPLEMENT IFilesEndpoint
1 parent a5702a1 commit eec04af

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

OpenAI_API/Files/FilesEndpoint.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace OpenAI_API.Files
99
/// <summary>
1010
/// The API endpoint for operations List, Upload, Delete, Retrieve files
1111
/// </summary>
12-
public class FilesEndpoint : EndpointBase
12+
public class FilesEndpoint : EndpointBase, IFilesEndpoint
1313
{
1414
/// <summary>
1515
/// Constructor of the api endpoint. Rather than instantiating this yourself, access it through an instance of <see cref="OpenAIAPI"/> as <see cref="OpenAIAPI.Files"/>.

OpenAI_API/Files/IFilesEndpoint.cs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using System.Collections.Generic;
2+
using System.Threading.Tasks;
3+
4+
namespace OpenAI_API.Files
5+
{
6+
/// <summary>
7+
/// The API endpoint for operations List, Upload, Delete, Retrieve files
8+
/// </summary>
9+
public interface IFilesEndpoint
10+
{
11+
/// <summary>
12+
/// Get the list of all files
13+
/// </summary>
14+
/// <returns></returns>
15+
/// <exception cref="HttpRequestException"></exception>
16+
Task<List<File>> GetFilesAsync();
17+
18+
/// <summary>
19+
/// Returns information about a specific file
20+
/// </summary>
21+
/// <param name="fileId">The ID of the file to use for this request</param>
22+
/// <returns></returns>
23+
Task<File> GetFileAsync(string fileId);
24+
25+
/// <summary>
26+
/// Returns the contents of the specific file as string
27+
/// </summary>
28+
/// <param name="fileId">The ID of the file to use for this request</param>
29+
/// <returns></returns>
30+
Task<string> GetFileContentAsStringAsync(string fileId);
31+
32+
/// <summary>
33+
/// Delete a file
34+
/// </summary>
35+
/// <param name="fileId">The ID of the file to use for this request</param>
36+
/// <returns></returns>
37+
Task<File> DeleteFileAsync(string fileId);
38+
39+
/// <summary>
40+
/// Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please contact OpenAI if you need to increase the storage limit
41+
/// </summary>
42+
/// <param name="filePath">The name of the file to use for this request</param>
43+
/// <param name="purpose">The intendend purpose of the uploaded documents. Use "fine-tune" for Fine-tuning. This allows us to validate the format of the uploaded file.</param>
44+
Task<File> UploadFileAsync(string filePath, string purpose = "fine-tune");
45+
}
46+
}

0 commit comments

Comments
 (0)