当前位置: 首页>>代码示例>>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;未经允许,请勿转载。