Package 'royale'

Title: Clash Royale API
Description: R interface to the official API for Clash Royale <https://developer.clashroyale.com/#/>.
Authors: Christopher T. Kenny [aut, cre]
Maintainer: Christopher T. Kenny <[email protected]>
License: MIT + file LICENSE
Version: 0.0.1
Built: 2024-06-29 03:28:47 UTC
Source: https://github.com/christopherkenny/royale

Help Index


Get Battle Log

Description

Get Battle Log

Usage

cr_get_battle_log(tag = "JYJQC88", key = cr_get_key())

Arguments

tag

Required. The player to return. Default: JYJQC88

key

Required. API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key()

Value

tibble of player info

Examples

cr_get_battle_log('JYJQC88')

Get card details

Description

Get card details

Usage

cr_get_cards(limit = NULL, after = NULL, before = NULL, key = cr_get_key())

Arguments

limit

number of items returned in the response.

after

return only items that occur after this marker.

before

return only items that occur before this marker.

key

Required. API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key()

Value

tibble of card info

Examples

cr_get_cards()

Get Challenges

Description

Get Challenges

Usage

cr_get_challenges(
  limit = NULL,
  after = NULL,
  before = NULL,
  key = cr_get_key()
)

Arguments

limit

number of items returned in the response.

after

return only items that occur after this marker.

before

return only items that occur before this marker.

key

Required. API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key()

Value

tibble of card info

Examples

cr_get_challenges()

Get a clan

Description

Gets full clan details

Usage

cr_get_clan(clan = "99R2PQVR", key = cr_get_key())

Arguments

clan

Required. Clan tag. Default: 99R2PQVR

key

Required. API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key

Value

a tibble with each row as a player

Examples

cr_get_clan('99R2PQVR')

Get current clan members

Description

Get current clan members

Usage

cr_get_clan_members(
  clan = "99R2PQVR",
  limit = NULL,
  after = NULL,
  before = NULL,
  key = cr_get_key()
)

Arguments

clan

Required. Clan tag. Default: 99R2PQVR

limit

number of items returned in the response.

after

return only items that occur after this marker.

before

return only items that occur before this marker.

key

Required. Clash Royale API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key

Value

tibble with list columns for clan, clans, and history.

Examples

cr_get_clan_members('99R2PQVR')

Get Global Player Path of Legend Rankings

Description

Get Global Player Path of Legend Rankings

Usage

cr_get_global_path_of_legend_players(
  season,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = cr_get_key()
)

Arguments

season

Required. Season ID, such as '2022-09'

limit

number of items returned in the response.

after

return only items that occur after this marker.

before

return only items that occur before this marker.

key

Required. API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key()

Value

tibble of card info

Examples

cr_get_global_path_of_legend_players('2023-02', limit = 10)

Get Global Player Rankings for a Season

Description

Get Global Player Rankings for a Season

Usage

cr_get_global_ranking_players(
  season,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = cr_get_key()
)

Arguments

season

Required. Season ID, such as '2022-09'

limit

number of items returned in the response.

after

return only items that occur after this marker.

before

return only items that occur before this marker.

key

Required. API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key()

Value

tibble of card info

Examples

cr_get_global_ranking_players('2022-09', limit = 10)

Get Global Tournament Rankings

Description

Get Global Tournament Rankings

Usage

cr_get_global_ranking_tournament(
  tournament,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = cr_get_key()
)

Arguments

tournament

Tournament tag. Required.

limit

number of items returned in the response.

after

return only items that occur after this marker.

before

return only items that occur before this marker.

key

Required. API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key()

Value

tibble of card info

Examples

# needs an ongoing tournament at time of request
try({cr_get_global_ranking_tournament('URP8YYUU0')})

Get Global Season

Description

This returns the current season if it's a valid season.

Usage

cr_get_global_season(
  season,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = cr_get_key()
)

Arguments

season

Required. Season ID, such as '2022-09'

limit

number of items returned in the response.

after

return only items that occur after this marker.

before

return only items that occur before this marker.

key

Required. API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key()

Value

tibble of global seasons

Examples

cr_get_global_season('2022-09')

Get Global Seasons

Description

Get Global Seasons

Usage

cr_get_global_seasons(
  season,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = cr_get_key()
)

Arguments

season

Required. Season ID, such as '2022-09'

limit

number of items returned in the response.

after

return only items that occur after this marker.

before

return only items that occur before this marker.

key

Required. API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key()

Value

tibble of card info

Examples

cr_get_global_seasons()

Get Global Tournament details

Description

Get Global Tournament details

Usage

cr_get_global_tournaments(
  limit = NULL,
  after = NULL,
  before = NULL,
  key = cr_get_key()
)

Arguments

limit

number of items returned in the response.

after

return only items that occur after this marker.

before

return only items that occur before this marker.

key

Required. API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key()

Value

tibble of card info

Examples

cr_get_global_tournaments()

Get Player Path of Legend Rankings for a Location

Description

Get Player Path of Legend Rankings for a Location

Usage

cr_get_local_path_of_legend_players(
  location,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = cr_get_key()
)

Arguments

location

Required. Location ID from cr_get_locations(). Must be a country.

limit

number of items returned in the response.

after

return only items that occur after this marker.

before

return only items that occur before this marker.

key

Required. API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key()

Value

tibble of card info

Examples

cr_get_local_path_of_legend_players(location = 57000249, limit = 10)

Get Clan Rankings for a Location

Description

Get Clan Rankings for a Location

Usage

cr_get_local_ranking_clans(
  location,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = cr_get_key()
)

Arguments

location

Required. Location ID from cr_get_locations().

limit

number of items returned in the response.

after

return only items that occur after this marker.

before

return only items that occur before this marker.

key

Required. API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key()

Value

tibble of card info

Examples

cr_get_local_ranking_clans(57000001, limit = 10)

Get Player Rankings for a Location

Description

Get Player Rankings for a Location

Usage

cr_get_local_ranking_players(
  location,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = cr_get_key()
)

Arguments

location

Required. Location ID from cr_get_locations(). Must be a country.

limit

number of items returned in the response.

after

return only items that occur after this marker.

before

return only items that occur before this marker.

key

Required. API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key()

Value

tibble of card info

Examples

cr_get_local_ranking_players(57000249, limit = 10)

Get One Location

Description

Get One Location

Usage

cr_get_location(location, key = cr_get_key())

Arguments

location

Required. Location ID from cr_get_locations().

key

Required. API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key()

Value

tibble of card info

Examples

cr_get_location(57000001)

Get Locations

Description

Get Locations

Usage

cr_get_locations(limit = NULL, after = NULL, before = NULL, key = cr_get_key())

Arguments

limit

number of items returned in the response.

after

return only items that occur after this marker.

before

return only items that occur before this marker.

key

Required. API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key()

Value

tibble of locations

Examples

cr_get_locations()

Get a single player

Description

Gets the player details for one player.

Usage

cr_get_player(tag = "JYJQC88", key = cr_get_key())

Arguments

tag

Required. The player to return. Default: JYJQC88

key

Required. API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key()

Value

tibble of player info

Examples

cr_get_player('JYJQC88')

Get current River Race

Description

Get current River Race

Usage

cr_get_riverrace_current(
  clan = "99R2PQVR",
  limit = NULL,
  after = NULL,
  before = NULL,
  key = cr_get_key()
)

Arguments

clan

Required. Clan tag. Default: 99R2PQVR

limit

number of items returned in the response.

after

return only items that occur after this marker.

before

return only items that occur before this marker.

key

Required. Clash Royale API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key

Value

tibble with list columns for clan, clans, and history.

Examples

cr_get_riverrace_current('99R2PQVR')

Get River Race Log

Description

Get River Race Log

Usage

cr_get_riverrace_log(
  clan = "99R2PQVR",
  limit = NULL,
  after = NULL,
  before = NULL,
  key = cr_get_key()
)

Arguments

clan

Required. Clan tag. Default: 99R2PQVR

limit

number of items returned in the response.

after

return only items that occur after this marker.

before

return only items that occur before this marker.

key

Required. Clash Royale API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key

Value

tibble with list columns for clan, clans, and history.

Examples

cr_get_riverrace_log('99R2PQVR')

Get Global Seasons

Description

This returns the current season if it's a valid season.

Usage

cr_get_seasons(key = cr_get_key())

Arguments

key

Required. API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key()

Value

a tibble of season info

Examples

cr_get_seasons()

Get Tournament

Description

Get Tournament

Usage

cr_get_tournament(tournament, key = cr_get_key())

Arguments

tournament

Tournament tag. Required.

key

Required. API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key

Value

a tibble with each row as a player

Examples

tournament <- cr_get_tournament_search('a')$tag[1]
cr_get_tournament(tournament)

Get Upcoming Chests

Description

Get Upcoming Chests

Usage

cr_get_upcoming_chests(tag = "JYJQC88", key = cr_get_key())

Arguments

tag

Required. The player to return. Default: JYJQC88

key

Required. API key. See https://developer.clashroyale.com/#/documentation Default: cr_get_key()

Value

tibble of player info

Examples

cr_get_upcoming_chests('JYJQC88')

Set Clash Royale API key

Description

Sets your Clash Royale API key for default use.

Usage

cr_set_key(key, overwrite = FALSE, install = FALSE)

Arguments

key

Required. Your Clash Royale API key. See https://developer.clashroyale.com/#/getting-started.

overwrite

Defaults to FALSE. Boolean. Should existing CR_API_KEY in Renviron be overwritten?

install

Defaults to FALSE. Boolean. Should this be added '~/.Renviron' file?

Value

key, invisibly

Examples

## Not run: 
cr_set_key('1234')

## End(Not run)

Get Clash Royale API key

Description

Retrieves Clash Royale API key set by cr_set_key() if cr_get_key() or indicates if one is set if cr_has_key().

Usage

cr_get_key()

cr_has_key()

Value

string key, invisibly otherwise logical

Examples

cr_has_key()