Class: GithubTarget

githubAdapter GithubTarget

Class representing the Github issue tracker.


new GithubTarget()

Throws:

TODO

Type
TODO

Extends

Methods


<static> fromRepo(adapter, repo)

Creates a new Endpoint from a set of repository data,

Parameters:
Name Type Description
adapter Adapter
repo Object

Repository data

Returns:
Type
Endpoint

<static> repoToDecor(repo)

Extract decoration data from repositpry data.

Parameters:
Name Type Description
repo Object

Repository data

Returns:
Type
Decoration

<async> _updateDecor(session)

Calls .updateDecor with SessionData.

Parameters:
Name Type Description
session Session
Inherited From:
Returns:
Type
undefined

<async> _validate(session)

Parameters:
Name Type Description
session Session
Inherited From:
Returns:
Type
undefined

annotation2Issue(annotation)

Turn an Annotation into isuue data ready to be posted to the github API.

Parameters:
Name Type Description
annotation Annotation
Returns:
Type
Issue

<async> ensureIssueNumber(annotation_id)

Makes sure there is an issue corresponding to the provided annotation id. If there is no such issue existing yet, then create a dummy issue and return its issue number. This is useful if a reply event fires before its parent annotation event. This can happen if the annotation is old and has never been imported or the import has been delayed for some reason.

Parameters:
Name Type Description
annotation_id String

Id from the original source

Throws:

If TODO

Type
TODO
Returns:

Github issue number

Type
String

<async> getCommentId(Reply)

Get a stored comment id correspoding to a reply id.

Parameters:
Name Type Description
Reply reply_id

Id from the original source.

Throws:

If TODO

Type
TODO
Returns:

Corresponding comment id

Type
String

<async> getData(key)

Retrieves data stored alongside the endpoint document.

Parameters:
Name Type Description
key String

The key, where the data is stored at.

Inherited From:
Returns:

Data stored at the key.

Type
Object | String | Number

<async> getIssueNumber(Id)

Get a stored issue number correspoding to an annotation id.

Parameters:
Name Type Description
Id annotation_id

from the original source.

Throws:

If TODO

Type
TODO
Returns:

Corresponding issue number

Type
String

<async> handleAnnotation(annotation)

Handle annotation event. Update or create a corresponding issue on Github.

Parameters:
Name Type Description
annotation Annotation
Throws:

If TODO

Type
TODO
Returns:
Type
undefined

<async> handleReply(reply)

Handle reply event. Update or create a corresponding comment on Github.

Parameters:
Name Type Description
reply Reply
Throws:

If TODO

Type
TODO
Returns:
Type
undefined

match(endpoint_or_identifier)

Checks if the provided Object points to the same external Resource as the endpoint's identifier.

Parameters:
Name Type Description
endpoint_or_identifier Identifier | DocloopEndpoint

And identifier or any instance of DocloopEndpoint or a class that extends DocloopEndpoint.

Inherited From:
Returns:

True iff endpoint_or_identifier and the current endpoint point have the same external resource.

Type
boolean

<async> remove()

Removes te endpoint document from the database.

Inherited From:
Returns:
Type
undefined

reply2Comment(reply)

Turn an Reply into comment data ready to be posted to the github API.

Parameters:
Name Type Description
reply Reply
Returns:

Comment data

Type
Object

<async> setData(key, data)

Stores arbitrary data alongside the endpoint document.

Parameters:
Name Type Description
key String

A key to store the data at.

data Object | String | Number

The data to be stored at the key.

Inherited From:
Returns:

undefined


<async> store()

Stores the endpoint to the database as new document. (Using the data from .export)

Inherited From:
Returns:

The mongo-db id for the inserted document.

Type
bson

<async> storeCommentId(reply_id, comment_id)

Stores connection between an reply and a coment number. If the same reply event fires again the correspondin comment will be updated/overwritten.

Parameters:
Name Type Description
reply_id String

Reply id from the original source.

comment_id String

Github comment_id

Throws:

If TODO

Type
TODO
Returns:
Type
undefined

<async> storeIssueNumber(annotation_id, issue_number)

Stores connection between an annotation and an issue number. This serves two purposes: If the same annotation event fires again the same issue will be updated/overwritten. If a reply event fires, a comment can be placed into the corresponding issue.

Parameters:
Name Type Description
annotation_id String

Id from the original source.

issue_number String

Github issue number

Throws:

If TODO

Type
TODO
Returns:
Type
undefined

<async> update()

Updates document associated with the endpoint using the data from .export.

Inherited From:
Throws:

If this.id is undefined (i.e. the endpoint has not been stored yet)

Type
ReferenceError
Returns:
Type
undefined

<async> updateDecor(session_data)

TODO: Rethink decoration

Parameters:
Name Type Description
session_data SessionData
Overrides:
Throws:

If TODO

Type
TODO
Returns:
Type
undefined

<async> validate(session_data)

Check if the current session has access to the repository the endpoint's identifier points to.

Parameters:
Name Type Description
session_data SessionData
Overrides:
Throws:

If current session cannot access the repository

Type
DocloopError | 403
Returns:
Type
undefined