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

Think about DSL for APIs #197

Closed
hadley opened this issue Feb 23, 2015 · 1 comment
Closed

Think about DSL for APIs #197

hadley opened this issue Feb 23, 2015 · 1 comment

Comments

@hadley
Copy link
Member

hadley commented Feb 23, 2015

github <- api_endpoint('https://api.github.com/') %>%
  api_oauth2(...) %>%
  api_error_handler(...)

github %>%
  api_path('repos', username, repo, 'issues') %>%
  GET(config(token = my_token))

# longer but simpler
github %>%
  api_path('repos') %>%
  api_path(username) %>%
  api_path(repo) %>%
  api_path('issues') %>%
  GET()

# with interpolation
repo_info <- list(username = 'craigcitro', repo = 'r-travis')
github %>% 
  api_template('repos/{username}/{repo}/issues', repo_info) %>%
  GET()

cc @craigcitro

@hadley hadley changed the title Think about DSL for API Think about DSL for APIs Feb 23, 2015
@hadley
Copy link
Member Author

hadley commented May 4, 2015

Now think this belongs elsewhere, e.g. https://github.com/sckott/httsnap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant