Skip to content

Commit

Permalink
Add GET /v2/Jobs/Standby
Browse files Browse the repository at this point in the history
  • Loading branch information
C9Glax committed Oct 19, 2024
1 parent a88b85e commit 26b2910
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions Tranga/Server/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public Server(Tranga parent) : base(parent)
new ("GET", @"/v2/Jobs/Running", GetV2JobsRunning),
new ("GET", @"/v2/Jobs/Waiting", GetV2JobsWaiting),
new ("GET", @"/v2/Jobs/Monitoring", GetV2JobsMonitoring),
new ("GET", @"/v2/Jobs/Standby", GetV2JobsStandby),
new ("GET", @"/v2/Job/Types", GetV2JobTypes),
new ("POST", @"/v2/Job/Create/([a-zA-Z]+)", PostV2JobCreateType),
new ("GET", @"/v2/Job", GetV2Job),
Expand Down
7 changes: 7 additions & 0 deletions Tranga/Server/v2Jobs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ public partial class Server
.Select(job => job.id));
}

private ValueTuple<HttpStatusCode, object?> GetV2JobsStandby(GroupCollection groups, Dictionary<string, string> requestParameters)
{
return new ValueTuple<HttpStatusCode, object?>(HttpStatusCode.OK, _parent.jobBoss.jobs
.Where(job => job.progressToken.state is ProgressToken.State.Standby)
.Select(job => job.id));
}

private ValueTuple<HttpStatusCode, object?> GetV2JobsMonitoring(GroupCollection groups, Dictionary<string, string> requestParameters)
{
return new ValueTuple<HttpStatusCode, object?>(HttpStatusCode.OK, _parent.jobBoss.jobs
Expand Down
10 changes: 10 additions & 0 deletions docs/API_Calls_v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,16 @@ Returns all Waiting Jobs as IDs.
List of JobIds.
</details>

### <sub>![GET](https://img.shields.io/badge/GET-0f0)</sub> `/v2/Jobs/Standby`

Returns all Standby Jobs as IDs.

<details>
<summary>Returns</summary>

List of JobIds.
</details>

### <sub>![GET](https://img.shields.io/badge/GET-0f0)</sub> `/v2/Jobs/Monitoring`

Returns all Monitoring Jobs as IDs.
Expand Down

0 comments on commit 26b2910

Please sign in to comment.