UNPKG

mindee

Version:

Mindee Client Library for Node.js

54 lines (53 loc) 2.41 kB
import { InferenceFields } from "./inferenceFields.js"; import { StringDict } from "../../../../parsing/stringDict.js"; import { BaseField } from "./baseField.js"; import type { SimpleField } from "./simpleField.js"; import type { ListField } from "./listField.js"; export declare class ObjectField extends BaseField { readonly fields: InferenceFields; /** * Retrieves the simple sub-fields in the object. * * @return {Map<string, SimpleField>} A map of field names to their corresponding `SimpleField` instances. */ get simpleFields(): Map<string, SimpleField>; /** * Retrieves the list sub-fields in the object. * * @return {Map<string, ListField>} A map of field names to their corresponding `ListField` instances. */ get listFields(): Map<string, ListField>; /** * Retrieves the object sub-fields in the object. * * @return {Map<string, ObjectField>} A map of field names to their corresponding `ObjectField` instances. */ get objectFields(): Map<string, ObjectField>; /** * Retrieves a SimpleField by its name if it exists and is of the correct type. * * @param {string} fieldName - The name of the field to retrieve. * @return {SimpleField} The SimpleField instance if it exists and is valid, or undefined if not. * @throws {Error} If the field does not exist or is not of type SimpleField. */ getSimpleField(fieldName: string): SimpleField; /** * Retrieves a ListField by its name if it exists and is of the correct type. * * @param {string} fieldName - The name of the field to retrieve. * @return {ListField} The ListField instance if it exists and is valid, or undefined if not. * @throws {Error} If the field does not exist or is not of type ListField. */ getListField(fieldName: string): ListField; /** * Retrieves an ObjectField by its name if it exists and is of the correct type. * * @param {string} fieldName - The name of the field to retrieve. * @return {ObjectField} The ObjectField instance if it exists and is valid, or undefined if not. * @throws {Error} If the field does not exist or is not of type ObjectField. */ getObjectField(fieldName: string): ObjectField; constructor(serverResponse: StringDict, indentLevel?: number); toString(): string; toStringFromList(): string; }