@stackbit/cms-contentful
Version:
Stackbit Contentful CMS Interface
95 lines • 7.84 kB
TypeScript
import { PlainClientAPI, EntryProps, AssetProps, AssetFileProp, LocaleProps, QueryParams, QueryOptions, CollectionProp, UserProps, ContentTypeProps, EditorInterfaceProps, AppInstallationProps, CreateEntryProps, CreateAssetProps, GetSpaceEnvironmentParams, BulkActionPayload, BulkActionValidatePayload, BulkActionPublishPayload, GetBulkActionParams, BulkActionProps, WebhookProps, CreateWebhooksProps, ReleaseProps, ScheduledActionProps, CursorPaginatedCollectionProp, ReleaseQueryOptions, BulkActionUnpublishPayload } from 'contentful-management';
import { Logger } from '@stackbit/types';
export { EntryProps, AssetProps, LocaleProps, UserProps } from 'contentful-management';
interface PlainApiClientOptions {
accessToken: string;
spaceId: string;
environment: string;
managementHost?: string;
uploadHost?: string;
}
export declare function createPlainApiClient({ accessToken, spaceId, environment, managementHost, uploadHost }: PlainApiClientOptions): PlainClientAPI;
export declare function fetchEntryById(client: PlainClientAPI, entryId: string): Promise<EntryProps>;
export declare function fetchAssetById(client: PlainClientAPI, assetId: string): Promise<AssetProps>;
export declare function createEntry(client: PlainClientAPI, contentTypeId: string, data: CreateEntryProps): Promise<EntryProps>;
export declare function updateEntry(client: PlainClientAPI, entryId: string, entry: EntryProps): Promise<EntryProps>;
export declare function publishEntry(client: PlainClientAPI, entry: EntryProps): Promise<EntryProps>;
export declare function unpublishEntry(client: PlainClientAPI, entryId: string): Promise<EntryProps<import("contentful-management").KeyValueMap>>;
export declare function archiveEntry(client: PlainClientAPI, entryId: string): Promise<EntryProps<import("contentful-management").KeyValueMap>>;
export declare function unarchiveEntry(client: PlainClientAPI, entryId: string): Promise<EntryProps<import("contentful-management").KeyValueMap>>;
export declare function deleteEntry(client: PlainClientAPI, entryId: string): Promise<any>;
export declare function createAsset(client: PlainClientAPI, data: CreateAssetProps): Promise<AssetProps>;
export declare function updateAsset(client: PlainClientAPI, assetId: string, asset: AssetProps): Promise<AssetProps>;
export declare function createAssetFromFile(client: PlainClientAPI, data: Omit<AssetFileProp, 'sys'>): Promise<AssetProps>;
export declare function processAssetForAllLocales(client: PlainClientAPI, data: AssetProps): Promise<AssetProps>;
export declare function publishAsset(client: PlainClientAPI, data: AssetProps): Promise<AssetProps>;
export declare function createValidateBulkAction(client: PlainClientAPI, options: GetSpaceEnvironmentParams, data: BulkActionValidatePayload): Promise<BulkActionProps<BulkActionValidatePayload>>;
export declare function createPublishBulkAction(client: PlainClientAPI, options: GetSpaceEnvironmentParams, data: BulkActionPublishPayload): Promise<BulkActionProps<BulkActionPublishPayload>>;
export declare function createUnpublishBulkAction(client: PlainClientAPI, options: GetSpaceEnvironmentParams, data: BulkActionUnpublishPayload): Promise<BulkActionProps<BulkActionUnpublishPayload>>;
export declare function createWebhook(client: PlainClientAPI, data: CreateWebhooksProps): Promise<WebhookProps>;
export declare function getBulkAction<T extends BulkActionPayload>(client: PlainClientAPI, data: GetBulkActionParams): Promise<BulkActionProps<T>>;
export declare function fetchEntriesByIds(client: PlainClientAPI, entryIds: string[], query?: QueryOptions): Promise<EntryProps[]>;
export declare function fetchAssetsByIds(client: PlainClientAPI, assetIds: string[], query?: QueryOptions): Promise<AssetProps[]>;
export declare function fetchAllEntries(client: PlainClientAPI, logger?: Logger): Promise<EntryProps<import("contentful-management").KeyValueMap>[]>;
export declare function fetchEntriesUpdatedAfter(client: PlainClientAPI, date: string, logger?: Logger): Promise<EntryProps<import("contentful-management").KeyValueMap>[]>;
export declare function fetchAllAssets(client: PlainClientAPI, logger?: Logger): Promise<AssetProps[]>;
export declare function fetchAssetsUpdatedAfter(client: PlainClientAPI, date: string, logger?: Logger): Promise<AssetProps[]>;
export declare function fetchAllLocales(client: PlainClientAPI, logger?: Logger): Promise<LocaleProps[]>;
export declare function fetchAllUsers(client: PlainClientAPI, logger?: Logger): Promise<UserProps[]>;
export declare function fetchAllContentTypes(client: PlainClientAPI, logger?: Logger): Promise<ContentTypeProps[]>;
export declare function hasContentTypesUpdatedAfter(client: PlainClientAPI, date: string, logger?: Logger): Promise<boolean>;
export declare function fetchContentTypesUpdatedAfter(client: PlainClientAPI, date: string, logger?: Logger): Promise<ContentTypeProps[]>;
export declare function fetchAllEditorInterfaces(client: PlainClientAPI, logger?: Logger): Promise<EditorInterfaceProps[]>;
export declare function fetchAllAppInstallations(client: PlainClientAPI, logger?: Logger): Promise<AppInstallationProps[]>;
export declare function fetchAllWebhooks(client: PlainClientAPI, logger?: Logger): Promise<WebhookProps[]>;
export declare function fetchAllReleases(client: PlainClientAPI, logger?: Logger): Promise<ReleaseProps[]>;
export declare function fetchAllSchedules(client: PlainClientAPI, params: {
environment: string;
entityId?: string;
status?: string;
}, logger?: Logger): Promise<ScheduledActionProps[]>;
export declare function fetchScheduleById(client: PlainClientAPI, params: {
environment: string;
scheduleId: string;
}): Promise<ScheduledActionProps>;
export declare function fetchEntityVersions(client: PlainClientAPI, params: {
environment: string;
entityId: string;
}): Promise<CollectionProp<import("contentful-management").SnapshotProps<EntryProps<import("contentful-management").KeyValueMap>>>>;
export declare function fetchEntityVersion(client: PlainClientAPI, params: {
environment: string;
entityId: string;
versionId: string;
}): Promise<import("contentful-management").SnapshotProps<EntryProps<import("contentful-management").KeyValueMap>>>;
export declare function createScheduledAction(client: PlainClientAPI, options: {
documentIds: string[];
name: string;
executeAt: string;
action: ScheduledActionProps['action'];
environment: string;
}): Promise<{
schedule: import("@stackbit/types/src/content-source-scheduled-action").ScheduledAction;
contentfulRelease: ReleaseProps;
contentfulSchedule: ScheduledActionProps;
}>;
export declare function updateScheduledAction(client: PlainClientAPI, scheduledActionId: string, options: {
documentIds?: string[];
name?: string;
executeAt?: string;
environment: string;
}): Promise<import("@stackbit/types/src/content-source-scheduled-action").ScheduledAction>;
export declare function cancelScheduledAction(client: PlainClientAPI, scheduledActionId: string, options: {
environment: string;
}): Promise<import("@stackbit/types/src/content-source-scheduled-action").ScheduledAction>;
export declare function getScheduledAction(client: PlainClientAPI, scheduledActionId: string, options: {
environment: string;
}): Promise<import("@stackbit/types/src/content-source-scheduled-action").ScheduledAction | null>;
export declare function fetchAllItems<T>({ getMany, logger, query }: {
getMany: (params: QueryParams) => Promise<CollectionProp<T>>;
logger?: Logger;
query?: QueryOptions;
}): Promise<T[]>;
export declare function fetchAllItemsCursor<T>(fn: (params: {
query?: ReleaseQueryOptions;
}) => Promise<CursorPaginatedCollectionProp<T>>, query: any, logger?: Logger): Promise<T[]>;
//# sourceMappingURL=contentful-api-client.d.ts.map