import { CoreObjectRelations } from "./relations/core-object-relations"; /** * This interface will need to be implemented by the SDK generator */ export interface CoreObjectAttributes { } export interface CoreObjectPayload { readonly data: { readonly attributes: CoreObjectAttributes; }; } /** * This is input from the fetch operation with the required data to construct this object and all * internal hierarcies * * data - the primary data that belongs to this object * records - a global list of additional records that might belong to this object (will be filtered) * cache - a global cache map to break recursion so multiple object of same type are not created */ export interface FetchData { readonly object: { readonly id: string; readonly type: string; readonly attributes: any; readonly relationships: any; }; readonly includes: Map; readonly cache: Map>; } /** * CoreObject is the base object that all Objects in the API derive base functionality from */ export declare abstract class CoreObject { private readonly _attributes; private readonly _relations; private _id; constructor(id?: string | null, attributes?: Attributes); get attributes(): Attributes; get relationships(): CoreObjectRelations; /** * Generates a JSON Payload that can be sent to a backend server */ get payload(): CoreObjectPayload; get id(): string; hasID(): boolean; static get type(): string; static newInstance>(): T; get type(): string; /** * shortcut for easier chained construction of Include Queries */ static include(...objects: Array<(typeof CoreObject) | Array>): Array; /** * Re-fills tis object instance with data from the api * * data - the primary data that belongs to this object * records - a global list of additional records that might belong to this object (will be filtered) * cache - a global cache map to break recursion so multiple object of same type are not created */ setFromAPI(data: FetchData): void; /** * internal use function by setFromAPI that constructs a new record */ private _CreateRecord; }