new UserAgent(username, password, version)
Create a new UserAgent.
Parameters:
Name | Type | Description |
---|---|---|
username |
string | User name. |
password |
string | Password. |
version |
string | API version. |
Methods
-
delete(endpoint [, data] [, params])
-
Perform a DELETE request as this user.
Parameters:
Name Type Argument Description endpoint
string API endpoint to make the request to.
data
Object <optional>
DELETE body.
params
Object <optional>
Request parameters.
Returns:
A promise which resolves to the Chakram DELETE response.
- Type
- ChakramPromise
-
get(endpoint [, params])
-
Perform a GET request as this user.
Parameters:
Name Type Argument Description endpoint
string API endpoint to make the request to.
params
Object <optional>
Request parameters.
Returns:
A promise which resolves to the Chakram GET response.
- Type
- ChakramPromise
-
on(version)
-
Returns a user agent with the same username and password as this one, with the given
version
. If such an agent does not exist, clone this one.Parameters:
Name Type Description version
string API version to use.
Returns:
A
UserAgent
set to use the given API version.- Type
- UserAgent
-
post(endpoint, data [, params])
-
Perform a POST request as this user.
Parameters:
Name Type Argument Description endpoint
string API endpoint to make the request to.
data
Object POST body.
params
Object <optional>
Request parameters.
Returns:
A promise which resolves to the Chakram POST response.
- Type
- ChakramPromise
-
put(endpoint, data [, params])
-
Perform a PUT request as this user.
Parameters:
Name Type Argument Description endpoint
string API endpoint to make the request to.
data
Object PUT body.
params
Object <optional>
Request parameters.
Returns:
A promise which resolves to the Chakram PUT response.
- Type
- ChakramPromise