export type MartAttributeRequest = {column?: (string | null) | undefined, dataDictionaryItemId?: number | undefined}; export type UpdateApiApiMartsIdAttributesAttrIdArgs = {id: number, attrId: number, body: MartAttributeRequest}; export type UpdateApiApiMartsIdAttributesAttrIdOptions = {baseUrl: string, token?: string | undefined, fetch?: typeof fetch | undefined}; /** * PUT /api/marts/{id}/attributes/{attrId} */ export const updateApiApiMartsIdAttributesAttrId = async (args: UpdateApiApiMartsIdAttributesAttrIdArgs, options: UpdateApiApiMartsIdAttributesAttrIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, token} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (token !== undefined) headers.set("X-Deluxe-Auth", token) const url = `${baseUrl.replace(/\/+$/, '')}/api/marts/${encodeURIComponent(String(args.id))}/attributes/${encodeURIComponent(String(args.attrId))}${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 };