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


TypeScript HttpClient.createRequest方法代碼示例

本文整理匯總了TypeScript中aurelia-http-client.HttpClient.createRequest方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript HttpClient.createRequest方法的具體用法?TypeScript HttpClient.createRequest怎麽用?TypeScript HttpClient.createRequest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在aurelia-http-client.HttpClient的用法示例。


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

示例1: getMicrosoftLoginUrl

 public getMicrosoftLoginUrl(redirectUrl: string) : Promise<string> {
     return this.httpClient
         .createRequest(`Authentication/Login/Microsoft/Url?redirectUrl=${encodeURIComponent(redirectUrl)}`)
         .asGet()
         .send()
         .then(response => response.content.url)
         .catch(response => Promise.reject(response.content.message));
 }
開發者ID:LeagueLogbook,項目名稱:LogbookWebsite,代碼行數:8,代碼來源:authentication-api.ts

示例2: getSummoners

 public getSummoners(token: JsonWebTokenModel): Promise<Summoner[]> {
     return this.httpClient
         .createRequest("Summoners")
         .asGet()
         .withHeader("Authorization", `Bearer ${token.token}`)
         .send()
         .then(response => response.content)
         .catch(response => Promise.reject(response.content.message));
 }
開發者ID:LeagueLogbook,項目名稱:LogbookWebsite,代碼行數:9,代碼來源:summoners-api.ts

示例3: sendRequest

    private sendRequest(url: string): Promise<any[]> {
        return this.http.createRequest(url).asGet().send().then(
            data => {
                if (data.statusCode === 200) {
                    var obj: any = JSON.parse(data.response);
                    console.log(obj.value);
                    return obj.value;
                }

                return data;
            });
    }
開發者ID:t0ms3n,項目名稱:SoftwareManager,代碼行數:12,代碼來源:lookup-service.ts

示例4: loginFacebook

 public loginFacebook(code: string, redirectUrl: string) : Promise<JsonWebTokenModel> {
     let content = {
         code: code,
         redirectUrl: redirectUrl,
     };
     
     return this.httpClient
         .createRequest("Authentication/Login/Facebook")
         .asPost()
         .withContent(content)
         .send()
         .then(response => response.content)
         .catch(response => Promise.reject(response.content.message));
 }
開發者ID:LeagueLogbook,項目名稱:LogbookWebsite,代碼行數:14,代碼來源:authentication-api.ts

示例5: loginLogbook

 public loginLogbook(emailAddress: string, password: string) : Promise<JsonWebTokenModel> {
     let body = {
         emailAddress: emailAddress,
         passwordSHA256Hash: crypto.SHA256(password).toString(crypto.enc.Base64),
     };
     
     return this.httpClient
         .createRequest("Authentication/Login/Logbook")
         .asPost()
         .withContent(body)
         .send()
         .then(response => response.content)
         .catch(response => Promise.reject(response.content.message));
 }
開發者ID:LeagueLogbook,項目名稱:LogbookWebsite,代碼行數:14,代碼來源:authentication-api.ts

示例6: loginTwitter

 public loginTwitter(oauthVerifier: string, payload: string) : Promise<JsonWebTokenModel> {
     let content = {
         oauthVerifier: oauthVerifier,
         payload: payload,
     };
     
     return this.httpClient
         .createRequest("Authentication/Login/Twitter")
         .asPost()
         .withContent(content)
         .send()
         .then(response => response.content)
         .catch(response => Promise.reject(response.content.message));
 }
開發者ID:LeagueLogbook,項目名稱:LogbookWebsite,代碼行數:14,代碼來源:authentication-api.ts

示例7: deleteSummoner

 public deleteSummoner(region: string, summonerId: number, token: JsonWebTokenModel): Promise<Summoner[]> {
     let body = {
         region: region,
         summonerId: summonerId,
     };
     
     return this.httpClient
         .createRequest("Summoners")
         .asDelete()
         .withHeader("Authorization", `Bearer ${token.token}`)
         .withContent(body)
         .send()
         .then(response => response.content)
         .catch(response => Promise.reject(response.content.message));
 }
開發者ID:LeagueLogbook,項目名稱:LogbookWebsite,代碼行數:15,代碼來源:summoners-api.ts

示例8: register

    public register(emailAddress: string, password: string, language: string) : Promise<void> {
        let body = {
            emailAddress: emailAddress,
            passwordSHA256Hash: crypto.SHA256(password).toString(crypto.enc.Base64),
            preferredLanguage: language,
        };

        return this.httpClient
            .createRequest("Authentication/Register")
            .asPost()
            .withContent(body)
            .send()
            .then(response => null)
            .catch(response => Promise.reject(response.content.message));
    }
開發者ID:LeagueLogbook,項目名稱:LogbookWebsite,代碼行數:15,代碼來源:authentication-api.ts

示例9: Promise

    return new Promise((resolve) => {
      let requestPromise = this.httpClient.createRequest(this.api.update)
        .withContent(this.serializeModelData(models))
        .send();

      requestPromise.then(response => {
        resolve({
          type: 'delete',
          success: true,
          data: this.getReader().read(response.content).data
        });
      });

      requestPromise.catch(() => {
        resolve({
          type: 'delete',
          success: false
        });
      });
    });
開發者ID:black-tree,項目名稱:data,代碼行數:20,代碼來源:http-adapter.ts

示例10: reportPost

  reportPost(id: number) {
    this.ea.publish(new ApiStatus('Reporting Post', { status: 'info' }));
    this.isRequesting = true;

    return this.http.createRequest(`https://api.app.net/posts/${id}/report`)
      .asPost()
      .withHeader('Authorization', 'Bearer ' + this.state.token)
      .withHeader('Content-Type', 'application/json')
      .send()
      .then((response: any) => {
        this.meta = response.content.meta;
        this.isRequesting = false;
        this.ea.publish(new ApiStatus('Post Reported', { status: 'success' }));
        return response.content.data;

      }).catch((err: any) => {
        this.isRequesting = false;
        this.ea.publish(new ApiStatus('Unable to report post', { status: 'error' }));
        return {};
      });
  }
開發者ID:mttmccb,項目名稱:dark_social,代碼行數:21,代碼來源:adn-api.ts


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