<private> new BusinessEndpoint(transport, business)
Parameters:
Name | Type | Description |
---|---|---|
transport |
Transport | Transport instance to use for fetching |
business |
Object | JSON object describing this business endpoint (fetched from sequoia services 'descriptor') |
- Source:
Example
// `contents` is used in the rest of the examples as our reference // to a ResourcefulEndpoint let feeds; client.generate().then(() => { client.service('feed').then((service) => { // Get a business endpoint (this is synchronous as the service passed // all the necessary data): feeds = service.businessEndpoint('feeds', { name: 'UTV-15246' }); // whatever }); });
Members
-
requiredQueryParameterNames :Array.<string>
-
Returns an array of query parameter names
Type:
- Array.<string>
- Source:
Example
// Returns e.g. ['currency', 'price']
-
requiredQueryParameters :Array.<object>
-
Required query parameters for the business endpoint from the
routes['name'].inputs.query
portion of the descriptorReturns the raw objects
Type:
- Array.<object>
- Source:
Example
// Returns e.g. [{ "type": "name", "meta": [{ "sequoiaType": "name" }], "invalids": ["" ], "name": "count", "required": false }, { "type": "string", "description": "language to localise response to", "invalids": [""], "name": "lang", "required": false }]
Methods
-
<private> criteriaToQuery(criteria)
-
Return a query string to append to the HTTP call. Will default to appending
?owner=<owner>
Parameters:
Name Type Argument Description criteria
string | Query <nullable>
A (potential) query string to append to the request
- Source:
Throws:
InvalidCriteriaException
Returns:
- Type
- string
-
<private> endPointUrl(criteria)
-
Get the full URL to the business endpoint/item we will send the request to
Parameters:
Name Type Argument Description criteria
string | Query <nullable>
A (potential) query string to append to the request
- Source:
- See:
Throws:
InvalidCriteriaException
Returns:
- Type
- string
-
fetch(criteria, options)
-
Perform an action against the business endpoint. Note, the HTTP method comes from the
routes['name'].method
portion of the descriptorParameters:
Name Type Description criteria
string | Query A query string to append to the request
options
object - Source:
- See:
Throws:
InvalidCriteriaException
Returns:
- JSON returned from the endpoint
- Type
- Promise