iOS SDK

You can obtain the source and example programs at https://github.com/audiogum/iossdk.


class AudiogumClient

Methods

init

Initialise the SDK with client id and secret

public public init(clientId: String, clientSecret: String, deviceId: String)
public public init(clientId: String, clientSecret: String, deviceId: String, configuration: AudiogumConfiguration)

Parameters

  • clientId client key issued by Audiogum
  • clientSecret client secret issued by Audiogum
  • deviceId unique device identifier
  • configuration optional configuration specifying SDK options


Methods

init

Initialise the SDK with AccessToken

public public init(accessToken: AccessToken, deviceId: String)
public public init(accessToken: AccessToken, deviceId: String, configuration: AudiogumConfiguration)

Parameters

  • accessToken AccessToken issued by Audiogum API
  • deviceId unique device identifier
  • configuration optional configuration specifying SDK options


IP Address Lookup

IP address lookup based upon client IP address. This product includes GeoLite2 data created by MaxMind, available from http://www.maxmind.com

Requires signin scope.

public func getIpMap()  -> Promise<IpLookup>

Returns

  • Promise of IpLookup result


Get Client Configuration

Gets country-specific configuration including both service configuration such as which content services are supported, and custom configuration settings for the client.

Requires signin scope.

public func getAppConfig() -> Promise<AppConfig>

Returns

  • Promise of AppConfig


Add User Config

Allows upload of arbitrary user config key/value pairs to store settings.

Requires write_userprofile scope.

public func updateUserConfig(userConfig: UserConfig) -> Promise<UserConfig>

Parameters

  • userConfig oem-specific user config

Returns

  • Promise of UserConfig


Update User Config by Key

Add or update user config by key

Requires write_userprofile scope.

public func updateUserConfigByKey(key: String, userConfig: UserConfig) -> Promise<IpLookup>

Parameters

  • key config key
  • value config value

Returns

  • Promise of UserConfig


Delete User Config by Key

Delete user config by key

Requires write_userprofile scope.

public func deleteUserConfigByKey(key: String) -> Promise<Void>

Parameters

  • key key to delete

Returns

  • Promise of Void


Get User Config

Gets previously stored key/value pairs.

Requires read_userprofile scope.

public func getUserConfig() -> Promise<UserConfig>

Returns

  • Promise of UserConfig


Get User Config by Key

Get user config by key

Requires read_userprofile scope.

public func getUserConfigByKey(key: String) -> Promise<UserConfig>

Parameters

  • key config key

Returns

  • Promise of UserConfig


Add User Image

Allows upload of a Base64 encoded JPG or PNG image with maximum size 800px x 800px. Once in place, an imageuri property will be added to the user account.

Requires write_userprofile scope.

public func updateUserImage(image: UserImage) -> Promise<UserImage>

Parameters

  • image image to add

Returns

  • Promise of UserImage


Delete User Image

Delete user image

Requires write_userprofile scope.

public func deleteUserImage() -> Promise<Void>

Returns

  • Promise of Void


Update User Profile Image

Add or update user profile image

Requires write_userprofile scope.

public func updateUserProfileImage(profileId: String, image: UserImage) -> Promise<UserImage>

Parameters

  • image image to add
  • profileId User Profile ID

Returns

  • Promise of UserImage


Delete user profile image

Remove user profile image

Requires write_userprofile scope.

public func deleteUserProfileImage(profileId: String) -> Promise<Void>

Parameters

  • profileId User Profile ID

Returns

  • Promise of Void


Reset User Password

Native client user email reset - sends a password reset email

public func resetUserPasswor(email: String) -> Promise<Void>

Parameters

  • email email address

Parameters

  • Promise of Void


Login User

Login a user and set their token

public func loginUser(email: String, password: String, scope: String = "all") -> Promise<Void>

Parameters

  • email email address
  • password password
  • scope scope

Returns

  • Promise of Void


Login External User

Login an external (shadow account) user and set their token

public func loginExternalUser(externalUserId: String, countryCode: String? = nil, scope: String = "all") -> Promise<Void>

Parameters

  • externalUserId external user id
  • countryCode country code
  • scope scope

Returns

  • Promise of Void


Login Mobile User

Login a mobile user and set their token

public func loginMobileUser(mobileNumber: String, code: String, scope: String = "all") -> Promise<Void>

Parameters

  • mobileNumber mobile number
  • code verification code
  • scope scope

Returns

  • Promise of Void


Is User Logged In?

Is user currently logged in?

public func isUserLoggedIn() -> Bool`

Returns

  • True if user is logged in


Get Login Url

Get the url for the login page

public func getLoginUrl(scope: String?, service: String?, state: String?) -> Promise<URL>

Parameters

  • scope scope
  • service service to login to
  • state state

Returns

  • Promise of String - the url of the login page


Create User

Regiser a new user. Assumes password been confirmed on client

public func createUser(firstName: String, lastName: String, email: String, password: String) -> Promise<AccessToken>

Parameters

  • firstName first name
  • lastName last name
  • email email address
  • password password

Returns

  • Promise of AccessToken


Get User Account Details

Get user account details by userid Gets the full account details.

Requires read_userprofile scope.

public func getUser() -> Promise<UserInfo>

Returns

  • Promise of UserInfo


Update User Account Details

If currentpassword or newpassword are passed both are required otherwise any non-password field can be submitted optionally. If email is included for update, this will not be updated immediately but a verification email will be sent. Once the verification link is clicked, the email will update.

Requires write_userprofile scope.

public func updateUser(userinfo: UserInfo) -> Promise<UserInfo>

Parameters

  • userInfo user info

Returns

  • Promise of UserInfo


Get User Profiles

Get user profiles

Requires read_userprofile scope.

public func getUserProfiles() -> Promise<UserProfile>

Returns

  • Promise of [UserProfile]


Update User Profile

Add or updates user profile

Requires write_userprofile scope.

public func updateUserProfile(updateProfile: UserProfile) -> Promise<UserProfile>

Parameters

  • userProfile User Profile

Returns

  • Promise of UserProfile


Update User Profile By Id

Update user profile details

Requires write_userprofile scope.

public func updateUserProfileById(profileId: String, userProfile: UserProfile) -> Promise<UserProfile>

Parameters

  • userProfile User Profile
  • profileId User Profile ID

Returns

  • Promise of UserProfile


Get User Profile By Id

Get user profile details

Requires read_userprofile scope.

public func getUserProfileById(profileId: String) -> Promise<UserProfile>

Parameters

  • profileId User Profile ID

Returns

  • Promise of UserProfile


Delete User Profile By Id

Delete a user profile

Requires write_userprofile scope.

public func deleteUserProfileById(profileId: String) -> Promise<Void>

Parameters

  • profileId User Profile ID

Parameters

  • Promise of Void


Verify User Mobile

Native client verification - verifies a user's mobile number

public func verifyUserMobile(mobileNumber: String, code: String) -> Promise<Void>

Parameters

  • mobileNumber mobile number
  • code verification code

Parameters

  • Promise of Void


Verify User Email

Native client verification - sends a verification email

public func verifyUserEmail(email: String) -> Promise<Void>

Parameters

  • email email address

Returns

  • Promise of Void


Check User Exists

Check if an account exists Check if an account exists by email address

public func checkUserExists(email: String, validate: Bool) -> Promise<Void>

Parameters

  • email The Email address to look up
  • validate Flag to enable email address validation

Parameters

  • Promise of Void


Get Support Documentation

Get help and support content Requires signin scope.

public func getSupportDocumentation(String language) -> Promise<SupportDocumentation>

Parameters

  • language Language code to look for; falls back to en

Returns

  • Promise of SupportDocumentation


Send Support Email

Sends support email

Requires signin scope.

public func sendSupportEmail(supportEmail: SupportEmail) -> Promise<Void>

Parameters

  • supportEmail email to send

Returns

  • Promise of Void


Get User Services

public func getUserServices() -> Promise<LinkedServiceList>

Gets a list of services the user has linked to their account.

Requires read_userprofile scope.

Returns

  • Promise of LinkedServiceList


Get User Service

public func getUserService(serviceId: String) -> Promise<LinkedService>

Gets details of a specific content service linked to the user's account, if available.

Requires read_userprofile scope.

Parameters

  • serviceId id of the service to fetch details of

Returns

  • Promise of LinkedService


Start Service Authorization

Gets an authorize URI to start a OAuth2 flow with the content service.

Requires write_userprofile scope.

public func startServiceAuthorization(serviceId: String) -> Promise<UserServiceAuthorizeDetails>

Parameters

  • serviceId id of the content service.

Returns

  • Promise of UserServiceAuthorizeDetails


Obtain Service Token

Obtain or refresh a service access token

Requires write_userprofile scope.

public func obtainServiceToken(serviceid: String, code: String?) -> Promise<UserServiceCredentials>

Parameters

  • serviceId id of the content service.
  • code optional OAuth2 authorization code from the service.

Returns

  • Promise of UserServiceCredentials


Remove Service Token

Remove a service access token

Requires write_userprofile scope.

public func removeServiceToken(serviceid: String) -> Promise<Void>

Parameters

  • serviceId id of the content service.

Returns

  • Promise of Void


Browse Service

Browse content services. Returns a list of items of type category; which can be explored with the ultimate goal of drilling down to items of types such as internetradio, audiobook or playlist. To explore a category, pass it's ref to this API in the parent parameter. Some services will return nested items within the category meaning no is required to explore further.

Requires search scope.

public func browseService(service: String, parent: String? = nil, startindex: Int? = nil, itemsperpage: Int? = nil) -> Promise<SearchResultsGroup>

Parameters

  • service The content service
  • parent Optional parent group for drill down
  • startindex Optional paging - the offset that items should start at - defaults to 0
  • itemsperpage Optional paging - the number of items to return in each bucket - defaults to 20

Returns

  • Promise of SearchResultsGroup


Get Artist

Get an artist by id Get an artist by id. Returns artisttype, biogs, dateofbirth, dateofdeath, gender, genres, images, links, name, origin, originname, popularity, related, similar, services, tags, territory, yearsactive.

Requires search scope.

public func getArtist(artistId: String) -> Promise<Artist>

Parameters

  • artistId Artist id

Returns

  • Returns Artist


Get Artist Songs

Gets an artist's albums or songs from a service based on our id Gets an artist's albums or songs from a service based on our id

Requires search scope.

public func getArtistSongs(artistId: String, service: String) -> Promise<TrackListing>

Parameters

  • artistId Audiogum artist id
  • service The content service

Returns

  • Promise of TrackListing


Get Artist Image

Gets an artist's albums or songs from a service based on our id Gets an artist's albums or songs from a service based on our id

Requires search scope.

public func getArtistSongs(artistId: String, service: String, startindex: Int? = nil) -> Promise<TrackListing>  

Parameters

  • artistId Audiogum artist id
  • service The content service
  • startindex paging - the offset that items should start at - defaults to 0

Returns

  • Promise of TrackListing


Get Artist Songs

Gets an artist's songs from a service based on our id

Requires search scope.

public func getArtistSongs(artistId: String, service: String, startindex: Int? = nil, itemsperpage: Int? = nil) -> Promise<TrackListing>

Parameters

  • artistId Audiogum artist id
  • service The content service
  • startindex paging - the offset that items should start at - defaults to 0
  • itemsperpage paging - the number of items to return - defaults to 50

Returns

  • Promise of TrackListing


Get Artist Songs By Ref

Gets an artist's songs from a service based on the service ref

Requires search scope.

public func getArtistSongsByRef(ref: String, service: String, startindex: Int? = nil, itemsperpage: Int? = nil) -> Promise<TrackListing>

Parameters

  • ref service ref for this artist
  • service The content service
  • startindex paging - the offset that items should start at - defaults to 0
  • itemsperpage paging - the number of items to return - defaults to 50

Returns

  • Promise of TrackListing


Get Artist Albums

Gets an artist's albums from a service based on our id

Requires search scope.

public func getArtistAlbums(artistId: String, service: String, startindex: Int? = nil,itemsperpage: Int? = nil) -> Promise<PlaylistListing>

Parameters

  • artistId Audiogum artist id
  • service The content service
  • startindex paging - the offset that items should start at - defaults to 0
  • itemsperpage paging - the number of items to return - defaults to 50

Returns

  • Promise of PlaylistListing


Get Artist Albums By Ref

Gets an artist's albums from a service based on the service ref

Requires search scope.

public func getArtistAlbumsByRef(ref: String, service: String, itemsperpage: Int? = nil, startindex: Int? = nil) -> Promise<PlaylistListing>

Parameters

  • ref Service ref for this artist
  • service The content service
  • startindex paging - the offset that items should start at - defaults to 0
  • itemsperpage paging - the number of items to return - defaults to 50

Returns

  • Promise of PlaylistListing


Get Artist Items By Ref

Gets an artist's items of a specific type from a service based on the service ref

Requires search scope.

public func getArtistItemsByRef(ref: String, service: String, itemtype: String, itemsperpage: Int? = nil, startindex: Int? = nil) -> Promise<SearchResultsGroup>

Parameters

  • ref Service ref for this artist
  • service The content service
  • itemtype The type of item to fetch. See AppConfig.Service.drilldowntypes in getAppConfig response for valid types for each service.
  • startindex paging - the offset that items should start at - defaults to 0
  • itemsperpage paging - the number of items to return - defaults to 50

Returns

  • Promise of SearchResultsGroup


Search across content services. Returns search results in various buckets

  • e.g. Playlists, Radio Stations, Artists.

Requires search scope.

 public func search(term: String? = nil, itemsperpage: Int? = nil, types: [String]? = nil, services: [String]? = nil) -> Promise<SearchResults>

Parameters

  • term Content query
  • itemsperpage Number of items in each bucket - default 3
  • types Optional filter parameter that limits types searched to those that are in this array
  • services Optional filter parameter that limits the services searched to those that are in this list (assuming they are allowed for the user)

Returns

  • Promise of SearchResults


Get Album Tracks

Get tracks for an album

Requires search scope.

public func getAlbumTracks(service: String,ref: String,startindex: Int? = nil,itemsperpage: Int? = nil) -> Promise<TrackListing>

Parameters

  • service The content service
  • ref Service reference of parent
  • startindex Optional paging - the offset that items should start at - defaults to 0
  • itemsperpage Optional paging - the number of items to return - defaults to 50

Returns

  • Promise of TrackListing


Get Playlist Tracks

Get tracks for a playlist

Requires search scope.

public func getPlaylistTracks(service: String, ref: String, startindex: Int? = nil, itemsperpage: Int? = nil) -> Promise<TrackListing>

Parameters

  • service The content service
  • ref Service reference of parent
  • startindex Optional paging - the offset that items should start at - defaults to 0
  • itemsperpage Optional paging - the number of items to return - defaults to 50

Returns

  • Promise of TrackListing


Search Artists

Search artists

Requires search scope.

public func searchArtist(term: String, itemsperpage: Int? = nil, startindex: Int? = nil, service: String? = nil) -> Promise<SearchResultsGroup>

Parameters

  • term Query to search for
  • itemsperpage Number of items in each bucket - default 20
  • startindex Page start position - default 0
  • service Service to search

Returns

  • Promise of SearchResultsGroup


Search Artists By Ids

Search artists

Requires search scope.

public func searchArtistByIds(ids: [String], itemsperpage: Int? = nil, service: String? = nil) -> Promise<SearchResultsGroup>

Parameters

  • id IDs to obtain details for
  • itemsperpage Number of items in each bucket - default 20
  • service Service to search

Returns

  • Promise of SearchResultsGroup


Search By Type and Service

Single bucket results for paging Drill down into detailed results for paging through a bucket.

Requires search scope.

public func searchByTypeService(type: String, service: String, term: String, itemsperpage: Int? = nil, startindex: Int? = nil) -> Promise<SearchResultsGroup>

Parameters

  • type The bucket type
  • service The content service
  • term Content query
  • itemsperpage Number of items in each bucket - default 20
  • startindex Page start position - default 0

Returns

  • Promise of SearchResultsGroup


Get Genres

Get a list of genres. Includes popularity in the current country and localized name.

Requires search scope.

public func getGenres(itemsperpage: Int? = nil, startindex: Int? = nil) -> Promise<Genres>

Parameters

  • startindex Paging - the offset that items should start at
  • itemsperpage Paging - the number of items to return

Returns

  • Promise of Genres


Get top artists for genres

Get the top artists (by popularity) for a selection of given genres

Requires search scope.

public func getTopArtistsForGenre(genres: [String], fields: [String]? = nils, itemsperpage: Int? = nil, startindex: Int? = nil) -> Promise<TopArtistsByGenre>

Parameters

  • genre The genres to get topartists for
  • startindex Paging - the offset that items should start at
  • itemsperpage Paging - the number of items to return
  • fields The fields to return

Returns

  • Promise of TopArtistsByGenre


Get Top Artists

The most popular artists across a range of genres, merged together.

Requires search scope.

public func getTopArtists(fields: [String]? = nils, itemsperpage: Int? = nil) -> Promise<TopArtists>

Parameters

  • itemsperpage Paging - the number of items to return
  • fields The fields to return

Returns

  • Promise of TopArtists


Create Playable

Request to create a playable and associate it with a device, based on specified parameters. This will update an existing playable if it exists for the same user with the same parameters. For examples, see https://www.audiogum.com/partners/docs/playback.html.

Requires write_playlists scope.

public func createPlayable(playableRequest: CreatePlayableRequest) -> Promise<Playable>

Parameters

  • playableRequest Information required to create a user playable

Returns

  • Promise of Playable


Get Playable Tracks

Get information for a playable for playback based on its id. Depending on the type of playable, this gives a list of items or a streamurl for playback, plus data for service authentication where necessary. For examples, see https://www.audiogum.com/partners/docs/playback.html

Requires read_playlists scope.

public func getPlayableTracks(playableId: String, itemsperpage: Int? = nil, startindex: Int? = nil, streamUrls: Bool? = true) -> Promise<PlayableTracks>`

Parameters

  • playableId id of playable
  • startindex the offset that items should start at - defaults to 0
  • itemsperpage Optional paging - the number of items to return - defaults to 50
  • streamUrls Optionally omit stream urls (false). Default (true) indicates include where applicable

Returns

  • Promise of PlayableTracks


Delete Playable

Deletes a specific playable based on its id

Requires write_playlists scope.

public func deletePlayable(playableId: String) -> Promise<Void>

Parameters

  • playableId id of playable

Returns

  • Promise of Void


Get User Playable

Get the basic details of a specific playable based on its id (note: this is not for playback purposes)

Requires write_playlists scope.

public func getUserPlayable(playableId: String) -> Promise<Playable>

Parameters

  • playableId id of playable

Returns

  • Promise of Playable


Get User Playable Items

Get the details including items of a specific playable based on its id (note: this is not for playback purposes)

Requires read_playlists scope.

public func getUserPlayableItems(playableId: String, itemsperpage: Int?, startindex: Int?) -> Promise<PlayableTracks>

Parameters

  • playableId id of playable
  • startindex the offset that items should start at - defaults to 0
  • itemsperpage optional paging - the number of items to return - defaults to 50

Returns

  • Promise of PlayableTracks


Refresh Stream Urls

Refresh streaming urls on behalf of the user for specific items from a service, for the case of time-limited content

Requires write_playlists scope.

public func refreshStreamUrls(playableId: String, service: String, trackIds: [String]) -> Promise<TrackListing>

Parameters

  • playableId id of playable
  • service service
  • trackIds track ids to refresh

Returns

  • Promise of TrackListing


Authenticate for Voice

public func authenticateForVoice() -> Promise<Void>

Authenticates the user, creating a 'speech' scoped token and a token valid for use in the remote control websockets API. If not called separately, this will be done the first time the openVoiceSession() function is used.

Call this method early in your flow if you know you will need voice capabilities, as opening the first voice session without first calling this method can be slow and lead to a poor user experience.

See https://www.audiogum.com/developers/docs/naturallanguageunderstanding.html for more details.

Returns

  • Promise of Void


Open Voice Session

Starts a voice session. This allows the client to talk to the Audiogum Voice service which are APIs for controlling devices through voice commands. This method must be called before any data is sent to the voice service through sendVoiceMessage(message: String!) or sendVoiceMessage(message: String!).

See https://www.audiogum.com/developers/docs/naturallanguageunderstanding.html for more details.

public func openVoiceSession(voiceProperties: VoiceProperties, delegate: VoiceDelegate) -> Promise<Void>

Parameters

  • voiceProperties The voiceproperties message must be sent by the device on the Remote Control WebSocket to initiate a voice interaction.
  • delegate An object that will respond to messages sent back from the voice service. It may also be sent again during the interaction as necessary to update nowplaying data if the player state changes.

Returns

  • Promise of Void


Send Voice Terminator

Sends a voice terminator

public func sendVoiceTerminator() throws


Send Voice Message

Send a string message to the voice service.

See https://www.audiogum.com/developers/docs/naturallanguageunderstanding.html for more details.

public func sendVoiceMessage(message: String!) throws

Parameters

  • message Message to be sent to voice service


Send Voice Data Message

Send a message as data to the voice service.

See https://www.audiogum.com/developers/docs/naturallanguageunderstanding.html for more details.

public func sendVoiceMessage(data: NSData) throws

Parameters

  • message Data to be sent to voice service


Close Voice Session

Closes the active voice session, if any is currently connected.

See https://www.audiogum.com/developers/docs/naturallanguageunderstanding for more details.

public func closeVoiceSession() throws


Generate Response Audio

public func generateResponseAudio(phraseKey: String, languageCode: String? = nil) -> Promise<RemoteControlCommand.Respond>

Generates an audio response for the specified phrase in the language desired.

Requires speech scope

Parameters

  • phraseKey the key of the phrase to generate audio for.
  • languageCode the language to use when generating. If not specified, the user's language will be used.

Returns

  • Promise of RemoteControlCommand.Respond


Get Speech Suggestions

public func getSpeechSuggestions(nowPlaying: SpeechNowPlaying?) -> Promise<SpeechSuggestionResponse>

Retrieves examples of speech requests that the user can make to the Audiogum service.

Requires speech scope

Parameters

  • nowPlaying optionally supply the current playing information for more personalised speech examples.

Returns

  • Promise of SpeechSuggestionResponse


Make Speech Request With Action Text

public func makeSpeechRequestWithActionText(request: TextToActionRequest) -> Promise<TextToActionResponse>

Convert the text of an instruction into the action that should be performed.

Requires speech scope

Parameters

  • request information about the request to be made.

Returns

  • Promise of TextToActionResponse


Get Remote Contol Details

Get remotecontrol details of connected remote control device

See https://www.audiogum.com/developers/docs/remotecontrol.html for more details.

public func getRemoteControlDetails(remoteControlToken: String) -> Promise<RemoteControlSupportedActionsDetails>

Parameters

  • remoteControlToken Remote control token

Returns

  • Promise of RemoteControlSupportedActionsDetails


Send Remote Control Command

Send a command to a remote control device

See https://www.audiogum.com/developers/docs/remotecontrol.html for more details.

public func sendRemoteControlCommand(command: RemoteControlCommand) -> Promise<Void>

Parameters

  • command Remote control command

Returns

Promise of Void


Get Remote Control Player State

Get player state from a connected remote control device

See https://www.audiogum.com/developers/docs/remotecontrol.html for more details.

public func getRemoteControlDevicePlayerDetails(remoteControlToken: String) -> Promise<DevicePlayerDetails>

Parameters

  • remoteControlToken Remote control token

Returns

  • Promise of DevicePlayerDetails


Get Remote Control Device State

Get device state from a connected remote control device

See https://www.audiogum.com/developers/docs/remotecontrol.html for more details.

public func getRemoteControlDeviceDetails(remoteControlToken: String) -> Promise<RemoteControlDeviceDetails>

Parameters

  • remoteControlToken Remote control token

Returns

  • Promise of RemoteControlDeviceDetails


Get Remote Control Preset State

Get preset state from a connected remote control device

See https://www.audiogum.com/developers/docs/remotecontrol.html for more details.

public func getRemoteControlDevicePresetDetails(remoteControlToken: String)-> Promise<RemoteControlDevicePresetDetails>

Parameters

  • remoteControlToken Remote control token

Returns

  • Promise of RemoteControlDevicePresetDetails


Get Taste Profile

public func getTasteProfile() -> Promise<TasteProfile>

Gets the taste profile

Returns

  • Promise of TasteProfile


Add to Taste Profile

public func addToTasteProfile(itemsToAdd: TasteProfile) -> Promise<Void>

Add items to the taste profile.

Parameters

  • itemsToAdd items to add to the taste profile

Returns

  • Promise of Void


Add Likes to Taste Profile

public func addLikesToTasteProfile(artists: [Artist]? = nil, internetradios: [InternetRadio]? = nil, playlists: [Playlist]? = nil, albums: [Playlist]? = nil, songs: [Track]? = nil) -> Promise<Void>

Add likes to the taste profile.

Parameters

  • artists artists to add
  • internetradios internetradios to add
  • playlists playlists to add
  • albums albums to add
  • songs songs to add

Returns

  • Promise of Void


Delete from Taste Profile

public func deleteFromTasteProfile(itemsToDelete: TasteProfile) -> Promise<Void>

Removes multiple items from the taste profile.

Parameters

  • itemsToDelete items to delete from the taste profile

Returns

  • Promise of Void


Delete Likes from Taste Profile

public func deleteLikesFromTasteProfile(artists: [Artist]? = nil, internetradios: [InternetRadio]? = nil, playlists: [Playlist]? = nil, albums: [Playlist]? = nil, songs: [Track]? = nil) -> Promise<Void>

Removes likes from the taste profile.

Parameters

  • artists artists to remove
  • internetradios internetradios to remove
  • playlists playlists to remove
  • albums albums to remove
  • songs songs to remove

Returns

  • Promise of Void


Get Taste Genre Tags

getTasteGenreTags(tagsPerItem: Int = 1) -> Promise<TagsProfile>

Gets the top genre tags matching user's profile.

Parameters

  • tagsPerItem optionally limit the tag values used per item to the specified number of most important values

Returns

  • Promise of the user's genre taste profile tags


Add to Taste Profile By Name

addToTasteProfileByName(itemsToAdd: TasteProfile) -> Promise<Void>

Add items to the taste profile by name.

Parameters

  • itemsToAdd the items to add by name

Returns

  • Promise of Void


Check Taste Profile by Name

checkArtistTasteStateByName(name: String) -> Promise<TasteMatch>

Check state of artists in taste profile by name.

Parameters

  • name the name to attempt to match

Returns

  • Promise of the taste information for the matched item


Send Analytics Events

public func sendAnalyticsEvents(_ events: [Event], validateOnly: Bool?) -> Promise<Void>`

Sends analytics events, recording user or client actions or behaviour.

Requires write_events scope.

See https://www.audiogum.com/developers/docs/analytics.html for more details.

Parameters

  • events the collection of events to send.
  • validateOnly if true, the events will validated but not recorded.

Returns

  • Promise of Void


Upload Log

public func uploadLog(deviceId: String, logType: String, content: String) -> Promise<Void>

Upload a log or crash dump file.

Requires write_device scope.

Parameters

  • deviceId The id of the device the log relates to.
  • logType The type of log to be sent.
  • content The content to be logged.

Returns

  • Promise of Void


Get App Release

public func getAppRelease(region: String, platform: String, appstore: String, version: String,
                          language: String?, altapp: String?, platformversion: String?, devicemanufacturer: String?,
                          devicename: String?) -> Promise<AppRelease>

Fetches details of any available app update.

Parameters

  • region Region to check for (required)
  • platform Operating system (required)
  • appstore App Store to check (required)
  • version Current version installed (required)
  • language Get releasenotes in this language
  • altapp Codename of alternative app. Omit this for releases of the default app.
  • platformversion Optional operating system version
  • devicemanufacturer Optional device manufacturer
  • devicename Optional device name

Returns

  • a Promise containing an AppRelease describing the available update, or nil if none available.


Register Device

public func registerDevice() -> Promise<Void>

Registers the device making the SDK calls with the Audiogum API. This is required to ensure your analytics data is as accurate as possible.

Returns

  • Promise of Void


Get User Devices

public func getUserDevices(ofType: [String]?) -> Promise<DeviceList>

Lists the devices this user has been associated with.

Parameters

  • ofType An optional array of device types to fetch.

Returns

  • a DeviceList containing information about the devices associated to the current user.


Get User Owned Devices

public func getUserOwnedDevices() -> Promise<DeviceList>

Lists the devices currently owned by the current user. Note that the full device info is not shown here.

Returns

  • a DeviceList containing information about the user's currently owned devices.


Register User Owned Device

public func registerUserOwnedDevice(deviceid: String) -> Promise<Void>

Creates an ownership relationship betweenn the specified device and the current user. If the device already has a different owner, this request will fail with 409 response code.

Parameters

  • deviceid the id of the device being marked as owned.

Returns

  • Promise of Void