The mailman-client API

0.1

A Node.js client for mailman-core

User Class

Extends ApiRequest
Defined in: lib/User.js:15
Module: User
Parent Module: mailman-client

User extends ApiRequest to perform operations on the user resource

Properties

_info Object private

Defined in lib/User.js:86

Object containing the resource information, will be null if getInfo() is never called

Default: null

_info Array private

Defined in lib/User.js:96

Adddress instances linked to the user, will be null if getInfo() is never called

Default: null

_keys Array private

Defined in lib/User.js:138

Array of properties based on the User _info object

_options Object private

Inherited from BaseRequest but overwritten in lib/User.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

Inherited from BaseRequest but overwritten in lib/User.js:57

Object containing request path variables used to assemble the request URI

Default: {}

_preferences Preferences private

Defined in lib/User.js:126

The Preferences instance corresponding to User instance

Default: null

_queryParams Boolean private

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

Default: false

_rootTemplate String private

Defined in lib/User.js:67

Root template string for the domain resource used to assemble other endpoints under this category

_subscriptions Array private

Defined in lib/User.js:106

Array of Member instances corresponding to the list subscriptions for the email address

Default: []

_subscriptions Array private

Defined in lib/User.js:116

Array of list ids of lists to which this address is subscribed

Default: []

_supportedMethods Array private

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

Supported HTTP methods

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

_template String private

Inherited from BaseRequest but overwritten in lib/User.js:76

The URI template used to generate the URI to request

Default: ''

_url String private

Defined in lib/User.js:48

URL of the user resource

addresses Addresses

Defined in lib/User.js:252

Return the Addresses instance linked to the user

display_name String

Defined in lib/User.js:208

Getter and Setter for the display name of the user

password String

Defined in lib/User.js:229

Getter and Setter for the password of the user

preferences Preferences

Defined in lib/User.js:271

Return the Preferences corresponding to the user

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

User
(
  • options
  • url
)

Defined in lib/User.js:15

Parameters:

  • options Object

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

  • url String

    Location of the user resource on the server

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/User.js:186

Set the accessors on the object for the resource information i.e _info object

addAddress
(
  • email
  • [callback]
)
Promise async

Defined in lib/User.js:291

Link a address to the user

Parameters:

  • email String

    The email address to be linked to the user

  • [callback] Function optional

    The callback function to be invoked with the results

    • err Error | Object

      Any errors encountered during the request

    • result Object

      The User object itself

Returns:

Promise:

Promise to the User 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

deleteUser
(
  • [callback]
)
Promise async

Defined in lib/User.js:432

Deletes the user

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 User instance itself

Returns:

Promise:

A promise to the User instance itself

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

getInfo
(
  • [callback]
)
Promise async

Defined in lib/User.js:157

Fetch the resource by making a HTTP GET request and calls the callback(if any), and provide a promise to the User object itself

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 User object itself

Returns:

Promise:

Promise to the User object itself

getSubscriptions
(
  • [callback]
)
Promise async

Defined in lib/User.js:314

Calls the callback (if any) or provide a promise to the array of Member instances corresponding to the current email address

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 Member instances corresponding to the current email address

Returns:

Promise:

A promise to the array of Member instances corresponding to the current email address

getSubscriptionsListIds
(
  • [callback]
)
Promise async

Defined in lib/User.js:370

Calls the callback (if any) or provide a promise to the array of list IDs corresponding to the list subscriptions

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 IDs corresponding to the list subscriptions

Returns:

Promise:

A promise to an array of list IDs corresponding to the list subscriptions

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

save
(
  • [callback]
)
Promise async

Defined in lib/User.js:406

Save the user properties upstream

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 User instance itself

Returns:

Promise:

A promise to the User instance itself

toString () String

Defined in lib/User.js:452

Returns the string representation of the User instance

Returns:

String:

The string representation of the user 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