CmsClient

How to get CmsClient

ES2015+:

import CmsClient from 'fontoxml-connector/CmsClient'

ES5:

define([
	'fontoxml-connector/CmsClient'
], function (
	CmsClient
) {
});

Type: Class

Base class, used by connectors to send requests to the CMS.

In most situations, you probably want to use the StandardCmsClient instance.

Constructor

# Name Type Description
1. configuration Object

Methods

Name Description
sendRequest

Send a request using the specified HTTP method to the named endpoint on the scope-provided CMS base URL, passing the data represented by the given RequestData instance


  Arguments
# Name Type Description
1. method String
2. endpoint String
3. requestData RequestData
4. [options] Object
  Members

Members

Name Type Description
[requestTimeoutInSeconds] Number

if a timeout is configured and this is set to a larger value, this overrides the configured timeout for the request. Ignored otherwise.

[validateResponse] Function

optional function used to validate whether the response returned by the CMS matches the expected contracts. The function should throw if a problem is detected.

  Returns

Type: Promise<Response>

Resolves to an object representing the response. Rejects if the request failed or if the CMS returned an error HTTP status code.

sendRequestToUrl

Send a request using the specified HTTP method to the given url, passing the data represented by the given RequestData instance.

For requests to endpoints on the standard CMS backend, use the sendRequest method instead.


  Arguments
# Name Type Description
1. method String
2. url String
3. requestData RequestData
4. [options] Object
  Members

Members

Name Type Description
[requestTimeoutInSeconds] Number

if a timeout is configured and this is set to a larger value, this overrides the configured timeout for the request. Ignored otherwise.

[validateResponse] Function

optional function used to validate whether the response returned by the CMS matches the expected contracts. The function should throw if a problem is detected.

  Returns

Type: Promise<Response>

Resolves to an object representing the response. Rejects if the request failed or if the CMS returned an error HTTP status code, or if the validateResponse function throws an error.