export type CreateApihttpLocalhost8000ProjectIdAnnotationsQueryTargetsArgs = {project_id: string, annotation_date_start?: string | undefined, annotation_date_end?: string | undefined, body: {name?: string | undefined, name_exact?: string | undefined, name_case_sensitive?: string | undefined, annotated_by?: string | undefined, annotated_with?: string | undefined, not_annotated_with?: string | undefined, sub_annotated_with?: string | undefined, with_annotations?: string | undefined, types?: string | undefined, sort_by?: string | undefined, sort_dir?: string | undefined, range_start?: string | undefined, range_length?: string | undefined, annotation_reference?: string | undefined, with_timestamps?: string | undefined, import_only?: string | undefined, ignore_nonexisting?: string | undefined, with_name?: string | undefined, with_type?: string | undefined}}; export type CreateApihttpLocalhost8000ProjectIdAnnotationsQueryTargetsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Query entities based on various constraints * * POST http://localhost:8000/{project_id}/annotations/query-targets */ export const createApihttpLocalhost8000ProjectIdAnnotationsQueryTargets = async (args: CreateApihttpLocalhost8000ProjectIdAnnotationsQueryTargetsArgs, options?: CreateApihttpLocalhost8000ProjectIdAnnotationsQueryTargetsOptions) => { const {baseUrl = "http://localhost:8000", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/x-www-form-urlencoded") if (args.annotation_date_start != null) query.append("annotation_date_start", String(args.annotation_date_start)) if (args.annotation_date_end != null) query.append("annotation_date_end", String(args.annotation_date_end)) const url = `${baseUrl.replace(/\/+$/, '')}http://localhost:8000/${encodeURIComponent(String(args.project_id))}/annotations/query-targets${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: new URLSearchParams(Object.entries(args.body).flatMap(([key, value]) => (value == null ? [] : [[key, String(value)]])))}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };