@notionhq/client
Version:
A simple and easy to use client for the Notion API
161 lines • 4.83 kB
TypeScript
import type { EmptyObject, IdRequest, IdResponse, InternalFileResponse, PartialUserObjectResponse, RequestStatusResponse, RichTextItemRequest, RichTextItemResponse } from "./common";
type BlockIdCommentParentResponse = {
type: "block_id";
block_id: IdResponse;
};
export type CommentObjectResponse = {
object: "comment";
id: IdResponse;
parent: CommentParentResponse;
discussion_id: IdResponse;
created_time: string;
last_edited_time: string;
created_by: PartialUserObjectResponse;
rich_text: Array<RichTextItemResponse>;
display_name: {
type: "custom" | "user" | "integration";
resolved_name: string | null;
};
attachments?: Array<{
category: "audio" | "image" | "pdf" | "productivity" | "video";
file: InternalFileResponse;
}>;
};
type CommentParentResponse = PageIdCommentParentResponse | BlockIdCommentParentResponse;
type PageIdCommentParentResponse = {
type: "page_id";
page_id: IdResponse;
};
export type PartialCommentObjectResponse = {
object: "comment";
id: IdResponse;
};
type CreateCommentBodyParameters = {
attachments?: Array<{
file_upload_id: string;
type?: "file_upload";
}>;
display_name?: {
type: "integration";
} | {
type: "user";
} | {
type: "custom";
custom: {
name: string;
};
};
} & ({
parent: {
page_id: IdRequest;
type?: "page_id";
} | {
block_id: IdRequest;
type?: "block_id";
};
rich_text: Array<RichTextItemRequest>;
} | {
parent: {
page_id: IdRequest;
type?: "page_id";
} | {
block_id: IdRequest;
type?: "block_id";
};
markdown: string;
} | {
discussion_id: IdRequest;
rich_text: Array<RichTextItemRequest>;
} | {
discussion_id: IdRequest;
markdown: string;
});
export type CreateCommentParameters = CreateCommentBodyParameters;
export type CreateCommentResponse = PartialCommentObjectResponse | CommentObjectResponse;
/**
* Create a comment
*/
export declare const createComment: {
readonly method: "post";
readonly pathParams: readonly [];
readonly queryParams: readonly [];
readonly bodyParams: readonly ["attachments", "display_name", "parent", "rich_text", "markdown", "discussion_id"];
readonly path: () => string;
};
type ListCommentsQueryParameters = {
block_id: IdRequest;
start_cursor?: string;
page_size?: number;
};
export type ListCommentsParameters = ListCommentsQueryParameters;
export type ListCommentsResponse = {
object: "list";
next_cursor: IdResponse | null;
has_more: boolean;
results: Array<CommentObjectResponse>;
type: "comment";
comment: EmptyObject;
request_status?: RequestStatusResponse;
};
/**
* List comments
*/
export declare const listComments: {
readonly method: "get";
readonly pathParams: readonly [];
readonly queryParams: readonly ["block_id", "start_cursor", "page_size"];
readonly bodyParams: readonly [];
readonly path: () => string;
};
type GetCommentPathParameters = {
comment_id: IdRequest;
};
export type GetCommentParameters = GetCommentPathParameters;
export type GetCommentResponse = PartialCommentObjectResponse | CommentObjectResponse;
/**
* Retrieve a comment
*/
export declare const getComment: {
readonly method: "get";
readonly pathParams: readonly ["comment_id"];
readonly queryParams: readonly [];
readonly bodyParams: readonly [];
readonly path: (p: GetCommentPathParameters) => string;
};
type UpdateCommentPathParameters = {
comment_id: IdRequest;
};
type UpdateCommentBodyParameters = {
rich_text: Array<RichTextItemRequest>;
} | {
markdown: string;
};
export type UpdateCommentParameters = UpdateCommentPathParameters & UpdateCommentBodyParameters;
export type UpdateCommentResponse = PartialCommentObjectResponse | CommentObjectResponse;
/**
* Update a comment
*/
export declare const updateComment: {
readonly method: "patch";
readonly pathParams: readonly ["comment_id"];
readonly queryParams: readonly [];
readonly bodyParams: readonly ["rich_text", "markdown"];
readonly path: (p: UpdateCommentPathParameters) => string;
};
type DeleteCommentPathParameters = {
comment_id: IdRequest;
};
export type DeleteCommentParameters = DeleteCommentPathParameters;
export type DeleteCommentResponse = PartialCommentObjectResponse | CommentObjectResponse;
/**
* Delete a comment
*/
export declare const deleteComment: {
readonly method: "delete";
readonly pathParams: readonly ["comment_id"];
readonly queryParams: readonly [];
readonly bodyParams: readonly [];
readonly path: (p: DeleteCommentPathParameters) => string;
};
export {};
//# sourceMappingURL=comments.d.ts.map