API for interacting with Jive communities.
Methods
-
<static> doRequest(community, options) → {Promise}
-
Make a request to the current community. Automatically handle access token refresh flow if failure.
Parameters:
Name Type Description community
options
Object Request options.
Properties
Name Type Description path
String Path relative to given community's jiveURL; used if options.url doesn't exist.
url
String Full request URL. options.path is not used if options.url is provided.
headers
Object Map of header key-values.
oauth
Object Map of oauth properties.
Properties
Name Type Description access_token
String OAuth access token.
refresh_token
String OAuth refresh token.
tokenPersistenceFunction
function Callback function that will be invoked with new oauth access and refresh tokens ({'access_token' : '...', 'refresh_token' : '...' }). If not provided, the community will be updated with the new access tokens.
Returns:
Promise
- Type
- Promise
-
<static> find(filter) → {Promise}
-
Searches persistence for communities that matches the given criteria filter object.
Parameters:
Name Type Description filter
Returns:
Promise
- Type
- Promise
-
<static> findByCommunity(jiveCommunity) → {Promise}
-
Searches persistence for a community that matches the name of the given jive community. If one is not found, the promise will resolve a null (undefined) value.
Parameters:
Name Type Description jiveCommunity
Returns:
Promise
- Type
- Promise
-
<static> findByJiveURL(jiveUrl) → {Promise}
-
Searches persistence for community that matches the given jiveUrl. If one is not fond, the promise will resolve with a null (undefined) value.
Parameters:
Name Type Description jiveUrl
Returns:
Promise
- Type
- Promise
-
<static> findByTenantID(tenantID) → {Promise}
-
Searches persistence for a community that matches the tenantID of the given jive community. If one is not found, the promise will resovle a null (undefined) value.
Parameters:
Name Type Description tenantID
Returns:
Promise
- Type
- Promise
-
<static> parseJiveCommunity(jiveUrl)
-
Parses the given jiveUrl for the name of the community.
Parameters:
Name Type Description jiveUrl
Returns:
Name of the community based on the jiveUrl.
-
<static> register(registration, registration) → {Promise}
-
Processes the incoming community addon registration request object. Validation rules:
- If jive.context.config['development'] == true, addon registration validation will be skipped.
- If not, then registration.jiveSignatureURL will be invoked to validate the registration block. Failure will cause the return promise reject callback to be fired.
Upon successful registration, a community object will be persisted or updated (if one already exists) based on the contents of the registration object.
Parameters:
Name Type Description registration
Object Community addon registration object.
Properties
Name Type Description jiveSignature
String Signature provided by Jive used for registration validation.
clientSecret
String Secret provided by the addon service.
jiveSignatureURL
String URL used for validating the registration.
jiveUrl
String URL of the originating Jive community.
tenantId
String Tenant ID of the originating Jive community. This is a durable, global ID.
clientId
String Client ID assigned by the Jive community to the addon as part of this registration request.
clientSecret
String Client Secret assigned by the Jive community to the addon as part of this registration request.
authorizationCode
String Optional. If provided, the system will automatically attempt an OAuth2 access and refresh token exchange with the originating Jive community using this authorization code. The code will be persisted along with the community object associated with this registration call.
registration
Returns:
Promise
- Type
- Promise
-
<static> requestAccessToken(jiveUrl, oauthCode) → {Promise}
-
Requests an access token by oauth access code (oauth access code is given in registration requests and valid for few minutes).
Parameters:
Name Type Description jiveUrl
the url of the jive community. this function will use this url to find the community in the persistence and get the client id and secret.
oauthCode
the code needed to be use to get access to a specific registration scope (usually a group).
Returns:
Promise A promise for success and failure [use .then(...) and .catch(...)]
- Type
- Promise
-
<static> save(community) → {Promise}
-
Saves the given community object into persistence. Will throw an Error if the community object does not contain a 'jiveUrl' property.
Parameters:
Name Type Description community
Object Community object, which must specify a jiveUrl property at minimum.
Returns:
Promise
- Type
- Promise