Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/univalence/zio-notion

A strongly typed interface to interact with Notion using ZIO
https://github.com/univalence/zio-notion

fp notion scala zio

Last synced: 3 months ago
JSON representation

A strongly typed interface to interact with Notion using ZIO

Awesome Lists containing this project

README

        

ZIO Notion


















A strongly typed interface to interact with Notion using ZIO

## Documentation

You can find the documentation of zio-notion [here](https://univalence.github.io/zio-notion/).

## Example

```scala
import zio._
import zio.notion._
import zio.notion.dsl._

import java.time.LocalDate

object UpdatePage extends ZIOAppDefault {
def example: ZIO[Notion, NotionError, Unit] = {
val date = LocalDate.of(2022, 2, 2)

// Apply the following operations to the page:
// - Apply the ceil function to the value contained in "col1"
// - Set the date between 2022-02-02 and 2022-02-16 in "col2"
// - Archive the page
val operations = $"col1".asNumber.patch.ceil ++ $"col2".asDate.patch.between(date, date.plusDays(14)) ++ archive

for {
page <- Notion.retrievePage("6A074793-D735-4BF6-9159-24351D239BBC") // Insert your own page ID
_ <- Notion.updatePage(page, operations)
} yield ()
}

override def run =
example.provide(Notion.layerWith("6A074793-D735-4BF6-9159-24351D239BBC")) // Insert your own bearer
}
```

We provide [other examples](https://github.com/univalence/zio-notion/tree/master/examples) in this repository.

## Features

### Page

- You can update a page
- You can retrieve a page
- You can archive a page
- You can create a page

### Database

- You can update a database
- You can retrieve a database
- You can query a database
- You can create a database (without blocks for the moment)

### Block

- You can retrieve a block
- You can retrieve blocks of a page
- ~~You can update a block~~ 🕦 COMING SOON
- ~~You can delete a block~~ 🕦 COMING SOON
- You can append a block

### User

- You can retrieve a user
- You can list users
- ~~You can retrieve your token's bot user~~ 🕦 COMING SOON

### Search

🕦 COMING SOON

## Latest version

If you want to get the very last version of this library you can still download it using:

```scala
libraryDependencies += "io.univalence" %% "zio-notion" % "0.9.3"
```

### Snapshots

If you want to get the latest snapshots (the version associated with the last commit on master), you can still download
it using:

```scala
resolvers += Resolver.sonatypeRepo("snapshots"),
libraryDependencies += "io.univalence" %% "zio-notion" % ""
```

You can find the latest version on
[nexus repository manager](https://oss.sonatype.org/#nexus-search;gav~io.univalence~zio-notion_2.13~~~~kw,versionexpand).

## Contributions

Pull requests are welcomed. We are open to organize pair-programming session to tackle improvements. If you want to add
new things in `zio-notion`, don't hesitate to open an issue!