export type GetApiApiV2MeShipmentAppSettingsArgs = {Accept: string, Authorization: string, 'User-Agent': string}; export type GetApiApiV2MeShipmentAppSettingsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Listar informações de aplicativo * * GET /api/v2/me/shipment/app-settings */ export const getApiApiV2MeShipmentAppSettings = async (args: GetApiApiV2MeShipmentAppSettingsArgs, options?: GetApiApiV2MeShipmentAppSettingsOptions) => { const {baseUrl = "https://sandbox.melhorenvio.com.br", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.Accept != null) headers.set("Accept", String(args.Accept)) if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) if (args['User-Agent'] != null) headers.set("User-Agent", String(args['User-Agent'])) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/me/shipment/app-settings${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 (await res.json()) as unknown };