export type CreateApiCaApiV1CustomFieldsReorderArgs = {body: {field_order?: Array | undefined}}; export type CreateApiCaApiV1CustomFieldsReorderOptions = {baseUrl?: string | undefined, knoxApiToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reorder Custom Fields * * POST /ca/api/v1/custom-fields/reorder */ export const createApiCaApiV1CustomFieldsReorder = async (args: CreateApiCaApiV1CustomFieldsReorderArgs, options?: CreateApiCaApiV1CustomFieldsReorderOptions) => { const {baseUrl = "https://api.meetcampfire.com", fetch: fetchFn = fetch, knoxApiToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (knoxApiToken !== undefined) headers.set("Authorization", knoxApiToken) const url = `${baseUrl.replace(/\/+$/, '')}/ca/api/v1/custom-fields/reorder${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 };