本文整理汇总了TypeScript中request-promise-native.get函数的典型用法代码示例。如果您正苦于以下问题:TypeScript get函数的具体用法?TypeScript get怎么用?TypeScript get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
return new Promise<Post>((ok, ko) => {
let params: any = {
timestamp: timestamp
};
let reqPath = path.join('/v1/server/posts', timestamp.toString());
let url = source + reqPath;
if(idtoken && sigtoken) {
params.idToken = idtoken;
let signature = utils.computeSignature('GET', url, params, sigtoken);
url += '?idToken=' + idtoken
url += '&signature=' + signature;
}
// We'll use HTTP only for localhost
if(url.indexOf('localhost') < 0 && !commons.settings.forceHttp) url = 'https://' + url;
else url = 'http://' + url
log.debug('Requesting GET ' + url);
request.get(url, {timeout: commons.settings.timeout})
.then((response) => {
log.debug('Received a post from ' + source);
ok(JSON.parse(response));
}).catch(ko);
})
开发者ID:JosephCaillet,项目名称:cozy-vinimay,代码行数:26,代码来源:postUtils.ts
示例2: icb
(x: string, icb) => {
const url = this.baseUrl + '/fee/' + x;
this.request
.get(url, {})
.then(ret => {
try {
ret = JSON.parse(ret);
// only process right responses.
if (!_.isUndefined(ret.blocks) && ret.blocks != x) {
log.info(`Ignoring response for ${x}:` + JSON.stringify(ret));
return icb();
}
result[x] = ret.feerate;
} catch (e) {
log.warn('fee error:', e);
}
return icb();
})
.catch(err => {
return icb(err);
});
},
开发者ID:bitpay,项目名称:bitcore,代码行数:25,代码来源:v8.ts
示例3: verifyUUIDisNew
public async verifyUUIDisNew(): Promise<boolean> {
const options = {
uri: `https://api.bespoken.link/pipe/${ this._secretKey }`,
headers: {
"x-access-token": "4772616365-46696f72656c6c61",
},
body: {
},
json: true, // Automatically parses the JSON string in the response
timeout: 30000
};
try {
await get(options);
} catch (error) {
if (error.statusCode && error.statusCode !== 404) {
// different kind of error, we log and throw
LoggingHelper.error(Logger, `Error while verifying id: ${ error.message }`);
throw error;
}
// uuid doesn't exist
return true;
}
return false;
};
开发者ID:bespoken,项目名称:bst,代码行数:27,代码来源:spokes.ts
示例4: getAddressTxos
async getAddressTxos(params) {
const { unspent, address } = params;
const args = unspent ? `?unspent=${unspent}` : '';
const url = `${this.baseUrl}/address/${address}${args}`;
return request.get(url, {
json: true
});
}
开发者ID:bitpay,项目名称:bitcore,代码行数:8,代码来源:client.ts
示例5: callService
public async callService() {
const options = {
uri: "https://source-api.bespoken.tools/v1/sourceId",
json: true,
timeout: 30000
};
return get(options);
};
开发者ID:bespoken,项目名称:bst,代码行数:8,代码来源:source-name-generator.ts
示例6: getTx
async getTx(params) {
const { txid } = params;
const url = `${this.baseUrl}/tx/${txid}`;
console.log('[client.js.59:url:]', url); // TODO
return request.get(url, {
json: true
});
}
开发者ID:bitpay,项目名称:bitcore,代码行数:8,代码来源:client.ts
示例7: getRank
getRank(id: number): Promise<Score> {
return request.get(Configuration.ServerWithApiUrl + id).then(result => {
let json = JSON.parse(result)[0];
return Score.FromJson(json);
}).catch((err) => {
console.error(err);
return err;
});
}
开发者ID:jpoon,项目名称:flappy-bird-muzik,代码行数:9,代码来源:leaderboard.ts
示例8: postScore
postScore(username: string, score: number): Promise<Score> {
return request.get(Configuration.ServerWithApiUrl + 'create?username=' + username + '&score=' + score).then(result => {
let json = JSON.parse(result);
return Score.FromJson(json);
}).catch((err) => {
console.error(err);
return err;
});
}
开发者ID:jpoon,项目名称:flappy-bird-muzik,代码行数:9,代码来源:leaderboard.ts
示例9: if
http.createServer((req, resp) => {
if (req.url === '/doodle.png') {
if (req.method === 'PUT') {
req.pipe(rpn.put('http://mysite.com/doodle.png'));
} else if (req.method === 'GET' || req.method === 'HEAD') {
rpn.get('http://mysite.com/doodle.png').pipe(resp);
}
}
});
开发者ID:Crevil,项目名称:DefinitelyTyped,代码行数:9,代码来源:request-promise-native-tests.ts
示例10: getCheckData
async getCheckData(params) {
const { payload, pubKey } = params;
const url = `${this.baseUrl}/wallet/${pubKey}/check`;
console.log('WALLET CHECK ', url); // TODO
const signature = this.sign({ method: 'GET', url, payload });
return request.get(url, {
headers: { 'x-signature': signature },
body: payload,
json: true
});
}
开发者ID:bitpay,项目名称:bitcore,代码行数:11,代码来源:client.ts
注:本文中的request-promise-native.get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论