filter_notion: Notion Filter object generator

Description Usage Arguments Details Examples

View source: R/filter_notion.R

Description

A helper function for creating 'Filter objects' used by Notion API in Search and Query.

Usage

1
2
3
4
5
6
7
filter_notion(
  property = character(),
  type = character(),
  ...,
  condition = list(),
  .CallfromSearch = false
)

Arguments

property

A character vector represented the name of the property to filter on. Should only be 'object', when used inside notion_search function.

type

A character vector represented the direction to sort. Either "ascending" and "descending".

timestamp

A character vector represented The name of the timestamp to sort against. Either "created_time" and "last_edited_time".

Details

please check: https://developers.notion.com/reference/post-search and https://developers.notion.com/reference/post-database-query

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# Size of one
sort_1 <- sort_notion(property = "Ingredients", direction = "descending", timestamp = "last_edited_time")
sort_1

# Size of N (all element should have an equal length or 1)
sort_n <- sort_notion(
  property = LETTERS[1:4],
  direction = "ascending",
  timestamp = rep(c("last_edited_time", "created_time"), 2)
)

# Coercing sort criteria with 'c()'
c(sort_1, sort_n)

# Omit properties when use inside notion search
notion_search(
  sort = sort_notion(direction = "ascending", timestamp = "last_edited_time"),
  page_size = 4
)

Songyosr/Rnotion documentation built on Dec. 18, 2021, 2:07 p.m.