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 communityoptionsObject Request options.
Properties
Name Type Description pathString Path relative to given community's jiveURL; used if options.url doesn't exist.
urlString Full request URL. options.path is not used if options.url is provided.
headersObject Map of header key-values.
oauthObject Map of oauth properties.
Properties
Name Type Description access_tokenString OAuth access token.
refresh_tokenString OAuth refresh token.
tokenPersistenceFunctionfunction 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 filterReturns:
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 jiveCommunityReturns:
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 jiveUrlReturns:
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 tenantIDReturns:
Promise
- Type
- Promise
-
<static> parseJiveCommunity(jiveUrl)
-
Parses the given jiveUrl for the name of the community.
Parameters:
Name Type Description jiveUrlReturns:
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 registrationObject Community addon registration object.
Properties
Name Type Description jiveSignatureString Signature provided by Jive used for registration validation.
clientSecretString Secret provided by the addon service.
jiveSignatureURLString URL used for validating the registration.
jiveUrlString URL of the originating Jive community.
tenantIdString Tenant ID of the originating Jive community. This is a durable, global ID.
clientIdString Client ID assigned by the Jive community to the addon as part of this registration request.
clientSecretString Client Secret assigned by the Jive community to the addon as part of this registration request.
authorizationCodeString 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.
registrationReturns:
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 jiveUrlthe 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.
oauthCodethe 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 communityObject Community object, which must specify a jiveUrl property at minimum.
Returns:
Promise
- Type
- Promise