Implement missing IDreamMakerClient functions

This commit is contained in:
Cyberboss
2018-09-14 17:14:32 -04:00
parent 11041f375d
commit bad36be94b
2 changed files with 27 additions and 3 deletions
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Api;
@@ -12,11 +13,12 @@ namespace Tgstation.Server.Client.Components
/// <summary>
/// The <see cref="IApiClient"/> for the <see cref="DreamMakerClient"/>
/// </summary>
private IApiClient apiClient;
readonly IApiClient apiClient;
/// <summary>
/// The <see cref="Instance"/> for the <see cref="DreamMakerClient"/>
/// </summary>
private Instance instance;
readonly Instance instance;
/// <summary>
/// Construct a <see cref="DreamMakerClient"/>
@@ -32,6 +34,12 @@ namespace Tgstation.Server.Client.Components
/// <inheritdoc />
public Task<Job> Compile(CancellationToken cancellationToken) => apiClient.Create<Job>(Routes.DreamMaker, instance.Id, cancellationToken);
/// <inheritdoc />
public Task<CompileJob> GetCompileJob(CompileJob compileJob, CancellationToken cancellationToken) => apiClient.Read<CompileJob>(Routes.SetID(Routes.DreamMaker, compileJob?.Id ?? throw new ArgumentNullException(nameof(compileJob))), instance.Id, cancellationToken);
/// <inheritdoc />
public Task<IReadOnlyList<CompileJob>> GetJobIds(CancellationToken cancellationToken) => apiClient.Read<IReadOnlyList<CompileJob>>(Routes.List(Routes.DreamMaker), instance.Id, cancellationToken);
/// <inheritdoc />
public Task<DreamMaker> Read(CancellationToken cancellationToken) => apiClient.Read<DreamMaker>(Routes.DreamMaker, instance.Id, cancellationToken);
@@ -1,4 +1,5 @@
using System.Threading;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Api.Models;
@@ -30,5 +31,20 @@ namespace Tgstation.Server.Client.Components
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param>
/// <returns>A <see cref="Task{TResult}"/> resulting in the <see cref="Job"/> for the compile</returns>
Task<Job> Compile(CancellationToken cancellationToken);
/// <summary>
/// Gets the <see cref="Api.Models.Internal.CompileJob.Id"/>s of all <see cref="CompileJob"/>s for the instance
/// </summary>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param>
/// <returns>A <see cref="Task{TResult}"/> resulting in a <see cref="IReadOnlyList{T}"/> of <see cref="CompileJob"/>s with only the <see cref="Api.Models.Internal.CompileJob.Id"/> field populated</returns>
Task<IReadOnlyList<CompileJob>> GetJobIds(CancellationToken cancellationToken);
/// <summary>
/// Get a <paramref name="compileJob"/>
/// </summary>
/// <param name="compileJob">The <see cref="CompileJob"/> to get</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param>
/// <returns>A <see cref="Task{TResult}"/> resulting in the <see cref="CompileJob"/></returns>
Task<CompileJob> GetCompileJob(CompileJob compileJob, CancellationToken cancellationToken);
}
}