sort_notion: Notion Sort object generator

Description Usage Arguments Details Examples

View source: R/sort_notion.R

Description

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

Usage

1
2
3
4
5
sort_notion(
  property = character(),
  direction = character(),
  timestamp = character()
)

Arguments

property

A character vector represented the name of the property to sort against. Should be omitted, when used inside notion_search function.

direction

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.