EcomApps

EcomApps

new EcomApps()

Source:
Construct a new apps manager instance object.
Example
const ecomApps = new EcomApps()

Methods

(static) edit(applicationId, body, canUpdateInternals) → {Promise.<(null|error)>}

Source:
Edit application body in Store API Store API.
Example
const body = {
  state: 'active',
  data: {
    my_app_data_configs: true
  },
  hidden_data: {
    my_app_hidden_data_config: true
  }
}
ecomApps.edit('5dc2023456cc4e057cfe8e94', body)
  .then(result => console.log(result))
  .catch(e => console.log(e))
Parameters:
Name Type Description
applicationId number Object ID (`_id`) of application in Store API
body object Application body must follow the schema
canUpdateInternals boolean Force update internals attributes
Returns:
Type
Promise.<(null|error)>

(static) find(applicationId) → {Promise.<(data|error)>}

Source:
find application from Store API.
Example
ecomApps.find('5dc2023456cc4e057cfe8e94')
  .then(result => console.log(result))
  .catch(e => console.log(e))
Parameters:
Name Type Description
applicationId number Object ID (`_id`) of application in Store API
Returns:
Type
Promise.<(data|error)>

(static) findOnMarket(appId) → {Promise.<(data|error)>}

Source:
Fetch specific app from [E-Com Plus Market API](https://github.com/ecomclub/market/blob/master/README.md#api-public-resources).
Example
ecomApps.findOnMarket(1236)
  .then(result => console.log(result))
  .catch(e => console.log(e))
Parameters:
Name Type Description
appId number Market application ID (`app_id`)
Returns:
Type
Promise.<(data|error)>

(static) install(appId, canRedirectopt, appBodyopt) → {Promise.<({app, result}|error)>}

Source:
Install Market Apps into E-Com Plus Store REST API.
Example
ecomApps.install(1236, true)
  .then(result => console.log(result))
  .catch(e => console.log(e))
Parameters:
Name Type Attributes Default Description
appId number Market application ID
canRedirect boolean <optional>
false Set to true when you want to automatically redirect user on new window when app returns a `redirect_uri` (usually for OAuth flux)
appBody object <optional>
Market application body
Returns:
Type
Promise.<({app, result}|error)>

(static) list(metaopt) → {Promise.<(data|error)>}

Source:
Fetch merchant's applications list Store API.
Example
ecomApps.list()
  .then(result => console.log(result))
  .catch(e => console.log(e))
Parameters:
Name Type Attributes Description
meta object <optional>
Search options
Properties
Name Type Attributes Default Description
params object <optional>
Search filters, can be `{ _id, app_id, title, slug, category, state, version, type }`
limit number <optional>
30 Set the maximum number of results to return
offset number <optional>
0 Specifies the first entry to return
fields array <optional>
Specifies the object properties to return
sort string <optional>
Specifies rules to order the resultant objects
Returns:
Type
Promise.<(data|error)>

(static) listFromMarket(metaopt) → {Promise.<(apps|error)>}

Source:
Fetch list of apps from [E-Com Plus Market API](https://github.com/ecomclub/market/blob/master/README.md#api-public-resources).
Examples
// Retrieve simple list of apps
ecomApps.listFromMarket()
  .then(result => console.log(result))
  .catch(e => console.log(e))
// Search for specific app
const options = {
  params: {
    title: 'Meu App',
    slug: 'meu-app'
  }
}
ecomApps.listFromMarket(self, options)
  .then(result => console.log(result))
  .catch(e => console.log(e))
// With limit and offset
const options = {
  limit: 10,
  offset: 2
}
ecomApps.listFromMarket(self, options)
  .then(result => console.log(result))
  .catch(e => console.log(e))
// Retrieve list of apps by ids
const options = {
  params: {
    app_id: '1236,1240,1245'
  }
}
ecomApps.listFromMarket(self, options)
  .then(result => console.log(result))
  .catch(e => console.log(e))
Parameters:
Name Type Attributes Description
meta object <optional>
Search options
Properties
Name Type Attributes Description
params object <optional>
Search filters, can be `{ title, slug, category }`
limit number <optional>
Set the maximum number of results to return
offset number <optional>
Specifies the first entry to return
fields array <optional>
Specifies the object properties to return
Returns:
Type
Promise.<(apps|error)>

(static) remove(applicationId) → {Promise.<(data|error)>}

Source:
Delete application from Store API.
Example
ecomApps.remove('5dc2023456cc4e057cfe8e94')
  .then(result => console.log(result))
  .catch(e => console.log(e))
Parameters:
Name Type Description
applicationId number Object ID (`_id`) of application in Store API
Returns:
Type
Promise.<(data|error)>