export type CreateApiV1ShopsShopIdCustomFieldsArgs = {body: {name: string, placeholder?: (string | null) | undefined, hint?: (string | null) | undefined, type: 'text' | 'textarea' | 'checkbox' | 'select', options?: (string | null) | undefined, default?: (string | null) | undefined, regex?: (string | null) | undefined, is_required?: boolean | undefined}}; export type CreateApiV1ShopsShopIdCustomFieldsOptions = {baseUrl?: string | undefined, defaultValue?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create Custom Field * * POST /v1/shops/{shopId}/custom-fields */ export const createApiV1ShopsShopIdCustomFields = async (args: CreateApiV1ShopsShopIdCustomFieldsArgs, options?: CreateApiV1ShopsShopIdCustomFieldsOptions) => { const {baseUrl = "https://api.sellauth.com", fetch: fetchFn = fetch, defaultValue} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (defaultValue !== undefined) headers.set('authorization', `Bearer ${defaultValue}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/shops/${encodeURIComponent(String(args.shopId))}/custom-fields${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 };