@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
44 lines (43 loc) • 2.12 kB
TypeScript
import * as contentful from 'contentful';
import { CommonFields, ContentId, ContentType, Context, DateRangeContent, FollowUp, TopContent } from '../cms';
import { ContentfulOptions } from '../plugin';
import { ReferenceDelivery } from './contents/reference';
import { SearchableByKeywordsFields } from './search/searchable-by';
export interface ContentWithNameFields {
name: string;
}
export interface CommonEntryFields extends ContentWithNameFields {
shortText?: string;
keywords?: string[];
searchableBy?: contentful.Entry<SearchableByKeywordsFields>[];
partitions?: string[];
dateRange?: contentful.Entry<DateRangeFields>;
followup?: contentful.Entry<FollowUpFields>;
}
export type FollowUpFields = CommonEntryFields;
export type ReferenceFields = CommonEntryFields;
export declare class ContentfulEntryUtils {
static getContentId(entry: contentful.Entry<any>): ContentId;
/**
* Will be false for broken references, or when we have only fetched
* the full Entry tree
*/
static isFullEntry(entry: contentful.Entry<any>): boolean;
static getContentModel<T extends ContentType = ContentType>(entry: contentful.Entry<any>): T;
static commonFieldsFromEntry(entry: contentful.Entry<CommonEntryFields>, followUp?: FollowUp): CommonFields;
/** Cannot be in date-range to avoid circular dependency */
static fromDateRangeEntry(entry: contentful.Entry<DateRangeFields>): DateRangeContent;
}
export declare function createContentfulClientApi(options: ContentfulOptions): contentful.ContentfulClientApi;
/** Cannot be in date-range to avoid circular dependency */
export interface DateRangeFields extends CommonEntryFields {
from: string;
to: string;
}
export declare function convertContentfulException(e: any, query: any): any;
export type Reference = {
delivery: ReferenceDelivery;
context: Context;
};
export declare function addCustomFields<T extends TopContent>(content: T, entryFields: CommonEntryFields, referenceDelivery?: Reference, ignoreFields?: string[]): Promise<T>;
export declare function isReferenceField(field: any): boolean;