export type SELLERACCOUNTSTORECREATERequestStores = {access_expiration_date?: string | undefined, channel_id: string, channel_store_id: string, name: string, state: string, suspension_type?: string | undefined}; export type SELLERACCOUNTSTORECREATERequest = {stores: Array}; export type CreateApiV1UsersStoresArgs = {token: string, link_stores_to_organization?: boolean | undefined, body: SELLERACCOUNTSTORECREATERequest}; export type CreateApiV1UsersStoresOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * SELLER_ACCOUNT_STORE_CREATE - Create stores and link them to a user * * POST /v1/users/stores */ export const createApiV1UsersStores = async (args: CreateApiV1UsersStoresArgs, options?: CreateApiV1UsersStoresOptions) => { const {baseUrl = "https://account.mirakl.net/api/channel-platform", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.token != null) query.append("token", String(args.token)) if (args.link_stores_to_organization != null) query.append("link_stores_to_organization", String(args.link_stores_to_organization)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/users/stores${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 };