export type UserColumName = string; export type EncryptedExpression = string; export type EncryptedBlocklyExpression = string; export type DisplayGroupName = string; export type CreateCustomColumnRequest = {userColumnName: UserColumName, encryptedExpression: EncryptedExpression, encryptedBlocklyExpression: EncryptedBlocklyExpression, displayGroupName: DisplayGroupName}; export type UpdateApiV2UserCatalogsStoreIdCustomColumnsColumnIdArgs = {storeId: unknown, columnId: unknown, body: CreateCustomColumnRequest}; export type UpdateApiV2UserCatalogsStoreIdCustomColumnsColumnIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create or replace a custom column * * PUT /v2/user/catalogs/{storeId}/customColumns/{columnId} */ export const updateApiV2UserCatalogsStoreIdCustomColumnsColumnId = async (args: UpdateApiV2UserCatalogsStoreIdCustomColumnsColumnIdArgs, options?: UpdateApiV2UserCatalogsStoreIdCustomColumnsColumnIdOptions) => { 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))}/customColumns/${encodeURIComponent(String(args.columnId))}${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 };