R/get_account_by_puuid.R

Defines functions get_account_by_puuid

Documented in get_account_by_puuid

#' Given the primary key, a puuid, return all the ACCOUNT-V1 info
#' Wraps the \href{"https://developer.riotgames.com/apis#account-v1/GET_getByRiotId"}{GET_getByRiotId} api method and the \href{"https://developer.riotgames.com/apis#account-v1/GET_getActiveShard"}{GET_getActiveShard} api method.
#'
#' Standard RATE LIMITS
#' *20 requests every 1 seconds(s) / 100 requests every 2 minutes(s) - Developer Key*
#' *500 requests every 10 seconds  / 30,000 requests every 10 minutes - Production Key*
#'
#' Method RATE LIMITS
#' *1000 requests every 1 minutes - Developer Key*
#' *1000 requests every 1 minutes - Production Key*
#'
#' @param server a character, must be one of americas,europe,sea or asia,apac
#' @param puuid a character, string for PUUID, a string of 42char like RGAPI-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
#'
#' @export
#'
#' @examples \dontrun{
#' puuid <- "kJKtE_3i_66edP3lUYSW3wOVxIl5sRKFhsF6IpNIX_RQxYmyBZxG94gNuR4dUe-ofBq_zy5Yll_gSw"
#' get_account_by_puuid(puuid = puuid)
#' }
get_account_by_puuid <- function(puuid,server="americas") {

	riotdId <- possible_riotId(puuid,server=server, "parsed")
	if (is.null(riotdId)) riotdId <- list( "gameName" = NA_character_,
																			 "tagLine"  = NA_character_ )
	shard  <- possible_shard(puuid,server=server, "parsed")
	if (is.null(shard)) shard  <- list( "game" = NA_character_,
																			"activeShard"  = NA_character_ )

	list(
		"puuid"    = puuid,
		"gameName" = riotdId$gameName,
		"tagLine"  = riotdId$tagLine,
		"game"        = shard$game,
		"activeShard" = shard$activeShard
	)

}
MaouLegna/lorR documentation built on Nov. 21, 2022, 8:58 a.m.