當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript http-service.request函數代碼示例

本文整理匯總了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" })));
}
開發者ID:dcos,項目名稱:dcos-ui,代碼行數:7,代碼來源:MetronomeClient.ts

示例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));
       }
     })
   )
開發者ID:dcos,項目名稱:dcos-ui,代碼行數:28,代碼來源:CosmosClient.ts

示例3: fetchJobs

export function fetchJobs(): Observable<RequestResponse<JobResponse[]>> {
  return request(
    `${
      Config.metronomeAPI
    }/v1/jobs?embed=activeRuns&embed=schedules&embed=historySummary`
  );
}
開發者ID:dcos,項目名稱:dcos-ui,代碼行數:7,代碼來源:MetronomeClient.ts

示例4:

 fetchVersion: (
   rootUrl: string = "/"
 ): Observable<RequestResponse<UIVersionResponse>> => {
   return request<UIVersionResponse>(
     `${rootUrl}dcos-ui-update-service/api/v1/version/`
   ).pipe(tap(handleBadResponses));
 },
開發者ID:dcos,項目名稱:dcos-ui,代碼行數:7,代碼來源:DCOSUIUpdateClient.ts

示例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" })));
}
開發者ID:dcos,項目名稱:dcos-ui,代碼行數:9,代碼來源:MetronomeClient.ts

示例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: "{}" }
  );
}
開發者ID:dcos,項目名稱:dcos-ui,代碼行數:9,代碼來源:MetronomeClient.ts

示例7: fetchJobDetail

export function fetchJobDetail(
  jobID: string
): Observable<RequestResponse<JobDetailResponse>> {
  return request(
    `${
      Config.metronomeAPI
    }/v1/jobs/${jobID}?embed=activeRuns&embed=history&embed=schedules`
  );
}
開發者ID:dcos,項目名稱:dcos-ui,代碼行數:9,代碼來源:MetronomeClient.ts

示例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 }
  );
}
開發者ID:dcos,項目名稱:dcos-ui,代碼行數:11,代碼來源:MetronomeClient.ts


注:本文中的@dcos/http-service.request函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。