new GithubAdapter(core, config [, eventQueue])
Parameters:
Name | Type | Argument | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
core |
DocloopCore | ||||||||||||||||||
config |
Object |
Properties
|
|||||||||||||||||
eventQueue |
Object |
<optional> |
EventQueue config. See EventQueue. |
||||||||||||||||
config.oAuth |
Object | Data to authorize GithubApp. Sets .oAuth property. |
|||||||||||||||||
config.dummy |
Object | Sets dummy property. |
Properties:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
endpointDefaultConfig.label |
String | Name of the label to tag a new issue with |
||||||||||||
githubUser |
GithubUser | API wrapper for github user interaction |
||||||||||||
githubApp |
GithubApp | API wrapper for github app interaction |
||||||||||||
events |
Collection | Mongo-db collection for stored events |
||||||||||||
eventQueue |
EventQueue | The event queue the event is stored in |
||||||||||||
oAuth |
Object | OAuth credentials has provided. Properties
|
||||||||||||
dummy |
Object | Content of the dummy issue created when a comment is missing its parent issue. Properties
|
Extends
Methods
-
_clearSessionData(session)
-
Clears the data associated with this adapter in the provided session object. Returns an empty object. Modifying its values will modify the session.
Parameters:
Name Type Description session
Session Express session
- Inherited From:
Returns:
Empty session data
- Type
- SessionData
-
<async> _getAuthState(session)
-
Calls .getAuthState() with sessionData.
Parameters:
Name Type Description session
Session Express session
- Inherited From:
Returns:
- Type
- AuthState
-
<async> _getData(session)
-
Collects adapter data for client use.
Parameters:
Name Type Description session
Session Express session
- Inherited From:
Returns:
- Type
- AdapterData
-
<async> _getEndpoints(session)
-
Calls .getEndpoints() with sessionData.
Parameters:
Name Type Description session
Session Express session
- Inherited From:
Returns:
- Type
- Array.<DocloopEndpoint>
-
_getSessionData(session)
-
Extracts the data associated with this adapter in the provided session object. Modifying its values will modify the session.
Parameters:
Name Type Description session
Session Express session
- Inherited From:
Returns:
Adapter's session data
- Type
- SessionData
-
<async> _getStoredEndpoint(id, session)
-
Calls .getStoredEndpoint() with sessionData.
Parameters:
Name Type Description id
String | bson session
Session Express session
- Inherited From:
Returns:
- Type
- ValidEndpoint
-
<async> _getStoredEndpoints(session)
-
Calls .getStoredEndpoints with sessionData.
Parameters:
Name Type Description session
Session Express session
- Inherited From:
Returns:
- Type
- Array.<DocloopEndpoint>
-
<async> getAuthState(session_data)
-
Parameters:
Name Type Description session_data
session_data - Overrides:
Returns:
- Type
- AuthState
-
<async> getEndpoints(session_data)
-
This method is meant to be overwritten by a custom adapter class. Returns valid endpoints the current session has privileged access to.
Parameters:
Name Type Description session_data
SessionData Data of the current session associated with this adapter
- Inherited From:
- Overrides:
Returns:
- Type
- Array.<ValidEndpoint>
-
<async> getStoredEndpoint(id)
-
Returns the endpoint with the provided id. Throws an error if it cannot be found or the session lacks privileges to access it.
Parameters:
Name Type Description id
String | bson Mongo-db id
- Inherited From:
Throws:
-
-
If the endpoint cannot be found.
- Type
- DocloopError
-
-
-
If the endpoint cannot be validated for the session.
- Type
- DocloopError
-
Returns:
- Type
- Endpoint
-
<async> getStoredEndpoints(session_data)
-
This method is meant to be overwritten by a custom adapter class. Retuns all endpoints stored in the db, that are also valid for the current session.
Parameters:
Name Type Description session_data
SessionData Data of the current session associated with this adapter
- Inherited From:
- Overrides:
Returns:
- Type
- Array.<ValidEndpoint>
-
<async> getUserRepos(session_data)
-
Get all Github repositories for the user authorized for with the access token in session data.
Parameters:
Name Type Description session_data
SessionData Returns:
- Type
- Array.<Object>
-
<async, route> handleOAuthCallback(req, res)
-
Route:
Method Path GET /adapters/github/oauth/callback Handle request sent by github after successful authorization. Uses the app config data and posted code to gain access token from github and store it in session data for later use. If successful redirects back to the configured front end url.
Parameters:
Name Type Description req
Object Express request object
res
Object Express result object
Throws:
-
If not successful
- Type
- DocloopError
Returns:
undefined
-
-
newEndpoint(data)
-
Creates a new instance of the endpoint class associated with this adapter. The new endpoint's adapter will be set to this adapter.
Parameters:
Name Type Description data
Object Data to instantiate the endpoint with.
- Inherited From:
Returns:
Endpoint
- Type
- DocloopEndpoint
-
queueAnnotationEvent(Annotation)
-
Add an annotation event to the event queue
Parameters:
Name Type Description Annotation
Annotation from an annotation event
Returns:
- Type
- undefined
-
queueReplyEvent(Reply)
-
Add an reply event to the event queue
Parameters:
Name Type Description Reply
Reply from an reply event#
Returns:
- Type
- undefined