Description Usage Arguments Value Source See Also Examples
Tool to access YuQue.
This is an extremely minimal client. You need to know the API to be able to use this client. All this function does is:
Try to substitute each listed parameter into
endpoint
, using the :parameter
notation.
If a GET request (the default), then add all other listed parameters as query parameters.
If not a GET request, then send the other parameters in the request body, as JSON.
Convert the response to an R list using
jsonlite::fromJSON
.
1 2 3 |
endpoint |
YuQue API endpoint. Must be one of the following forms:
If the method is not supplied, will use |
... |
Name-value pairs giving API parameters. Will be matched
into |
.token |
Authentication token. Default to YUQUE_TOKEN environment variables, in this order if any is set. |
.destfile |
path to write response to disk. If NULL (default), response will be processed and returned as an object. If path is given, response will be written to disk in the form sent. |
.overwrite |
if |
.api_url |
YuQue API url (default: https://www.yuque.com/api/v2). Used
if |
.method |
HTTP method to use if not explicitly supplied in the
|
.send_headers |
Named character vector of header field values
(excepting |
A response
object from httr package, which is also a list
.
yq_whoami()
for details on YuQue API token
management.
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 | # For more details, please read API of 'YuQue'
# <https://www.yuque.com/yuque/developer>
# User -----------------------------------------
## Information for a user
yq("/users/shixiangwang")
yq("/users/shixiangwang") %>% headers() # Obtain headers
yq("/users/shixiangwang") %>% status_code() # Obtain status
yq("/users/shixiangwang") %>% content() # Obtain response
## Information for the current authenticated user
yq("/user")
# Group -----------------------------------------
## List groups of a user
yq("/users/shixiangwang/groups")
## Information for a group
## Just treat it like a user
yq("/groups/elegant-r")
# Repo -------------------------------------------
## List repo of a user or group
yq("/users/shixiangwang/repos")
yq("/users/elegant-r/repos")
## Information for a repo
yq("/repos/shixiangwang/tools")
# Doc --------------------------------------------
## List documents of a repo
yq("/repos/shixiangwang/tools/docs")
## Information of a document
## Not run:
yq("/repos/elegant-r/zfc8ub/docs/krle92")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.