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

TypeScript unirest.get函数代码示例

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

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



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

示例1: searchEvents

		public searchEvents(options : searchEventOptions, 
			callback : (err: any, data: searchEventResults) => void)
		{
			var request = this.base_url + 'events/search?app_key='+ this.app_key;

			for(var i in options){
				
				request += '&';
				
				request += i + '=' + options[i];
			}
			
			unirest.get(request, (response : any, err : any) => {
				
				if(err){
					return callback(err, null);
				}

				xml2js.parseString(response.body, {explicitArray : false}, (err: any, parsed: any) => {
					
					if(err){
						return callback(err, null);
					}
					
					return callback(null, parsed);
				});
				
			});
			
		}
开发者ID:sedouard,项目名称:eventful-node,代码行数:30,代码来源:eventful-node.ts


示例2: MountebankRequestLog

export function MountebankRequestLog(port) {
    let deferred = Q.defer();

    unirest.get('http://localhost:2525/imposters/' + port).end((res) => {
        deferred.resolve(res.body.requests);
    });

    return deferred.promise;
}
开发者ID:njenan,项目名称:turbulence,代码行数:9,代码来源:MountebankRequestLog.ts


示例3: reject

        return new Promise<any>((resolve, reject) => {
            unirest.get(this.userInfoEndpoint).headers({ authorization: `Bearer ${accessToken}`}).as.json(res => {
                if (res.status >= 400) {
                    reject(res);
                } else {
                    resolve(res.body);
                }
            });

        });
开发者ID:workfel,项目名称:vulcain-corejs,代码行数:10,代码来源:expressStsAuthentication.ts


示例4: reject

 return new Promise<WordPress.User>((resolve, reject) => {
     unirest
         .get(`https://www.aliemu.com/wp-json/wp/v2/users/${userID}`)
         .headers(HEADERS)
         .query('context=edit')
         .end(
             res =>
                 res.error
                     ? reject(new Error('Could not retrieve user.'))
                     : resolve(res.body)
         );
 });
开发者ID:AcademicLifeInEM,项目名称:slackbot,代码行数:12,代码来源:aliemu.ts


示例5: resolve

 return new Promise<boolean>((resolve, reject) => {
     if (this.userInfoEndpoint) {
         resolve(true);
     } else {
         const openIdConfigUrl = `${this.authority.value}/.well-known/openid-configuration`;
         unirest.get(openIdConfigUrl).as.json(res => {
             if (res.status >= 400) {
                 reject(res);
             } else {
                 this.userInfoEndpoint = res.body.userinfo_endpoint;
                 resolve(true);
             }
         });
     }
 });
开发者ID:workfel,项目名称:vulcain-corejs,代码行数:15,代码来源:expressStsAuthentication.ts


示例6: listCategories

		public listCategories(callback : (err: any, data: categoryResult[]) => void)
		{
			var request = this.base_url + '/categories/list?app_key='+ this.app_key;
			
			unirest.get(request, (response: any, err: any) => {
			
				if(err){
					return callback(err, null);
				}
				
				xml2js.parseString(response.body, {explicitArray : false}, (err: any, parsed: any) => {
					
					if(err){
						return callback(err, null);
					}
					
					return callback(null, parsed.categories.category);
				});
			});
		}
开发者ID:sedouard,项目名称:eventful-node,代码行数:20,代码来源:eventful-node.ts


示例7: resolve

        return new Promise<DataSource>((resolve) => {
            let uri = this.createRequestUrl();

            try {
                let values: Map<string, ConfigurationItem>;

                let request = rest.get(uri)
                    .headers({ 'Accept': 'application/json' })
                    .timeout(timeoutInMs);

                request = this.prepareRequest(request);

                request.end(function (response) {
                    if (response.status === 200 && response.body) {
                        if (response.body.error) {
                            if (!Service.isDevelopment) {
                                Service.log.info(null, () => `HTTP CONFIG : error when polling properties on ${uri} - ${response.body.error.message}`);
                            }
                        }
                        else {
                            values = new Map<string, ConfigurationItem>();
                            let data = response.body;
                            data.value && data.value.forEach(cfg => values.set(cfg.key, cfg));
                            self.lastUpdate = Service.nowAsString();
                            self.mergeChanges(values);
                        }
                    }
                    else {
                        Service.log.info(null, () => `HTTP CONFIG : error when polling properties on ${uri} - ${(response.error && response.error.message) || response.status}`);
                    }
                    resolve((values && new DataSource(values.values())) || null);
                });
            }
            catch (e) {
                Service.log.info(null, () => `HTTP CONFIG : error when polling properties on ${uri} - ${e.message}`);
                resolve(null);
            }
        });
开发者ID:Zenasoft,项目名称:vulcain-corejs,代码行数:38,代码来源:httpConfigurationSource.ts


示例8: resolve

        return new Promise<PollResult>( ( resolve ) =>
        {
            let uri = this.createRequestUrl();

            try {
                let values;

                let request = rest.get(uri)
                    .headers({ 'Accept': 'application/json' })
                    .timeout(timeoutInMs);

                request = this.prepareRequest(request);

                request.end(function (response) {
                    if (response.status === 200 && response.body) {
                        if (response.body.error) {
                            if (!System.isDevelopment) {
                                System.log.info(null, ()=>`HTTP CONFIG : error when polling properties on ${uri} - ${response.body.error.message}`);
                            }
                        }
                        else {
                            values = new Map<string, ConfigurationItem>();
                            let data = response.body;
                            data.value && data.value.forEach(cfg => values.set(cfg.key, cfg));
                            self.lastUpdate = moment.utc().format();
                        }
                    }
                    else {
                        System.log.info(null, ()=>`HTTP CONFIG : error when polling properties on ${uri} - ${(response.error && response.error.message) || response.status}`);
                    }
                    resolve(values && new PollResult(self, values));
                });
            }
            catch (e) {
                System.log.info(null, ()=>`HTTP CONFIG : error when polling properties on ${uri} - ${e.message}`);
                resolve(null);
            }
        } );
开发者ID:workfel,项目名称:vulcain-corejs,代码行数:38,代码来源:httpConfigurationSource.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript unirest.post函数代码示例发布时间:2022-05-25
下一篇:
TypeScript unicode-properties.getCategory函数代码示例发布时间: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