The mailman-client API

0.1

A Node.js client for mailman-core

Page Class

Extends ApiRequest
Defined in: lib/Page.js:12
Module: Page
Parent Module: mailman-client

Page extends ApiRequest to provide pagination functionality

Properties

_options Object private

Inherited from BaseRequest but overwritten in lib/Page.js:28

Configuration options such as the endpoint of the API, auth parameters etc.

Default: {}

_params Object private

The object containing the query parameters

Default: {}

_path Object private

Object containing request path variables used to assemble the request URI (This will be overwritten by each of the child constructor classes i.e Client, List, etc.)

Default: {}

_queryParams Boolean private

A boolean flag that is set when there are query parameters to be rendered

Default: false

_supportedMethods Array private

Inherited from BaseRequest but overwritten in lib/Page.js:47

Supported HTTP methods

Default: ['get']

_supportedMethods Array private

Defined in lib/Page.js:57

Supported HTTP methods

Default: ['get','delete']

_template String private

Inherited from BaseRequest but overwritten in lib/Page.js:38

The URI template used to generate the URI to request

There are no properties that match your current filter settings. You can change your filter settings in the index section on this page. index

Constructor

Page
(
  • options
  • path
  • model
  • count
  • page
)

Defined in lib/Page.js:12

Parameters:

  • options Object

    A hash of options for the Member instance

    • endpoint String

      The endpoint URI to request

    • [username] String optional

      A username for authenticating API requests

    • [password] String optional

      A password for authenticating API requests

  • path String

    The path to be requested

  • model Object

    Resource class on which pagination is to be done, eg. List, Domain etc.

  • count Number

    Number of items on a page

  • page Number

    Number of pages to be requested

Methods

_auth () Object private

Performs auth on the superagent request object if implied externally

Returns:

Object:

The superagent request object by performing auth on it

_checkAuthParameters () Boolean private

Checks if authentication is externally forced on the request object by passing in username & password

Returns:

Boolean:

Returns true if auth is forced else false

_checkMethodSupport
(
  • method
)
Boolean private

Verify that the request object in use supports a HTTP method

Parameters:

  • method String

    An HTTP method to check ('get', 'post', etc)

Returns:

Boolean:

Returns true if the HTTP method is supported else it will throw

_createPage
(
  • [callback]
)
Promise private async

Defined in lib/Page.js:78

Creates the page corresponding to the Model class

Parameters:

  • [callback] Function optional

    The callback function to be invoked with the results

    • err Error | Object

      Any errors encountered during the request

    • result Object

      The Page object itself

Returns:

Promise:

Promise to the Page object itself

_renderPath () String private

Renders the request path by using _path and _template

Returns:

String:

The rendered path string

_renderQuery () String private

Compose query string by using the recorded query parameters

Returns:

String:

Returns the query string to be appended in the final URI

_renderURI () String private

Renders the URI to request after checking for query parameters

Returns:

String:

The URI enpoint to request

all
(
  • callback
)
async

Defined in lib/Page.js:178

Calls the callback with all the entries of the current page

Parameters:

  • callback Function

    The callback function to be invoked

current
(
  • [callback]
)
Promise async

Defined in lib/Page.js:110

Get the current page

Parameters:

  • [callback] Function optional

    The callback function to be invoked with the results

    • err Error | Object

      Any errors encountered during the request

    • result Object

      The Page object itself

Returns:

Promise:

Promise to the Page object itself

delete
(
  • [callback]
  • transform
)
Promise async

Parameters:

  • [callback] Function optional

    A callback to invoke with the results of the DELETE request

    • err Error | Object

      Any errors encountered during the request

    • result Object

      The response of the request

  • transform String

    Flag to get the full response object by passing in identity

Returns:

Promise:

A promise to the results of the HTTP request

each
(
  • callback
)
async

Defined in lib/Page.js:161

Iterate over all the entries in the current page

Parameters:

  • callback Function

    The callback function to be invoked with each page entry

get
(
  • [callback]
  • transform
)
Promise async

Parameters:

  • [callback] Function optional

    A callback to invoke with the results of the GET request

    • err Error | Object

      Any errors encountered during the request

    • result Object

      The response of the request

  • transform String

    Flag to get the full response object by passing in identity

Returns:

Promise:

A promise to the results of the HTTP request

head
(
  • [callback]
  • transform
)
Promise async

Parameters:

  • [callback] Function optional

    A callback to invoke with the results of the HEAD request

    • err Error | Object

      Any errors encountered during the request

    • result Object

      The response of the request

  • transform String

    Flag to get the full response object by passing in identity

Returns:

Promise:

A promise to the results of the HTTP request

next
(
  • [callback]
)
Promise async

Defined in lib/Page.js:125

Get the next page

Parameters:

  • [callback] Function optional

    The callback function to be invoked with the results

    • err Error | Object

      Any errors encountered during the request

    • result Object

      The Page object itself

Returns:

Promise:

Promise to the Page object itself

patch
(
  • data
  • [callback]
  • transform
)
Promise async

Parameters:

  • data Object

    The patch data

  • [callback] Function optional

    A callback to invoke with the results of the PATCH request

    • err Error | Object

      Any errors encountered during the request

    • result Object

      The response of the request

  • transform String

    Flag to get the full response object by passing in identity

Returns:

Promise:

A promise to the results of the HTTP request

post
(
  • data
  • [callback]
  • transform
)
Promise async

Parameters:

  • data Object

    The post data

  • [callback] Function optional

    A callback to invoke with the results of the POST request

    • err Error | Object

      Any errors encountered during the request

    • result Object

      The response of the request

  • transform String

    Flag to get the full response object by passing in identity

Returns:

Promise:

A promise to the results of the HTTP request

previous
(
  • [callback]
)
Promise async

Defined in lib/Page.js:142

Get the previous page

Parameters:

  • [callback] Function optional

    The callback function to be invoked with the results

    • err Error | Object

      Any errors encountered during the request

    • result Object

      The Page object itself

Returns:

Promise:

Promise to the Page object itself

put
(
  • data
  • [callback]
  • transform
)
Promise async

Parameters:

  • data Object

    The put data

  • [callback] Function optional

    A callback to invoke with the results of the PUT request

    • err Error | Object

      Any errors encountered during the request

    • result Object

      The response of the request

  • transform String

    Flag to get the full response object by passing in identity

Returns:

Promise:

A promise to the results of the HTTP request

query
(
  • key
  • [value]
)
Object chainable

Record query parameters to be rendered in the final URI

Parameters:

  • key String | Object

    The name of the query parameter or an object containing query parameters as key,val pairs repectively

  • [value] String | Array optional

    If the supplied key is a String, then value can be of type Array or String

Returns:

Object:

Returns the ApiRequest instance itself if the arguments are in the required form else throw an Error

toString () String

Defined in lib/Page.js:193

String representation of the Page object

Returns:

String:

Returns the string representation of the Page object

There are no methods that match your current filter settings. You can change your filter settings in the index section on this page. index