本文整理汇总了TypeScript中urijs类的典型用法代码示例。如果您正苦于以下问题:TypeScript urijs类的具体用法?TypeScript urijs怎么用?TypeScript urijs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了urijs类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: URI
export function get<T>(nodeID: number, fields: string): Promise<T> {
let uri = URI('/api').segment(nodeID.toString());
uri.setQuery('authToken', AuthTokenKeeper.getAuthToken());
if (fields) {
uri.setQuery('fields', fields);
}
return axios.get(uri.toString()).then((response): T => {
return response.data as T;
});
}
示例2: getGeneric
export function getGeneric(path: string, params: Map<string, string>) {
let uri = URI('/api').segment(path);
params.set('authToken', AuthTokenKeeper.getAuthToken());
params.forEach((value, key) => {
uri.setQuery(key, value);
});
return axios.get(uri.toString()).then((response) => {
return response.data;
});
}
示例3: many
static many ({ skip = null, limit = null } = {}) {
// TODO: Add check for limit and skip params
const input = URI(`${url}/categories`).query({ skip, limit }).toString()
return makeGetReq(input)
}
示例4: exists
static exists ({ id = undefined, username = undefined }): Promise<boolean> {
// TODO: Add params' values check
if (!id && !username) return Promise.reject(INVALID_PARAMS_ERR)
const input = URI(`${url}/${token()}/exists`).query({ id, username }).toString()
return makeGetReq(input)
}
示例5: one
static one ({ id = undefined, username = undefined }): Promise<Account> {
// TODO: Add permission check
if (!id && !username) return Promise.reject(INVALID_PARAMS_ERR)
const input = URI(`${url}/${token()}/getBio`).query({ id, username }).toString()
return makeGetReq(input)
}