Skip to content

Commit 840fc45

Browse files
committed
Add XML documentation for API interfaces
This commit introduces comprehensive XML comments to improve codebase clarity and maintainability. Detailed descriptions were added for all methods and properties across `ISubDBClient`, `IResponse`, `IRequest`, and `ISubDBApi` interfaces, outlining their purpose, parameters, and return values. These changes enhance API usability and developer understanding.
1 parent cbe183c commit 840fc45

File tree

4 files changed

+114
-0
lines changed

4 files changed

+114
-0
lines changed

src/Http/IRequest.cs

+23
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,33 @@
33

44
namespace SubDBSharp.Models
55
{
6+
/// <summary>
7+
/// Represents an HTTP request with a specified endpoint, method, and optional body content.
8+
/// </summary>
69
public interface IRequest
710
{
11+
/// <summary>
12+
/// Gets or sets the HTTP content to be sent as the body of an HTTP request.
13+
/// </summary>
14+
/// <remarks>
15+
/// Typically used to include serialized data or other payloads in HTTP requests such as POST or PUT.
16+
/// </remarks>
817
HttpContent Body { get; }
18+
19+
/// <summary>
20+
/// Gets or sets the URI that represents the target endpoint of the HTTP request.
21+
/// </summary>
22+
/// <remarks>
23+
/// Used to specify the destination URL for the HTTP operation being executed.
24+
/// </remarks>
925
Uri EndPoint { get; }
26+
27+
/// <summary>
28+
/// Gets or sets the HTTP method to be used for the request.
29+
/// </summary>
30+
/// <remarks>
31+
/// Specifies the action to be performed by the request, such as GET, POST, PUT, or DELETE.
32+
/// </remarks>
1033
HttpMethod Method { get; }
1134
}
1235
}

src/Http/IResponse.cs

+28
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,38 @@
33

44
namespace SubDBSharp.Http
55
{
6+
/// <summary>
7+
/// Represents a response received from an HTTP request.
8+
/// </summary>
69
public interface IResponse
710
{
11+
/// <summary>
12+
/// Gets the content of the response body.
13+
/// </summary>
14+
/// <remarks>
15+
/// The body contains the data returned by the HTTP request, which may be in various formats such as plain text,
16+
/// JSON object, or binary data, depending on the nature of the response.
17+
/// This property is represented as an object and may require casting to the expected type.
18+
/// </remarks>
819
object Body { get; }
20+
21+
/// <summary>
22+
/// Gets the collection of HTTP headers included in the response as key-value pairs.
23+
/// </summary>
24+
/// <remarks>
25+
/// The headers provide metadata about the response, such as content type, server, and other relevant information.
26+
/// This property is represented as a read-only dictionary where the keys are the header names
27+
/// and the values are the corresponding header values.
28+
/// </remarks>
929
IReadOnlyDictionary<string, string> Headers { get; }
30+
31+
/// <summary>
32+
/// Gets the HTTP status code associated with the response.
33+
/// </summary>
34+
/// <remarks>
35+
/// The status code indicates the outcome of the HTTP request, such as success, client error, or server error.
36+
/// It conforms to the standardized status codes as defined in the <see cref="System.Net.HttpStatusCode"/> enumeration.
37+
/// </remarks>
1038
HttpStatusCode StatusCode { get; }
1139
}
1240
}

src/Http/ISubDBApi.cs

+28
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,39 @@
33

44
namespace SubDBSharp
55
{
6+
/// <summary>
7+
/// Interface for interacting with the SubDB API to perform operations related to subtitle management.
8+
/// </summary>
69
public interface ISubDBApi
710
{
11+
/// <summary>
12+
/// Downloads a subtitle file based on the provided video hash and language preferences.
13+
/// </summary>
14+
/// <param name="hash">A unique hash representing the video file, generated using a specific hash function.</param>
15+
/// <param name="languages">A list of language codes indicating the preferred languages for the subtitle. The first matching language is returned.</param>
16+
/// <returns>A Task representing the asynchronous operation, containing the server's response to the subtitle download request.</returns>
817
Task<Response> DownloadSubtitle(string hash, params string[] languages);
18+
19+
/// <summary>
20+
/// Retrieves a list of available languages supported by the SubDB API for subtitles.
21+
/// </summary>
22+
/// <returns>A Task representing the asynchronous operation, containing the server's response with the list of available languages.</returns>
923
Task<Response> GetAvailableLanguagesAsync();
24+
25+
/// <summary>
26+
/// Searches for subtitles based on the hash of a video file, optionally returning the number of subtitle versions available per language.
27+
/// </summary>
28+
/// <param name="hash">The hash of the video file, uniquely identifying it in the subtitle database.</param>
29+
/// <param name="getVersions">Optional parameter to indicate whether to include the number of versions available for each subtitle language.</param>
30+
/// <returns>A Task representing the asynchronous operation, containing the server's response to the subtitle search request.</returns>
1031
Task<Response> SearchSubtitle(string hash, bool getVersions = false);
32+
33+
/// <summary>
34+
/// Uploads a subtitle file for a specific movie to the server.
35+
/// </summary>
36+
/// <param name="subtitle">The content of the subtitle file being uploaded.</param>
37+
/// <param name="movie">The movie identifier or hash that the subtitle is associated with.</param>
38+
/// <returns>A Task representing the asynchronous operation, containing the server's response to the upload request.</returns>
1139
Task<Response> UploadSubtitle(string subtitle, string movie);
1240
}
1341
}

src/ISubDBClient.cs

+35
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,46 @@
33

44
namespace SubDBSharp
55
{
6+
/// <summary>
7+
/// Defines methods for interacting with the SubDB API,
8+
/// including operations for downloading, uploading, searching subtitles,
9+
/// and retrieving available subtitle languages.
10+
/// </summary>
611
public interface ISubDBClient
712
{
13+
/// <summary>
14+
/// Downloads the subtitle for a given video file based on its hash and specified language preferences.
15+
/// </summary>
16+
/// <param name="hash">The hash of the video file, used to uniquely identify the video.</param>
17+
/// <param name="languages">An array of language codes specifying the preferred subtitle language(s).
18+
/// If multiple language codes are provided, the first available subtitle will be returned in the specified order.</param>
19+
/// <returns>A task that represents the asynchronous operation. The task result contains the server response,
20+
/// including the subtitle content and its associated metadata.</returns>
821
Task<Response> DownloadSubtitleAsync(string hash, params string[] languages);
22+
23+
/// <summary>
24+
/// Retrieves the list of all available subtitle languages currently supported in the SubDB database.
25+
/// </summary>
26+
/// <returns>A task that represents the asynchronous operation. The task result contains the server response,
27+
/// including the list of available language codes.</returns>
928
Task<Response> GetAvailableLanguagesAsync();
29+
30+
/// <summary>
31+
/// Searches for subtitles for a given video file based on its hash.
32+
/// Optionally, retrieves additional information about the subtitle versions available.
33+
/// </summary>
34+
/// <param name="hash">The hash of the video file used to uniquely identify the video.</param>
35+
/// <param name="getVersions">A boolean indicating whether to return information about the number of subtitle versions per language available in the database.</param>
36+
/// <returns>A task that represents the asynchronous operation. The task result contains the server response, including available subtitles and their metadata if found.</returns>
1037
Task<Response> SearchSubtitleAsync(string hash, bool getVersions);
38+
39+
/// <summary>
40+
/// Uploads a subtitle file for a specific movie to the SubDB server.
41+
/// </summary>
42+
/// <param name="subtitle">The subtitle content to be uploaded.</param>
43+
/// <param name="movie">The movie name or identifier associated with the subtitle.</param>
44+
/// <returns>A task that represents the asynchronous operation. The task result contains the server response,
45+
/// including status and any additional metadata related to the upload operation.</returns>
1146
Task<Response> UploadSubtitleAsync(string subtitle, string movie);
1247
}
1348
}

0 commit comments

Comments
 (0)