本文整理汇总了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;未经允许,请勿转载。 |
请发表评论