export type Link = {href?: (string | null) | undefined, filename_properties?: (Array | null) | undefined, title?: (string | null) | undefined, templated?: boolean | undefined}; export type EntityResource = {id?: number | undefined, identifier?: (string | null) | undefined, cultures?: (Array | null) | undefined, properties?: ({[key: string]: Record | null} | null) | undefined, relations?: ({[key: string]: Record | null} | null) | undefined, created_by?: Link | undefined, created_on?: string | undefined, modified_by?: Link | undefined, modified_on?: string | undefined, locked_by?: Link | undefined, locked_on?: (string | null) | undefined, entitydefinition?: Link | undefined, copy?: Link | undefined, copyasync?: Link | undefined, permissions?: Link | undefined, requested_permissions?: ({[key: string]: boolean | null} | null) | undefined, lifecycle?: Link | undefined, saved_selections?: Link | undefined, roles?: Link | undefined, annotations?: Link | undefined, is_root_taxonomy_item?: (boolean | null) | undefined, is_path_root?: (boolean | null) | undefined, inherits_security?: boolean | undefined, is_system_owned?: boolean | undefined, version?: number | undefined, full?: Link | undefined, modules?: (Array | null) | undefined, self?: Link | undefined} | {[key: string]: unknown}; export type UpdateApiApiJobsIdTargetsTargetIdArgs = {id: number, targetId: number, body: EntityResource}; export type UpdateApiApiJobsIdTargetsTargetIdOptions = {baseUrl?: string | undefined, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a job target * * PUT /api/jobs/{id}/targets/{targetId} */ export const updateApiApiJobsIdTargetsTargetId = async (args: UpdateApiApiJobsIdTargetsTargetIdArgs, options?: UpdateApiApiJobsIdTargetsTargetIdOptions) => { 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/${encodeURIComponent(String(args.targetId))}${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 };