Guide | Description |
---|---|
Notion Class | A class that enable developers to create a client side Notion object and assign specific tasks(e.g. search, create database...etc) to it. |
Base Class | A base class for Database, Page, and Block class, provide them some basic features. |
Page Class | A class that provides methods and functionality for interacting with Notion pages. |
Block Class | |
Database Class |
A class that enable developers to create a client side Notion object and assign specific tasks(e.g. search, create database…etc) to it.
Constructor of the Notion
object.
auth
: Your Notion integration internal token.
- If the request succeeds, it will create a
Notion
object, allowing you to perform various Notion-related operations. - If the request fails, it will print an error message and return it.
Retrieves information about the current user.
- If the request succeeds, it will return information about the user.
- If the request fails, it will print an error message and return it.
Search for a target database or page.
target
: The name of the target database or page.
- If the request succeeds, it will return a JSON file representing the list of search results.
- If the request fails, it will print an error message and return it.
Retrieves information about a specific block.
block_id
: The ID of a specific block in a Notion page.
- If the request succeeds, it will return a
Block
object representing the block. - If the request fails, it will print an error message and return it.
Retrieves information about a specific page.
page_id
: The ID of a specific page on your Notion workspace.
- If the request succeeds, it will return a
Page
object representing the page. - If the request fails, it will print an error message and return it.
Retrieves information about a specific database.
database_id
: The ID of a specific database in a Notion page.
- If the request succeeds, it will return a
Database
object representing the database. - If the request fails, it will print an error message and return it.
Notion.create_new_page(parent: Union[Page, Database, Parent], properties: Union[Properties, dict] = Properties(), **kwargs)
Creates a new page within the current page or database.
parent
: Information about the page's parent, represented as a JSON object with apage_id
ordatabase_id
key, and the corresponding ID.properties
: The schema of properties, using a Properties object to implement a predefined JSON template.**kwargs
: Additional keyword arguments for customizing the new page.
- If the request succeeds, it will return a new
Page
object representing the created page. - If the request fails, it will print an error message and return it.
Notion.create_new_database(parent: Union[Page, Parent], properties: Union[Properties, dict] = Properties(), **kwargs)
Creates a new database within the current page.
parent
: Information about the database's parent, represented as a JSON object with apage_id
key and the corresponding ID.properties
: The schema of properties, using a Properties object to implement a predefined JSON template.**kwargs
: Additional keyword arguments for customizing the new database.
- If the request succeeds, it will return a new
Database
object representing the created database. - If the request fails, it will print an error message and return it.
The Notion
class provides methods for interacting with Notion objects and allows for the creation of new pages and databases within a Notion workspace.
A base class for Database, Page, and Block class, provide them some basic features.
Constructor of the Base
object.
bot
: Represents the Notion integration token. Ensure you have created your own Notion integration before using it. Create a Notion integration.object_id
: Represents the unique identifier for the Notion object.object
: Specifies the type of Notion object, which can be "database," "page," or "block."
- If the request succeeds, it returns a
Base
object, which can be used for various operations. - If the request fails, it prints an error message and returns the error.
Retrieves details about the Notion object.
- If the request succeeds, it returns a dictionary containing details about the object, including creation and last edit times, creators, and properties.
- If the request fails, it prints an error message and returns the error.
Prints the properties of the Notion object.
- If the request succeeds, it prints the properties of the object in a formatted manner.
- If the request fails, it prints an error message and returns the error.
Deletes the Notion object.
- If the request succeeds, it returns a confirmation message of the deletion.
- If the request fails, it prints an error message and returns the error.
Asynchronously deletes the Notion object.
session
: An asyncio session for making asynchronous requests.
- If the request succeeds, it returns a confirmation message of the deletion as an awaitable.
- If the request fails, it prints an error message and returns the error as an awaitable.
Retrieves children (blocks) of the Notion object.
- If the request succeeds, it returns a JSON response containing the children (blocks).
- If the request fails, it prints an error message and returns the error.
Appends children (blocks) to the Notion object.
children
: An instance of theChildren
class representing the blocks to be added.
- If the request succeeds, it returns a list of added children (blocks).
- If the request fails, it prints an error message and returns the error.
Asynchronously appends children (blocks) to the Notion object.
children
: An instance of theChildren
class representing the blocks to be added.session
: An asyncio session for making asynchronous requests.
- If the request succeeds, it returns a list of added children (blocks) as an awaitable.
- If the request fails, it prints an error message and returns the error as an awaitable.
The Base
class provides a foundation for interacting with Notion objects and is used for tasks such as retrieving details, managing children, and deleting objects.
A class that provides methods and functionality for interacting with Notion pages.
Constructor of the Page
object.
bot
: Represents the Notion integration token.page_id
: Represents the unique identifier of the Notion page.
- If the request succeeds, it will return a
Page
object, allowing you to perform various page-related operations. - If the request fails, it will print an error message and return it.
Retrieves information about a specific property of the page.
property_id
: Represents the ID of a specific property of the page, you might want to use Notion.get_page() first to find the id from the JSON response.
- If the request succeeds, it will return a JSON representation of the property.
- If the request fails, it will print an error message and return it.
Updates the page with the provided data.
**kwargs
: Keyword arguments representing the properties to update.
- If the request succeeds, it will return a JSON response with updated page data.
- If the request fails, it will print an error message and return it.
Deletes the page.
- If the request succeeds, it will return a JSON response indicating the page has been deleted.
- If the request fails, it will print an error message and return it.
Restores a previously deleted page.
- If the request succeeds, it will return a JSON response indicating the page has been restored.
- If the request fails, it will print an error message and return it.
Creates a new page within the current page or database.
properties
: Represents the schema of properties, using a Properties object to implement a predefined JSON template.**kwargs
: Additional keyword arguments for customizing the new page.
- If the request succeeds, it will return a new
Page
object representing the created page. - If the request fails, it will print an error message and return it.