當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript services.setMethod函數代碼示例

本文整理匯總了TypeScript中src/services.setMethod函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript setMethod函數的具體用法?TypeScript setMethod怎麽用?TypeScript setMethod使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了setMethod函數的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);
開發者ID:linode,項目名稱:manager,代碼行數:7,代碼來源:users.ts

示例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);
開發者ID:linode,項目名稱:manager,代碼行數:7,代碼來源:images.ts

示例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);
開發者ID:displague,項目名稱:manager,代碼行數:7,代碼來源:account.ts

示例4: setURL

export const createUser = (data: Partial<User>) =>
  Request<User>(
    setURL(`${API_ROOT}/account/users`),
    setMethod('POST'),
    setData(data, CreateUserSchema),
  )
    .then(response => response.data);
開發者ID:displague,項目名稱:manager,代碼行數:7,代碼來源:users.ts

示例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);
開發者ID:displague,項目名稱:manager,代碼行數:7,代碼來源:oauth.ts

示例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);
};
開發者ID:linode,項目名稱:manager,代碼行數:31,代碼來源:payments.ts


注:本文中的src/services.setMethod函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。