/** * JSON:API Resource Object * @see https://jsonapi.org/format/#document-resource-objects */ export interface JsonApiResource> { /** Resource type */ type: string; /** Resource ID */ id: string; /** Resource attributes (defaults to empty object if not provided) */ attributes: TAttributes; /** Resource relationships */ relationships?: Record; /** Resource links */ links?: JsonApiLinks; /** Resource meta */ meta?: Record; } /** * JSON:API Relationship Object * @see https://jsonapi.org/format/#document-resource-object-relationships */ export interface JsonApiRelationship { /** Relationship data */ data: JsonApiResourceIdentifier | JsonApiResourceIdentifier[] | null; /** Relationship links */ links?: JsonApiLinks; /** Relationship meta */ meta?: Record; } /** * JSON:API Resource Identifier Object * @see https://jsonapi.org/format/#document-resource-identifier-objects */ export interface JsonApiResourceIdentifier { /** Resource type */ type: string; /** Resource ID */ id: string; /** Identifier meta */ meta?: Record; } /** * JSON:API Links Object * @see https://jsonapi.org/format/#document-links */ export interface JsonApiLinks { self?: string | JsonApiLink; related?: string | JsonApiLink; first?: string | JsonApiLink | null; last?: string | JsonApiLink | null; prev?: string | JsonApiLink | null; next?: string | JsonApiLink | null; [key: string]: string | JsonApiLink | null | undefined; } /** * JSON:API Link Object * @see https://jsonapi.org/format/#document-links */ export interface JsonApiLink { href: string; rel?: string; describedby?: string; title?: string; type?: string; hreflang?: string | string[]; meta?: Record; } /** * JSON:API Error Object * @see https://jsonapi.org/format/#error-objects */ export interface JsonApiError { /** Unique identifier for this error */ id?: string; /** Links related to the error */ links?: { about?: string | JsonApiLink; type?: string | JsonApiLink; }; /** HTTP status code */ status?: string; /** Application-specific error code */ code?: string; /** Short summary of the error */ title?: string; /** Detailed explanation of the error */ detail?: string; /** Source of the error */ source?: { pointer?: string; parameter?: string; header?: string; }; /** Error meta */ meta?: Record; } /** * JSON:API Document * @see https://jsonapi.org/format/#document-structure */ export interface JsonApiDocument> { /** Primary data */ data?: JsonApiResource | JsonApiResource[] | null; /** Included resources */ included?: JsonApiResource[]; /** Errors */ errors?: JsonApiError[]; /** Top-level meta */ meta?: JsonApiMeta; /** Top-level links */ links?: JsonApiLinks; /** JSON:API version info */ jsonapi?: { version?: string; ext?: string[]; profile?: string[]; meta?: Record; }; } /** * JSON:API Meta Object (commonly used for pagination) */ export interface JsonApiMeta { /** Current page number */ current_page?: number; /** Total number of pages */ total_pages?: number; /** Total count of items */ total_count?: number; /** Items per page */ per_page?: number; /** Any additional meta fields */ [key: string]: unknown; } /** * Type guard for single resource document */ export declare function isSingleResourceDocument(doc: JsonApiDocument): doc is JsonApiDocument & { data: JsonApiResource; }; /** * Type guard for collection resource document */ export declare function isCollectionDocument(doc: JsonApiDocument): doc is JsonApiDocument & { data: JsonApiResource[]; }; /** * Type guard for error document */ export declare function isErrorDocument(doc: JsonApiDocument): doc is JsonApiDocument & { errors: JsonApiError[]; }; //# sourceMappingURL=types.d.ts.map