• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript aurelia-http-client.HttpClient类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中aurelia-http-client.HttpClient的典型用法代码示例。如果您正苦于以下问题:TypeScript HttpClient类的具体用法?TypeScript HttpClient怎么用?TypeScript HttpClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了HttpClient类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: convert

  public convert(): Promise<void> {

      if (!this.rawSql)
          return;

      return this
          .client
          .createRequest("/api/sql/format")
          .asPost()
          .withHeader('Content-Type', 'text/plain')
          .withContent(this.rawSql)
          .send()
          .then(r => {

              var result = JSON.parse(r.response);
              this.formattedSql = result.Sql;
              this.timeTaken = result.Duration;
              this.showFormattedSql = true;
          })
          .catch(r => {

              console.log(r.response);
              this.showNotification({ message: r.response, type: "error" });
              this.showFormattedSql = false;
          });
  }
开发者ID:benlaan,项目名称:sqlformat,代码行数:26,代码来源:app.ts


示例2: getFunnyPosts

 getFunnyPosts() : Promise<IRedditPosts> {
   return this.http.jsonp('http://reddit.com/r/funny.json', 'jsonp')
     .then(response => { 
         this.funny = response.response.data.children;
         return this.funny;
     });
 }
开发者ID:ltrain777,项目名称:skeleton-navigation,代码行数:7,代码来源:redditservice.ts


示例3: getGifPosts

 getGifPosts() : Promise<IRedditPosts> {
   return this.http.jsonp('http://reddit.com/r/gifs.json', 'jsonp')
     .then(response => { 
         this.gifs = response.response.data.children;
         return this.gifs;
     });
 }
开发者ID:ltrain777,项目名称:skeleton-navigation,代码行数:7,代码来源:redditservice.ts


示例4: activate

 activate(params: any) {
     return this.http.get(`/api/schedulers/${params.schedulerName}/jobs/history`).then(response => {
         let model = response.content;
         this.entries = model.historyEntries;
         this.errorMessage = model.errorMessage;
     });
 }
开发者ID:Indifer,项目名称:quartznet,代码行数:7,代码来源:history.ts


示例5: Promise

    return new Promise((resolve) => {

      let requestPromise = this.httpClient.createRequest(this.api.read)
        .withParams(options.params || {})
        .send();

      requestPromise.then(response => {
        let result = this.getReader().read(response.content);
        resolve({
          type: 'read',
          success: true,
          data: result.data,
          total: result.total,
          page: result.page,
          limit: result.limit,
          offset: result.offset
        });
      });

      requestPromise.catch(() => {
        resolve({
          type: 'read',
          success: false
        });
      });
    });
开发者ID:black-tree,项目名称:data,代码行数:26,代码来源:http-adapter.ts


示例6: createPost

  createPost(text: string, options: any) {
    this.ea.publish(new ApiStatus('Creating Post', { status: 'info' }));
    var jsonText = {
      text: text,
      entities: {
        parse_links: true,
        parse_markdown_links: true
      },
      reply_to: 0
    };
    if (options.reply_to) { jsonText.reply_to = options.reply_to; }
    this.isRequesting = true;

    return this.http.configure((x: any) => {
      x.withHeader('Authorization', 'Bearer ' + this.state.token);
      x.withHeader('Content-Type', 'application/json');
    }).post(`https://api.app.net/posts`, jsonText)
      .then((response: any) => {
        this.meta = response.content.meta;
        this.isRequesting = false;
        this.ea.publish(new ApiStatus('Post Created', { status: 'success' }));
        return response.content.data;

      }).catch((err: any) => {
        this.isRequesting = false;
        this.ea.publish(new ApiStatus('Unable to post', { status: 'error' }));
        return {};
      });
  }
开发者ID:mttmccb,项目名称:dark_social,代码行数:29,代码来源:adn-api.ts


示例7: getGoogleLoginUrl

 public getGoogleLoginUrl(redirectUrl: string) : Promise<string> {
     return this.httpClient
         .createRequest(`Authentication/Login/Google/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


示例8: activate

 activate(params: any) {
   var teamId = params.id;
   
   return this.httpClient.get('./team/'+teamId)
     .then(response => {
       this.team = new TeamViewModel(response.content);
     });
   
 }
开发者ID:richardnagle,项目名称:buildjs,代码行数:9,代码来源:team.ts


示例9: nameChanged

 nameChanged(newValue) {
     if (newValue.length > 0) {
         this.httpClient.get('/hello/' + newValue).then((response) => {
             this.result = response.content.Result;
         });
     } else {
         this.result = '';
     }
 }
开发者ID:KevinHoward,项目名称:ServiceStackVS,代码行数:9,代码来源:hello.ts


示例10: 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



注:本文中的aurelia-http-client.HttpClient类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript aurelia-i18n.I18N类代码示例发布时间:2022-05-25
下一篇:
TypeScript aurelia-framework.TaskQueue类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap