/// import type { Agent } from "http"; import { Logger, LogLevel } from "./logging"; import { GetBlockParameters, GetBlockResponse, UpdateBlockParameters, UpdateBlockResponse, DeleteBlockParameters, DeleteBlockResponse, AppendBlockChildrenParameters, AppendBlockChildrenResponse, ListBlockChildrenParameters, ListBlockChildrenResponse, ListDatabasesParameters, ListDatabasesResponse, GetDatabaseParameters, GetDatabaseResponse, QueryDatabaseParameters, QueryDatabaseResponse, CreateDatabaseParameters, CreateDatabaseResponse, UpdateDatabaseParameters, UpdateDatabaseResponse, CreatePageParameters, CreatePageResponse, GetPageParameters, GetPageResponse, UpdatePageParameters, UpdatePageResponse, GetUserParameters, GetUserResponse, ListUsersParameters, ListUsersResponse, SearchParameters, SearchResponse, GetSelfParameters, GetSelfResponse, GetPagePropertyParameters, GetPagePropertyResponse, CreateCommentParameters, CreateCommentResponse, ListCommentsParameters, ListCommentsResponse } from "./api-endpoints"; import { SupportedFetch } from "./fetch-types"; export interface ClientOptions { auth?: string; timeoutMs?: number; baseUrl?: string; logLevel?: LogLevel; logger?: Logger; notionVersion?: string; fetch?: SupportedFetch; /** Silently ignored in the browser */ agent?: Agent; } export interface RequestParameters { path: string; method: Method; query?: QueryParams; body?: Record; auth?: string; } export default class Client { #private; static readonly defaultNotionVersion = "2022-06-28"; constructor(options?: ClientOptions); /** * Sends a request. * * @param path * @param method * @param query * @param body * @returns */ request({ path, method, query, body, auth, }: RequestParameters): Promise; readonly blocks: { /** * Retrieve block */ retrieve: (args: WithAuth) => Promise; /** * Update block */ update: (args: WithAuth) => Promise; /** * Delete block */ delete: (args: WithAuth) => Promise; children: { /** * Append block children */ append: (args: WithAuth) => Promise; /** * Retrieve block children */ list: (args: WithAuth) => Promise; }; }; readonly databases: { /** * List databases * * @deprecated Please use `search` */ list: (args: WithAuth) => Promise; /** * Retrieve a database */ retrieve: (args: WithAuth) => Promise; /** * Query a database */ query: (args: WithAuth) => Promise; /** * Create a database */ create: (args: WithAuth) => Promise; /** * Update a database */ update: (args: WithAuth) => Promise; }; readonly pages: { /** * Create a page */ create: (args: WithAuth) => Promise; /** * Retrieve a page */ retrieve: (args: WithAuth) => Promise; /** * Update page properties */ update: (args: WithAuth) => Promise; properties: { /** * Retrieve page property */ retrieve: (args: WithAuth) => Promise; }; }; readonly users: { /** * Retrieve a user */ retrieve: (args: WithAuth) => Promise; /** * List all users */ list: (args: WithAuth) => Promise; /** * Get details about bot */ me: (args: WithAuth) => Promise; }; readonly comments: { /** * Create a comment */ create: (args: WithAuth) => Promise; /** * List comments */ list: (args: WithAuth) => Promise; }; /** * Search */ search: (args: WithAuth) => Promise; /** * Emits a log message to the console. * * @param level The level for this message * @param args Arguments to send to the console */ private log; /** * Transforms an API key or access token into a headers object suitable for an HTTP request. * * This method uses the instance's value as the default when the input is undefined. If neither are defined, it returns * an empty object * * @param auth API key or access token * @returns headers key-value object */ private authAsHeaders; } type Method = "get" | "post" | "patch" | "delete"; type QueryParams = Record | URLSearchParams; type WithAuth = P & { auth?: string; }; export {}; //# sourceMappingURL=Client.d.ts.map
= P & { auth?: string; }; export {}; //# sourceMappingURL=Client.d.ts.map