-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TM-1531] add job service url and script (#734)
* [TM-1531] add job service url and script * [TM-1531] apiSlice add job resource * [TM-1531] updates for job service * [TM-1531] sort alphabetical * [TM-1527] Update the defaults. --------- Co-authored-by: Nathan Curtis <[email protected]>
- Loading branch information
1 parent
c8778e3
commit 0dceeb4
Showing
7 changed files
with
319 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
/** | ||
* Generated by @openapi-codegen | ||
* | ||
* @version 1.0 | ||
*/ | ||
import type * as Fetcher from "./jobServiceFetcher"; | ||
import { jobServiceFetch } from "./jobServiceFetcher"; | ||
import type * as Schemas from "./jobServiceSchemas"; | ||
|
||
export type ListDelayedJobsError = Fetcher.ErrorWrapper<{ | ||
status: 401; | ||
payload: { | ||
/** | ||
* @example 401 | ||
*/ | ||
statusCode: number; | ||
/** | ||
* @example Unauthorized | ||
*/ | ||
message: string; | ||
/** | ||
* @example Unauthorized | ||
*/ | ||
error?: string; | ||
}; | ||
}>; | ||
|
||
export type ListDelayedJobsResponse = { | ||
data?: { | ||
/** | ||
* @example delayedJobs | ||
*/ | ||
type?: string; | ||
/** | ||
* @format uuid | ||
*/ | ||
id?: string; | ||
attributes?: Schemas.DelayedJobDto; | ||
}; | ||
}; | ||
|
||
/** | ||
* Retrieve a list of all delayed jobs. | ||
*/ | ||
export const listDelayedJobs = (signal?: AbortSignal) => | ||
jobServiceFetch<ListDelayedJobsResponse, ListDelayedJobsError, undefined, {}, {}, {}>({ | ||
url: "/jobs/v3/delayedJobs", | ||
method: "get", | ||
signal | ||
}); | ||
|
||
export type DelayedJobsFindPathParams = { | ||
uuid: string; | ||
}; | ||
|
||
export type DelayedJobsFindError = Fetcher.ErrorWrapper< | ||
| { | ||
status: 401; | ||
payload: { | ||
/** | ||
* @example 401 | ||
*/ | ||
statusCode: number; | ||
/** | ||
* @example Unauthorized | ||
*/ | ||
message: string; | ||
/** | ||
* @example Unauthorized | ||
*/ | ||
error?: string; | ||
}; | ||
} | ||
| { | ||
status: 404; | ||
payload: { | ||
/** | ||
* @example 404 | ||
*/ | ||
statusCode: number; | ||
/** | ||
* @example Not Found | ||
*/ | ||
message: string; | ||
/** | ||
* @example Not Found | ||
*/ | ||
error?: string; | ||
}; | ||
} | ||
>; | ||
|
||
export type DelayedJobsFindResponse = { | ||
data?: { | ||
/** | ||
* @example delayedJobs | ||
*/ | ||
type?: string; | ||
/** | ||
* @format uuid | ||
*/ | ||
id?: string; | ||
attributes?: Schemas.DelayedJobDto; | ||
}; | ||
}; | ||
|
||
export type DelayedJobsFindVariables = { | ||
pathParams: DelayedJobsFindPathParams; | ||
}; | ||
|
||
/** | ||
* Get the current status and potentially payload or error from a delayed job. | ||
*/ | ||
export const delayedJobsFind = (variables: DelayedJobsFindVariables, signal?: AbortSignal) => | ||
jobServiceFetch<DelayedJobsFindResponse, DelayedJobsFindError, undefined, {}, {}, DelayedJobsFindPathParams>({ | ||
url: "/jobs/v3/delayedJobs/{uuid}", | ||
method: "get", | ||
...variables, | ||
signal | ||
}); | ||
|
||
export type BulkUpdateJobsError = Fetcher.ErrorWrapper< | ||
| { | ||
status: 400; | ||
payload: { | ||
/** | ||
* @example 400 | ||
*/ | ||
statusCode: number; | ||
/** | ||
* @example Bad Request | ||
*/ | ||
message: string; | ||
/** | ||
* @example Bad Request | ||
*/ | ||
error?: string; | ||
}; | ||
} | ||
| { | ||
status: 401; | ||
payload: { | ||
/** | ||
* @example 401 | ||
*/ | ||
statusCode: number; | ||
/** | ||
* @example Unauthorized | ||
*/ | ||
message: string; | ||
/** | ||
* @example Unauthorized | ||
*/ | ||
error?: string; | ||
}; | ||
} | ||
| { | ||
status: 404; | ||
payload: { | ||
/** | ||
* @example 404 | ||
*/ | ||
statusCode: number; | ||
/** | ||
* @example Not Found | ||
*/ | ||
message: string; | ||
/** | ||
* @example Not Found | ||
*/ | ||
error?: string; | ||
}; | ||
} | ||
>; | ||
|
||
export type BulkUpdateJobsResponse = { | ||
data?: { | ||
/** | ||
* @example delayedJobs | ||
*/ | ||
type?: string; | ||
/** | ||
* @format uuid | ||
*/ | ||
id?: string; | ||
attributes?: Schemas.DelayedJobDto; | ||
}; | ||
}; | ||
|
||
export type BulkUpdateJobsVariables = { | ||
body: Schemas.DelayedJobBulkUpdateBodyDto; | ||
}; | ||
|
||
/** | ||
* Accepts a JSON:API-compliant payload to bulk update jobs, allowing each job's isAcknowledged attribute to be set to true or false. | ||
*/ | ||
export const bulkUpdateJobs = (variables: BulkUpdateJobsVariables, signal?: AbortSignal) => | ||
jobServiceFetch<BulkUpdateJobsResponse, BulkUpdateJobsError, Schemas.DelayedJobBulkUpdateBodyDto, {}, {}, {}>({ | ||
url: "/jobs/v3/delayedJobs/bulk-update", | ||
method: "patch", | ||
...variables, | ||
signal | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// This type is imported in the auto generated `jobServiceComponents` file, so it needs to be | ||
// exported from this file. | ||
export type { ErrorWrapper } from "../utils"; | ||
|
||
// The serviceFetch method is the shared fetch method for all service fetchers. | ||
export { serviceFetch as jobServiceFetch } from "../utils"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { isFetching, fetchFailed } from "../utils"; | ||
import { ApiDataStore } from "@/store/apiSlice"; | ||
import { DelayedJobsFindPathParams, DelayedJobsFindVariables } from "./jobServiceComponents"; | ||
|
||
export const listDelayedJobsIsFetching = (store: ApiDataStore) => | ||
isFetching<{}, {}>({ store, url: "/jobs/v3/delayedJobs", method: "get" }); | ||
|
||
export const listDelayedJobsFetchFailed = (store: ApiDataStore) => | ||
fetchFailed<{}, {}>({ store, url: "/jobs/v3/delayedJobs", method: "get" }); | ||
|
||
export const delayedJobsFindIsFetching = (variables: DelayedJobsFindVariables) => (store: ApiDataStore) => | ||
isFetching<{}, DelayedJobsFindPathParams>({ store, url: "/jobs/v3/delayedJobs/{uuid}", method: "get", ...variables }); | ||
|
||
export const delayedJobsFindFetchFailed = (variables: DelayedJobsFindVariables) => (store: ApiDataStore) => | ||
fetchFailed<{}, DelayedJobsFindPathParams>({ | ||
store, | ||
url: "/jobs/v3/delayedJobs/{uuid}", | ||
method: "get", | ||
...variables | ||
}); | ||
|
||
export const bulkUpdateJobsIsFetching = (store: ApiDataStore) => | ||
isFetching<{}, {}>({ store, url: "/jobs/v3/delayedJobs/bulk-update", method: "patch" }); | ||
|
||
export const bulkUpdateJobsFetchFailed = (store: ApiDataStore) => | ||
fetchFailed<{}, {}>({ store, url: "/jobs/v3/delayedJobs/bulk-update", method: "patch" }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/** | ||
* Generated by @openapi-codegen | ||
* | ||
* @version 1.0 | ||
*/ | ||
export type DelayedJobDto = { | ||
/** | ||
* The current status of the job. If the status is not pending, the payload and statusCode will be provided. | ||
*/ | ||
status: "pending" | "failed" | "succeeded"; | ||
/** | ||
* If the job is out of pending state, this is the HTTP status code for the completed process | ||
*/ | ||
statusCode: number | null; | ||
/** | ||
* If the job is out of pending state, this is the JSON payload for the completed process | ||
*/ | ||
payload: Record<string, any> | null; | ||
/** | ||
* If the job is in progress, this is the total content to process | ||
*/ | ||
totalContent: number | null; | ||
/** | ||
* If the job is in progress, this is the total content processed | ||
*/ | ||
processedContent: number | null; | ||
/** | ||
* If the job is in progress, this is the progress message | ||
*/ | ||
progressMessage: string | null; | ||
/** | ||
* Indicates whether the jobs have been acknowledged (cleared) | ||
*/ | ||
isAcknowledged: boolean | null; | ||
}; | ||
|
||
export type DelayedJobAttributes = { | ||
/** | ||
* Value to set for isAcknowledged | ||
* | ||
* @example true | ||
*/ | ||
isAcknowledged: boolean; | ||
}; | ||
|
||
export type DelayedJobData = { | ||
/** | ||
* Type of the resource | ||
* | ||
* @example delayedJobs | ||
*/ | ||
type: "delayedJobs"; | ||
/** | ||
* UUID of the job | ||
* | ||
* @format uuid | ||
* @example uuid-1 | ||
*/ | ||
uuid: string; | ||
/** | ||
* Attributes to update for the job | ||
*/ | ||
attributes: DelayedJobAttributes; | ||
}; | ||
|
||
export type DelayedJobBulkUpdateBodyDto = { | ||
/** | ||
* List of jobs to update isAcknowledged | ||
*/ | ||
data: DelayedJobData[]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters