Module: linkedinLearning

Members

(inner) failedRenewals

Number of failed API token renewals. Functions use this to avoid repeating unauthorised API requests
Source:

Methods

(async, inner) fetchLearningObject(urn) → {Object}

Attempt to fetch learningObject from LinkedIn Learning API based on its Unique Resource Identifier (URN) if respective object in database is out of date. If the API response is 401 Unauthorised and there haven't been any failed renewals, reattempts with a renewed token. Logs attempt details including whether the cached value is up to date. Returns undefined on failure.
Parameters:
Name Type Description
urn String
Source:
Returns:
learningObject or undefined
Type
Object

(async, inner) fetchURNByContent(learningObject, type) → {String}

Attempt to fetch matching URN to given learningObject from LinkedIn Learning API. In order for a URN to be considered matching, the user input hyperlink must match the full path of the API object's hyperlink. If the API response is 401 Unauthorised and there haven't been any failed renewals, reattempts with a renewed token. Logs attempt details including degree of match. Returns undefined on failure.
Parameters:
Name Type Description
learningObject Object must have title & hyperlink
type String learning object type COURSE / VIDEO
Source:
Returns:
URN or undefined
Type
String

(inner) getOAuthToken() → {String}

Returns the server's LinkedIn Learning API token in OAuth 2.0 Authorisation header format.
Source:
Returns:
API token in OAuth 2.0 format
Type
String

(async, inner) renewAccessToken()

Attempt to renew LinkedIn Learning API token. Update failedRenewals counter based on result.
Source:

(inner) resetFailedRenewalsCounter()

TEST FUNCTION: Must only be used for testing purposes. Reset failedRenewals counter to 0.
Source: