Home Reference Source Test Repository
import Station from '@npr/npr-one-sdk/model/station.js'
public class | source

Station

Extends:

CollectionDoc → Station

Container class for all metadata pertaining to an organization (member station) from the NPR One API

Test:

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public get

Returns the raw attributes that represent this station.

public get

Returns the call sign, brand (AM or FM), and frequency together as one string, e.g.

public get

Returns the display name that the station would prefer to use.

public get

Returns the URL to the station's online donation page, if available.

public get

Returns the URL to the station's website, if available.

public get

Returns the unique ID that represents this station across NPR's various APIs. The ID is an integer between 1 and 9999, but it will always be returned in string format.

public get

Returns whether or not the station is eligible for inclusion in NPR One applications.

public get

Returns the location of the station, which always consists of a city and (abbreviated) state, e.g.

public get

Returns the logo for this station, if one can be found.

public get

Returns the tagline for this station.

Method Summary

Public Methods
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

Public Members

public get attributes: StationAttributes source

Returns the raw attributes that represent this station. Please use this with caution; the public accessor methods in this class should be sufficient for most use cases, and consumers should rarely need to use this additional metadata.

Test:

public get callSignAndFrequency: null | string source

Returns the call sign, brand (AM or FM), and frequency together as one string, e.g. 'WAMU FM 88.5' or 'KCFR FM 90.1' or 'KWSU AM 1250'. Again, this should be treated as supplemental metadata for a station and not the sole identifying information; where possible, stations prefer to be identified primarily by their displayName and logo. However, some local stations are members of networks such as Colorado Public Radio and therefore use the same display name and logo; in those cases, the call sign + band + frequency combination is the main way to disambiguate between multiple stations in the same network. This value is guaranteed to be unique.

Test:

public get displayName: string source

Returns the display name that the station would prefer to use. Please use this anytime you want to display a given station's name, rather than attempting to find the appropriate field inside of Station.attributes yourself; branding is a sensitive issue for stations and we should all respect how they wish to be identified.

Test:

public get donationUrl: null | string source

Returns the URL to the station's online donation page, if available.

Test:

public get homepageUrl: null | string source

Returns the URL to the station's website, if available.

Test:

public get id: string source

Returns the unique ID that represents this station across NPR's various APIs. The ID is an integer between 1 and 9999, but it will always be returned in string format.

Test:

public get isNprOneEligible: boolean source

Returns whether or not the station is eligible for inclusion in NPR One applications.

public get location: string source

Returns the location of the station, which always consists of a city and (abbreviated) state, e.g. 'Austin, TX' or 'Rochester, NY'. Similarly to callSignAndFrequency, this is most useful for disambiguating between multiple local stations in a bigger network such as Colorado Public Radio, which use the same displayName and logo. Note that this value isn't guaranteed to be unique; some cities (e.g. Boston) have multiple NPR stations.

Test:

Returns the logo for this station, if one can be found. If no logo can be found at all, this will return null.

Test:

public get tagline: string source

Returns the tagline for this station. This should be used as supplemental metadata for a station; it should never be used as the sole identifying information. Note that while the majority of the stations in our system have taglines, it is not guaranteed that each station has one.

Test:

Public Methods

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 station's display name.

Return:

string

Test: