import { AxiosError } from "axios"; import { ResourceType } from "./ResourceType"; import { ActionStatus } from "../services/ApiActionCreator/enums/ActionStatus"; import { RequestMethod } from "../selectors/enums/RequestMethod"; export interface ApiDataState { meta: MetaData; html: HTMLState; entities: Entities; links?: Links; } export declare type Links = Partial; export interface ApiLinks { self: string; first: string; last: string; prev: string; next: string; } export declare type Entities = Partial; export interface Entity { id: string; type: ResourceType; } export declare type DataMetaPotentialValues = string | number | null | undefined | boolean | { [key: string]: DataMetaPotentialValues; }; export interface MetaData { [operation: string]: Partial | undefined; } export interface OperationMeta { loading: boolean; status: ActionStatus; endpoint: string; entities?: Entity[]; error?: AxiosError; dataMeta?: { [key: string]: DataMetaPotentialValues; }; count?: number; } export declare type MetaMethods = { [type in RequestMethod]: OperationMeta; }; export interface HTMLState { [key: string]: string; } export declare type ApiModels = { [R in ResourceType]: Identifiers; }; export interface Identifiers { [id: string]: ApiModelData; } export interface ApiModelData { id: string; type: ResourceType; attributes: { [key: string]: DataMetaPotentialValues; }; relationships?: Partial; } declare type RelationshipObjects = { [R in ResourceType | string]: { data: RelationshipObject[] | RelationshipObject; }; }; export interface TypedSingleRelationshipObject { data: RelationshipObject; } export interface TypedManyRelationshipObject { data: Array>; } export interface RelationshipObject { type: Type extends ResourceType ? Type : Type extends string ? Type : string; id: string; } export {};