Skip to main content

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

ParamTypeDescription
libraryIdstringThe library ID
bodyobjectThe entry body to create

This operation writes the following keys to state:

State KeyDescription
dataThe 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

ParamTypeDescription
libraryIdstringThe library ID
entryIdstringThe entry ID

This operation writes the following keys to state:

State KeyDescription
dataan entry object

Example: Get an entry

getEntry('HyZV7AYk0', 'T0xIYmE-V2QoMmRTWF1sVVJUKnU');

getFields

getFields(libraryId) ⇒ Operation

Get fields for a library

ParamTypeDescription
libraryIdstringThe library ID

This operation writes the following keys to state:

State KeyDescription
data.fieldsAn 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.

ParamTypeDescription
libraryIdstringThe library ID
[options]EntriesRequestOptionsList entries request options

This operation writes the following keys to state:

State KeyDescription
data.entriesAn 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 KeyDescription
data.librariesan array of library objects

Example: List all libraries

listLibraries();

updateEntry

updateEntry(libraryId, entryId, body) ⇒ Operation

Update an entry

ParamTypeDescription
libraryIdstringThe ID of the library to update the entry in
entryIdstringThe ID of the entry to update
bodyobjectThe entry body to update

This operation writes the following keys to state:

State KeyDescription
dataThe 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

ParamTypeDescription
pathstringPath to resource
optionsRequestOptionsOptional request options

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the HTTP server, including headers, statusCode, body, etc
referencesan 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

ParamTypeDescription
pathstringPath to resource
bodyobjectObject which will be attached to the POST body
optionsRequestOptionsOptional request options

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the HTTP server, including headers, statusCode, body, etc
referencesan 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

ParamTypeDescription
pathstringPath to resource
bodyobjectObject which will be attached to the PUT body
optionsRequestOptionsOptional request options

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the HTTP server, including headers, statusCode, body, etc
referencesan 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

ParamTypeDescription
methodstringHTTP method to use
pathstringPath to resource
bodyobjectObject which will be attached to the POST body
optionsRequestOptionsOptional request options

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the HTTP server, including headers, statusCode, body, etc
referencesan 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

NameTypeDefaultDescription
[options.pageSize]number100The maximum number of entries to return per page.
[options.pageToken]stringStart pagination from this token/cursor.
[options.startRevision]stringThe revision to start from.
[options.fields]string"'all'"The comma-separated list of fields ids to include in the response

HttpState

State object

Properties

NameDescription
datathe parsed response body
responsethe response from the HTTP server, including headers, statusCode, body, etc
referencesan array of all previous data objects used in the Job

RequestOptions

Options provided to the HTTP request

Properties

NameTypeDescription
bodyobject | stringbody 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).
queryobjectAn object of query parameters to be encoded into the URL.
headersobjectAn object of headers to append to the request.
parseAsstringParse the response body as json, text or stream. By default will use the response headers.