本文整理汇总了TypeScript中urijs.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: URI
#!/usr/bin/env node
import request from 'request-promise';
import URI from 'urijs';
import program from 'commander';
import Bluebird from 'bluebird';
const CONCURRENCY = 5;
const SENTRY_API_TOKEN = process.env.SENTRY_API_TOKEN;
const BASE_URI = URI('https://sentry.io/api/0/');
let eventId = 0;
program
.version('3.0.0')
.usage('[options] <event_id>')
.arguments('<event_id>')
.action(event_id => {
eventId = event_id;
})
.option('-p, --pages [pages]', 'number of pages to fetch. defaults to 1', parseInt)
.option('-o, --organisation [organisation]', 'organisation. required for extended events')
.option('-n, --project-name [project-name]', 'project name. required for extended events')
.option('-x, --extended-event', 'enable extended event')
.parse(process.argv);
validate();
getSentryEventData()
.then(JSON.stringify)
.then(console.log)
示例2: fetchPrograms
public async fetchPrograms(queryOptions: ApiRequestPrograms = {}): Promise<ApiResponsePrograms> {
const url =
URI(API_URL)
.segment('programs')
.segment('items')
.suffix('json')
.query(this.queryParamsWithCredentials(queryOptions))
.toString()
const response = await this.fetcher(url)
return this.retrieveJSONOrError(response)
}
示例3: trackStreamStart
public async trackStreamStart(programId: string, mediaId: string): Promise<void> {
const url =
URI(API_URL)
.segment('tracking')
.segment('streamstart')
.query(this.queryParamsWithCredentials({
program_id: programId,
media_id: mediaId
}))
.toString()
const response = await this.fetcher(url)
if (!response.ok) {
return Promise.reject(`Track stream failed: ${response.status} ${response.statusText}`)
}
}
示例4: getImageUrl
public getImageUrl(
programImageId: string,
format: CloudinaryImageFormat = 'jpg',
transformations?: CloudinaryImageTransformations
): string {
let url = URI(IMAGES_URL)
if (transformations) {
url = url.segment(makeImageTransformationString(transformations))
}
return (
url
.segment(programImageId)
.suffix(format)
.toString()
)
}
示例5: fetchPlayouts
public async fetchPlayouts(
programId: string,
mediaId: string,
protocol: PlayoutProtocol,
decryptMediaUrls = true
): Promise<ApiResponseMediaPlayouts> {
const decryptKey = this.apiAuth.decryptKey
if (decryptMediaUrls && !decryptKey) {
const decryptKeyMissingError = () => {
throw new Error('Missing media decryption key')
}
throw decryptKeyMissingError
}
const url =
URI(API_URL)
.segment('media')
.segment('playouts')
.suffix('json')
.query(this.queryParamsWithCredentials({
program_id: programId,
media_id: mediaId,
protocol
}))
.toString()
const maybeDecryptMediaUrls = (playouts: ApiResponseMediaPlayouts) => {
if (!decryptMediaUrls) {
return playouts
} else {
return this.decryptMediaUrls(playouts, this.apiAuth.decryptKey as string)
}
}
const response = await this.fetcher(url)
return this
.retrieveJSONOrError(response)
.then(maybeDecryptMediaUrls)
}