TypeScript Types
Complete type reference for the AutoBlogWriter SDK.
TypeScript Types
All types are exported from the main @autoblogwriter/sdk entry point.
import type {
AutoBlogWriterClientConfig,
BlogPost,
PostsResponse,
PaginatedList,
SitemapEntry,
BuildSitemapOptions,
BuildRobotsOptions,
MetadataRouteSitemap,
MetadataRouteRobots,
AutoBlogWriterRevalidatePayload,
RevalidatePathFn,
RevalidateTagFn,
FetchRequestOptions,
FetchNextConfig,
} from "@autoblogwriter/sdk";Client Configuration
AutoBlogWriterClientConfig
interface AutoBlogWriterClientConfig {
apiUrl: string;
apiKey: string;
workspaceId?: string;
workspaceSlug?: string;
authMode?: "bearer" | "x-api-key";
fetch?: typeof fetch;
headers?: Record<string, string>;
timeoutMs?: number;
}AuthMode
type AuthMode = "bearer" | "x-api-key";Blog Post
BlogPost
The primary data model returned by the API.
interface BlogPost {
id: string;
title: string;
slug: string;
excerpt?: string;
content: string;
status: "DRAFT" | "PUBLISHED" | "HIDDEN";
seo?: {
title?: string;
description?: string;
keywords?: string[];
};
metadata?: {
canonicalUrl?: string;
ogImageUrl?: string;
readingTimeMinutes?: number;
wordCount?: number;
};
publishedAt?: string;
updatedAt: string;
}PostsResponse
Returned by client.getPosts() and fetchBlogPosts().
interface PostsResponse {
posts: BlogPost[];
nextCursor?: string;
}PaginatedList<T>
The raw paginated response from the API (used internally by the client).
interface PaginatedList<T> {
items: T[];
pagination: {
page: number;
limit: number;
total: number;
totalPages: number;
hasMore: boolean;
};
}SEO Types
SitemapEntry
Input for the sitemap builder.
interface SitemapEntry {
slug: string;
updatedAt?: string;
}BuildSitemapOptions
interface BuildSitemapOptions {
siteUrl: string;
routePrefix?: string;
entries: SitemapEntry[];
}MetadataRouteSitemap
Output of buildSitemap(). Compatible with Next.js MetadataRoute.Sitemap.
type MetadataRouteSitemap = Array<{
url: string;
lastModified?: string;
}>;BuildRobotsOptions
interface BuildRobotsOptions {
siteUrl: string;
sitemapPath?: string;
}MetadataRouteRobots
Output of buildRobots(). Compatible with Next.js MetadataRoute.Robots.
interface MetadataRouteRobots {
rules: MetadataRouteRobotsRule | MetadataRouteRobotsRule[];
sitemap?: string | string[];
}
interface MetadataRouteRobotsRule {
userAgent: string;
allow?: string | string[];
disallow?: string | string[];
}Webhook Types
AutoBlogWriterRevalidatePayload
The JSON body of a AutoBlogWriter webhook request.
interface AutoBlogWriterRevalidatePayload {
workspaceSlug: string;
postSlug?: string | null;
event: string;
ts: string;
[key: string]: unknown;
}RevalidatePathFn
Signature for the Next.js revalidatePath function.
type RevalidatePathFn = (
path: string,
type?: "page" | "layout" | "route",
) => void | Promise<void>;RevalidateTagFn
Signature for the Next.js revalidateTag function.
type RevalidateTagFn = (tag: string) => void | Promise<void>;Fetch Options
FetchRequestOptions
Optional caching parameters for client methods.
interface FetchRequestOptions {
cache?: RequestCache;
next?: FetchNextConfig;
}FetchNextConfig
Next.js-specific fetch extensions.
interface FetchNextConfig {
revalidate?: number | false;
tags?: string[];
}Environment Config
AutoBlogWriterEnvConfig
Returned by createAutoBlogWriterFromEnv().
interface AutoBlogWriterEnvConfig {
client: AutoBlogWriterClient;
workspaceSlug: string;
workspaceId?: string;
siteUrl: string;
revalidateSecret?: string;
apiUrl: string;
apiKey: string;
tags: {
posts: string;
post: (slug: string) => string;
sitemap: string;
};
}Client Interface
AutoBlogWriterClient
The client instance returned by createAutoBlogWriterClient().
interface AutoBlogWriterClient {
getPosts(params?: {
limit?: number;
cursor?: string;
} & FetchRequestOptions): Promise<PostsResponse>;
getPostBySlug(
slug: string,
options?: FetchRequestOptions,
): Promise<BlogPost | null>;
getSitemapEntries(): Promise<Array<{ slug: string; updatedAt: string }>>;
}Error Types
ApiErrorDetails
interface ApiErrorDetails {
status: number;
code?: string;
details?: unknown;
}Next.js Helper Types
FetchBlogPostsOptions
interface FetchBlogPostsOptions {
limit?: number;
cursor?: string;
}NextMetadata
The metadata object returned by buildNextMetadata().
interface NextMetadata {
title?: string;
description?: string;
keywords?: string[];
alternates?: { canonical?: string };
openGraph?: {
type?: string;
title?: string;
description?: string;
images?: Array<{ url: string }>;
publishedTime?: string;
modifiedTime?: string;
};
twitter?: {
card?: string;
title?: string;
description?: string;
images?: string[];
};
}Next Steps
- Client Reference — How to use these types with the client.
- Error Handling — Error class details.
On this page
- Client Configuration
- `AutoBlogWriterClientConfig`
- `AuthMode`
- Blog Post
- `BlogPost`
- `PostsResponse`
- `PaginatedList<T>`
- SEO Types
- `SitemapEntry`
- `BuildSitemapOptions`
- `MetadataRouteSitemap`
- `BuildRobotsOptions`
- `MetadataRouteRobots`
- Webhook Types
- `AutoBlogWriterRevalidatePayload`
- `RevalidatePathFn`
- `RevalidateTagFn`
- Fetch Options
- `FetchRequestOptions`
- `FetchNextConfig`
- Environment Config
- `AutoBlogWriterEnvConfig`
- Client Interface
- `AutoBlogWriterClient`
- Error Types
- `ApiErrorDetails`
- Next.js Helper Types
- `FetchBlogPostsOptions`
- `NextMetadata`
- Next Steps