@bonniernews/abbe-api-utils
Version:
Utilities for converting to Abbe article format
278 lines (277 loc) • 7.37 kB
TypeScript
import Puff from "./Puff";
import Content from "../draftjs/types/Content";
export default class Article {
private _uuid;
private _headline;
private _articleState;
private _newsValue;
private _originalSource;
private _relevanceLength;
private _presenceState;
private _premiumLevel;
private _publishedAt;
private _content;
private _functionTags;
private _stories;
private _bylines;
private _temporaryByline?;
private _articleType;
private _categories;
private _locations;
private _tags;
private _puff;
private _channels;
private _created;
private _updated;
private _externalId;
private _sections;
private _points;
private _unpublishedAt?;
private _expireRelevanceAt?;
private _liveStart?;
private _liveStop?;
private _toolsCategories;
private _topWidgets;
private _bottomWidgets;
private _preambleAreaWidgets;
private _publishingGroup;
private _externalUrl;
static initialize(): Article;
static initializeContent(): Content;
get uuid(): UUID;
setUuid(value: UUID): this;
get headline(): string;
setHeadline(value: string): this;
get articleState(): ArticleState;
setArticleState(value: ArticleState): this;
get newsValue(): NewsValue;
setNewsValue(value: NewsValue): this;
get originalSource(): string;
setOriginalSource(value: string): this;
get relevanceLength(): RelevanceLength;
setRelevanceLength(value: RelevanceLength): this;
get presenceState(): PresenceState;
get premiumLevel(): PremiumLevel;
setPremiumLevel(value: PremiumLevel): this;
get publishedAt(): Date;
setPublishedAt(value: Date): this;
setContent(value: Content): this;
get content(): Content;
get functionTags(): string[];
setFunctionTags(value: UUID[]): this;
get stories(): string[];
setStories(value: UUID[]): this;
get bylines(): string[];
setBylines(value: UUID[]): this;
get temporaryByline(): string;
setTemporaryByline(value: string): this;
get articleType(): string;
setArticleType(value: UUID): this;
get categories(): string[];
setCategories(value: UUID[]): this;
get locations(): string[];
setLocations(value: UUID[]): this;
get tags(): string[];
setTags(value: UUID[]): this;
get puff(): Puff;
setPuff(value: Puff): this;
get channels(): string[];
setChannels(value: UUID[]): this;
get created(): Date;
setCreated(value: Date): this;
get updated(): Date;
setUpdated(value: Date): this;
get externalId(): string;
setExternalId(value: string): this;
get sections(): string[];
setSections(value: UUID[]): this;
get points(): LatLng[];
setPoints(value: LatLng[]): this;
get unpublishedAt(): Date;
setUnpublishedAt(value: Date): this;
get expireRelevanceAt(): Date;
setExpireRelevanceAt(value: Date): this;
get liveStart(): Date;
setLiveStart(value: Date): this;
get liveStop(): Date;
setLiveStop(value: Date): this;
get toolsCategories(): string[];
setToolsCategories(value: UUID[]): this;
get publishingGroup(): string;
setPublishingGroup(value: UUID): this;
get externalUrl(): string;
setExternalUrl(value: string): this;
validate(): Promise<{
uuid: string;
headline: string;
articleState: ArticleState;
newsValue: NewsValue;
originalSource: string;
relevanceLength: RelevanceLength;
presenceState: PresenceState;
premiumLevel: PremiumLevel;
publishedAt: string;
content: string;
functionTags: {
uuid: string;
}[];
stories: {
uuid: string;
}[];
bylines: {
uuid: string;
}[];
temporaryByline: string;
articleTypes: {
uuid: string;
}[];
categories: {
uuid: string;
}[];
locations: {
uuid: string;
}[];
tags: {
uuid: string;
}[];
channels: {
uuid: string;
}[];
created: string;
updated: string;
unpublishedAt: string;
expireRelevanceAt: string;
liveStart: string;
liveStop: string;
externalId: string;
externalUrl: string;
sections: {
uuid: string;
}[];
points: LatLng[];
toolsCategories: {
uuid: string;
}[];
publishingGroup: {
uuid: string;
};
puff: {
image?: {
uuid: string;
};
headLine: string;
subheading: string;
hasActiveImage: boolean;
};
graphicsBylines: any[];
photoBylines: any[];
topWidgets: any[];
bottomWidgets: any[];
preambleAreaWidgets: any[];
}>;
validateSchema(abbeUrl: string): Promise<this>;
finalize(): Promise<{
uuid: string;
headline: string;
articleState: ArticleState;
newsValue: NewsValue;
originalSource: string;
relevanceLength: RelevanceLength;
presenceState: PresenceState;
premiumLevel: PremiumLevel;
publishedAt: string;
content: string;
functionTags: {
uuid: string;
}[];
stories: {
uuid: string;
}[];
bylines: {
uuid: string;
}[];
temporaryByline: string;
articleTypes: {
uuid: string;
}[];
categories: {
uuid: string;
}[];
locations: {
uuid: string;
}[];
tags: {
uuid: string;
}[];
channels: {
uuid: string;
}[];
created: string;
updated: string;
unpublishedAt: string;
expireRelevanceAt: string;
liveStart: string;
liveStop: string;
externalId: string;
externalUrl: string;
sections: {
uuid: string;
}[];
points: LatLng[];
toolsCategories: {
uuid: string;
}[];
publishingGroup: {
uuid: string;
};
puff: {
image?: {
uuid: string;
};
headLine: string;
subheading: string;
hasActiveImage: boolean;
};
graphicsBylines: any[];
photoBylines: any[];
topWidgets: any[];
bottomWidgets: any[];
preambleAreaWidgets: any[];
}>;
private _toUuidObjects;
private _formatDate;
private _toUnstyledTextContent;
private toAbbeFormat;
}
export declare enum ArticleState {
PUBLISHED = "PUBLISHED",
DRAFT = "DRAFT"
}
export declare enum NewsValue {
ZERO = "ZERO",
ONE = "ONE",
TWO = "TWO",
THREE = "THREE",
FOUR = "FOUR",
FIVE = "FIVE",
SIX = "SIX"
}
export declare enum RelevanceLength {
SHORT = "SHORT",
NORMAL = "NORMAL",
LONG = "LONG",
CUSTOM = "CUSTOM"
}
export declare enum PresenceState {
ACTIVE = "ACTIVE"
}
export declare enum PremiumLevel {
NONE = "NONE",
PLUS = "PLUS"
}
interface LatLng {
lat: string;
lng: string;
}
export type UUID = string;
export {};