export type QPilotCoreModelsShippingCarrier = 'FlatRate' | 'USPS' | 'ShipperHQ'; export type QPilotCoreModelsShippingIntegration = {id?: number | undefined, siteId?: number | undefined, shippingCarrierType: QPilotCoreModelsShippingCarrier, apiKey1: string, apiKey2?: (string | null) | undefined, apiKey3?: (string | null) | undefined, apiKey4?: (string | null) | undefined, isTest: boolean, createdUtc?: string | undefined, updatedUtc?: string | undefined}; export type UpdateApiSitesSiteIdShippingIntegrationsIdArgs = {siteId: number, id: number, body: QPilotCoreModelsShippingIntegration}; export type UpdateApiSitesSiteIdShippingIntegrationsIdOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Shipping Integration * * PUT /Sites/{siteId}/ShippingIntegrations/{id} */ export const updateApiSitesSiteIdShippingIntegrationsId = async (args: UpdateApiSitesSiteIdShippingIntegrationsIdArgs, options?: UpdateApiSitesSiteIdShippingIntegrationsIdOptions) => { const {baseUrl = "https://api.qpilot.cloud", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set("Authorization", Bearer) const url = `${baseUrl.replace(/\/+$/, '')}/Sites/${encodeURIComponent(String(args.siteId))}/ShippingIntegrations/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };