本文整理汇总了TypeScript中@dcos/http-service.request函数的典型用法代码示例。如果您正苦于以下问题:TypeScript request函数的具体用法?TypeScript request怎么用?TypeScript request使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了request函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createSchedule
export function createSchedule(jobID: string, schedule: JobSchedule) {
return request(`${Config.metronomeAPI}/v1/jobs/${jobID}/schedules`, {
method: "POST",
body: JSON.stringify(schedule),
headers: defaultHeaders
}).pipe(catchError(e => throwError({ ...e, type: "SCHEDULE" })));
}
示例2: buildRequestHeader
listPackageVersions: (packageName: string) =>
request<PackageVersionsResponse>(`${rootUrl || "/"}package/list-versions`, {
method: "POST",
body: JSON.stringify({
includePackageVersions: true,
packageName
}),
headers: {
Accept: buildRequestHeader(
"list-versions",
"response",
"package",
"v1"
),
"Content-type": buildRequestHeader(
"list-versions",
"request",
"package",
"v1"
)
}
}).pipe(
tap(requestResponse => {
if (requestResponse.code >= 300) {
throw new Error(getErrorMessage(requestResponse));
}
})
)
示例3: fetchJobs
export function fetchJobs(): Observable<RequestResponse<JobResponse[]>> {
return request(
`${
Config.metronomeAPI
}/v1/jobs?embed=activeRuns&embed=schedules&embed=historySummary`
);
}
示例4:
fetchVersion: (
rootUrl: string = "/"
): Observable<RequestResponse<UIVersionResponse>> => {
return request<UIVersionResponse>(
`${rootUrl}dcos-ui-update-service/api/v1/version/`
).pipe(tap(handleBadResponses));
},
示例5: updateSchedule
export function updateSchedule(
jobID: string,
schedule: JobSchedule
): Observable<RequestResponse<any>> {
return request(
`${Config.metronomeAPI}/v1/jobs/${jobID}/schedules/${schedule.id}`,
{ method: "PUT", headers: defaultHeaders, body: JSON.stringify(schedule) }
).pipe(catchError(e => throwError({ ...e, type: "SCHEDULE" })));
}
示例6: stopJobRun
export function stopJobRun(
jobID: string,
jobRunID: string
): Observable<RequestResponse<any>> {
return request(
`${Config.metronomeAPI}/v1/jobs/${jobID}/runs/${jobRunID}/actions/stop`,
{ headers: defaultHeaders, method: "POST", body: "{}" }
);
}
示例7: fetchJobDetail
export function fetchJobDetail(
jobID: string
): Observable<RequestResponse<JobDetailResponse>> {
return request(
`${
Config.metronomeAPI
}/v1/jobs/${jobID}?embed=activeRuns&embed=history&embed=schedules`
);
}
示例8: deleteJob
export function deleteJob(
jobID: string,
stopCurrentJobRuns = false
): Observable<RequestResponse<any>> {
return request(
`${
Config.metronomeAPI
}/v1/jobs/${jobID}?stopCurrentJobRuns=${stopCurrentJobRuns}`,
{ method: "DELETE", headers: defaultHeaders }
);
}