export type StoreName = string; export type StoreUrl = string; export type StoreSector = string; export type StoreSectors = Array; export type UpdateStoreRequest = {name: StoreName, url: StoreUrl, sectors: StoreSectors, isInternationalStore?: boolean | undefined}; export type PatchApiV2UserCustomerStoresStoreIdArgs = {storeId: unknown, body: UpdateStoreRequest}; export type PatchApiV2UserCustomerStoresStoreIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update some store's information. * * PATCH /v2/user/customer/stores/{storeId} */ export const patchApiV2UserCustomerStoresStoreId = async (args: PatchApiV2UserCustomerStoresStoreIdArgs, options?: PatchApiV2UserCustomerStoresStoreIdOptions) => { const {baseUrl = "https://api.beezup.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v2/user/customer/stores/${encodeURIComponent(String(args.storeId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };