本文整理匯總了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();
});