tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
RepositoryClient.cs
Go to the documentation of this file.
1using System;
2using System.Threading;
3using System.Threading.Tasks;
4
9
11{
14 {
19
24
31 {
32 this.apiClient = apiClient;
33 this.instance = instance;
34 }
35
37 public ValueTask<RepositoryResponse> Clone(RepositoryCreateRequest repository, CancellationToken cancellationToken) => apiClient.Create<RepositoryCreateRequest, RepositoryResponse>(Routes.Repository, repository, instance.Id!.Value, cancellationToken);
38
40 public ValueTask<RepositoryResponse> Delete(CancellationToken cancellationToken) => apiClient.Delete<RepositoryResponse>(Routes.Repository, instance.Id!.Value, cancellationToken);
41
43 public ValueTask<RepositoryResponse> Read(CancellationToken cancellationToken) => apiClient.Read<RepositoryResponse>(Routes.Repository, instance.Id!.Value, cancellationToken);
44
46 public ValueTask<RepositoryResponse> Update(RepositoryUpdateRequest repository, CancellationToken cancellationToken) => apiClient.Update<RepositoryUpdateRequest, RepositoryResponse>(Routes.Repository, repository ?? throw new ArgumentNullException(nameof(repository)), instance.Id!.Value, cancellationToken);
47
49 public ValueTask<RepositoryResponse> Reclone(CancellationToken cancellationToken) => apiClient.Patch<RepositoryResponse>(Routes.Repository, instance.Id!.Value, cancellationToken);
50 }
51}
virtual ? long Id
The ID of the entity.
Definition EntityId.cs:13
Metadata about a server instance.
Definition Instance.cs:9
Routes to a server actions.
Definition Routes.cs:9
const string Repository
The git repository controller.
Definition Routes.cs:58
ValueTask< RepositoryResponse > Reclone(CancellationToken cancellationToken)
Deletes and reclones the repository.A ValueTask<TResult> resulting in the RepositoryResponse.
readonly IApiClient apiClient
The IApiClient for the RepositoryClient.
readonly Instance instance
The Instance for the RepositoryClient.
ValueTask< RepositoryResponse > Clone(RepositoryCreateRequest repository, CancellationToken cancellationToken)
Clones a repository .A ValueTask<TResult> resulting in the RepositoryResponse/.
ValueTask< RepositoryResponse > Read(CancellationToken cancellationToken)
Get the repository's current status.A ValueTask<TResult> resulting in the RepositoryResponse.
RepositoryClient(IApiClient apiClient, Instance instance)
Initializes a new instance of the RepositoryClient class.
ValueTask< RepositoryResponse > Update(RepositoryUpdateRequest repository, CancellationToken cancellationToken)
Update the repository.A ValueTask<TResult> resulting in the RepositoryResponse.
ValueTask< RepositoryResponse > Delete(CancellationToken cancellationToken)
Deletes the repository.A ValueTask<TResult> resulting in the RepositoryResponse.
Web interface for the API.
Definition IApiClient.cs:17
ValueTask Patch(string route, CancellationToken cancellationToken)
Run an HTTP PATCH request.
ValueTask Delete(string route, CancellationToken cancellationToken)
Run an HTTP DELETE request.