Skip to content

v2.0.0 #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 42 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
6658ac6
Fix typo
jonathangomz Jul 27, 2021
0b443d1
Add `text` constructor for blocks
jonathangomz Jul 28, 2021
c7e1fb7
Add shortcut constructors for text styles
jonathangomz Jul 28, 2021
b9e91df
Update example
jonathangomz Jul 28, 2021
114bcde
Add change for next release (1.2.1)
jonathangomz Jul 28, 2021
6dec5b0
Implement suggestions on issue #11
jonathangomz Jul 30, 2021
6959bb7
Remove deprecated code
jonathangomz Jul 30, 2021
d9f8c11
Add test for new database constructor
jonathangomz Jul 30, 2021
0e7a2cd
Add tests to improve coverage
jonathangomz Jul 30, 2021
ec05680
Update information for next release (2.0.0)
jonathangomz Jul 30, 2021
ba9a017
Rename package entry point to match package name
jonathangomz Jul 30, 2021
44c51d3
Fix typo
jonathangomz Jul 30, 2021
b1c828c
Refactor to look like oficial Notion SDK with Javascript
jonathangomz Aug 6, 2021
b55b5a5
Update version changes for next release (2.0.0-beta2)
jonathangomz Aug 6, 2021
a3113ff
Update examples
jonathangomz Aug 6, 2021
c05fff2
Update beta version
jonathangomz Aug 6, 2021
b1cfb6b
Fix examples with wrong class name for client
jonathangomz Aug 6, 2021
0e495d2
Updates ROADMAP
jonathangomz Feb 24, 2022
50fa37a
Updates latest date version
jonathangomz Feb 24, 2022
d3f7434
Create RiohText class as a Text copy
jonathangomz Feb 24, 2022
d9d8338
Add properties `forDatabase` constructor
jonathangomz Feb 24, 2022
1b8d388
Renames BaseFields to Object
jonathangomz Feb 24, 2022
552540d
Rename BaseFields to Object
jonathangomz Feb 24, 2022
4fe8f45
Adds throw exception method to utils
jonathangomz Feb 24, 2022
5c0298c
Renames BaseFields to Object
jonathangomz Feb 24, 2022
3db05e1
Improves database class
jonathangomz Feb 24, 2022
2cf0a2f
Fixes wrong field type on test
jonathangomz Feb 24, 2022
b9dbd9d
Improves Database class
jonathangomz Feb 24, 2022
37a2427
Rename database_id to databaseId
jonathangomz Feb 24, 2022
493632e
Renames database_id to databaseId
jonathangomz Feb 24, 2022
e502432
Adds database properties library
jonathangomz Feb 24, 2022
2049c75
Implements database properties
jonathangomz Feb 24, 2022
01bf7c4
Adds update database
jonathangomz Feb 24, 2022
9052958
Implements database properties library
jonathangomz Feb 24, 2022
6627623
Fixes error String not a subtype of DateTime?
jonathangomz Feb 24, 2022
1fe5f93
Updates release date for v2.0.0
jonathangomz Feb 24, 2022
6ed5bbb
[Try] Improve database and properties
jonathangomz Feb 24, 2022
9d31172
Removes prints
jonathangomz Feb 24, 2022
ac8b908
Fixes errors on test
jonathangomz Feb 24, 2022
b1cf99f
Adds access to properties with explicit type
jonathangomz Feb 25, 2022
b1cba99
Improves docs for `add` property
jonathangomz Feb 25, 2022
e4bfacf
Updates colon for equal for default parameters
jonathangomz Aug 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 38 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,41 @@
* Remove named parameters for `Children` class
* Update documentation

## v1.2.0:
> Release date: 27/Jul/2021
* Implement new endpoints
* Update page: https://developers.notion.com/reference/patch-page#archive-delete-a-page
* Create database: https://developers.notion.com/reference/create-a-database
* Add `Page` support for responses
* Add more colors for Text
* Add list of endpoints implemented on package
* Improve coverage
## v2.0.0-beta1
> Release date: 30/Aug/2021
* 🐣 Add constructor for empty `Database`.
* 🐣 Add parameter `blocks` for `Children` constructor.
* πŸ— Remove deprecated code:
* `textSeparation`
* Parameter constructors for `Children`:
* `heading`
* `paragraph`
* `toDo`
* 🐣 Add suggestions on issue [#11](https://github.com/jonathangomz/notion_api/issues/11):
* Update exports to improve usage
* Add private folder (`src/`)
* 🐣 Add constructors with only single text content with default style for:
* `Paragraph`: `Paragraph.text('some text here...')`
* `ToDo`: `ToDo.text('some text here...', checked: true)`
* `Heading`: `Heading.text('some text here...', type: 2)`
* `BulletedListItem`: `BulletedListItem.text('some text here...')`
* `NumberedListItem`: `NumberedListItem.text('some text here...')`
* `Toggle`: `Toggle.text('some text here...', children: [])`
* 🐣 Add more constructors for `Heading` class:
* `one`: Heading with type 1 by default.
* `two`: Heading with type 2 by default.
* `three`: Heading with type 3 by default.
* 🐣 Add more constructors for `Text` class:
* `code`: Text with code style by default.
* `italic`: Text with italic style by default.
* `bold`: Text with bold style by default.
* `underline`: Text with underline style by default.
* `color`: Text with different color of default.
* 🐣 Add `list(List<Text> texts, String separator, String lastSeparator)`:
* **A static method**
* Generate a textual list of texts separated by comma (by default).

## v2.0.0-beta2
> Release date: 06/Aug/2021
* πŸ— Add more suggestions on issue [#11](https://github.com/jonathangomz/notion_api/issues/11):
* Copy some terminologies from [`notion-sdk-js`](https://github.com/makenotion/notion-sdk-js)
68 changes: 30 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,33 @@ See the [ROADMAP](ROADMAP.md) file to see what is coming next.

- [API implemented](#api-implemented)
- [Usage](#usage)
- [`NotionClient` class](#notionclient-class)
- [`Client` class](#client-class)
- [Individual classes](#individual-classes)
- [A few examples](#a-few-examples)
- [Append blocks children](#append-blocks-children)
- [Create a page](#create-a-page)
- [Errors](#errors)
- [Create page with chidren](#create-page-with-chidren)
- [Create page with children](#create-page-with-children)
- [Contributions](#contributions)
- [Rules](#rules)
- [Tests](#tests)
- [Example:](#example)
- [Next release](#next-release)
- [v1.2.1:](#v121)
- [Releases](#releases)
- [Next](#next)
- [v2.0.0](#v200)
- [Last](#last)
- [v2.0.0-beta2](#v200-beta2)

# API implemented
| Endpoint | Avaliable | Notes
|:------------------------|:----------:|:-
| Retrieve a database | βœ… |
| Query a database | πŸ— | Working on it
| List databases | βœ… |
| Create a database | βœ… | Workin on more properties
| Create a database | βœ… | Working on more properties
| Retrieve a page | βœ… |
| Create a page | βœ… | Workin on more properties
| Update a page | βœ… | Workin on more properties
| Create a page | βœ… | Working on more properties
| Update a page | βœ… | Working on more properties
| Retrieve block children | βœ… |
| Append block children | βœ… |
| Retrieve a user | |
Expand All @@ -41,10 +44,10 @@ See the [ROADMAP](ROADMAP.md) file to see what is coming next.
# Usage
**Important**: The methods return a `NotionResponse`. You can find how to use it in its [documentation][1].

## `NotionClient` class
You only have to create a new instance of the `NotionClient` class and all the API requests will be available as class methods.
## `Client` class
You only have to create a new instance of the `Client` class and all the API requests will be available as class methods.
```dart
NotionClient notion = NotionClient(token: 'YOUR SECRET TOKEN FROM INTEGRATIONS PAGE');
Client notion = Client(token: 'YOUR SECRET TOKEN FROM INTEGRATIONS PAGE');
```

## Individual classes
Expand All @@ -53,12 +56,12 @@ You can also use individual request group class like `NotionPagesClient` or `Not
**Example**
```dart
// With main class
NotionClient notion = NotionClient(token: 'YOUR_TOKEN');
notion.databases.fetchAll();
Client notion = Client(token: 'YOUR_TOKEN');
notion.databases.list();

// With individual class
NotionDatabasesClient databases = NotionDatabasesClient(token: 'YOUR_TOKEN');
databases.fetchAll();
databases.list();
```

## A few examples
Expand All @@ -70,7 +73,7 @@ _To see code to create the page above or see more examples [go here](https://git
### Append blocks children
```dart
// Create children instance:
Children children = Children.withBlocks([
Children children = Children(blocks: [
Heading(text: Text('Test')),
Paragraph(texts: [
Text('Lorem ipsum (A)'),
Expand All @@ -85,7 +88,7 @@ Children children = Children.withBlocks([

// Send the instance to Notion
notion.blocks.append(
to: 'YOUR_BLOCK_ID',
block_id: 'YOUR_BLOCK_ID',
children: children,
);
```
Expand All @@ -104,7 +107,7 @@ notion.pages.create(page);

# Errors
Some errors that I have encounter and still don't know how to solve because are errors that also occur on Postman are:
## Create page with chidren
## Create page with children
When the parent is a page the error is:
```json
"body failed validation: body.properties.title.type should be anΒ array, instead was `\"array\"`."
Expand Down Expand Up @@ -146,27 +149,16 @@ TEST_BLOCK_ID=c8hac4bb32af48889228bf483d938e34
TEST_BLOCK_HEADING_ID=c8hac4bb32af48889228bf483d938e34
```

# Next release
## v1.2.1:
> Release date: 02/Aug/2021
* Add constructors with only single text content with default style for:
* `Paragraph.text('some text here...')`
* `ToDo.text('some text here...', checked: true)`
* `Heading.text('some text here...', type: 2)`
* `BulletedListItem.text('some text here...')`
* `NumberedListItem.text('some text here...')`
* `Toggle.text('some text here...', children: [])`
* Add more constructors for `Heading` class:
* `one`: Heading with type 1 by default.
* `two`: Heading with type 2 by default.
* `three`: Heading with type 3 by default.
* Add more constructors for `Text` class:
* `code`: Text with code style by default.
* `italic`: Text with italic style by default.
* `bold`: Text with bold style by default.
* [**Opt**] `list`: List of words separated by comma (by default).
* Example: `Text.list()` will receive a list of Text and will be concatenated separated with comma by default. **It may be unnecessary**. Can help to make the code more readable.
* [**Opt**] `sep`: Text separator.
* Example: `Text.sep()`, by default, will insert " " in a list of `Text` instances, but it will be able to do more things that I don't know yet, hehe. **It may be unnecessary**. Can help to make the code more readable.
# Releases
## Next
### v2.0.0
> Release date: 13/Aug/2021
* πŸ”§ Fix any error on beta

## Last
### v2.0.0-beta2
> Release date: 06/Aug/2021
* πŸ— Add more suggestions on issue [#11](https://github.com/jonathangomz/notion_api/issues/11):
* Copy some terminologies from [`notion-sdk-js`](https://github.com/makenotion/notion-sdk-js)

[1]:https://pub.dev/documentation/notion_api/1.0.0-beta1/responses_notion_response/NotionResponse-class.html
89 changes: 64 additions & 25 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,75 @@
## More coming soon...
If you have suggestions feel free to create an Issue or to create a PR with the feature.

## v1.3.0
> Release date: 06/Aug/2021
* Maybe fix errors creating page with children. I don't know if is an error with Notion API.
* Add query a database endpoint:
## v2.1.0
|||
|:---------------|:------------|
| Release date | ? |
| Notion-Version | 2021-08-16 |
* 🐣 Add `Retrieve a block` endpoint:
* https://developers.notion.com/reference/retrieve-a-block
* 🐣 Add `Update a block` endpoint:
* https://developers.notion.com/reference/update-a-block
* 🐣 Add `Query a database` endpoint:
* https://developers.notion.com/reference/post-database-query
* Add more properties for pages and databases:

## v2.0.1
|||
|:---------------|:------------|
| Release date | ? |
| Notion-Version | 2021-08-16 |
* πŸ”§ Maybe fix errors creating page with children. I don't know if is an error with Notion API.
* 🐣 Add more properties for pages and databases:
* Page properties: https://developers.notion.com/reference/page#page-property-value
* Database properties: https://developers.notion.com/reference/database#database-property

## v1.2.1:
> Release date: 02/Aug/2021
* Add constructors with only single text content with default style for:
* `Paragraph.text('some text here...')`
* `ToDo.text('some text here...', checked: true)`
* `Heading.text('some text here...', type: 2)`
* `BulletedListItem.text('some text here...')`
* `NumberedListItem.text('some text here...')`
* `Toggle.text('some text here...', children: [])`
* Add more constructors for `Heading` class:
* `one`: Heading with type 1 by default.
* `two`: Heading with type 2 by default.
* `three`: Heading with type 3 by default.
* Add more constructors for `Text` class:
* Database properties: https://develop ers.notion.com/reference/database#database-property

## v2.0.0
|||
|:---------------|:------------|
| Release date | 31/Mar/2022 |
| Notion-Version | 2021-08-16 |
* **Full refactorization to all the project**

## v2.0.0-beta2 βœ…
> Release date: 06/Aug/2021
* πŸ— Add more suggestions on issue [#11](https://github.com/jonathangomz/notion_api/issues/11):
* Copy some terminologies from [`notion-sdk-js`](https://github.com/makenotion/notion-sdk-js)

## v2.0.0-beta1 βœ…
> Release date: 30/Jun/2021
* 🐣 Add constructor for empty `Database`.
* 🐣 Add parameter `blocks` for `Children` constructor.
* πŸ— Remove deprecated code:
* `textSeparation`
* Parameter constructors for `Children`:
* `heading`
* `paragraph`
* `toDo`
* πŸ— Add suggestions on issue [#11](https://github.com/jonathangomz/notion_api/issues/11):
* Update exports to improve usage
* Add private folder (`src/`)
* 🐣 Add constructors with only single text content with default style for:
* `Paragraph`: `Paragraph.text('some text here...')`
* `ToDo`: `ToDo.text('some text here...', checked: true)`
* `Heading`: `Heading.text('some text here...', type: 2)`
* `BulletedListItem`: `BulletedListItem.text('some text here...')`
* `NumberedListItem`: `NumberedListItem.text('some text here...')`
* `Toggle`: `Toggle.text('some text here...', children: [])`
* (**CANCELED**) ~~🐣 Add more constructors for `Heading` class:~~
* ~~`one`: Heading with type 1 by default.~~
* ~~`two`: Heading with type 2 by default.~~
* ~~`three`: Heading with type 3 by default.~~
* 🐣 Add more constructors for `Text` class:
* `code`: Text with code style by default.
* `italic`: Text with italic style by default.
* `bold`: Text with bold style by default.
* [**Opt**] `list`: List of words separated by comma (by default).
* Example: `Text.list()` will receive a list of Text and will be concatenated separated with comma by default. **It may be unnecessary**. Can help to make the code more readable.
* [**Opt**] `sep`: Text separator.
* Example: `Text.sep()`, by default, will insert " " in a list of `Text` instances, but it will be able to do more things that I don't know yet, hehe. **It may be unnecessary**. Can help to make the code more readable.
* `underline`: Text with underline style by default.
* `color`: Text with different color of default.
* [**CANCELED**] ~~`sep`: Text separator.~~
* ~~Example: `Text.sep()`, by default, will insert " " in a list of `Text` instances, but it will be able to do more things that I don't know yet, hehe. **It may be unnecessary**. Can help to make the code more readable.~~
* 🐣 Add `list(List<Text> texts, String separator, String lastSeparator)`:
* **A static method**
* Generate a textual list of texts separated by comma (by default).

## v1.2.0: βœ…
> Release date: 27/Jul/2021
Expand Down
Loading