Metadata-Version: 2.1
Name: notion-apilib
Version: 0.0.1a0
Summary: This library allows developers to call Notion API using custom DSL Pydantic-validated classes and API methods
Home-page: https://github.com/Real1tyy/notion-apilib-python
License: MIT
Keywords: notion,api,pydantic,dsl,python
Author: Real1ty
Author-email: vavro.matej3@gmail.com
Requires-Python: >=3.9,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: anyio (>=4.4.0,<5.0.0)
Requires-Dist: asttokens (==2.4.1)
Requires-Dist: backcall (==0.2.0)
Requires-Dist: beautifulsoup4 (==4.12.3)
Requires-Dist: bleach (==6.1.0)
Requires-Dist: build (==1.2.1)
Requires-Dist: certifi (==2024.7.4)
Requires-Dist: charset-normalizer (==3.3.2)
Requires-Dist: click (==8.1.7)
Requires-Dist: decorator (==5.1.1)
Requires-Dist: defusedxml (==0.7.1)
Requires-Dist: dependency-injector (==4.41.0)
Requires-Dist: dnspython (==2.6.1)
Requires-Dist: docopt (==0.6.2)
Requires-Dist: executing (==2.0.1)
Requires-Dist: fastjsonschema (==2.20.0)
Requires-Dist: greenlet (==3.0.3)
Requires-Dist: h11 (==0.14.0)
Requires-Dist: httpcore (==1.0.5)
Requires-Dist: httpx (==0.27.0)
Requires-Dist: idna (==3.7)
Requires-Dist: jedi (==0.19.1)
Requires-Dist: jinja2 (==3.1.4)
Requires-Dist: jsonschema (==4.22.0)
Requires-Dist: jsonschema-specifications (==2023.12.1)
Requires-Dist: mako (==1.3.5)
Requires-Dist: markupsafe (==2.1.5)
Requires-Dist: matplotlib-inline (==0.1.7)
Requires-Dist: mccabe (==0.7.0)
Requires-Dist: pandocfilters (==1.5.1)
Requires-Dist: parso (==0.8.4)
Requires-Dist: pexpect (==4.9.0)
Requires-Dist: pickleshare (==0.7.5)
Requires-Dist: platformdirs (==4.2.2)
Requires-Dist: prompt-toolkit (==3.0.47)
Requires-Dist: psycopg2 (==2.9.9)
Requires-Dist: ptyprocess (==0.7.0)
Requires-Dist: pycodestyle (==2.12.0)
Requires-Dist: pydantic (>=2.8.2,<3.0.0)
Requires-Dist: pyflakes (==3.2.0)
Requires-Dist: pygments (==2.18.0)
Requires-Dist: pymongo (==4.8.0)
Requires-Dist: pyproject-hooks (==1.1.0)
Requires-Dist: python-dateutil (==2.9.0.post0)
Requires-Dist: python-dotenv (==1.0.1)
Requires-Dist: pyzmq (==26.0.3)
Requires-Dist: referencing (==0.35.1)
Requires-Dist: requests (==2.32.3)
Requires-Dist: returns (==0.23.0)
Requires-Dist: rpds-py (==0.18.1)
Requires-Dist: six (==1.16.0)
Requires-Dist: sniffio (==1.3.1)
Requires-Dist: soupsieve (==2.5)
Requires-Dist: tinycss2 (==1.3.0)
Requires-Dist: tornado (==6.4.1)
Requires-Dist: types-requests (==2.32.0.20240622)
Requires-Dist: typing-extensions (==4.12.2)
Requires-Dist: urllib3 (==2.2.2)
Requires-Dist: wcwidth (==0.2.13)
Requires-Dist: webencodings (==0.5.1)
Project-URL: Documentation, https://github.com/Real1tyy/notion-apilib-python/wiki
Project-URL: Repository, https://github.com/Real1tyy/notion-apilib-python
Description-Content-Type: text/markdown

# notion-apilib-python

This library allows developers to work with Notion API using custom DSL Pydantic models, removing the need to manually
construct json payloads and API requests or handle JSON responses. The library wraps the Notion REST API, transforming
the calls into intuitive custom API methods that accept and return custom Pydantic objects. Also provides factory
methods
for easy instantiation of these custom objects.

## Key Features

- Schema Enforcement: Ensures data integrity by validating all objects against Notion's API schema using Pydantic.
- Factory Methods: Simplifies the creation of Notion objects with pre-configured factory methods.
- Provide a high-level abstraction over Notion's REST API. Abstracting away the low-level details of the API like json
  structure, formats and URL's.
- Simple and intuitive syntax for creating, retrieving, updating, and deleting Notion objects like Pages, Databases
  and Blocks.
- Supports pagination, filtering, sorting, and other advanced features.

## Installation

You can install the package via pip, link to the package -
[PyPi Package](https://pypi.org/project/notion-apilib/)

```bash
pip install notion-apilib
```

## Usage

```python
from notion_apilib import NotionApi

# Initialize the client
client = NotionApi(api_key="your_notion_integration_secret_api_key")

# Access the notion object providers / accessors:
page_provider = client.page_provider
blocks_provider = client.block_provider
database_provider = client.database_provider

# Example usage
database = database_provider.retrieve_database("your_database_id")
page = page_provider.retrieve_page("your_page_id")
```

## Documentation

[Usage Examples](docs/examples) \
[Changelog](CHANGELOG.md)

### Modules

#### notion-apilib:

- Contains the core NotionApi class used for accessing the pages, database and blocks providers used for interacting
  with Notion API.

#### notion-apilib.data:

- Contains inside Pydantic models and factory methods for Notion objects like Page, Database, Block, Properties, etc.

#### notion-apilib.data.blocks:

- Pydantic models and factory methods for blocks.

#### notion-apilib.data.properties:

- Pydantic models and factory methods for page and database properties as well as Filter and Sort objects.

#### notion-apilib.data.structures:

- Pydantic models and factory methods for low-level structures like RichText and Annotations used by other objects.

### External:

1. [Notion API Documentation](https://developers.notion.com/reference/intro)
2. [Developers Notion](https://developers.notion.com/)
3. [Notion Integration](https://notionintegrations.com/)

## Contributing

This is my first library, and I know it might not be perfect. I welcome any suggestions, code reviews, documentation
improvements, bug reports or feature requests. Please feel free to contribute to the project.

### How to Contribute

1. Fork the repository.
2. Create a new branch (git checkout -b feature-branch).
3. Make your changes and commit them (git commit -am 'Add new feature').
4. Push the branch (git push origin feature-branch).
5. Open a Pull Request.

For major changes, please open an issue first to discuss what you would like to change.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.

## Feedback

As this is my first library, any constructive criticism or feedback is greatly appreciated. Whether it's a suggestion
for improvement or just a comment on how the library could be better, I'm eager to hear your thoughts. Please don't
hesitate to reach out if you have any ideas, feedback, or feature requests.

