/** * Loosely following the JSON API 1.0 formats and conventions * https://jsonapi.org/format/ */ import type { ApiError } from './error.ts'; import type { ApiLinks } from './links.ts'; import type { Relationship } from './relationship.ts'; import type { ApiResourceIdentifierObject } from './resourceIdentifier.ts'; /** A JSON:API resource object with optional attributes, links, meta, and relationships. */ export interface ApiResourceObject extends ApiResourceIdentifierObject { /** * An attributes object representing some of the resource's data. */ attributes?: Record; /** * A links object containing links related to the resource. */ links?: ApiLinks; /** * A meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship. */ meta?: Record; /** * A relationships object describing relationships between the resource and other JSON:API resources. */ relationships?: Record; } /** JSON:API version and metadata descriptor. */ export interface JsonApi { meta?: Record; version?: '1.0' | '1.1'; } /** Base interface for all JSON:API responses, including optional links and metadata. */ export interface ApiResponseBase { jsonapi?: JsonApi; links?: ApiLinks; meta?: Record; } /** A successful JSON:API response containing primary data and optional included resources. */ export interface ApiDataResponse extends ApiResponseBase { data: T; included?: ApiResourceObject[]; } /** A JSON:API error response containing one or more error objects. */ export interface ApiErrorResponse extends ApiResponseBase { errors: ApiError[]; } /** A JSON:API response, either a data response or an error response. */ export type ApiResponse = ApiDataResponse | ApiErrorResponse; //# sourceMappingURL=response.d.ts.map