本文整理汇总了TypeScript中helpers/api_request_builder.ApiResult类的典型用法代码示例。如果您正苦于以下问题:TypeScript ApiResult类的具体用法?TypeScript ApiResult怎么用?TypeScript ApiResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ApiResult类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: expect
const onResponse = jasmine.createSpy().and.callFake((response: ApiResult<any>) => {
const responseJSON = response.unwrap() as SuccessResponse<any>;
expect(responseJSON.body.object.id()).toEqual("cluster_1");
expect(responseJSON.body.object.pluginId()).toEqual("plugin_1");
expect(response.getEtag()).toEqual("some-etag");
done();
});
示例2: expect
const onResponse = jasmine.createSpy().and.callFake((response: ApiResult<any>) => {
// @ts-ignore
const serverBackup = response.unwrap().body as ServerBackup;
expect(serverBackup.time.toISOString()).toBe(new Date("2019-02-28T06:46:57Z").toISOString());
expect(serverBackup.isInProgress()).toBe(true);
expect(serverBackup.username).toBe("admin");
expect(serverBackup.message).toBe("Backing up Config.");
done();
});
示例3: resolve
DataSharingNotificationPermission.get().then((apiResponse: ApiResult<DataSharingNotificationPermission>) => {
apiResponse.do((successResponse) => {
const permissions = successResponse.body;
if (permissions.showNotification()) {
if (existingDataSharingNotification !== undefined) {
const message = "GoCDâs shared data has been updated to include new metrics.";
const link = "/go/admin/data_sharing/settings";
const type = "DataSharing_v18.8.0";
SystemNotifications.notifyNewMessage(type, message, link, "Learn more ...");
} else {
const message = "GoCD shares data so that it can be improved.";
const link = "/go/admin/data_sharing/settings";
const type = "DataSharing_v18.8.0";
SystemNotifications.notifyNewMessage(type, message, link, "Learn more ...");
}
}
resolve({});
}, reject);
});
示例4: expect
const onResponse = jasmine.createSpy().and.callFake((response: ApiResult<any>) => {
const responseJSON = response.unwrap() as SuccessResponse<any>;
expect(responseJSON.body).toEqual(userJSON);
done();
});
示例5: expect
const onResponse = jasmine.createSpy().and.callFake((response: ApiResult<string>) => {
const responseJSON = response.unwrap() as SuccessResponse<any>;
expect(responseJSON.body.message).toEqual(`Secret Configuration ${secretConfig.id()} was deleted successfully!`);
expect(response.getEtag()).toEqual("some-etag");
});
示例6: expect
const onResponse = jasmine.createSpy().and.callFake((response: ApiResult<any>) => {
const responseJSON = response.unwrap() as SuccessResponse<any>;
expect(responseJSON.body.object.description()).toEqual(accessToken.description());
expect(responseJSON.body.etag).toEqual("some-etag");
done();
});
示例7: expect
const onResponse = jasmine.createSpy().and.callFake((response: ApiResult<ClusterProfiles>) => {
const responseJSON = response.unwrap() as SuccessResponse<ClusterProfiles>;
expect((responseJSON.body as ClusterProfiles)).toHaveLength(2);
done();
});