export type DeleteApiV2InventoryLocationsInventoryLocationIdArgs = {inventory_location_id: string, remove_inventory?: ('0' | '1') | undefined}; export type DeleteApiV2InventoryLocationsInventoryLocationIdOptions = {baseUrl?: string | undefined, apiKeys?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete an inventory location * * DELETE /v2/inventory_locations/{inventory_location_id} */ export const deleteApiV2InventoryLocationsInventoryLocationId = async (args: DeleteApiV2InventoryLocationsInventoryLocationIdArgs, options?: DeleteApiV2InventoryLocationsInventoryLocationIdOptions) => { const {baseUrl = "https://api.shipstation.com", fetch: fetchFn = fetch, apiKeys} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.remove_inventory != null) query.append("remove_inventory", String(args.remove_inventory)) if (apiKeys !== undefined) headers.set("api-key", apiKeys) const url = `${baseUrl.replace(/\/+$/, '')}/v2/inventory_locations/${encodeURIComponent(String(args.inventory_location_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 };