Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start moving to {httr2} #18

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
49 changes: 49 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
48 changes: 48 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
folder: docs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
.Rhistory
.Rproj.user/DAAF7741/cpp-definition-cache
.Rproj.user
docs
18 changes: 14 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
Package: notionR
Title: R interfase for Notion API
Version: 0.0.0.9000
Version: 0.0.0.9001
Author: Eduardo Flores
Depends: R (>= 2.10)
Maintainer: Eduardo Flores <eduardo@enelmargen.org>
Description: Provides wrappers to access the Notion API using R.
License: `use_mit_license()`
License: MIT + file LICENSE
URL: https://Eflores89.github.io/notionR/,
https://github.com/Eflores89/notionR
Depends:
R (>= 2.10)
Imports:
dplyr,
httr,
httr2,
stringi,
tibble,
tidyr
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
23 changes: 2 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,2 @@
MIT License

Copyright (c) 2021 Eduardo Flores

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
YEAR: 2024
COPYRIGHT HOLDER: notionR authors
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2024 notionR authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
13 changes: 11 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ export(add_relation_id_filter)
export(add_select_filter)
export(archivePage)
export(createNotionPage)
export(deleteBlock)
export(getMultiSelectValues)
export(getNotionDatabase)
export(getNotionDatabaseMetadata)
export(getNotionPage)
export(getNotionPageContent)
export(getNotionPage_WIP)
export(isEmptyNotionDatabaseExport)
export(normalizeChromePageIds)
export(notion_filter)
Expand All @@ -33,9 +34,17 @@ importFrom(dplyr,group_by)
importFrom(dplyr,summarise)
importFrom(httr,GET)
importFrom(httr,PATCH)
importFrom(httr,POST)
importFrom(httr,accept)
importFrom(httr,add_headers)
importFrom(httr,content)
importFrom(httr,content_type)
importFrom(httr2,req_body_json)
importFrom(httr2,req_headers)
importFrom(httr2,req_perform)
importFrom(httr2,req_url_path)
importFrom(httr2,request)
importFrom(httr2,resp_body_json)
importFrom(httr2,resp_status_desc)
importFrom(stringi,stri_split_regex)
importFrom(tibble,enframe)
importFrom(tidyr,pivot_wider)
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# notionR 0.0.0.9001

* Start move to httr2

# notionR 0.0.0.9000

* First release
9 changes: 5 additions & 4 deletions R/addBlockH1.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#' Adds an H1 (heading one) Block to a Page
#'
#' Id refers to a page id, content should be only text.
#' @param secret API token
#' @param id Page id where block will be appended
#' @param content content to append as H1
#' @param toggle defaults to FALSE. If TRUE, will create an H1 Toggle.
#'
#' @param secret API token
#' @param id Page id where block will be appended
#' @param content content to append as H1
#' @param toggle defaults to FALSE. If TRUE, will create an H1 Toggle.
#'
#' @importFrom httr PATCH
#' @export
Expand Down
13 changes: 7 additions & 6 deletions R/addBlockH2.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#' Adds an H2 (heading two) Block to a Page
#' Adds an H2 (heading two) Block to a Page
#'
#' Id refers to a page id, content should be only text.
#' @param secret API token
#' @param id Page id where block will be appended
#' @param content content to append as H2
#' @param toggle defaults to FALSE. If TRUE, will create an H1 Toggle.
#' Id refers to a page id, content should be only text.
#'
#' @param secret API token
#' @param id Page id where block will be appended
#' @param content content to append as H2
#' @param toggle defaults to FALSE. If TRUE, will create an H1 Toggle.
#'
#' @importFrom httr PATCH
#' @export
Expand Down
11 changes: 6 additions & 5 deletions R/addBlockParagraph.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#' Adds a Paragraph Block to a Page
#' Adds a Paragraph Block to a Page
#'
#' Id refers to a page id, content should be only text. HTML will export to text.
#' @param secret API token
#' @param id Page id where block will be appended
#' @param content content to append
#' Id refers to a page id, content should be only text. HTML will export to text.
#'
#' @param secret API token
#' @param id Page id where block will be appended
#' @param content content to append
#'
#' @importFrom httr PATCH
#' @export
Expand Down
4 changes: 1 addition & 3 deletions R/deleteBlock.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
#' @param id block id
#'
#'
#' @importFrom httr PATCH
#' @importFrom httr content
#' @importFrom httr content_type
#' @importFrom httr PATCH content content_type add_headers accept
#' @export
deleteBlock <- function(secret, id){

Expand Down
1 change: 1 addition & 0 deletions R/filters.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#'
#' @param . List of filter conditions
#' @param sort List of sort conditions. NULL by default.
#' @param ... A combination of filters
#'
#'
#' @examples
Expand Down
2 changes: 1 addition & 1 deletion R/getMultiSelectValues.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#' @return vector
#'
#' @param column vector of column in data.frame (usually, after using getNotionDatabase, in form db$column_name )
#' @strip_string String by which we should strip >1 selects in a single database row. Defaults to "|", as this is the default behaviour in getNotionDatabase().
#' @param strip_string String by which we should strip >1 selects in a single database row. Defaults to "|", as this is the default behaviour in getNotionDatabase().
#' @param no_na Strip all NA's? Defaults to TRUE.
#' @param only_unique Export only unique values in vector? Defaults to TRUE.
#' @param show_progress Print the count of values? Defaults to TRUE.
Expand Down
Loading