import { AxiosAdapter } from 'axios'; export interface CreateClientParams { spaceUid: string; token: string; apiType?: 'cdn' | 'api'; adapter?: AxiosAdapter; retryOnError?: boolean; retryLimit?: number; fetch?: typeof fetch; } export interface Client { getContents: (params: GetContentsParams) => Promise>; getContent: (params: GetContentParams) => Promise; getFirstContent: (params: GetFirstContentParams) => Promise; getApp: (params: GetAppParams) => Promise; } export interface GetContentsParams { appUid: string; modelUid: string; query?: GetContentsQuery; } export interface GetContentParams { appUid: string; modelUid: string; contentId: string; query?: GetContentQuery; } export interface GetFirstContentParams { appUid: string; modelUid: string; query?: GetFirstContentQuery; } type OperatorValue = { ne?: string | number | boolean; match?: string; in?: string[] | number[]; nin?: string[] | number[]; all?: string[] | number[]; exists?: boolean; lt?: string | number; lte?: string | number; gt?: string | number; gte?: string | number; fmt?: 'text'; }; type QueryValue = string | number | boolean | OperatorValue; export type FilterQuery = { or?: Array; and?: Array; [key: string]: QueryValue | Array | undefined; }; export type Query = { select?: string[]; order?: string[]; limit?: number; skip?: number; depth?: number; or?: Array; and?: Array; [key: string]: QueryValue | string[] | Array | undefined; }; export type GetContentsQuery = Query; type ExceptFormat = { select?: string[]; depth?: number; }; type Format = { [key: string]: { fmt: 'text'; }; }; export type GetContentQuery = ExceptFormat | Format; export type GetFirstContentQuery = Omit; export interface Contents { skip: number; limit: number; total: number; items: Array; } export interface Content { _id: string; _sys: { createdAt: string; updatedAt: string; customOrder: number; raw: { createdAt: string; updatedAt: string; firstPublishedAt: string; publishedAt: string; }; }; } export interface Image { _id: string; src: string; fileName: string; fileType: string; fileSize: number; width: number; height: number; title: string; description: string; altText: string; metadata: Record; } export interface File { _id: string; src: string; fileName: string; fileType: string; fileSize: number; width: number | null; height: number | null; title: string; description: string; altText: string; metadata: Record; } export interface Media { _id: string; src: string; fileName: string; fileType: string; fileSize: number; width: number | null; height: number | null; title: string; description: string; altText: string; metadata: Record; } export type AppIcon = { type: string; value: string; }; export type AppCover = { type: string; value: string; }; export interface AppMeta { name: string; uid: string; icon?: AppIcon; cover?: AppCover; } export interface GetAppParams { appUid: string; } export interface NewtError { status: number; code: string; message: string; } export interface ErrorRequest { method?: string; headers?: Record; url?: string; } export interface ErrorResponse extends NewtError { request?: ErrorRequest; } export {};