The mailman-client API

0.1

A Node.js client for mailman-core

Client Class

Extends ApiRequest
Defined in: lib/Client.js:17
Module: mailman-client

Client extends ApiRequest to serve as the entry point for the Mailman Client API

Properties

_options Object private

Inherited from BaseRequest but overwritten in lib/Client.js:29

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

Supported HTTP methods for this BaseRequest instance (Each of the child constructor classes i.e Client, List etc. define their own subset of supported methods)

Default: [ 'head', 'get', 'put', 'post', 'delete', 'patch' ]

_template String private

The URI template used to generate the URI to request (This will be overwritten by each of the child constructor classes i.e Client, List, etc.)

Default: ''

preferences Preferences private

Defined in lib/Client.js:73

Preferences object representing the system preferences

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

Client
(
  • options
)

Defined in lib/Client.js:17

Parameters:

  • options Object

    A hash of options for the Client 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

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

_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

_setAccessors () private

Defined in lib/Client.js:66

Set the accessors on the Client instance

createDomain
(
  • mailHost
  • [baseURL]
  • [description]
  • [owner]
  • [callback]
)
Promise async

Defined in lib/Client.js:260

Create a domain and call the callback(if any) or provide a promise to the Domain instance

Parameters:

  • mailHost String

    The mail host

  • [baseURL] String optional

    The base URL of the mail host

  • [description] String optional

    Description about the domain

  • [owner] String optional

    Email of the domain owner

  • [callback] Function optional

    The callback function to be invoked with the created Domain instance

    • err Error | Object

      Any errors encountered during the request

    • result Object

      The created Domain instance

Returns:

Promise:

Promise to the created Domain instance

createUser
(
  • email
  • password
  • displayName
)
Promise async

Defined in lib/Client.js:369

Create a mailman user and call the callback(if any) with the User instance or provide a promise to it

Parameters:

  • email String

    The email address of the user

  • password String

    A password string

  • displayName String

    The display name of the user

Returns:

Promise:

Returns a promise to the created User instance

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

deleteDomain
(
  • [callback]
)
Promise async

Defined in lib/Client.js:297

Delete a domain

Parameters:

  • [callback] Function optional

    The callback function to be invoked

    • err Error | Object

      Any errors encountered during the request

    • result Object

      The Client instance itself

Returns:

Promise:

Promise to the Client instance itself

deleteList
(
  • fqdnListname
  • [callback]
)
Promise async

Defined in lib/Client.js:469

Delete a list by it's fqdn listname (fully qualified domain name) and call the callback(if any) with the Client instance or provide a promise to it

Parameters:

  • fqdnListname String

    The fully qualified domian name of the list

  • [callback] Function optional

    The callback function to be invoked

    • err Error | Object

      Any errors encountered during the request

    • result Object

      The List instance

Returns:

Promise:

Promise to the List instance

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

getAddress
(
  • email
  • [callback]
)
Promise async

Defined in lib/Client.js:421

Get an address by it's associated email address and call the callback(if any) with the Address instance or provide a promise to it

Parameters:

  • email String

    The associated email address

  • [callback] Function optional

    The callback function to be invoked

    • err Error | Object

      Any errors encountered during the request

    • result Object

      The Address instance

Returns:

Promise:

Promise to the Address instance

getDomain
(
  • mailHost
  • webHost
  • [callback]
)
Promise async

Defined in lib/Client.js:317

Get a domain by it's web host name or mail host name, call the provided callback(if any) with the Domain instance or provide a promise to it

Parameters:

  • mailHost String

    The mail host of the domain

  • webHost String

    The web host of the domain

  • [callback] Function optional

    The callback function to be invoked

    • err Error | Object

      Any errors encountered during the request

    • result Object

      The Domain instance

Returns:

Promise:

Promise to the Domain instance

getDomains
(
  • [callback]
)
Promise async

Defined in lib/Client.js:135

Calls the callback(if any) or provide a promise to an array of Domain instances

Parameters:

  • [callback] Function optional

    The callback function to be invoked with the results

    • err Error | Object

      Any errors encountered during the request

    • result Object

      An array of Domain instances

Returns:

Promise:

Promise to an array of Domain instances

getList
(
  • fqdnListname
  • [callback]
)
Promise async

Defined in lib/Client.js:445

Get a list by it's fqdn listname (fully qualified domain name) and call the callback(if any) with the List instance or provide a promise to it

Parameters:

  • fqdnListname String

    The fully qualified domian name of the list

  • [callback] Function optional

    The callback function to be invoked

    • err Error | Object

      Any errors encountered during the request

    • result Object

      The List instance

Returns:

Promise:

Promise to the List instance

getListPage
(
  • count
  • page
  • [callback]
)
Promise async

Defined in lib/Client.js:116

Provides a paging interface to the lists

Parameters:

  • count Number

    Number of items on a page

  • page Page

    Number of pages to be requested

  • [callback] Function optional

    The callback function to be invoked with a Page instance

    • err Error | Object

      Any errors encountered during the request

    • result Object

      A Page instance

Returns:

Promise:

Promise to a Page instance

getLists
(
  • [callback]
)
Promise async

Defined in lib/Client.js:89

Calls the callback(if any) or provide a promise to an array of List instances

Parameters:

  • [callback] Function optional

    The callback function to be invoked with the results

    • err Error | Object

      Any errors encountered during the request

    • result Object

      An array of List instances

Returns:

Promise:

Promise to an array of List instances

getMemberPage
(
  • count
  • page
  • [callback]
)
Promise async

Defined in lib/Client.js:192

Provides a paging interface to the lists

Parameters:

  • count Number

    Number of items on a page

  • page Page

    Number of pages to be requested

  • [callback] Function optional

    The callback function to be invoked with a Page instance

    • err Error | Object

      Any errors encountered during the request

    • result Object

      A Page instance

Returns:

Promise:

Promise to a Page instance

getMembers
(
  • [callback]
)
Promise async

Defined in lib/Client.js:165

Calls the callback(if any) or provide a promise to an array of Member instances

Parameters:

  • [callback] Function optional

    The callback function to be invoked with the results

    • err Error | Object

      Any errors encountered during the request

    • result Object

      An array of Members instances

Returns:

Promise:

Promise to an array of Member instances

getUser
(
  • email
  • [callback]
)
Promise async

Defined in lib/Client.js:397

Get a user by it's associated email address and call the callback(if any) with the User instance or provide a promise to it

Parameters:

  • email String

    The email address of the user

  • [callback] Function optional

    The callback function to be invoked with the created Domain instance

    • err Error | Object

      Any errors encountered during the request

    • result Object

      The User instance

Returns:

Promise:

Promise to the User instance

getUserPage
(
  • count
  • page
  • [callback]
)
Promise async

Defined in lib/Client.js:241

Provides a paging interface to the users

Parameters:

  • count Number

    Number of items on a page

  • page Page

    Number of pages to be requested

  • [callback] Function optional

    The callback function to be invoked with a Page instance

    • err Error | Object

      Any errors encountered during the request

    • result Object

      A Page instance

Returns:

Promise:

Promise to a Page instance

getUsers
(
  • [callback]
)
Promise async

Defined in lib/Client.js:211

Calls the callback(if any) or provide a promise to an array of User instances

Parameters:

  • [callback] Function optional

    The callback function to be invoked with the results

    • err Error | Object

      Any errors encountered during the request

    • result Object

      An array of User instances

Returns:

Promise:

Promise to an array of User instances

getVersions
(
  • [callback]
)
Promise async

Defined in lib/Client.js:46

Provides the system versions information

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 system version information

Returns:

Promise:

Promise to the system version information

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

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

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/Client.js:492

String representation of the Client instance

Returns:

String:

Return the string representation of the Client instance

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