export type GetApiApiV2BscWebhooksArgs = {'X-Network'?: ('testnet' | 'mainnet') | undefined, Authorization: string, 'Content-Type'?: ('application/json' | 'application/x-www-form-urlencoded' | 'multipart/form-data') | undefined}; export type GetApiApiV2BscWebhooksOptions = {baseUrl?: string | undefined, defaultValue?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get all webhooks * * GET /api/v2/bsc/webhooks */ export const getApiApiV2BscWebhooks = async (args: GetApiApiV2BscWebhooksArgs, options?: GetApiApiV2BscWebhooksOptions) => { const {baseUrl = "https://app.chaingateway.io", fetch: fetchFn = fetch, defaultValue} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-Network'] != null) headers.set("X-Network", String(args['X-Network'])) if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) if (args['Content-Type'] != null) headers.set("Content-Type", String(args['Content-Type'])) if (defaultValue !== undefined) headers.set('authorization', `Bearer ${defaultValue}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/bsc/webhooks${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };