https://github.com/tylerlittlefield/blizz
:snowflake: Minimalistic client to access Blizzard’s API in R
https://github.com/tylerlittlefield/blizz
api blizzard games r rstats
Last synced: 7 days ago
JSON representation
:snowflake: Minimalistic client to access Blizzard’s API in R
- Host: GitHub
- URL: https://github.com/tylerlittlefield/blizz
- Owner: tylerlittlefield
- License: other
- Created: 2018-12-21T03:49:08.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-09-16T01:01:13.000Z (over 5 years ago)
- Last Synced: 2025-02-25T18:48:23.901Z (over 1 year ago)
- Topics: api, blizzard, games, r, rstats
- Language: R
- Homepage: https://blizz.netlify.com/
- Size: 3.47 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# blizz
[](https://travis-ci.org/tyluRp/blizz)
[](https://ci.appveyor.com/project/tyluRp/blizz)
[](https://codecov.io/gh/tyluRp/blizz?branch=master)
[](https://www.tidyverse.org/lifecycle/#experimental)
```{r, echo=FALSE}
knitr::include_graphics("man/figures/Nagrand_Concept_Art_Peter_Lee_1.jpg")
```
Minimalistic client to access [Blizzards API](https://develop.battle.net/).
## Installation
You can install from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("tyluRp/blizz")
```
## Additional Setup
You need to create a developer account at Blizzard's [**dev portal**](https://develop.battle.net/). Once you've created an account, a client needs to be made. Creating a client will produce a **Client ID** and **Client Secret**. With these credentials you can run:
```r
# replace ID/SECRET with your own
blizz_auth("ID", "SECRET")
```
After this, you're all set.
If you want to avoid using `blizz_auth()`, you can obtain the Client ID, Secret, and Token by following the [docs](https://develop.battle.net/documentation/guides/getting-started). Then edit the `.Renviron` file manually and supply the credentials like so:
```r
BLIZZARD_CLIENT_ID='your ID'
BLIZZARD_CLIENT_SECRET='your secret'
BLIZZARD_AUTH_TOKEN='your token'
```
Note: Blizzard's authentication tokens expire after 24 hours. To avoid having to refresh the token everyday, `blizz` runs the following command everytime the library is loaded:
```r
blizz_auth(refresh = TRUE)
```
This will remove the expired token from your `.Renviron` and add the fresh token to it. More info on how to get started can be found in [**this**](https://blizz.netlify.com/articles/auth.html) vignette.
## Example
Use the `blizz()` function to access all API endpoints. Note that the leading slash must be included as well:
```{r example1}
library(blizz)
blizz("/d3/data/act/1")
```
Additionally, we can print the response as JSON thanks to the [`jsonlite`](https://github.com/jeroen/jsonlite) package:
```{r example2}
blizz("/d3/data/act/1", json = TRUE)
```
## Acknowledgements
* [Blizzard](https://develop.battle.net/): API
* [Peter Lee](https://www.artstation.com/peterconcept): Nagrand concept art
* [Jeroen Ooms](https://github.com/jeroen): `jsonlite` package
* [r-lib](https://github.com/r-lib): `httr` package