UNPKG

@botonic/plugin-contentful

Version:

Botonic Plugin Contentful is one of the **[available](https://github.com/hubtype/botonic/tree/master/packages)** plugins for Botonic. **[Contentful](http://www.contentful.com)** is a CMS (Content Management System) which manages contents of a great variet

58 lines (57 loc) 2.42 kB
import { Equatable, ValueObject } from '../util/objects'; import { CMS, ContentType, TopContentType } from './cms'; import { Content, TopContent } from './contents'; import { Context } from './context'; export declare class Callback implements ValueObject, Equatable { readonly payload?: string | undefined; readonly url?: string | undefined; readonly empty: boolean; /** * @param payload may contain the reference of a {@link Content}. See {@link ContentCallback} * @param url for hardcoded URLs (otherwise, use a {@link Url}) * @param empty eg. if locale fallback is disabled, we may get empty * fields. */ protected constructor(payload?: string | undefined, url?: string | undefined, empty?: boolean); static ofPayload(payload: string): Callback; static ofUrl(url: string): Callback; static empty(): Callback; asContentId(): TopContentId | undefined; equals(other: Callback): boolean; toString(): string; } export declare class ContentCallback extends Callback { readonly model: TopContentType; readonly id: string; private static PAYLOAD_SEPARATOR; constructor(model: TopContentType, id: string); asContentId(): TopContentId; static payloadReferencesContent(payload: string): boolean; static ofPayload(payload: string): ContentCallback; static ofContentId(contentId: TopContentId): ContentCallback; static regexForModel(modelType: ContentType): RegExp; private static checkDeliverableModel; } export declare class ResourceId implements ValueObject { readonly resourceType: string; readonly id: string; constructor(resourceType: string, id: string); toString(): string; equals(other: ContentId): boolean; static create(resourceType: string, id: string): ResourceId; } export declare class ContentId extends ResourceId { readonly model: ContentType; constructor(model: ContentType, id: string); static create(model: ContentType, id: string): ContentId; deliver(cms: CMS, context?: Context): Promise<Content>; } export declare class AssetId extends ResourceId { readonly assetType: string | undefined; constructor(id: string, assetType: string | undefined); } export declare class TopContentId extends ContentId { readonly model: TopContentType; constructor(model: TopContentType, id: string); deliver(cms: CMS, context?: Context): Promise<TopContent>; }