public class

User

extends Model
java.lang.Object
   ↳ java.util.Observable
     ↳ fm.audiobox.core.models.Model
       ↳ fm.audiobox.core.models.User

Class Overview

A User can interact with his own files in different ways, depending on the remote storage in play.

However AudioBox is built with homogeneity in mind and therefore you will end up calling the same methods for different, powerful actions.

For the most part the returned attributes are straightforward, such as media_files_count, however there are special attributes to explain:

auth_token:
The current authentication token for the user. This attribute can change and might be rotated at any time.
permissions: {...}
A user can subscribe and manage multiple remote storage services. This hash defines the boolean permissions the user has access to, depending on subscription state if it's a paid feature. In case the User has been created through a Partner it will inherit permissions depending on the Partner requested features. Such attributes are automatically set by the system and cannot be changed manually.
external_tokens: {...}
For each of the external services the boolean value indicates if we have stored a OAuth token for the user. Such attributes are automatically set by the system and cannot be changed manually.
stats: {...}
Bytes long values showing the storage used for each supported storage service and the amount of data that has been streamed.
subscription_state:
String identifying the paid subscription states for this user. Some features cannot be accessed if the subscription is not valid. We suggest to not use logic in your own application against this attribute, but rather query the permissions: {} data to have more fine-grained control over the available actions. Possible values are: active, trialing, past_due, canceled and unpaid.
plan:
The plan name the user is subscribed to, if any.
comet_channel:
The unique push engine channel for this user. AudioBox employ push notifications, by making the application subscribe to this channel name it will be able to receive actions to perform in the user interface. Using push messages is a great way to keep all the applications in sync when an action is performed, such as media add. Further documentation on how to connect to the push server will be provided soon.
preferences: {...}
General preferences of the user, mostly used in the Cloud Web Player.

Summary

Constants
String ACCEPTED_EXTENSIONS
String ACCEPTED_FORMATS
String COMET_CHANNEL
String COUNTRY
String CREATED_AT
String MEDIA_FILES_COUNT
String OFFLINE_PLAYLIST
String PLAN
String PLAYLISTS_COUNT
String REAL_NAME
String SUBSCRIPTION_STATE
String TIME_ZONE
String TOTAL_PLAY_COUNT
String UPDATED_AT
Public Constructors
User()
Public Methods
String getAcceptedExtensions()
Gets accepted extensions.
String getAcceptedFormats()
Gets accepted formats.
String getAuthToken()
Gets the current authentication token for the user.
String getCometChannel()
Gets the unique push engine channel for this user.
String getCountry()
Gets country.
String getCreatedAt()
Gets the user creation time (in form of an UTC String).
String getEmail()
Gets email.
ExternalTokens getExternalTokens()
Gets the user's ExternalTokens that indicates if AudioBox have stored an OAuth token for the user.
long getId()
Gets id.
long getMediaFilesCount()
Gets total media files count.
String getOfflinePlaylist()
Gets offline playlist token.
Permissions getPermissions()
Gets the hash that defines the boolean permissions the user has access to, depending on subscription state if it's a paid feature.
String getPlan()
Gets the plan name the user is subscribed to, if any..
long getPlaylistsCount()
Gets playlists count.
Preferences getPreferences()
Gets the user's Preferences
Preferences are never null
String getRealName()
Gets real name.
Stats getStats()
Gets the user's Stats
String getSubscriptionState()
Gets the string identifying the paid subscription states for this user.
String getTimeZone()
Gets time zone.
long getTotalPlayCount()
Gets total play count.
String getUpdatedAt()
Gets the last time (in form of an UTC String) this account have been changed.
boolean savePreferences(AudioBoxClient audioBoxClient)
Saves user preferences
[Expand]
Inherited Methods
From class fm.audiobox.core.models.Model
From class java.util.Observable
From class java.lang.Object

Constants

public static final String ACCEPTED_EXTENSIONS

Constant Value: "accepted_extensions"

public static final String ACCEPTED_FORMATS

Constant Value: "accepted_formats"

public static final String COMET_CHANNEL

Constant Value: "comet_channel"

public static final String COUNTRY

Constant Value: "country"

public static final String CREATED_AT

Constant Value: "created_at"

public static final String MEDIA_FILES_COUNT

Constant Value: "media_files_count"

public static final String OFFLINE_PLAYLIST

Constant Value: "offline_playlist"

public static final String PLAN

Constant Value: "plan"

public static final String PLAYLISTS_COUNT

Constant Value: "playlists_count"

public static final String REAL_NAME

Constant Value: "real_name"

public static final String SUBSCRIPTION_STATE

Constant Value: "subscription_state"

public static final String TIME_ZONE

Constant Value: "time_zone"

public static final String TOTAL_PLAY_COUNT

Constant Value: "total_play_count"

public static final String UPDATED_AT

Constant Value: "updated_at"

Public Constructors

public User ()

Public Methods

public String getAcceptedExtensions ()

Gets accepted extensions.

Returns
  • the accepted extensions

public String getAcceptedFormats ()

Gets accepted formats.

Returns
  • the accepted formats

public String getAuthToken ()

Gets the current authentication token for the user. This attribute can change and might be rotated at any time.

Returns
  • the auth token

public String getCometChannel ()

Gets the unique push engine channel for this user. AudioBox employ push notifications, by making the application subscribe to this channel name it will be able to receive actions to perform in the user interface.

Using push messages is a great way to keep all the applications in sync when an action is performed, such as media add. Further documentation on how to connect to the push server will be provided soon.

Returns
  • the comet channel

public String getCountry ()

Gets country.

Returns
  • the country

public String getCreatedAt ()

Gets the user creation time (in form of an UTC String).

Returns
  • the UTC String of the user creation time

public String getEmail ()

Gets email.

Returns
  • the email

public ExternalTokens getExternalTokens ()

Gets the user's ExternalTokens that indicates if AudioBox have stored an OAuth token for the user.

Such attributes are automatically set by the system and cannot be changed manually.

Returns
  • the external tokens

public long getId ()

Gets id.

Returns
  • the id

public long getMediaFilesCount ()

Gets total media files count.

Returns
  • the media files count

public String getOfflinePlaylist ()

Gets offline playlist token.

Returns
  • the offline playlist token

public Permissions getPermissions ()

Gets the hash that defines the boolean permissions the user has access to, depending on subscription state if it's a paid feature.

In case the User has been created through a Partner it will inherit permissions depending on the Partner requested features.

Such attributes are automatically set by the system and cannot be changed manually.

Returns

public String getPlan ()

Gets the plan name the user is subscribed to, if any..

Returns
  • the plan

public long getPlaylistsCount ()

Gets playlists count.

Returns
  • the playlists count

public Preferences getPreferences ()

Gets the user's Preferences
Preferences are never null

Returns
  • the preferences

public String getRealName ()

Gets real name.

Returns
  • the real name

public Stats getStats ()

Gets the user's Stats

Returns
  • the stats

public String getSubscriptionState ()

Gets the string identifying the paid subscription states for this user. Some features cannot be accessed if the subscription is not valid. We suggest to not use logic in your own application against this attribute, but rather query the permissions: {} data to have more fine-grained control over the available actions.

Possible values are: active, trialing, past_due, canceled and unpaid.

Returns
  • the subscription state

public String getTimeZone ()

Gets time zone.

Returns
  • the time zone

public long getTotalPlayCount ()

Gets total play count.

Returns
  • the total play count

public String getUpdatedAt ()

Gets the last time (in form of an UTC String) this account have been changed.
NOTE: Since client timezone may differ significantly you are strongly invited to always trust and use this datetime in case you are building a sync tool.

Returns
  • the UTC String of the last update on this account

public boolean savePreferences (AudioBoxClient audioBoxClient)

Saves user preferences

Parameters
audioBoxClient the client
Returns
  • true if operation succeed throws an exception if something goes wrong
Throws
AudioBoxException if any of the remote error exception is detected.
IOException if any connection problem occurs.