export type ModuleOptionRequest = {name?: (string | null) | undefined, value?: (string | null) | undefined}; export type UpdateApiTemplatesTemplateIdModulesModuleIdOptionsArgs = {templateId: string, moduleId: string, body: Array}; export type UpdateApiTemplatesTemplateIdModulesModuleIdOptionsOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Replace all configuration options for a module/zone (bulk set). * This removes all existing options and creates new ones from the provided array. * Useful for resetting module/zone configuration or applying presets. * * PUT /templates/{templateId}/modules/{moduleId}/options * * Also accepts auth: ApiKeyInHeader, ApiKeyInQuery */ export const updateApiTemplatesTemplateIdModulesModuleIdOptions = async (args: UpdateApiTemplatesTemplateIdModulesModuleIdOptionsArgs, options?: UpdateApiTemplatesTemplateIdModulesModuleIdOptionsOptions) => { const {baseUrl = "https://api.reveldigital.com", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/templates/${encodeURIComponent(String(args.templateId))}/modules/${encodeURIComponent(String(args.moduleId))}/options${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 };