export type DeleteApiV1MarketplaceBilletsIdArgs = {'integration-key': string, 'x-token': string, id: string}; export type DeleteApiV1MarketplaceBilletsIdOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Cancelar boleto * * DELETE /v1/marketplace/billets/{id} */ export const deleteApiV1MarketplaceBilletsId = async (args: DeleteApiV1MarketplaceBilletsIdArgs, options?: DeleteApiV1MarketplaceBilletsIdOptions) => { const {baseUrl = "https://api.sandbox.paytime.com.br", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['integration-key'] != null) headers.set("integration-key", String(args['integration-key'])) if (args['x-token'] != null) headers.set("x-token", String(args['x-token'])) if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/marketplace/billets/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };