Skip to content

Instantly share code, notes, and snippets.

@Hangsolow
Created April 22, 2020 14:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hangsolow/f59e6c089ff48aee5b0559360723d7f4 to your computer and use it in GitHub Desktop.
Save Hangsolow/f59e6c089ff48aee5b0559360723d7f4 to your computer and use it in GitHub Desktop.
common interfaces for content coming from Content Api
/** interface for ContentLanguage coming from episerver content delivery api */
export interface ContentLanguage {
/** the link to the this langauge version of the current content */
link: string;
/** the localized displayName for the language */
displayName: string;
/** the ISO name for the language */
name: string;
}
/** interface for ContentReference coming from episerver content delivery api */
export interface ContentReference {
/** the episerver content id */
id: number;
/** the episerver content work id */
workId: number;
/** the guid id of the content */
guidValue: string;
/** the content providerName */
providerName?: string;
/** url to the content (block points to the frontpage) */
url: string;
}
/** The possible categories for ContentType */
export type ContentTypeCategory = "Page" | "Block" | "Media" | "Video" | "Image"
/** interface for ContentType coming from episerver content delivery api */
export interface ContentType {
/** the name of the content type */
name: string;
/** The Id of the content type in guid format */
guidValue: string;
/** The category of the type, tells you either this type is a page, block, media or something else! */
category: ContentTypeCategory;
}
/** The interface for Content coming from episerver content delivery api */
export interface IContent {
/** ContentReference to the content */
contentLink: ContentReference;
/** name of the content */
name: string;
/** language of the content */
language: ContentLanguage;
/** The current languages the content exist in */
existingLanguages: Array<ContentLanguage>;
/** the master language for the content */
masterLanguage?: ContentLanguage;
/** The contentType for this content */
contentType: ContentType;
/** ContentReference to the parent content */
parentLink: ContentReference;
routeSegment: string;
url: string;
changed: string;
created: string;
startPublish: string;
stopPublish?: string;
saved: string;
status: string;
/** optional property where the rendered html of the content will be if requested by the client */
html?: string;
/**
* optional that contain the display option if set on the content (normally it will only be set in content coming from ContentAreas)
*/
displayOption?: string;
displayOptionFallback?: string;
/**
* optional boolean that will hide the current content if it is true
* */
hide?: boolean;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment