export type CreateApiApiMetadataTermsArgs = {name: string, active: boolean, version: string, type: string, body: {file: string}};
export type CreateApiApiMetadataTermsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined};
/**
* Allowed user roles:
Create a sdz specific terms record
*
* POST /api/metadata/terms
*/
export const createApiApiMetadataTerms = async (args: CreateApiApiMetadataTermsArgs, options?: CreateApiApiMetadataTermsOptions) => {
const {baseUrl = "https://api.burstiq.com", fetch: fetchFn = fetch} = options ?? {}
const query = new URLSearchParams()
const headers = new Headers()
headers.set('content-type', "application/json")
headers.set('accept', "*/*")
if (args.name != null) query.append("name", String(args.name))
if (args.active != null) query.append("active", String(args.active))
if (args.version != null) query.append("version", String(args.version))
if (args.type != null) query.append("type", String(args.type))
const url = `${baseUrl.replace(/\/+$/, '')}/api/metadata/terms${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 res.blob()
};