A strongly typed interface to interact with Notion using ZIO
You can find the documentation of zio-notion here.
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 in this repository.
- You can update a page
- You can retrieve a page
- You can archive a page
- You can create a page
- 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)
- You can retrieve a block
- You can retrieve blocks of a page
You can update a block🕦 COMING SOONYou can delete a block🕦 COMING SOON- You can append a block
- You can retrieve a user
- You can list users
You can retrieve your token's bot user🕦 COMING SOON
🕦 COMING SOON
If you want to get the very last version of this library you can still download it using:
libraryDependencies += "io.univalence" %% "zio-notion" % "0.9.3"
If you want to get the latest snapshots (the version associated with the last commit on master), you can still download it using:
resolvers += Resolver.sonatypeRepo("snapshots"),
libraryDependencies += "io.univalence" %% "zio-notion" % "<SNAPSHOT-VERSION>"
You can find the latest version on nexus repository manager.
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!