json-api/src/declarations.ts
Properties |
|
attributes |
attributes:
|
Type : JsonApiAttributes
|
Optional |
id |
id:
|
Type : string
|
Optional |
links |
links:
|
Type : JsonApiLink
|
Optional |
meta |
meta:
|
Type : JsonApiMeta
|
Optional |
relationships |
relationships:
|
Type : JsonApiRelationship
|
Optional |
type |
type:
|
Type : string
|
export type ParsedJsonApiResource = { [fieldName: string]: string | ParsedJsonApiResource | Array<ParsedJsonApiResource>; id: string } | null;
export type JsonApiMeta = any;
export interface JsonApiAttributes {
[fieldName: string]: any;
}
export type UJsonApiResourceIdentifier = JsonApiResourceIdentifier | JsonApiResourceIdentifier[];
export interface JsonApiRelationship {
[type: string]: JsonApiResponse<UJsonApiResourceIdentifier>;
}
export interface JsonApiLink {
self?: string;
next?: string;
last?: string;
related?: string;
}
export interface JsonApiResource {
type: string;
id?: string;
meta?: JsonApiMeta;
links?: JsonApiLink;
attributes?: JsonApiAttributes;
relationships?: JsonApiRelationship;
}
export interface JsonApiResourceIdentifier {
type: string;
id: string;
meta?: JsonApiMeta;
links?: JsonApiLink;
}
export interface JsonApiBaseResponse {
meta?: JsonApiMeta;
jsonapi?: any;
}
export type UJsonApiResource = JsonApiResource | Array<JsonApiResource>;
export interface JsonApiResponse<T = UJsonApiResource> extends JsonApiBaseResponse {
data: T;
links?: JsonApiLink;
included?: Array<JsonApiResource>;
}
export interface JsonApiError extends JsonApiBaseResponse {
error: any;
}