export type SellerRedeemRequest = {amount: number, description?: string | undefined}; export type CreateApiV2SellerSellerIdRedeemsArgs = {sellerId: string, 'X-Token-Api': string, 'Content-Type'?: 'application/json' | undefined, 'x-ip-origin-request'?: string | undefined, 'x-idempotency-key'?: string | undefined, body: SellerRedeemRequest}; export type CreateApiV2SellerSellerIdRedeemsOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Solicitar repasse * * POST /v2/seller/{sellerId}/redeems */ export const createApiV2SellerSellerIdRedeems = async (args: CreateApiV2SellerSellerIdRedeemsArgs, options?: CreateApiV2SellerSellerIdRedeemsOptions) => { const {baseUrl = "https://api.barte.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['X-Token-Api'] != null) headers.set("X-Token-Api", String(args['X-Token-Api'])) if (args['Content-Type'] != null) headers.set("Content-Type", String(args['Content-Type'])) if (args['x-ip-origin-request'] != null) headers.set("x-ip-origin-request", String(args['x-ip-origin-request'])) if (args['x-idempotency-key'] != null) headers.set("x-idempotency-key", String(args['x-idempotency-key'])) if (ApiKeyAuth !== undefined) headers.set("X-Token-Api", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v2/seller/${encodeURIComponent(String(args.sellerId))}/redeems${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };