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


TypeScript api_request_builder.ApiResult類代碼示例

本文整理匯總了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();
 });
開發者ID:GaneshSPatil,項目名稱:gocd,代碼行數:7,代碼來源:cluster_profiles_crud_spec.ts

示例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();
 });
開發者ID:GaneshSPatil,項目名稱:gocd,代碼行數:9,代碼來源:server_backup_api_spec.ts

示例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);
        });
開發者ID:GaneshSPatil,項目名稱:gocd,代碼行數:21,代碼來源:data_sharing_notification.ts

示例4: expect

 const onResponse = jasmine.createSpy().and.callFake((response: ApiResult<any>) => {
   const responseJSON = response.unwrap() as SuccessResponse<any>;
   expect(responseJSON.body).toEqual(userJSON);
   done();
 });
開發者ID:Skarlso,項目名稱:gocd,代碼行數:5,代碼來源:users_crud_spec.ts

示例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");
 });
開發者ID:,項目名稱:,代碼行數:5,代碼來源:

示例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();
 });
開發者ID:GaneshSPatil,項目名稱:gocd,代碼行數:6,代碼來源:access_token_crud_spec.ts

示例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();
 });
開發者ID:GaneshSPatil,項目名稱:gocd,代碼行數:5,代碼來源:cluster_profiles_crud_spec.ts


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