Class: OpenVeoClient

openveo-rest-nodejs-client/OpenVeoClient~OpenVeoClient(webServiceUrl, clientId, clientSecret, certificateopt)

OpenVeoClient

Constructor

new OpenVeoClient(webServiceUrl, clientId, clientSecret, certificateopt)

Creates a client to connect to OpenVeo web service.

It aims to facilitate the interaction with OpenVeo web service. All authentication aspects are managed by the client and are transparent to the user. Requesting an end point, without being authenticated, will automatically authenticate first before calling the end point. If token expired, a new authentication is made automatically.

Parameters:
Name Type Attributes Description
webServiceUrl String

The complete URL of the OpenVeo Web Service (with protocol and port)

clientId String

Application's client id

clientSecret String

Application's client secret

certificate String <optional>

Absolute path to the web service server full chain certificate file

Source:
Throws:

Thrown if webServiceUrl, clientId or clientSecret is not a valid String

Type
TypeError
Example
const OpenVeoClient = require('@openveo/rest-nodejs-client').OpenVeoClient;
const client = new OpenVeoClient(
  'https://www.openveo-web-service:443',
  'client id',
  'client secret',
  '/absolute/path/to/fullchain/certificate.crt'
);

Extends

Members

(readonly) authenticateRequest :module:openveo-rest-nodejs-client/Request~Request

The authenticate request to get an access token.

Type:
Source:

(readonly) clientId :String

Application client id.

Type:
  • String
Source:

(readonly) clientSecret :String

Application client secret.

Type:
  • String
Source:

(readonly) credentials :String

Encoded credentials ready for OAuth authentication.

Type:
  • String
Source:

Methods

(async) delete(endPoint, optionsopt, timeoutopt) → {Promise}

Executes a DELETE request.

If client is not authenticated or access token has expired, a new authentication is automatically performed.

Parameters:
Name Type Attributes Default Description
endPoint String

The web service end point to reach with query parameters

options Object <optional>

The list of http(s) options as described by NodeJS http.request documentation

timeout Number <optional>
10000

Maximum execution time for the request (in ms), set it to Infinity for a request without limits

Inherited From:
Source:
Throws:

Thrown if endPoint is not valid a String

Type
TypeError
Returns:

Promise resolving with results as an Object

Type
Promise

(async) get(endPoint, optionsopt, timeoutopt) → {Promise}

Executes a GET request.

If client is not authenticated or access token has expired, a new authentication is automatically performed.

Parameters:
Name Type Attributes Default Description
endPoint String

The web service end point to reach with query parameters

options Object <optional>

The list of http(s) options as described by NodeJS http.request documentation

timeout Number <optional>
10000

Maximum execution time for the request (in ms), set it to Infinity for a request without limits

Inherited From:
Source:
Throws:

Thrown if endPoint is not valid a String

Type
TypeError
Returns:

Promise resolving with result as an Object

Type
Promise

getAuthenticationHeaders() → {Object}

Gets the list of headers to send with each request.

Overrides:
Source:
Returns:

The list of headers to add to all requests sent to the server

Type
Object

(async) patch(endPoint, bodyopt, optionsopt, timeoutopt, multipartedopt) → {Promise}

Executes a PATCH request.

If client is not authenticated or access token has expired, a new authentication is automatically performed.

Parameters:
Name Type Attributes Default Description
endPoint String

The web service end point to reach with query parameters

body Object | String <optional>

The request body

options Object <optional>

The list of http(s) options as described by NodeJS http.request documentation

timeout Number <optional>
10000

Maximum execution time for the request (in ms), set it to Infinity for a request without limits

multiparted Boolean <optional>
false

true to send body as multipart/form-data

Inherited From:
Source:
Throws:

Thrown if endPoint is not valid a String

Type
TypeError
Returns:

Promise resolving with results as an Object

Type
Promise

(async) post(endPoint, bodyopt, optionsopt, timeoutopt, multipartedopt) → {Promise}

Executes a POST request.

If client is not authenticated or access token has expired, a new authentication is automatically performed.

Parameters:
Name Type Attributes Default Description
endPoint String

The web service end point to reach with query parameters

body Object | String <optional>

The request body

options Object <optional>

The list of http(s) options as described by NodeJS http.request documentation

timeout Number <optional>
10000

Maximum execution time for the request (in ms), set it to Infinity for a request without limits

multiparted Boolean <optional>
false

true to send body as multipart/form-data

Inherited From:
Source:
Throws:

Thrown if endPoint is not valid a String

Type
TypeError
Returns:

Promise resolving with results as an Object

Type
Promise

(async) put(endPoint, bodyopt, optionsopt, timeoutopt, multipartedopt) → {Promise}

Executes a PUT request.

If client is not authenticated or access token has expired, a new authentication is automatically performed.

Parameters:
Name Type Attributes Default Description
endPoint String

The web service end point to reach with query parameters

body Object | String <optional>

The request body

options Object <optional>

The list of http(s) options as described by NodeJS http.request documentation

timeout Number <optional>
10000

Maximum execution time for the request (in ms), set it to Infinity for a request without limits

multiparted Boolean <optional>
false

true to send body as multipart/form-data

Inherited From:
Source:
Throws:

Thrown if endPoint is not valid a String

Type
TypeError
Returns:

Promise resolving with results as an Object

Type
Promise