当前位置: 首页>>代码示例>>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;未经允许,请勿转载。