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


TypeScript ApiService.API類代碼示例

本文整理匯總了TypeScript中core/api/ApiService.API的典型用法代碼示例。如果您正苦於以下問題:TypeScript API類的具體用法?TypeScript API怎麽用?TypeScript API使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了API類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: 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

示例2: 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

示例3:

 return $q((resolve, reject) => {
   API.one('v2')
     .one('pipelineTemplates')
     .one('create')
     .post(template)
     .then(resolve, reject);
 });
開發者ID:emjburns,項目名稱:deck,代碼行數:7,代碼來源:PipelineTemplateWriter.ts

示例4: 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

示例5: getManifest

 public static getManifest(account: string, location: string, name: string): IPromise<IManifest> {
   return API.all('manifests')
     .all(account)
     .all(location)
     .one(name)
     .get();
 }
開發者ID:emjburns,項目名稱:deck,代碼行數:7,代碼來源:ManifestReader.ts

示例6: 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

示例7:

 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

示例8: 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

示例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: getJobConfig

 public static getJobConfig(master: string, job: string): IPromise<IJobConfig> {
   return API.one('v2')
     .one('builds')
     .one(master)
     .one('jobs')
     .one(job)
     .get();
 }
開發者ID:mizzy,項目名稱:deck,代碼行數:8,代碼來源:igor.service.ts


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