yq_whoami: Info on current YuQue user

Description Usage Arguments Details Value Examples

View source: R/whoami.R

Description

Reports basic profile for the YuQue user.

Usage

1
2
yq_whoami(.token = NULL, .api_url = NULL, .send_headers = NULL,
  show = TRUE)

Arguments

.token

Authentication token. Default to YUQUE_TOKEN environment variables, in this order if any is set.

.api_url

YuQue API url (default: https://www.yuque.com/api/v2). Used if endpoint just contains a path. Default to YuQue_API_URL environment variable if set.

.send_headers

Named character vector of header field values (excepting Authorization, which is handled via .token). This can be used to override or augment the defaults, which are as follows: the Accept field defaults to "application/json" and the User-Agent field defaults to "https://github.com/ShixiangWang/yq". This can be used to, e.g., provide a custom media type, in order to access a preview feature of the API.

show

default is TRUE, print info.

Details

Get a personal access token for the YuQue API from https://www.yuque.com/settings and select the scopes necessary for your planned tasks. The repo scope, for example, is one many are likely to need. The token itself is a string of 40 letters and digits.

You can set it using yq_config function. You can also store it any way you like and provide explicitly via the .token argument to yq().

However, you can also define an environment variable YUQUE_TOKEN with this value in their .Renviron file. Add a line that looks like this, substituting your PAT:

1
YUQUE_TOKEN=8c70fd8419398999c9ac5bacf3192882193cadf2

Put a line break at the end! If you're using an editor that shows line numbers, there should be (at least) two lines, where the second one is empty. Restart R for this to take effect. Call yq_whoami() to confirm success.

To get complete information on the authenticated user, call yq("/users/your_login_name").

Value

a data.frame

Examples

1
2
3
4
5
## Not run: 
yq_whoami()


## End(Not run)

ShixiangWang/yq documentation built on Oct. 30, 2019, 11:57 p.m.