export type GetApiDeliveryLeadTimesDeliveryLeadTimeIdStockLocationArgs = {deliveryLeadTimeId: string}; export type GetApiDeliveryLeadTimesDeliveryLeadTimeIdStockLocationOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Retrieve the stock location associated to the delivery lead time * * GET /delivery_lead_times/{deliveryLeadTimeId}/stock_location */ export const getApiDeliveryLeadTimesDeliveryLeadTimeIdStockLocation = async (args: GetApiDeliveryLeadTimesDeliveryLeadTimeIdStockLocationArgs, options: GetApiDeliveryLeadTimesDeliveryLeadTimeIdStockLocationOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/delivery_lead_times/${encodeURIComponent(String(args.deliveryLeadTimeId))}/stock_location${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 };