本文整理匯總了TypeScript中src/services.setURL函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript setURL函數的具體用法?TypeScript setURL怎麽用?TypeScript setURL使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了setURL函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: setURL
export const getUsers = (params?: any, filters?: any) =>
Request<Page<User>>(
setURL(`${API_ROOT}/account/users`),
setMethod('GET'),
setParams(params),
setXFilter(filters)
).then(response => response.data);
示例2: setURL
export const getImages = (params: any = {}, filters: any = {}) =>
Request<Page<Image>>(
setURL(`${API_ROOT}/images`),
setMethod('GET'),
setParams(params),
setXFilter(filters)
).then(response => response.data);
示例3: setURL
export const updateAccountSettings = (data: Partial<Linode.AccountSettings>) =>
Request<Linode.AccountSettings>(
setURL(`${API_ROOT}/account/settings`),
setMethod('PUT'),
setData(data, UpdateAccountSettingsSchema)
)
.then(response => response.data);
示例4: setURL
export const createUser = (data: Partial<User>) =>
Request<User>(
setURL(`${API_ROOT}/account/users`),
setMethod('POST'),
setData(data, CreateUserSchema),
)
.then(response => response.data);
示例5: setURL
export const updateOAuthClient = (clientId: number, data: Partial<OAuthClientRequest>) =>
Request<OAuthClient>(
setURL(`${API_ROOT}/account/oauth-clients/${clientId}`),
setMethod('PUT'),
setData(data, updateOAuthClientSchema),
)
.then(response => response.data);
示例6: setURL
export const makePayment = (data: { usd: string; cvv?: string }) => {
/**
* in the context of APIv4, CVV is optional - in other words, it's totally
* valid to submit a payment without a CVV
*
* BUT if CVV is included in the payload, APIv4 will send an error that CVV must
* have 3-4 characters.
*
* So for example this payload will result in an error
*
* {
* usd: 5,
* cvv: ''
* }
*
* but this is good
*
* {
* usd: 5
* }
*/
if (!data.cvv) {
delete data.cvv;
}
return Request<Linode.Payment>(
setURL(`${API_ROOT}/account/payments`),
setMethod('POST'),
setData(data, PaymentSchema)
).then(response => response.data);
};