@jahands/notion-client
Version:
A simple and easy to use client for the Notion API
363 lines • 7.92 kB
JavaScript
// cspell:disable-file
// Note: This is a generated file. DO NOT EDIT!
/**
* Retrieve your token's bot user
*/
export const getSelf = {
method: 'get',
pathParams: [],
queryParams: [],
bodyParams: [],
path: () => `users/me`,
};
/**
* Retrieve a user
*/
export const getUser = {
method: 'get',
pathParams: ['user_id'],
queryParams: [],
bodyParams: [],
path: (p) => `users/${p.user_id}`,
};
/**
* List all users
*/
export const listUsers = {
method: 'get',
pathParams: [],
queryParams: ['start_cursor', 'page_size'],
bodyParams: [],
path: () => `users`,
};
/**
* Create a page
*/
export const createPage = {
method: 'post',
pathParams: [],
queryParams: [],
bodyParams: ['parent', 'properties', 'icon', 'cover', 'content', 'children'],
path: () => `pages`,
};
/**
* Retrieve a page
*/
export const getPage = {
method: 'get',
pathParams: ['page_id'],
queryParams: ['filter_properties'],
bodyParams: [],
path: (p) => `pages/${p.page_id}`,
};
/**
* Update page properties
*/
export const updatePage = {
method: 'patch',
pathParams: ['page_id'],
queryParams: [],
bodyParams: ['properties', 'icon', 'cover', 'is_locked', 'archived', 'in_trash'],
path: (p) => `pages/${p.page_id}`,
};
/**
* Retrieve a page property item
*/
export const getPageProperty = {
method: 'get',
pathParams: ['page_id', 'property_id'],
queryParams: ['start_cursor', 'page_size'],
bodyParams: [],
path: (p) => `pages/${p.page_id}/properties/${p.property_id}`,
};
/**
* Retrieve a block
*/
export const getBlock = {
method: 'get',
pathParams: ['block_id'],
queryParams: [],
bodyParams: [],
path: (p) => `blocks/${p.block_id}`,
};
/**
* Update a block
*/
export const updateBlock = {
method: 'patch',
pathParams: ['block_id'],
queryParams: [],
bodyParams: [
'embed',
'type',
'archived',
'in_trash',
'bookmark',
'image',
'video',
'pdf',
'file',
'audio',
'code',
'equation',
'divider',
'breadcrumb',
'table_of_contents',
'link_to_page',
'table_row',
'heading_1',
'heading_2',
'heading_3',
'paragraph',
'bulleted_list_item',
'numbered_list_item',
'quote',
'to_do',
'toggle',
'template',
'callout',
'synced_block',
'table',
'column',
],
path: (p) => `blocks/${p.block_id}`,
};
/**
* Delete a block
*/
export const deleteBlock = {
method: 'delete',
pathParams: ['block_id'],
queryParams: [],
bodyParams: [],
path: (p) => `blocks/${p.block_id}`,
};
/**
* Retrieve block children
*/
export const listBlockChildren = {
method: 'get',
pathParams: ['block_id'],
queryParams: ['start_cursor', 'page_size'],
bodyParams: [],
path: (p) => `blocks/${p.block_id}/children`,
};
/**
* Append block children
*/
export const appendBlockChildren = {
method: 'patch',
pathParams: ['block_id'],
queryParams: [],
bodyParams: ['children', 'after'],
path: (p) => `blocks/${p.block_id}/children`,
};
/**
* Retrieve a data source
*/
export const getDataSource = {
method: 'get',
pathParams: ['data_source_id'],
queryParams: [],
bodyParams: [],
path: (p) => `data_sources/${p.data_source_id}`,
};
/**
* Update a data source
*/
export const updateDataSource = {
method: 'patch',
pathParams: ['data_source_id'],
queryParams: [],
bodyParams: ['title', 'icon', 'properties', 'in_trash', 'archived', 'parent'],
path: (p) => `data_sources/${p.data_source_id}`,
};
/**
* Query a data source
*/
export const queryDataSource = {
method: 'post',
pathParams: ['data_source_id'],
queryParams: ['filter_properties'],
bodyParams: ['sorts', 'filter', 'start_cursor', 'page_size', 'archived', 'in_trash'],
path: (p) => `data_sources/${p.data_source_id}/query`,
};
/**
* Create a data source
*/
export const createDataSource = {
method: 'post',
pathParams: [],
queryParams: [],
bodyParams: ['parent', 'properties', 'title', 'icon'],
path: () => `data_sources`,
};
/**
* Retrieve a database
*/
export const getDatabase = {
method: 'get',
pathParams: ['database_id'],
queryParams: [],
bodyParams: [],
path: (p) => `databases/${p.database_id}`,
};
/**
* Update a database
*/
export const updateDatabase = {
method: 'patch',
pathParams: ['database_id'],
queryParams: [],
bodyParams: [
'parent',
'title',
'description',
'is_inline',
'icon',
'cover',
'in_trash',
'is_locked',
],
path: (p) => `databases/${p.database_id}`,
};
/**
* Create a database
*/
export const createDatabase = {
method: 'post',
pathParams: [],
queryParams: [],
bodyParams: [
'parent',
'title',
'description',
'is_inline',
'initial_data_source',
'icon',
'cover',
],
path: () => `databases`,
};
/**
* Search by title
*/
export const search = {
method: 'post',
pathParams: [],
queryParams: [],
bodyParams: ['sort', 'query', 'start_cursor', 'page_size', 'filter'],
path: () => `search`,
};
/**
* Create a comment
*/
export const createComment = {
method: 'post',
pathParams: [],
queryParams: [],
bodyParams: ['rich_text', 'attachments', 'display_name', 'parent', 'discussion_id'],
path: () => `comments`,
};
/**
* List comments
*/
export const listComments = {
method: 'get',
pathParams: [],
queryParams: ['block_id', 'start_cursor', 'page_size'],
bodyParams: [],
path: () => `comments`,
};
/**
* Retrieve a comment
*/
export const getComment = {
method: 'get',
pathParams: ['comment_id'],
queryParams: [],
bodyParams: [],
path: (p) => `comments/${p.comment_id}`,
};
/**
* Create a file upload
*/
export const createFileUpload = {
method: 'post',
pathParams: [],
queryParams: [],
bodyParams: ['mode', 'filename', 'content_type', 'number_of_parts', 'external_url'],
path: () => `file_uploads`,
};
/**
* List file uploads
*/
export const listFileUploads = {
method: 'get',
pathParams: [],
queryParams: ['status', 'start_cursor', 'page_size'],
bodyParams: [],
path: () => `file_uploads`,
};
/**
* Upload a file
*/
export const sendFileUpload = {
method: 'post',
pathParams: ['file_upload_id'],
queryParams: [],
bodyParams: [],
formDataParams: ['file', 'part_number'],
path: (p) => `file_uploads/${p.file_upload_id}/send`,
};
/**
* Complete a multi-part file upload
*/
export const completeFileUpload = {
method: 'post',
pathParams: ['file_upload_id'],
queryParams: [],
bodyParams: [],
path: (p) => `file_uploads/${p.file_upload_id}/complete`,
};
/**
* Retrieve a file upload
*/
export const getFileUpload = {
method: 'get',
pathParams: ['file_upload_id'],
queryParams: [],
bodyParams: [],
path: (p) => `file_uploads/${p.file_upload_id}`,
};
/**
* Exchange an authorization code for an access and refresh token
*/
export const oauthToken = {
method: 'post',
pathParams: [],
queryParams: [],
bodyParams: ['grant_type', 'code', 'redirect_uri', 'external_account', 'refresh_token'],
path: () => `oauth/token`,
};
/**
* Revoke a token
*/
export const oauthRevoke = {
method: 'post',
pathParams: [],
queryParams: [],
bodyParams: ['token'],
path: () => `oauth/revoke`,
};
/**
* Introspect a token
*/
export const oauthIntrospect = {
method: 'post',
pathParams: [],
queryParams: [],
bodyParams: ['token'],
path: () => `oauth/introspect`,
};
//# sourceMappingURL=api-endpoints.js.map