-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
126 lines (95 loc) · 3.3 KB
/
README.Rmd
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
124
125
126
---
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%"
)
library(yq)
```
# yq: An R client to access 'YuQue' API <img src="https://github.com/openbiox/openbiox-wiki/blob/master/static/img/logo-long.png" align="right" width="200"/>
<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/ShixiangWang/yq?branch=master&svg=true)](https://ci.appveyor.com/project/ShixiangWang/yq)
[![Travis build status](https://travis-ci.org/ShixiangWang/yq.svg?branch=master)](https://travis-ci.org/ShixiangWang/yq)
[![Codecov test coverage](https://codecov.io/gh/ShixiangWang/yq/branch/master/graph/badge.svg)](https://codecov.io/gh/ShixiangWang/yq?branch=master)
<!-- badges: end -->
## Installation
You can install the development version of **yq** from GitHub with:
``` r
remotes::install_github("openbiox/yq")
```
## Configuration
Firstly, you should let YuQue know who you are by running `yq_config()`.
You will need to answer some questions.
```r
> library(yq)
> yq_config()
Please type your login name of YuQue:
(type e to exit) shixiangwang
Do you want to input token?
(type ENTER to proceed)
Please type your token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Found token, checking it...
Saving info to ~/.yuque.json
Updating login
Updating token
Done. Enjoy this tool.
- Shixiang
```
Next, you can run `yq_whoami()` to check if your profile is right.
```r
> yq_whoami()
type : User
id : 471931
login : shixiangwang
name : 王诗翔
description : https://shixiangwang.github.io/home/
books_count : 3
public_books_count : 2
followers_count : 0
following_count : 0
created_at : 2019-09-01T09:21:50.000Z
updated_at : 2019-09-03T06:43:10.000Z
limits : 49899
```
> The token can be obtained from YuQue account.
> More please run `?yq_whoami` to see documentation.
## Usage
### Main API
The main API of **yq** package is `yq()` function. You can send any queries
to YuQue API URL <https://www.yuque.com/api/v2> or set custom API URL by `.api_url` argument.
All user functions are built on the top of `yq()`.
```{r}
args(yq)
```
### User functions
This package is under heavy development, many features shown in YuQue API have
not yet implemented. I will give a short intro to functions available.
- `yq_whoami` - return personal profile
- `yq_token` - return your token used by API query
- `yq_config` - set your login name and token (you can re-run it to reset)
- `yq_list_groups` - return personal groups
- `yq_list_public_groups` - return public groups
- `yq_list_group_info` - return group info and your ability
### Show cases
```{r}
yq_list_groups()
```
```{r}
yq_list_groups(verbose = "all")
```
```{r}
yq_list_public_groups()
```
```{r}
yq_list_group_info(login = "elegant-r")
```
## Code of Conduct
Please note that the 'yq' project is released with a
[Contributor Code of Conduct](CODE_OF_CONDUCT.md).
By contributing to this project, you agree to abide by its terms.