interface Author { /** * The name of the author if available otherwise null */ name: string | null; /** * The profile url of the author if available otherwise null */ url: string | null; /** * The image url of the author if available otherwise null */ image: string | null; /** * Indicates whether author profile is publicly accessible */ public: boolean; } interface Extended { /** * The unique css class for the author (can be null) */ class: string | null; /** * The formatted time when the comment was published (can be null) */ time: string | null; /** * Indicates whether comment is removed */ removed: boolean; } interface Link { rel: string; href: string; type: string | null; title: string | null; } type Links = Record; type Geo = { box: string | null; featureName: string | null; point: string | null; }; interface Blog$1 { /** * The title of the blog */ title: string; /** * The subtitle of the blog */ subtitle: string | null; /** * An array of string * representing all the available labels in the blog */ labels: string[]; /** * The url of the blog */ url: string; links: Links; /** * The id of the blog */ id: string; /** * The time as string when the blog was last updated */ updated: string; /** * Contains information about the author of the blog */ author: Author; } interface PostCommentInfo { feed: string | null; number: number | null; title: string | null; } interface Post { /** * The title of the post */ title: string; /** * The published time of the post */ published: string; /** * The updated time of the post */ updated: string; /** * An Array of string * representing labels of the post */ labels: string[]; /** * The url of the post */ url: string; links: Links; /** * The id of the post */ id: string; /** * Contains information about the author of the post */ author: Author; /** * The thumbnail of the post if available * (it can be image from content) otherwise null */ thumbnail: string | null; /** * The thumbnail of the post * (selected by blogger) if available otherwise null */ thumbnailAlt: string | null; /** * The summary of the post if available otherwise null */ summary: string | null; /** * The full content of the post if available otherwise null */ content: string | null; /** * Contains information about comments of the post */ comments: PostCommentInfo; /** * Contains information about geolocation of the post */ geo: Geo; } interface Comment { /** * The title of the comment */ title: string; /** * The published time of the comment */ published: string; /** * The last updated time of the comment */ updated: string; /** * The url of the comment */ url: string; links: Links; id: string; /** * Contains information about the author of the comment */ author: Author; /** * The summary of the comment if available otherwise null */ summary: string | null; /** * The content of the comment if available otherwise null */ content: string | null; /** * Contains more information about the comment */ extended: Extended; /** * Contains information about the post * on which the comment was posted */ post: { /** * The id of the post */ id: string; /** * The url of the post */ url: string; }; /** * If the comment is reply to another comment, * it will be the id of that comment otherwise null */ inReplyTo: string | null; } interface Feed { blog: Blog$1 | null; links: Links; posts: Post[] | null; comments: Comment[] | null; itemsPerPage: number | null; startIndex: number | null; totalResults: number | null; selfUrl: string | null; previousUrl: string | null; nextUrl: string | null; } /** * An interface of parameters which can be used for blogger feed api */ interface Params { maxResults?: number; startIndex?: number; orderBy?: 'lastmodified' | 'starttime' | 'published' | 'updated'; publishedMin?: Date | string; publishedMax?: Date | string; updatedMin?: Date | string; updatedMax?: Date | string; query?: string; } /** * An interface representing options for {@link fetchFeed} */ interface FetchFeedOptions { params?: Params; include?: (keyof Params)[]; exclude?: (keyof Params)[]; baseUrl?: string | URL; jsonp?: boolean; signal?: AbortSignal; } /** * An interface representing options for {@link Client} constructor */ interface ClientOptions { /** When set to `true`, enables jsonp callbacks */ jsonp?: boolean; } /** * A class for fetching Blogger feed */ declare class Client { private jsonp; private base; private _bU; private _bI; /** * Creates an instance of {@link Client} * * @param urlOrId The url or id of the blog * @param options Options */ constructor(urlOrId: string | URL, options?: ClientOptions); private _?; get blog(): Promise<{ id: string; url: string; serviceBase: string; domainBase: string; }>; get id(): Promise; get url(): Promise; get domainBase(): Promise; get serviceBase(): Promise; req(path: string, options?: FetchFeedOptions): Promise; } type PaginationMap = { posts: Post[]; comments: Comment[]; }; /** Pagination props */ interface PaginationProps { readonly itemsPerPage: number | null; readonly startIndex: number | null; readonly totalResults: number | null; readonly selfUrl: string | null; readonly previousUrl: string | null; readonly nextUrl: string | null; next(requestOptions?: { signal?: AbortSignal; }): Promise<(PaginationMap[T] & PaginationProps) | null>; previous(requestOptions?: { signal?: AbortSignal; }): Promise<(PaginationMap[T] & PaginationProps) | null>; } declare class Methods { protected c: Client; constructor(client: Client); /** Adds pagination properties and methods to feed entries array */ protected _p(type: T, feed: Feed): PaginationMap[T] & PaginationProps; } /** * A class having methods related to Blog */ declare class Blog extends Methods { /** * Retrieve blog information * * @returns The blog info */ get({ signal }?: { signal?: AbortSignal; }): Promise; } /** Options for {@link Comments.list} */ type CommentsListOptions = { maxResults?: number; startIndex?: number; orderBy?: 'published' | 'updated'; publishedMin?: Date | string; publishedMax?: Date | string; updatedMin?: Date | string; updatedMax?: Date | string; summary?: boolean; postId?: string; }; /** Options for {@link Comments.get} */ type CommentsGetOptions = { summary?: boolean; }; /** * A class having methods related to Comments */ declare class Comments extends Methods { /** * Retrieves all the comments of the blog or a post * * @param options Options for filters * * @returns On success, an Array of Comment */ list(options?: CommentsListOptions, { signal }?: { signal?: AbortSignal; }): Promise>; /** * Retrieves a comment * * @param postId The id of the post * @param commentId The id of the comment * @param options Options * * @returns On success, a Comment */ get(postId: string, commentId: string, options?: CommentsGetOptions, { signal }?: { signal?: AbortSignal; }): Promise; } /** Feed ot entry not found error */ declare const NOT_FOUND_ERRORS: { readonly post: { readonly error: "The post was not found."; readonly code: "post_not_found"; }; readonly page: { readonly error: "The page was not found."; readonly code: "page_not_found"; }; readonly comment: { readonly error: "The comment was not found."; readonly code: "comment_not_found"; }; readonly blog: { readonly error: "The blog was not found."; readonly code: "blog_not_found"; }; }; /** * Represents a SDK error */ declare class SDKError extends Error { constructor(message: string, options?: ErrorOptions); } /** * Represents a SDK type error */ declare class SDKTypeError extends SDKError { constructor(message: string, options?: ErrorOptions); } /** * Represents a error thrown while making an API request */ declare class SDKRequestError extends SDKError { readonly url: string; constructor(message: string, url: string | URL, options?: ErrorOptions); } /** * Represents a error thrown when client is requesting for some resources which does not exists. * For example requesting for a post with specific `post_id` but that doesn't exists. */ declare class SDKInputNotFoundError extends SDKError { readonly error: T['error']; readonly code: T['code']; constructor(result: T, options?: ErrorOptions); } /** Options for {@link Pages.list} */ type PagesListOptions = { maxResults?: number; startIndex?: number; orderBy?: 'published' | 'updated'; publishedMin?: Date | string; publishedMax?: Date | string; updatedMin?: Date | string; updatedMax?: Date | string; summary?: boolean; }; /** Options for {@link Pages.get} */ type PagesGetOptions = { summary?: boolean; }; /** * A class having methods related to Pages */ declare class Pages extends Methods { /** * Retrieves all the pages of the blog * * @param options Options for filters * * @returns On success, an Array of Post */ list(options?: PagesListOptions, { signal }?: { signal?: AbortSignal; }): Promise>; /** * Retrieves a page * * @param pageId The id of the page * @param options Options for filters * * @returns On success, a Post */ get(pageId: string, options?: PagesGetOptions, { signal }?: { signal?: AbortSignal; }): Promise; } /** Options for {@link Posts.list} */ type PostsListOptions = { maxResults?: number; startIndex?: number; orderBy?: 'published' | 'updated'; publishedMin?: Date | string; publishedMax?: Date | string; updatedMin?: Date | string; updatedMax?: Date | string; label?: string; summary?: boolean; }; /** Options for {@link Posts.get} */ type PostsGetOptions = { summary?: boolean; }; /** Options for {@link Posts.query} */ type PostsQueryOptions = Omit; declare class Posts extends Methods { /** * Retrieves all the posts of the blog * * @param options Options for filters * * @returns On success, an Array of Post */ list(options?: PostsListOptions, { signal }?: { signal?: AbortSignal; }): Promise>; /** * Retrieves a post * * @param postId The id of the post * @param options Options * * @returns On success, a Post */ get(postId: string, options?: PostsGetOptions, { signal }?: { signal?: AbortSignal; }): Promise; /** * Retrieves all the posts with query * * @param query The query * @param options Options for filters * * @returns On success, an Array of Post */ query(query: string, options?: PostsQueryOptions, { signal }?: { signal?: AbortSignal; }): Promise>; } /** * An interface representing options for {@link BloggerFeed} */ interface BloggerFeedOptions { /** * When set to `true`, enables jsonp callbacks, useful when running in browser environments to prevent cors issues. * * **Warning**: Set it to `true` if and only if you are running it in browser * because it loads javascript by appending script element to document. * * @default false */ jsonp?: boolean; } declare class BloggerFeed { static readonly SDKError: typeof SDKError; static readonly SDKInputNotFoundError: typeof SDKInputNotFoundError; static readonly SDKRequestError: typeof SDKRequestError; static readonly SDKTypeError: typeof SDKTypeError; static readonly parseFeed: (input: unknown) => Feed; readonly posts: Posts; readonly pages: Pages; readonly comments: Comments; readonly blog: Blog; /** * Creates an instance of {@link BloggerFeed} * * @param urlOrId The url or id of the blog * @param options Options */ constructor(urlOrId: string | URL, options?: BloggerFeedOptions); } /** * Get the information from Blogger feed json object * * @param input A feed object * * Possible inputs: * * ```ts * type Input = * | { feed: { entry?: object | unknown[] } } * | { entry?: object | unknown[] } * ``` * * @returns An object containing information from feed */ declare const parseFeed: (input: unknown) => Feed; export { type Author, type Blog$1 as Blog, BloggerFeed, type BloggerFeedOptions, type Comment, type Extended, type Feed, type Geo, type Link, type Links, type Post, type PostCommentInfo, SDKError, SDKInputNotFoundError, SDKRequestError, SDKTypeError, parseFeed };