export type BeezUPCommonStoreId = unknown; export type ReplicationStrategy = 'None' | 'Standard' | 'AddOnly' | 'PurgeAndReplace'; export type CatalogReplicationToConfiguration = {toStoreId: BeezUPCommonStoreId, customColumnStrategy: ReplicationStrategy}; export type PatchApiV2UserCatalogsStoreIdReplicationToArgs = {storeId: unknown, body: CatalogReplicationToConfiguration}; export type PatchApiV2UserCatalogsStoreIdReplicationToOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * [PREVIEW] [Mocked] Patch Store's Replicated To Configuration * * PATCH /v2/user/catalogs/{storeId}/replication/to */ export const patchApiV2UserCatalogsStoreIdReplicationTo = async (args: PatchApiV2UserCatalogsStoreIdReplicationToArgs, options?: PatchApiV2UserCatalogsStoreIdReplicationToOptions) => { 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/catalogs/${encodeURIComponent(String(args.storeId))}/replication/to${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 };