tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
DreamMakerClient.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Threading;
4using System.Threading.Tasks;
5
10
12{
15 {
20
27 : base(apiClient)
28 {
29 this.instance = instance ?? throw new ArgumentNullException(nameof(instance));
30 }
31
33 public ValueTask<JobResponse> Compile(CancellationToken cancellationToken) => ApiClient.Create<JobResponse>(Routes.DreamMaker, instance.Id!.Value, cancellationToken);
34
36 public ValueTask<CompileJobResponse> GetCompileJob(EntityId compileJob, CancellationToken cancellationToken) => ApiClient.Read<CompileJobResponse>(Routes.SetID(Routes.DreamMaker, compileJob?.Id ?? throw new ArgumentNullException(nameof(compileJob))), instance.Id!.Value, cancellationToken);
37
39 public ValueTask<List<CompileJobResponse>> ListCompileJobs(PaginationSettings? paginationSettings, CancellationToken cancellationToken)
40 => ReadPaged<CompileJobResponse>(paginationSettings, Routes.ListRoute(Routes.DreamMaker), instance.Id!.Value, cancellationToken);
41
43 public ValueTask<DreamMakerResponse> Read(CancellationToken cancellationToken) => ApiClient.Read<DreamMakerResponse>(Routes.DreamMaker, instance.Id!.Value, cancellationToken);
44
46 public ValueTask<DreamMakerResponse> Update(DreamMakerRequest dreamMaker, CancellationToken cancellationToken) => ApiClient.Update<DreamMakerRequest, DreamMakerResponse>(Routes.DreamMaker, dreamMaker ?? throw new ArgumentNullException(nameof(dreamMaker)), instance.Id!.Value, cancellationToken);
47 }
48}
Common base of entities with IDs.
Definition EntityId.cs:7
virtual ? long Id
The ID of the entity.
Definition EntityId.cs:13
Metadata about a server instance.
Definition Instance.cs:9
A request to the DreamMaker controller.
Represents a long running job on the server. Model is read-only, updates attempt to cancel the job.
Definition JobResponse.cs:7
Routes to a server actions.
Definition Routes.cs:9
static string SetID(string route, long id)
Apply an id postfix to a route .
static string ListRoute(string route)
Get the /List postfix for a route .
const string DreamMaker
The deployment controller.
Definition Routes.cs:98
DreamMakerClient(IApiClient apiClient, Instance instance)
Initializes a new instance of the DreamMakerClient class.
ValueTask< JobResponse > Compile(CancellationToken cancellationToken)
Compile the current repository revision.A ValueTask<TResult> resulting in the JobResponse for the com...
ValueTask< List< CompileJobResponse > > ListCompileJobs(PaginationSettings? paginationSettings, CancellationToken cancellationToken)
Gets the CompileJobResponses for the instance.A ValueTask<TResult> resulting in a List<T> of CompileJ...
ValueTask< CompileJobResponse > GetCompileJob(EntityId compileJob, CancellationToken cancellationToken)
Get a compileJob .A ValueTask<TResult> resulting in the CompileJobResponse.
ValueTask< DreamMakerResponse > Read(CancellationToken cancellationToken)
Get the DreamMakerResponse.A ValueTask<TResult> resulting in the DreamMakerResponse.
readonly Instance instance
The Instance for the DreamMakerClient.
ValueTask< DreamMakerResponse > Update(DreamMakerRequest dreamMaker, CancellationToken cancellationToken)
Updates the Api.Models.Internal.DreamMakerSettings.A ValueTask representing the running operation.
Client that deals with getting paginated results.
Settings for a paginated request.
Web interface for the API.
Definition IApiClient.cs:17