-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathREADME.Rmd
More file actions
123 lines (90 loc) · 3.32 KB
/
README.Rmd
File metadata and controls
123 lines (90 loc) · 3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# rscloud
<!-- badges: start -->
[](https://codecov.io/gh/rstudio/rscloud?branch=master)
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[](https://github.com/rstudio/rscloud/actions)
<!-- badges: end -->
API wrappers for the rstudio.cloud service. The initial release includes APIs for managing space memberships, and listing projects within a space.
## Getting started
To get started, you'll need to obtain credentials and set the environment variables `RSCLOUD_CLIENT_ID` and `RSCLOUD_CLIENT_SECRET`. The recommended way to set these is by editing your `.Renviron` file. This can be done using the `usethis::edit_r_environ()` function. Your `.Renviron` file may look something like the following:
```
RSCLOUD_CLIENT_ID=xxxxxxx
RSCLOUD_CLIENT_SECRET=zzzzzzz
```
To get your credentials log in to RStudio Cloud, click on your name/icon on the right side of the header, and choose "Credentials" from the user panel that appears. That will take you the RStudio User Settings application, where you can create credentials for use with rscloud.
You can install the development version of rscloud as follows:
```{r, eval = FALSE}
install.packages("remotes")
remotes::install_github("rstudio/rscloud")
```
The entry point to most of the functionality is a *space*. To see the list of spaces you have access to, you can use the `rscloud_space_list()` function:
```{r, include = FALSE, eval = TRUE}
library(rscloud)
# clean up
space <- rscloud_space(name = "test-space-1")
members <- space %>%
space_member_list() %>%
dplyr::filter(email != "rscloud.test.01@gmail.com")
space %>%
purrr::safely(space_member_remove)(members, content_action = "leave", ask = FALSE)
space %>%
purrr::possibly(space_invitation_list, otherwise = NULL)() %>%
purrr::safely(invitation_rescind)()
```
```{r}
library(rscloud)
rscloud_space_list()
```
To create a space object, use the `rscloud_space()` function:
```{r}
space <- rscloud_space(178750)
# you can also use the space name
# space <- rstudio_space(name = "test-space-1")
space
```
Adding members to a space can be done via `space_member_add()`:
```{r}
space %>%
space_member_add("mine+test1@rstudio.com")
space
```
You can get a tidy data frame of space members with `space_member_list()`:
```{r}
space %>%
space_member_list()
```
You can also provide a data frame of user information, which can be useful when working with spreadsheets of class rosters:
```{r}
roster <- tibble::tribble(
~user_email,
"mine+test2@rstudio.com",
"mine+test3@rstudio.com"
)
space %>%
space_member_add(roster)
space
```
You can also work with outstanding invitations:
```{r}
invitations <- space %>%
space_invitation_list()
invitations
```
To resend invitations, use the `invitation_send()` function:
```{r, eval = FALSE}
invitations %>%
# filter(...) %>%
invitation_send()
```