Get, Set and Delete a FromTo

Get and Set values ​​for fromTos within the platform, defining as owner the tenant or subscriber of the context

Get a FromTo

const fromTo = require('linkapi-sdk/core/fromTo');

const query = {
  from: 'example'
};

const options = {
 ownerType: 'SUBSCRIBER', // tenant is default owner,
 findOne: true // get only one value
};

const value = await fromTo.get('parentName', query, options);

Set a FromTo or multiple FromTos
Note: If there is already a "from" with the same value on that parent, the "to" will be updated.

const fromTo = require('linkapi-sdk/core/fromTo');

const options = {
  ownerType: 'SUBSCRIBER', // set the subscriber as owner, default is tenant
  tenant: 'id' // create a from to to an diferent tenant
};

await fromTo.set('parentName', 'from', 'to', options); // set a single fromto
// or

await fromTo.set('parentName',[{ from: 'from1', to : 'to1'}, { from: 'from2', to : 'to2'}], null, options); // set multiples fromtos

Delete a FromTo

const fromTo = require('linkapi-sdk/core/fromTo');

const options = {
  ownerType: 'SUBSCRIBER' // set the subscriber as owner, default is tenant
};

await fromTo.delete('parentName', 'from', options);