{"id":16926364,"url":"https://github.com/scordio/spring-batch-notion","last_synced_at":"2025-03-22T11:31:05.668Z","repository":{"id":161296720,"uuid":"582331004","full_name":"scordio/spring-batch-notion","owner":"scordio","description":"Spring Batch extension for Notion","archived":true,"fork":false,"pushed_at":"2024-11-08T01:00:47.000Z","size":229,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-25T22:31:43.608Z","etag":null,"topics":["batch","hacktoberfest","java","notion","spring"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scordio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"scordio"}},"created_at":"2022-12-26T13:38:01.000Z","updated_at":"2024-11-08T01:02:09.000Z","dependencies_parsed_at":"2024-01-01T11:25:23.002Z","dependency_job_id":"434440f7-3b2f-46c7-ae9b-cb02a591890a","html_url":"https://github.com/scordio/spring-batch-notion","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scordio%2Fspring-batch-notion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scordio%2Fspring-batch-notion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scordio%2Fspring-batch-notion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scordio%2Fspring-batch-notion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scordio","download_url":"https://codeload.github.com/scordio/spring-batch-notion/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244951277,"owners_count":20537352,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["batch","hacktoberfest","java","notion","spring"],"created_at":"2024-10-13T20:29:42.041Z","updated_at":"2025-03-22T11:31:05.662Z","avatar_url":"https://github.com/scordio.png","language":"Java","funding_links":["https://github.com/sponsors/scordio"],"categories":[],"sub_categories":[],"readme":"\u003e [!IMPORTANT]  \n\u003e This project is now part of [spring-projects/spring-batch-extensions](https://github.com/spring-projects/spring-batch-extensions).\n\n# Spring Batch Notion [![Maven Central](https://img.shields.io/maven-central/v/io.github.scordio/spring-batch-notion?label=Maven%20Central)](https://mvnrepository.com/artifact/io.github.scordio/spring-batch-notion) [![javadoc](https://javadoc.io/badge2/io.github.scordio/spring-batch-notion/javadoc.svg)](https://javadoc.io/doc/io.github.scordio/spring-batch-notion)\n\n[![CI](https://github.com/scordio/spring-batch-notion/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/scordio/spring-batch-notion/actions/workflows/main.yml?query=branch%3Amain)\n[![Cross-Version](https://github.com/scordio/spring-batch-notion/actions/workflows/cross-version.yml/badge.svg?branch=main)](https://github.com/scordio/spring-batch-notion/actions/workflows/cross-version.yml?query=branch%3Amain)\n\nThis project provides a [Spring Batch][] extension module that adds support for [Notion][].\n\n## Compatibility\n\nSpring Batch Notion is based on Spring Batch 5 and tested on Spring Boot 3, thus requiring at least Java 17.\n\nCompatibility is guaranteed only with the Spring Boot versions under [OSS support](https://spring.io/projects/spring-boot/#support). \n\n## Getting Started\n\n### Maven\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eio.github.scordio\u003c/groupId\u003e\n  \u003cartifactId\u003espring-batch-notion\u003c/artifactId\u003e\n  \u003cversion\u003e${spring-batch-notion.version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Gradle\n\n```kotlin\nimplementation(\"io.github.scordio:spring-batch-notion:${springBatchNotionVersion}\")\n```\n\n## NotionDatabaseItemReader\n\nThe `NotionDatabaseItemReader` is a restartable `ItemReader` that reads entries from a [Notion Database] via a paging technique.\n\nA minimal configuration of the item reader is as follows:\n\n```java\nNotionDatabaseItemReader\u003cItem\u003e itemReader() {\n    NotionDatabaseItemReader\u003cItem\u003e reader = new NotionDatabaseItemReader\u003c\u003e();\n    reader.setToken(System.getenv(\"NOTION_TOKEN\"));\n    reader.setDatabaseId(\"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\"); // UUID\n    reader.setPropertiesMapper(new CustomPropertyMapper());\n    return reader;\n}\n```\n\nThe following configuration options are available:\n\n| Property         | Required | Default                     | Description                                                                                                               |\n|------------------|----------|-----------------------------|---------------------------------------------------------------------------------------------------------------------------|\n| `baseUrl`        | no       | `https://api.notion.com/v1` | Base URL of the Notion API. A custom value can be provided for testing purposes (e.g., the URL of a [WireMock][] server). |\n| `databaseId`     | yes      | -                           | UUID of the database to read from.                                                                                        |\n| `filter`         | no       | `null`                      | `Filter` condition to limit the returned items.                                                                           |\n| `pageSize`       | no       | `100`                       | Number of items to be read with each page. Must be greater than zero and less than or equal to 100.                       |\n| `propertyMapper` | yes      | -                           | The `PropertyMapper` responsible for mapping properties of a Notion item into a Java object.                              |\n| `sorts`          | no       | `null`                      | `Sort` conditions to order the returned items. Each condition is applied following the declaration order.                 |\n| `token`          | yes      | -                           | The Notion integration token.                                                                                             |\n\nIn addition to the Notion-specific configuration, all the configuration options of the Spring Batch\n[`AbstractPaginatedDataItemReader`](https://docs.spring.io/spring-batch/docs/current/api/org/springframework/batch/item/data/AbstractPaginatedDataItemReader.html)\nare supported.\n\n### PropertyMapper\n\nThe `NotionDatabaseItemReader` requires a `PropertyMapper` to map the properties of a Notion item into an object.\n\nCurrently, only properties of type [Title](https://developers.notion.com/reference/property-object#title)\nand [Rich Text](https://developers.notion.com/reference/property-object#rich-text) are supported,\nand both are converted to strings.\n\nThe following `PropertyMapper` implementations are provided out of the box.\n\n| Name                        | Description                                                                                                                                                                |\n|-----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `BeanWrapperPropertyMapper` | Supports JavaBeans. Requires a default constructor and expects the setter names to match the Notion item property names (case-insensitive).                                |\n| `ConstructorPropertyMapper` | Supports types with a constructor with arguments. Requires the constructor to be unique and its argument names to match the Notion item property names (case-insensitive). |\n| `RecordPropertyMapper`      | Supports Java records. It uses the record canonical constructor and requires the record component names to match the Notion item property names (case-insensitive).        |\n\nAll implementations above offer two constructors:\n* One accepting the `Class` instance of the type to be mapped\n* One without parameters, for cases where the type to be mapped can be inferred by the generic type of the variable or method enclosing the constructor declaration\n\nIn case none of the provided implementations is suitable, a custom one can be provided.\n\n## NotionDatabaseItemWriter\n\nCurrently not provided but will be added in the future.\n\n## License\n\nThe Spring Batch Notion is released under version 2.0 of the [Apache License][].\n\n[Apache License]: https://www.apache.org/licenses/LICENSE-2.0\n[Notion]: https://notion.so/\n[Notion Database]: https://www.notion.so/help/category/databases\n[Spring Batch]: https://github.com/spring-projects/spring-batch\n[WireMock]: https://wiremock.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscordio%2Fspring-batch-notion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscordio%2Fspring-batch-notion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscordio%2Fspring-batch-notion/lists"}