export type EntityLink = {properties?: ({[key: string]: Record | null} | null) | undefined, renditions?: ({[key: string]: Record | null} | null) | undefined, permissions?: (Array | null) | undefined, identifier?: (string | null) | undefined, href?: (string | null) | undefined, filename_properties?: (Array | null) | undefined, title?: (string | null) | undefined, templated?: boolean | undefined}; export type Link = {href?: (string | null) | undefined, filename_properties?: (Array | null) | undefined, title?: (string | null) | undefined, templated?: boolean | undefined}; export type RelationResource = {parents?: (Array | null) | undefined, parent?: EntityLink | undefined, children?: (Array | null) | undefined, child?: EntityLink | undefined, inherits_security?: (boolean | null) | undefined, parent_total?: (number | null) | undefined, child_total?: (number | null) | undefined, self?: Link | undefined}; export type EntityPostResource = {id?: (number | null) | undefined, identifier?: (string | null) | undefined, properties?: ({[key: string]: Record | null} | null) | undefined, relations?: ({[key: string]: RelationResource} | null) | undefined, is_root_taxonomy_item?: (boolean | null) | undefined, is_path_root?: (boolean | null) | undefined, entitydefinition?: Link | undefined, is_system_owned?: boolean | undefined, inherits_security?: boolean | undefined, self?: Link | undefined}; export type CreateApiApiJobsIdTargetsArgs = {id: number, body: EntityPostResource}; export type CreateApiApiJobsIdTargetsOptions = {baseUrl?: string | undefined, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a job target * * POST /api/jobs/{id}/targets */ export const createApiApiJobsIdTargets = async (args: CreateApiApiJobsIdTargetsArgs, options?: CreateApiApiJobsIdTargetsOptions) => { const {baseUrl = "https://your-server", 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(/\/+$/, '')}/api/jobs/${encodeURIComponent(String(args.id))}/targets${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 };