Module: cpb-api/subscription/shopify

Members

(static) CACHE

Properties:
Name Type Description
CACHE CACHE
Source:

Methods

(static) fillCache(name, data, key) → {*}

Updates the CACHE[name][entry[key]] = entry;

Parameters:
Name Type Description
name string

cached entity name

data object | Array.<object>

data to stor by the key

key string

object key to use for lookup (usually shopName)

Source:
Returns:

CACHE[name] - cached entity map

Type
*

(static) fillInstalledStoresCache(data) → {*}

populates cache for installed stores with given data

Parameters:
Name Type Description
data Array.<object>
Source:
Returns:
Type
*

(static) fillUninstalledStoresCache(data) → {*}

populates cache for Uninstalled stores with given data

Parameters:
Name Type Description
data Array.<object>
Source:
Returns:
Type
*

(static) getInstalledStores(shopNameopt, nullable) → {Promise.<(module:cpb-api/subscription/shopify.CACHE.installedStores|Map)>}

Get installed shopify shops information from the datastore

If the shopName is given - retrieves a particular record. Otherwise, returns a full list.

Parameters:
Name Type Attributes Description
shopName string <optional>
<nullable>
Source:
Returns:
Type
Promise.<(module:cpb-api/subscription/shopify.CACHE.installedStores|Map)>

(static) getToken(filterObjectopt, fetch) → {Promise.<object>}

Get Shopify Authentication Token record from the datastore.

Parameters:
Name Type Attributes Default Description
filterObject object <optional>
{}
fetch *
Source:
Returns:

tpken

Type
Promise.<object>
Example
const token = Shopify.getToken({shopName: '02bp2018'}, true);
console.info(token);
 {
    shopName: '02bp2018',
    shopID: null,
    paymentProblem: false,
    datastore_inserted_at: 2021-12-30T07:51:27.128Z,
    uninstalled: false,
    info: '!fetch',
    datastore_updated_at: 2022-01-13T04:34:56.816Z,
    planName: 'default',
    token: '42b71e125874a649225b191f23780d93',
    error: 'GET_SHOP_ID',
    [Symbol(KEY)]: Key {
      namespace: undefined,
      name: '02bp2018',
      kind: 'custom-product-builder-production-tokens',
      path: [Getter]
    }

(static) getTokens(opts, fetch) → {Promise.<Array()>}

get the shops authentication tokens records from the datastore

Parameters:
Name Type Description
opts
fetch
Source:
Returns:
Type
Promise.<Array()>

(static) getUninstalledStores() → {Promise.<Map>}

get uninstalled stores data

Source:
Returns:
Type
Promise.<Map>