memento@1.0.0
- createEntry(libraryId, body)
- getEntry(libraryId, entryId)
- getFields(libraryId)
- listEntries(libraryId, [options])
- listLibraries()
- updateEntry(libraryId, entryId, body)
This adaptor exports the following namespaced functions:
- http.get(path, options)
- http.post(path, body, options)
- http.put(path, body, options)
- http.request(method, path, body, options)
This adaptor exports the following from common:
- as()
- assert()
- combine()
- cursor()
- dataPath()
- dataValue()
- dateFns
- each()
- field()
- fields()
- fn()
- fnIf()
- group()
- lastReferenceValue()
- map()
- merge()
- scrubEmojis()
- sourceValue()
- util
Functions
createEntry
createEntry(libraryId, body) ⇒ Operation
Create an entry
Param | Type | Description |
---|---|---|
libraryId | string | The library ID |
body | object | The entry body to create |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | The created entry as returned by Memento |
Example: Create an entry
createEntry("HyZV7AYk0", {
fields: [
{
value: "Record 1",
id: 1,
},
{
id: 2,
value: 1000,
},
],
});
getEntry
getEntry(libraryId, entryId) ⇒ Operation
Get an entry
Param | Type | Description |
---|---|---|
libraryId | string | The library ID |
entryId | string | The entry ID |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | an entry object |
Example: Get an entry
getEntry('HyZV7AYk0', 'T0xIYmE-V2QoMmRTWF1sVVJUKnU');
getFields
getFields(libraryId) ⇒ Operation
Get fields for a library
Param | Type | Description |
---|---|---|
libraryId | string | The library ID |
This operation writes the following keys to state:
State Key | Description |
---|---|
data.fields | An array of fields for the library |
Example: Get library fields
getFields('HyZV7AYk0');
listEntries
listEntries(libraryId, [options]) ⇒ Operation
List all entries in a library. This function handles rate limits and automatically paginates to fetch all entries.
Param | Type | Description |
---|---|---|
libraryId | string | The library ID |
[options] | EntriesRequestOptions | List entries request options |
This operation writes the following keys to state:
State Key | Description |
---|---|
data.entries | An array of entry objects for a library |
Example: List all entries in a library
listEntries('HyZV7AYk0');
listLibraries
listLibraries() ⇒ Operation
List all libraries
This operation writes the following keys to state:
State Key | Description |
---|---|
data.libraries | an array of library objects |
Example: List all libraries
listLibraries();
updateEntry
updateEntry(libraryId, entryId, body) ⇒ Operation
Update an entry
Param | Type | Description |
---|---|---|
libraryId | string | The ID of the library to update the entry in |
entryId | string | The ID of the entry to update |
body | object | The entry body to update |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | The updated entry as returned by Memento |
Example: Update an entry
updateEntry('HyZV7AYk0', 'T0xIYmE-V2QoMmRTWF1sVVJUKnU', {
fields: [
{
value: "Record Updated",
id: 1,
},
{
id: 2,
value: 100,
},
],
});
http
These functions belong to the http namespace.
http.get
get(path, options) ⇒ Operation
Make a GET request
Param | Type | Description |
---|---|---|
path | string | Path to resource |
options | RequestOptions | Optional request options |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the HTTP server, including headers, statusCode, body, etc |
references | an array of all previous data objects used in the Job |
Example: List all libraries
get("libraries");
Example: Get a single library fields
get('libraries/HyZV7AYk0');
http.post
post(path, body, options) ⇒ Operation
Make a POST request
Param | Type | Description |
---|---|---|
path | string | Path to resource |
body | object | Object which will be attached to the POST body |
options | RequestOptions | Optional request options |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the HTTP server, including headers, statusCode, body, etc |
references | an array of all previous data objects used in the Job |
Example: Create an entry
post("libraries/HyZV7AYk0/entries", { "name": "Bukayo" });
http.put
put(path, body, options) ⇒ Operation
Make a PUT request
Param | Type | Description |
---|---|---|
path | string | Path to resource |
body | object | Object which will be attached to the PUT body |
options | RequestOptions | Optional request options |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the HTTP server, including headers, statusCode, body, etc |
references | an array of all previous data objects used in the Job |
Example: Update an entry
put("libraries/HyZV7AYk0/entries/T0xIYmE-V2QoMmRTWF1sVVJUKnU", { "name": "Bukayo" });
http.request
request(method, path, body, options) ⇒ Operation
Make a general HTTP request
Param | Type | Description |
---|---|---|
method | string | HTTP method to use |
path | string | Path to resource |
body | object | Object which will be attached to the POST body |
options | RequestOptions | Optional request options |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the HTTP server, including headers, statusCode, body, etc |
references | an array of all previous data objects used in the Job |
Example: Edit an entry
request("PUT", "libraries/HyZV7AYk0/entries/T0xIYmE-V2QoMmRTWF1sVVJUKnU", { "name": "Bukayo" });
Example: Delete an entry
request("DELETE", "libraries/HyZV7AYk0/entries/T0xIYmE-V2QoMmRTWF1sVVJUKnU");
Interfaces
EntriesRequestOptions
Fetch Entries Request Options
Properties
Name | Type | Default | Description |
---|---|---|---|
[options.pageSize] | number | 100 | The maximum number of entries to return per page. |
[options.pageToken] | string | Start pagination from this token/cursor. | |
[options.startRevision] | string | The revision to start from. | |
[options.fields] | string | "'all'" | The comma-separated list of fields ids to include in the response |
HttpState
State object
Properties
Name | Description |
---|---|
data | the parsed response body |
response | the response from the HTTP server, including headers, statusCode, body, etc |
references | an array of all previous data objects used in the Job |
RequestOptions
Options provided to the HTTP request
Properties
Name | Type | Description |
---|---|---|
body | object | string | body data to append to the request. JSON will be converted to a string (but a content-type header will not be attached to the request). |
query | object | An object of query parameters to be encoded into the URL. |
headers | object | An object of headers to append to the request. |
parseAs | string | Parse the response body as json, text or stream. By default will use the response headers. |