UNPKG

@querc/squidex-client

Version:

NodeJS client for the [Squidex](https://squidex.io/) CMS

64 lines (63 loc) 2.34 kB
import { SquidexClientConfiguration } from '../configuration'; import { AuthenticationManager } from '../authentication/authentication-manager'; import { HttpClient } from '../http'; import { SquidexQuery } from './squidex-query'; import { SquidexContent } from './squidex-content'; import { SquidexContentCollection } from './squidex-content-collection'; import { SquidexStatusUpdate } from './squidex-status-update'; export declare class ContentSchema { private readonly config; private readonly httpClient; private readonly authenticationManager; schema: string; constructor(config: SquidexClientConfiguration, httpClient: HttpClient, authenticationManager: AuthenticationManager); /** * Returns all content from the API matching `query` * Set `draft` to true to return content in draft * */ query<T = any>(query?: SquidexQuery, draft?: boolean): Promise<SquidexContentCollection<SquidexContent<T>>>; /** * Returns the first content item from the API matching `query` * Set `draft` to true to return content in draft * */ querySingle<T = any>(query?: SquidexQuery, draft?: boolean): Promise<SquidexContent<T>>; /** * Creates a new content item * * @param publish whether to publish the content item immediately */ create<T = any, R = T>(content: T, publish?: boolean): Promise<SquidexContent<R>>; /** * Updates a content item * * @param id ID of the content item */ update<T = any>(id: string, content: T): Promise<SquidexContent<T>>; /** * Patches a content item * * @param id ID of the content item */ patch<T = any>(id: string, content: Partial<T>): Promise<SquidexContent<T>>; /** * Deletes a content item * * @param id ID of the content item */ delete<T = any>(id: string): Promise<boolean>; /** * Updates the status of a content item * * @param id ID of the content item * @param status the new status */ updateStatus<T = any>(id: string, status: SquidexStatusUpdate): Promise<SquidexContent<T>>; /** * Discards changes to a content item * * @param id ID of the content item */ discard<T = any>(id: string): Promise<SquidexContent<T>>; private convertFromJson; private buildPath; }