- AEMHeadless
This class provides methods to call AEM GraphQL APIs. Before calling any method initialize the instance with GraphQL endpoint, GraphQL serviceURL and auth if needed
- Model :
object GraphQL Model type
- ModelResult :
object - ModelResults :
object - ModelEdge :
object - PageInfo :
object - ModelConnection :
object - ModelByPathArgs :
object - ModelListArgs :
object - ModelPaginatedArgs :
object - ModelArgs :
ModelByPathArgs|ModelListArgs|ModelPaginatedArgs - QueryBuilderResult :
object - ModelConfig :
object
This class provides methods to call AEM GraphQL APIs. Before calling any method initialize the instance with GraphQL endpoint, GraphQL serviceURL and auth if needed
Kind: global class
- AEMHeadless
- new AEMHeadless(config)
- .runQuery(body, [options], [retryOptions]) ⇒
Promise.<any> - .persistQuery(query, path, [options], [retryOptions]) ⇒
Promise.<any> - .listPersistedQueries([options], [retryOptions]) ⇒
Promise.<any> - .runPersistedQuery(path, [variables], [options], [retryOptions]) ⇒
Promise.<any> - .runPaginatedQuery(model, fields, [config], [args], [options], [retryOptions])
- .buildQuery(model, fields, [config], [args]) ⇒
QueryBuilderResult
Constructor.
If param is a string, it's treated as AEM server URL, default GraphQL endpoint is used. For granular params, use config object
| Param | Type | Description |
|---|---|---|
| config | string | object | Configuration object, or AEM server URL string |
| [config.serviceURL] | string | AEM server URL |
| [config.endpoint] | string | GraphQL endpoint |
| [config.auth] | string | Array | Bearer token string or [user,pass] pair array |
| [config.headers] | object | header { name: value, name: value, ... } |
| [config.fetch] | object | custom Fetch instance |
Returns a Promise that resolves with a POST request JSON data.
Kind: instance method of AEMHeadless
Returns: Promise.<any> - - the response body wrapped inside a Promise
| Param | Type | Default | Description |
|---|---|---|---|
| body | string | object | the query string or an object with query (and optionally variables) as a property |
|
| [options] | object | {} | additional POST request options |
| [retryOptions] | object | {} | retry options for @adobe/aio-lib-core-networking |
Returns a Promise that resolves with a PUT request JSON data.
Kind: instance method of AEMHeadless
Returns: Promise.<any> - - the response body wrapped inside a Promise
| Param | Type | Default | Description |
|---|---|---|---|
| query | string | the query string |
|
| path | string | AEM path to save query, format: configuration_name/endpoint_name |
|
| [options] | object | {} | additional PUT request options |
| [retryOptions] | object | {} | retry options for @adobe/aio-lib-core-networking |
Returns a Promise that resolves with a GET request JSON data.
Kind: instance method of AEMHeadless
Returns: Promise.<any> - - the response body wrapped inside a Promise
| Param | Type | Default | Description |
|---|---|---|---|
| [options] | object | {} | additional GET request options |
| [retryOptions] | object | {} | retry options for @adobe/aio-lib-core-networking |
Returns a Promise that resolves with a GET request JSON data.
Kind: instance method of AEMHeadless
Returns: Promise.<any> - - the response body wrapped inside a Promise
| Param | Type | Default | Description |
|---|---|---|---|
| path | string | AEM path for persisted query, format: configuration_name/endpoint_name |
|
| [variables] | object | {} | query variables |
| [options] | object | {} | additional GET request options |
| [retryOptions] | object | {} | retry options for @adobe/aio-lib-core-networking |
Returns a Generator Function.
Kind: instance method of AEMHeadless
| Param | Type | Default | Description |
|---|---|---|---|
| model | string | contentFragment model name |
|
| fields | string | The query string for item fields |
|
| [config] | ModelConfig | {} | Pagination config |
| [args] | ModelArgs | {} | Query arguments |
| [options] | object | {} | additional POST request options |
| [retryOptions] | object | {} | retry options for @adobe/aio-lib-core-networking |
aemHeadless.buildQuery(model, fields, [config], [args]) ⇒ QueryBuilderResult
Builds a GraphQL query string for the given parameters.
Kind: instance method of AEMHeadless
Returns: QueryBuilderResult - - object with The GraphQL query string and type
| Param | Type | Default | Description |
|---|---|---|---|
| model | string | contentFragment Model Name |
|
| fields | string | The query string for item fields |
|
| [config] | ModelConfig | {} | Pagination config |
| [args] | ModelArgs | {} | Query arguments |
GraphQL Model type
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| * | any | model properties |
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| item | Model | response item |
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| items | Array.<Model> | response items |
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| cursor | string | item cursor |
| node | Model | item node |
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| endCursor | string | endCursor |
| hasNextPage | boolean | hasNextPage |
| hasPreviousPage | boolean | hasPreviousPage |
| startCursor | string | startCursor |
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| edges | Array.<ModelEdge> | edges |
| pageInfo | PageInfo | pageInfo |
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| _path | string | contentFragment path |
| variation | string | contentFragment variation |
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| [_locale] | string | contentFragment locale |
| [variation] | string | contentFragment variation |
| [filter] | object | list filter options |
| [sort] | string | list sort options |
| [offset] | number | list offset |
| [limit] | number | list limit |
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| [_locale] | string | contentFragment locale |
| [variation] | string | contentFragment variation |
| [filter] | object | list filter options |
| [sort] | string | list sort options |
| [first] | number | number of list items |
| [after] | string | list starting cursor |
ModelArgs : ModelByPathArgs | ModelListArgs | ModelPaginatedArgs
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| * | any | placeholder property |
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| type | string | Query type |
| query | QueryString | Query string |
Kind: global typedef
Properties
| Name | Type | Default | Description |
|---|---|---|---|
| [pageSize] | number | 10 | page size |
| [after] | string | number | starting cursor or offset |
|
| [useLimitOffset] | boolean | false | use offset pagination |