当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript API.one方法代码示例

本文整理汇总了TypeScript中core/api/ApiService.API.one方法的典型用法代码示例。如果您正苦于以下问题:TypeScript API.one方法的具体用法?TypeScript API.one怎么用?TypeScript API.one使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core/api/ApiService.API的用法示例。


在下文中一共展示了API.one方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: waitUntilTaskIsDeleted

 private static waitUntilTaskIsDeleted(taskId: string): IPromise<void> {
   // wait until the task is gone, i.e. the promise from the get() is rejected, before succeeding
   const deferred = $q.defer<void>();
   API.one('tasks', taskId)
     .get()
     .then(
       () => {
         $timeout(
           () => {
             // task is still present, try again
             this.waitUntilTaskIsDeleted(taskId).then(() => deferred.resolve());
           },
           1000,
           false,
         );
       },
       (resp: IHttpPromiseCallbackArg<any>) => {
         if (resp.status === 404) {
           // task is no longer present
           deferred.resolve();
         } else {
           $timeout(
             () => {
               // task is maybe still present, try again
               this.waitUntilTaskIsDeleted(taskId).then(deferred.resolve);
             },
             1000,
             false,
           );
         }
       },
     );
   return deferred.promise;
 }
开发者ID:mizzy,项目名称:deck,代码行数:34,代码来源:task.write.service.ts

示例2:

 this.accounts$ = Observable.defer(() => {
   const promise = API.one('credentials')
     .useCache()
     .withParams({ expand: true })
     .get();
   return Observable.fromPromise<IAccountDetails[]>(promise);
 })
开发者ID:emjburns,项目名称:deck,代码行数:7,代码来源:AccountService.ts

示例3: getFallbackResults

  public static search<T extends ISearchResult>(
    searchParams: ISearchParams,
    cache: ICache = null,
  ): IPromise<ISearchResults<T>> {
    const defaultParams: ISearchParams = {
      pageSize: SearchService.DEFAULT_PAGE_SIZE,
    };

    const params = { ...searchParams, ...defaultParams };

    const requestBuilder = API.one('search').withParams(params);

    if (cache) {
      requestBuilder.useCache(cache);
    }

    return requestBuilder
      .get()
      .then((response: Array<ISearchResults<T>>) => {
        return response[0] || getFallbackResults();
      })
      .catch((response: IHttpPromiseCallbackArg<any>) => {
        $log.error(response.data, response);
        return getFallbackResults();
      });
  }
开发者ID:emjburns,项目名称:deck,代码行数:26,代码来源:search.service.ts

示例4: getInstanceDetails

 public static getInstanceDetails(account: string, region: string, id: string): IPromise<IInstance> {
   return API.one('instances')
     .one(account)
     .one(region)
     .one(id)
     .get();
 }
开发者ID:emjburns,项目名称:deck,代码行数:7,代码来源:InstanceReader.ts

示例5: listJobsForMaster

 public static listJobsForMaster(master: string): IPromise<string[]> {
   return API.one('v2')
     .one('builds')
     .one(master)
     .one('jobs')
     .get();
 }
开发者ID:mizzy,项目名称:deck,代码行数:7,代码来源:igor.service.ts

示例6:

 return $q((resolve, reject) => {
   API.one('v2')
     .one('pipelineTemplates')
     .one('create')
     .post(template)
     .then(resolve, reject);
 });
开发者ID:emjburns,项目名称:deck,代码行数:7,代码来源:PipelineTemplateWriter.ts

示例7: getAllSecurityGroups

 public getAllSecurityGroups(): IPromise<ISecurityGroupsByAccountSourceData> {
   // Because these are cached in local storage, we unfortunately need to remove the moniker, as it triples the size
   // of the object being stored, which blows out our LS quota for a sufficiently large footprint
   const cache = InfrastructureCaches.get('securityGroups');
   const cached = !!cache ? cache.get('allGroups') : null;
   if (cached) {
     return this.$q.resolve(cached);
   }
   return API.one('securityGroups')
     .useCache()
     .get()
     .then((groupsByAccount: ISecurityGroupsByAccountSourceData) => {
       Object.keys(groupsByAccount).forEach(account => {
         Object.keys(groupsByAccount[account]).forEach(provider => {
           Object.keys(groupsByAccount[account][provider]).forEach(region => {
             groupsByAccount[account][provider][region].forEach(group => {
               delete group.moniker;
             });
           });
         });
       });
       if (cache) {
         cache.put('allGroups', groupsByAccount);
       }
       return groupsByAccount;
     });
 }
开发者ID:mizzy,项目名称:deck,代码行数:27,代码来源:securityGroupReader.service.ts

示例8: listPipelinesForTeam

 public static listPipelinesForTeam(master: string, team: string): IPromise<string[]> {
   return API.one('concourse')
     .one(master)
     .one('teams')
     .one(team)
     .one('pipelines')
     .get();
 }
开发者ID:spinnaker,项目名称:deck,代码行数:8,代码来源:concourse.service.ts

示例9: getArtifactNames

 public static getArtifactNames(type: string, accountName: string): IPromise<string[]> {
   return API.one('artifacts')
     .one('account')
     .one(accountName)
     .one('names')
     .withParams({ type: type })
     .get();
 }
开发者ID:emjburns,项目名称:deck,代码行数:8,代码来源:ArtifactService.ts

示例10: listBuildsForJob

 public static listBuildsForJob(master: string, job: string): IPromise<IBuild[]> {
   return API.one('v2')
     .one('builds')
     .one(master)
     .one('builds')
     .one(job)
     .get();
 }
开发者ID:mizzy,项目名称:deck,代码行数:8,代码来源:igor.service.ts


注:本文中的core/api/ApiService.API.one方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。