export type StoreId = string; export type UpdateStorelinkStatusRequest = {status: 'ACTIVE' | 'SUSPENDED' | 'INVALID', message?: (string | null) | undefined}; export type UpdateApiV1StoresStatusArgs = {'X-Store-Id': StoreId, body: UpdateStorelinkStatusRequest}; export type UpdateApiV1StoresStatusOptions = {baseUrl?: string | undefined, OAuth20?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update store status * * PUT /v1/stores/status */ export const updateApiV1StoresStatus = async (args: UpdateApiV1StoresStatusArgs, options?: UpdateApiV1StoresStatusOptions) => { const {baseUrl = "https://partners.tryotter.com", fetch: fetchFn = fetch, OAuth20} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['X-Store-Id'] != null) headers.set("X-Store-Id", String(args['X-Store-Id'])) if (OAuth20 !== undefined) headers.set('authorization', `Bearer ${OAuth20}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/stores/status${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 };