Interface for a media type extension
Properties:
Name | Type | Description |
---|---|---|
mediaTypes |
Array.<String> | The media types this extension can process. Used to generate the HTTP Accept header for requests. |
encoders |
Object.<String, Extension~encoder> | Encoders for creating request bodies, keyed by media type. |
- Source:
Methods
applies(data, headers, context) → {Boolean}
Determine whether this extension should be used to process a particular response
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The body of the response, pre-parsed if some form of JSON. |
headers |
Object.<string, string> | The HTTP headers of the response |
context |
Context | The context of the current resource/operation. |
- Source:
Returns:
True if the extension should be used to process the response.
- Type
- Boolean
curiePrefixParser(data, headers, context) → {Object.<String, CuriePrefix>}
Parse any CURIE prefixes defined in this resource.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The body of the response, pre-parsed if some form of JSON. |
headers |
Object.<string, string> | The HTTP headers of the response |
context |
Context | The context of the current resource/operation. |
- Source:
Returns:
The curie prefixes, indexed by the prefix identifier.
- Type
- Object.<String, CuriePrefix>
dataParser(data, headers, context) → {Array.<{name: String, value: Object}>}
Parse any field data that is part of the resource.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The body of the response, pre-parsed if some form of JSON. |
headers |
Object.<string, string> | The HTTP headers of the response |
context |
Context | The context of the current resource/operation. |
- Source:
Returns:
The fields, as an array of name/value pairs.
- Type
- Array.<{name: String, value: Object}>
embeddedParser(data, headers, context, the) → {Object.<String, Array.<Resource>>}
Parse any embedded resources found in this resource.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The body of the response, pre-parsed if some form of JSON. |
headers |
Object.<string, string> | The HTTP headers of the response |
context |
Context | The context of the current resource/operation. |
the |
Resource | parent resource that contains the parsed resources. |
- Source:
Returns:
The embedded resources, aggregated by the link relation.
- Type
- Object.<String, Array.<Resource>>
formatSpecificParser(data, headers, context) → {Object}
Parse and assign hypermedia format specific attributes in this resource.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The body of the response, pre-parsed if some form of JSON. |
headers |
Object.<string, string> | The HTTP headers of the response |
context |
Context | The context of the current resource/operation. |
- Source:
Returns:
The object containing any format specific properties.
- Type
- Object
formParser(data, headers, context) → {Object.<String, Array.<Form>>}
Parse any hypermedia forms found in this resource.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The body of the response, pre-parsed if some form of JSON. |
headers |
Object.<string, string> | The HTTP headers of the response |
context |
Context | The context of the current resource/operation. |
- Source:
Returns:
The hypermedia forms, aggregated by the link relation.
- Type
- Object.<String, Array.<Form>>
linkParser(data, headers, context) → {Object.<String, LinkCollection>}
Parse any links found in the resources.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The body of the response, pre-parsed if some form of JSON. |
headers |
Object.<string, string> | The HTTP headers of the response |
context |
Context | The context of the current resource/operation. |
- Source:
Returns:
The links, aggregated by the link relation.
- Type
- Object.<String, LinkCollection>
Type Definitions
encoder(data) → {String}
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The data to encode |
- Source:
Returns:
The data encoded to a request body string.
- Type
- String