using System; using System.IO; using System.Threading; using System.Threading.Tasks; using Tgstation.Server.Api; using Tgstation.Server.Api.Models; using Tgstation.Server.Api.Models.Response; namespace Tgstation.Server.Client { /// /// Web interface for the API. /// interface IApiClient : IDisposable { /// /// The the uses. /// ApiHeaders Headers { get; set; } /// /// The pointing the tgstation-server. /// Uri Url { get; } /// /// The request timeout. /// TimeSpan Timeout { get; set; } /// /// Adds a to the request pipeline. /// /// The to add. void AddRequestLogger(IRequestLogger requestLogger); /// /// Run an HTTP PUT request. /// /// The type to of the request body. /// The type of the response body. /// The server route to make the request to. /// The request body. /// The for the operation. /// A resulting in the response body as a . Task Create(string route, TBody body, CancellationToken cancellationToken) where TBody : class; /// /// Run an HTTP PUT request. /// /// The type of the response body. /// The server route to make the request to. /// The for the operation. /// A resulting in the response body as a . Task Create(string route, CancellationToken cancellationToken); /// /// Run an HTTP GET request. /// /// The type of the response body. /// The server route to make the request to. /// The for the operation. /// A resulting in the response body as a . Task Read(string route, CancellationToken cancellationToken); /// /// Run an HTTP POST request. /// /// The type to of the request body. /// The type of the response body. /// The server route to make the request to. /// The request body. /// The for the operation. /// A resulting in the response body as a . Task Update(string route, TBody body, CancellationToken cancellationToken) where TBody : class; /// /// Run an HTTP POST request. /// /// The type of the response body. /// The server route to make the request to. /// The for the operation. /// A resulting in the response body as a . Task Update(string route, CancellationToken cancellationToken); /// /// Run an HTTP POST request. /// /// The type to of the request body. /// The server route to make the request to. /// The request body. /// The for the operation. /// A representing the running operation. Task Update(string route, TBody body, CancellationToken cancellationToken) where TBody : class; /// /// Run an HTTP PATCH request. /// /// The server route to make the request to. /// The for the operation. /// A representing the running operation. Task Patch(string route, CancellationToken cancellationToken); /// /// Run an HTTP DELETE request. /// /// The server route to make the request to. /// The for the operation. /// A representing the running operation. Task Delete(string route, CancellationToken cancellationToken); /// /// Run an HTTP PUT request. /// /// The type to of the request body. /// The type of the response body. /// The server route to make the request to. /// The request body. /// The instance to make the request to. /// The for the operation. /// A resulting in the response body as a . Task Create( string route, TBody body, long instanceId, CancellationToken cancellationToken) where TBody : class; /// /// Run an HTTP PUT request. /// /// The type of the response body. /// The server route to make the request to. /// The instance to make the request to. /// The for the operation. /// A resulting in the response body as a . Task Create(string route, long instanceId, CancellationToken cancellationToken); /// /// Run an HTTP PATCH request. /// /// The type of the response body. /// The server route to make the request to. /// The instance to make the request to. /// The for the operation. /// A resulting in the response body as a . Task Patch(string route, long instanceId, CancellationToken cancellationToken); /// /// Run an HTTP GET request. /// /// The type of the response body. /// The server route to make the request to. /// The instance to make the request to. /// The for the operation. /// A resulting in the response body as a . Task Read(string route, long instanceId, CancellationToken cancellationToken); /// /// Run an HTTP POST request. /// /// The type to of the request body. /// The type of the response body. /// The server route to make the request to. /// The request body. /// The instance to make the request to. /// The for the operation. /// A resulting in the response body as a . Task Update( string route, TBody body, long instanceId, CancellationToken cancellationToken) where TBody : class; /// /// Run an HTTP DELETE request. /// /// The server route to make the request to. /// The instance to make the request to. /// The for the operation. /// A representing the running operation. Task Delete(string route, long instanceId, CancellationToken cancellationToken); /// /// Run an HTTP DELETE request. /// /// The type to of the request body. /// The server route to make the request to. /// The request body. /// The instance to make the request to. /// The for the operation. /// A representing the running operation. Task Delete(string route, TBody body, long instanceId, CancellationToken cancellationToken) where TBody : class; /// /// Run an HTTP DELETE request. /// /// The type of the response body. /// The server route to make the request to. /// The instance to make the request to. /// The for the operation. /// A resulting in the response body as a . Task Delete(string route, long instanceId, CancellationToken cancellationToken); /// /// Run an HTTP DELETE request. /// /// The type to of the request body. /// The type of the response body. /// The server route to make the request to. /// The request body. /// The instance to make the request to. /// The for the operation. /// A representing the running operation. Task Delete(string route, TBody body, long instanceId, CancellationToken cancellationToken) where TBody : class; /// /// Downloads a file for a given . /// /// The to download. /// The for the operation. /// A resulting in the downloaded . Task Download(FileTicketResponse ticket, CancellationToken cancellationToken); /// /// Uploads a given for a given . /// /// The to download. /// The to upload. represents an empty file. /// The for the operation. /// A representing the running operation. Task Upload(FileTicketResponse ticket, Stream? uploadStream, CancellationToken cancellationToken); } }