Package 'clash'

Title: Access the Clash of Clans API
Description: Interfaces with the official API for Clash of Clans <https://developer.clashofclans.com/#/>. Provides tools to work with players, clans, wars, raids, and other game events. All outputs are provided in a tidy format, where each player, clan, or attack is an observation.
Authors: Christopher T. Kenny [aut, cre]
Maintainer: Christopher T. Kenny <[email protected]>
License: MIT + file LICENSE
Version: 0.0.1
Built: 2024-10-01 02:51:30 UTC
Source: https://github.com/christopherkenny/clash

Help Index


Get information for one Builder Base league

Description

Get information for one Builder Base league

Usage

coc_get_builderbase_league(
  league,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = coc_get_key()
)

Arguments

league

league id, such as 44000041

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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

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

Examples

coc_get_builderbase_league(league = '44000041', limit = 10)

Get Builder Base Leagues

Description

Get Builder Base Leagues

Usage

coc_get_builderbase_leagues(
  limit = NULL,
  after = NULL,
  before = NULL,
  key = coc_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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

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

Examples

coc_get_builderbase_leagues(limit = 10)

Get information for one capital league

Description

Get information for one capital league

Usage

coc_get_capital_league(
  league,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = coc_get_key()
)

Arguments

league

league id, such as 85000022

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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

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

Examples

coc_get_capital_league(league = '85000022', limit = 10)

Get Capital Leagues

Description

Get Capital Leagues

Usage

coc_get_capital_leagues(
  limit = NULL,
  after = NULL,
  before = NULL,
  key = coc_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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

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

Examples

coc_get_capital_leagues(limit = 10)

Get Capital Raid Seasons

Description

Get Capital Raid Seasons

Usage

coc_get_capital_raid_seasons(
  clan,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = get_clash_key()
)

Arguments

clan

Required. Clan tag.

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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

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

Examples

coc_get_capital_raid_seasons(clan = '8UC2J90Y')

Get a clan

Description

Gets full clan details

Usage

coc_get_clan(clan, key = get_clash_key())

Arguments

clan

Required. Clan tag.

key

Required. API key. See https://developer.clashofclans.com/#/documentation Default: get_clash_key()

Value

a tibble with each row as a player

Examples

coc_get_clan(clan = '8UC2J90Y')

Get clan labels

Description

Get clan labels

Usage

coc_get_clan_labels(
  limit = NULL,
  after = NULL,
  before = NULL,
  key = get_clash_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

coc_get_clan_labels()

Get current clan members

Description

Get current clan members

Usage

coc_get_clan_members(
  clan,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = coc_get_key()
)

Arguments

clan

Required. Clan tag.

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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

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

Examples

coc_get_clan_members(clan = '8UC2J90Y')

Get Gold Pass Season Information

Description

Get Gold Pass Season Information

Usage

coc_get_goldpass(key = get_clash_key())

Arguments

key

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

Value

a tibble of gold pass info

Examples

coc_get_goldpass()

Get information for one league

Description

Get information for one league

Usage

coc_get_league(
  league,
  season,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = coc_get_key()
)

Arguments

league

league id, such as 29000022

season

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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

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

Examples

coc_get_league(league = '29000022', season = '2022-09', limit = 10)

Get seasons for one league

Description

Get seasons for one league

Usage

coc_get_league_seaons(
  league,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = coc_get_key()
)

Arguments

league

league id, such as 29000022

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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

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

Examples

coc_get_league_seaons(league = '29000022', limit = 10)

Get Leagues

Description

Get Leagues

Usage

coc_get_leagues(limit = NULL, after = NULL, before = NULL, key = coc_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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

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

Examples

coc_get_leagues(limit = 10)

Get information for one location

Description

Get information for one location

Usage

coc_get_location(
  location,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = coc_get_key()
)

Arguments

location

location id, such as 32000249

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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

tibble of card info

Examples

coc_get_location(location = 32000249)

Get Locations

Description

Get Locations

Usage

coc_get_locations(
  limit = NULL,
  after = NULL,
  before = NULL,
  key = coc_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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

tibble of card info

Examples

coc_get_locations()

Get a single player

Description

Gets the player details for one player.

Usage

coc_get_player(tag, key = get_clash_key())

Arguments

tag

Required. The player to return.

key

Required. API key. See https://developer.clashofclans.com/#/documentation Default: get_clash_key()

Value

a tibble of player info

Examples

coc_get_player('92GCQQYP')

Get player labels

Description

Get player labels

Usage

coc_get_player_labels(
  limit = NULL,
  after = NULL,
  before = NULL,
  key = get_clash_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

coc_get_player_labels()

Get Builder Base Clan Rankings

Description

Get Builder Base Clan Rankings

Usage

coc_get_ranking_builderbase_clans(
  location,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = coc_get_key()
)

Arguments

location

location id, such as 32000249

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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

tibble of card info

Examples

coc_get_ranking_builderbase_clans(location = 32000249)

Get Builder Base Player Rankings

Description

Get Builder Base Player Rankings

Usage

coc_get_ranking_builderbase_players(
  location,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = coc_get_key()
)

Arguments

location

location id, such as 32000249

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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

tibble of card info

Examples

coc_get_ranking_builderbase_players(location = 32000249)

Get Capitals Rankings

Description

Get Capitals Rankings

Usage

coc_get_ranking_capitals(
  location,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = coc_get_key()
)

Arguments

location

location id, such as 32000249

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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

tibble of card info

Examples

coc_get_ranking_capitals(location = 32000249)

Get Clan Rankings

Description

Get Clan Rankings

Usage

coc_get_ranking_clans(
  location,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = coc_get_key()
)

Arguments

location

location id, such as 32000249

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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

tibble of card info

Examples

coc_get_ranking_clans(location = 32000249)

Get Player Rankings

Description

Get Player Rankings

Usage

coc_get_ranking_players(
  location,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = coc_get_key()
)

Arguments

location

location id, such as 32000249

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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

tibble of card info

Examples

coc_get_ranking_players(location = 32000249)

Get Versus Clan Rankings

Description

Get Versus Clan Rankings

Usage

coc_get_ranking_versus_clans(
  location,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = coc_get_key()
)

Arguments

location

location id, such as 32000249

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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

tibble of card info

Examples

coc_get_ranking_versus_clans(location = 32000249)

Get Versus Player Rankings

Description

Get Versus Player Rankings

Usage

coc_get_ranking_versus_players(
  location,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = coc_get_key()
)

Arguments

location

location id, such as 32000249

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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

tibble of card info

Examples

coc_get_ranking_versus_players(location = 32000249)

Get current Clan War

Description

Get current Clan War

Usage

coc_get_war_current(
  clan,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = get_clash_key()
)

Arguments

clan

Required. Clan tag.

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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

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

Examples

coc_get_war_current(clan = '8UC2J90Y')

Get information for one war league

Description

Get information for one war league

Usage

coc_get_war_league(
  league,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = coc_get_key()
)

Arguments

league

league id, such as 48000018

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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

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

Examples

coc_get_war_league(league = 48000018, limit = 10)

Get War Leagues

Description

Get War Leagues

Usage

coc_get_war_leagues(
  limit = NULL,
  after = NULL,
  before = NULL,
  key = coc_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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

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

Examples

coc_get_war_leagues(limit = 10)

Get Clan War Log

Description

Get Clan War Log

Usage

coc_get_war_log(
  clan,
  limit = NULL,
  after = NULL,
  before = NULL,
  key = coc_get_key()
)

Arguments

clan

Required. Clan tag.

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.clashofclans.com/#/documentation. Default: get_clash_key()

Value

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

Examples

coc_get_war_log(clan = '8UC2J90Y')

Check or Get Clash of Clans API Key

Description

Check or Get Clash of Clans API Key

Usage

has_clash_key()

get_clash_key()

coc_get_key()

coc_has_key()

Value

logical if has, key if get

Examples

has_clash_key()

Add Entry to Renviron

Description

Adds Clash of Clans API key to .Renviron.

Usage

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

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

Arguments

key

Character. API key to add to add.

overwrite

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

install

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

Value

key, invisibly

Examples

## Not run: 
set_clash_key('1234')

## End(Not run)