API Reference

Types

All interfaces are exported from blogjs and re-exported via the main index.ts.

Blog

Code
export interface BlogImage {
  id: string;
  url: string;
  filesize: number;
}

export type ParagraphBlock = { type: "paragraph"; text: string };
export type HeadingBlock   = { type: "heading"; text: string; level: 2 | 3 };
export type ListBlock      = { type: "list"; items: string[]; ordered?: boolean };
export type QuoteBlock     = { type: "quote"; text: string };
export type ImageBlock     = { type: "image"; src: string; alt: string; caption?: string };
export type CodeBlock      = { type: "code"; code: string; language?: string };

export type ContentBlock =
  | ParagraphBlock
  | HeadingBlock
  | ListBlock
  | QuoteBlock
  | ImageBlock
  | CodeBlock;

export type BlogStatus = 'draft' | 'published';

export interface BlogProject {
  id: string;
  name: string;
}

export interface BlogAuthor {
  id: string;
  name: string;
  email: string;
}

export interface BlogCategory {
  id: string;
  name: string;
}

export interface BlogTag {
  id: string;
  name: string;
}

export interface Blog {
  id: string;
  title: string;
  slug: string;
  description: string | null;
  image: BlogImage | null;
  readTime: number | null;
  publishedAt: string | null;
  content: ContentBlock[] | null;
  status: BlogStatus;
  project: BlogProject | null;
  author: BlogAuthor | null;
  categories: BlogCategory | null;
  tags: BlogTag[];
  createdAt: string;
  updatedAt: string | null;
}

PaginationOptions

FieldTypeRequired
pagenumberoptional
limitnumberoptional
querystringoptional

PaginatedResult<T>

FieldType
dataT[]
pagination.pagenumber
pagination.limitnumber
pagination.totalnumber
pagination.totalPagesnumber
pagination.hasMoreboolean