Class: PaperhiveAdapter

paperhiveAdapter PaperhiveAdapter

Adapter to harvest public annotations from paperhive.


new PaperhiveAdapter(core, config, home, contentLink, extraEndpoints, scanningInterval)

Parameters:
Name Type Description
core DocloopCore
config Object

Configuration object

home String

Website of the used paperhive instance.

contentLink String

Url of paperhive doument's discussion. Use %s in this string to indicate the positin of the document's id.

extraEndpoints Boolean

True iff there are addtional non privileged endpoints.

scanningInterval Number

Time between two scans in milliseconds.

Properties:
Name Type Description
endpointDefaultConfig Object
Properties
Name Type Description
includePastAnnotations Object

If set to true, the adapter will collect all annotations from a source, as soon as a link is established. This might be undesirable for documents with a large amount of annotations.

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, abstract> getAuthState(session_data)

This method is meant to be overwritten by a custom adapter class. Returns the authorization state for the adapter in the current session.

Parameters:
Name Type Description
session_data SessionData

Data of the current session associated with this adapter

Inherited From:
Returns:
Type
AuthState

<async> getEndpoints()

There are no privileged endpoints. This Adapter only uses public paperhive documents.

Overrides:
Returns:

[]

Type
Array

<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()

There are no privileged endpoints. This Adapter only uses public paperhive documents.

Overrides:
Returns:

[]

Type
Array

<async> handleLinkEstablishedEvent(link)

If the source matches this adapter it will be scanned for annotations and replies.

Parameters:
Name Type Description
link DocloopLink.skeleton
Listens to Events:
  • event:link-established
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

<async> scanSources()

Scan all stored source for new annotations or replies

Returns:

undefined