Skip to content

A strongly typed interface to interact with Notion using ZIO

License

Notifications You must be signed in to change notification settings

univalence/zio-notion

Repository files navigation

ZIO Notion

A strongly typed interface to interact with Notion using ZIO

Documentation

You can find the documentation of zio-notion here.

Example

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.

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:

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:

resolvers += Resolver.sonatypeRepo("snapshots"),
libraryDependencies += "io.univalence" %% "zio-notion" % "<SNAPSHOT-VERSION>"

You can find the latest version on nexus repository manager.

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!