Learn R Programming

spotifyr (version 2.2.4)

validate_parameters: Assertion for Correct API Requests.

Description

Assertions are made to give early and precise error messages for wrong API call parameters.

Usage

validate_parameters(
  artists_or_tracks = NULL,
  artist_or_user = NULL,
  market = NULL,
  country = NULL,
  limit = NULL,
  offset = NULL,
  locale = NULL,
  volume_percent = NULL,
  time_range = NULL,
  position_ms = NULL,
  state = NULL,
  include_meta_info = NULL
)

Value

A boolean if the parameter matches the Spotify Web API parameter range.

Arguments

artists_or_tracks

The type parameter must be either 'artists' or 'tracks'."

artist_or_user

"The type parameter must be either 'artist' or 'user'."

market

Optional.
An ISO 3166-1 alpha-2 country code or the string "from_token". Provide this parameter if you want to apply Track Relinking

country

Optional.
An ISO 3166-1 alpha-2 country code or the string "from_token". Provide this parameter if you want to apply Track Relinking

limit

Optional. The maximum number of items to return. Default to 20. Minimum: 1. Maximum: 50.

offset

Optional. The index of the first item to return. Defaults to 0, i.e., the first object. Use with limit to get the next set of items.

locale

Optional. The desired language, consisting of an ISO 639-1 language code and an ISO 3166-1 alpha-2 country code, joined by an underscore. For example: es_MX, meaning "Spanish (Mexico)". Provide this parameter if you want the category strings returned in a particular language. Note that, if locale is not supplied, or if the specified language is not available, the category strings returned will be in the Spotify default language (American English). The locale parameter, combined with the country parameter, may give odd results if not carefully matched. For example country=SE&locale=de_DE will return a list of categories relevant to Sweden but as German language strings.

volume_percent

Required integer value. The volume to set. Must be a value from 0 to 100 inclusive. Defaults to 50.

time_range

Optional. Over what time frame the affinities are computed. Valid values: long_term (calculated from several years of data and including all new data as it becomes available), medium_term (approximately last 6 months), short_term (approximately last 4 weeks). Default: medium_term.

position_ms

Optional. Integer indicating from what position to start playback. Must be a positive number. Passing in a position that is greater than the length of the track will cause the player to start playing the next song.

state

The state parameter must be exactly one of 'track', 'context' or 'off'.

include_meta_info

Optional. Boolean indicating whether to include full result, with meta information such as "total", and "limit". Defaults to FALSE.

Details

These assertions are called from various wrapper functions. However, you can also call this function directly to make sure that you are adding (programatically) the correct parameters to a call.

All validate_parameters parameters default to NULL. Asserts the correct parameter values for any values that are not NULL.