Home Reference Source Test Repository
public class | source

User

Extends:

CollectionDoc → User

Container class for all metadata pertaining to a user object from the NPR One API

Test:

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

Method Summary

Public Methods
public

Returns the programs, shows, and podcasts that this user has positively interacted with.

public

Returns the user's cohort. In most cases, SDK consumers will never need to use this.

public

Returns the list of organizations this user is affiliated with.

public

Returns the primary, non-NPR organization that this user is affiliated with, or null if no such organization exists.

public

Whether this user is a temporary user or not

public

A convenience function to cast this object back to a string, generally only used by the Logger class.

Inherited Summary

From class CollectionDoc
public get

Exposed for legacy reasons.

protected
protected

Ensure that the given Collection Doc is valid

Public Constructors

public constructor(json: CollectionDocJSON) source

Override:

CollectionDoc#constructor

Params:

NameTypeAttributeDescription
json CollectionDocJSON

The decoded JSON object that should be used as the basis for this model

Test:

Public Members

public attributes: UserAttributes source

Public Methods

public getAffiliations(): Array<UserAffiliation> source

Returns the programs, shows, and podcasts that this user has positively interacted with.

Test:

public getCohort(): UserCohort source

Returns the user's cohort. In most cases, SDK consumers will never need to use this.

Return:

UserCohort

Test:

public getOrganizations(): Array<UserOrganization> source

Returns the list of organizations this user is affiliated with. In most cases, you only want a single organization, in which case User#getPrimaryOrganization should be used.

Test:

public getPrimaryOrganization(): null | UserOrganization source

Returns the primary, non-NPR organization that this user is affiliated with, or null if no such organization exists.

Test:

public isTemporary(): boolean source

Whether this user is a temporary user or not

Return:

boolean

Test:

public toString(): string source

A convenience function to cast this object back to a string, generally only used by the Logger class. In this case, we return the user's ID.

Return:

string

Test: