export type CustomCategoryCreateModel = {Value?: string | undefined, CustomCategoryType?: (0 | 1) | undefined}; export type CustomCategoryPostModel = {ContactId?: number | undefined, Added?: Array | undefined, Removed?: Array | undefined}; export type CreateApiV1ResourceownerContacts3CustomcategoryArgs = {body: CustomCategoryPostModel}; export type CreateApiV1ResourceownerContacts3CustomcategoryOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add and remove custom categories * * POST /v1/resourceowner/contacts3/customcategory */ export const createApiV1ResourceownerContacts3Customcategory = async (args: CreateApiV1ResourceownerContacts3CustomcategoryArgs, options: CreateApiV1ResourceownerContacts3CustomcategoryOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/resourceowner/contacts3/customcategory${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 };