export type FriendEmail = string; export type CreateApiV2UserCustomerStoresStoreIdSharesArgs = {storeId: unknown, body: FriendEmail}; export type CreateApiV2UserCustomerStoresStoreIdSharesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Share a store to another user * * POST /v2/user/customer/stores/{storeId}/shares */ export const createApiV2UserCustomerStoresStoreIdShares = async (args: CreateApiV2UserCustomerStoresStoreIdSharesArgs, options?: CreateApiV2UserCustomerStoresStoreIdSharesOptions) => { 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))}/shares${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };