contentful-management
Version:
Client for Contentful's Content Management API
79 lines (78 loc) • 2.87 kB
TypeScript
import type { CursorPaginationParams, ExoCursorPaginatedCollectionProp, ExperienceMetadataProps, ExoQueryFilters, Link, ResourceLink } from '../common-types';
import type { ComponentTypeViewport, DimensionedDesignPropertyValue, FragmentNode } from './component-type';
export type ExperienceContentBindings = {
sys: ResourceLink<'Contentful:DataAssembly'>['sys'];
parameters: Record<string, ResourceLink<string>>;
};
export type ExperienceSys = {
id: string;
type: 'Experience';
version: number;
space: Link<'Space'>;
environment: Link<'Environment'>;
template: ResourceLink<'Contentful:Template'>;
createdAt: string;
updatedAt: string;
createdBy: Link<'User'>;
updatedBy: Link<'User'>;
archivedAt?: string;
archivedBy?: Link<'User'>;
archivedVersion?: number;
variant?: string;
variantType?: string;
variantDimension?: string;
publishedAt?: string;
publishedVersion?: number;
publishedCounter?: number;
firstPublishedAt?: string;
publishedBy?: Link<'User'> | Link<'AppDefinition'>;
localeStatus?: Record<string, 'draft' | 'published' | 'changed'>;
};
type ExperienceCommonProps = {
name: string;
description: string;
viewports: ComponentTypeViewport[];
designProperties: Record<string, DimensionedDesignPropertyValue>;
contentBindings?: ExperienceContentBindings;
metadata?: ExperienceMetadataProps;
slots?: Record<string, Array<FragmentNode | InlineFragmentNode>>;
};
export type ExperienceProps = ExperienceCommonProps & {
sys: ExperienceSys;
};
export type ExperienceQueryOptions = CursorPaginationParams & ExoQueryFilters & {
order?: string;
};
export type ExperienceLocalePublishPayload = {
add: string[];
} | {
remove: string[];
};
export type CreateExperienceProps = ExperienceCommonProps & {
template: ResourceLink<'Contentful:Template'>;
};
export type UpsertExperienceProps = ExperienceCommonProps & {
sys: {
id: string;
type: 'Experience';
version?: number;
};
template?: ResourceLink<'Contentful:Template'>;
};
export type InlineFragmentNode = {
id: string;
nodeType: 'InlineFragment';
componentType: ResourceLink<'Contentful:ComponentType'>;
designProperties: Record<string, DimensionedDesignPropertyValue>;
contentBindings?: ExperienceContentBindings;
slots?: Record<string, Array<FragmentNode | InlineFragmentNode>>;
};
export type ExperienceCollection = ExoCursorPaginatedCollectionProp<ExperienceProps>;
export type ReleaseExperienceSys = Omit<ExperienceSys, 'variant' | 'variantType' | 'variantDimension'> & {
release: Link<'Release'>;
};
export type ReleaseExperience = Omit<ExperienceProps, 'sys'> & {
sys: ReleaseExperienceSys;
};
export type ReleaseExperienceCollection = ExoCursorPaginatedCollectionProp<ReleaseExperience>;
export {};