Module: variants

Methods


<inner> create(options)

A function to create a variant of a particular type.
Parameters:
Name Type Description
options object An options object
Properties
Name Type Argument Description
pushAppId string The id of the push application
type string The type variant. - ex: android, ios, .... All Variants will have a type, name, and an optional description
name string The name of the variant
description string <optional>
The description of the variant * For SimplePush ** Nothing else required * For iOS **
ios object <optional>
The specific iOS options
Properties
Name Type Argument Description
passphrase string <optional>
The APNs passphrase that is needed to establish a connection to any of Apple's APNs Push Servers.
certficate string | Buffer | Stream <optional>
the full location of the APNs certificate that is needed to establish a connection to any of Apple's APNs Push Servers.
production boolean <optional>
defaults to false - flag to indicate if a connection to Apples production or sandbox APNS server * For Android **
android object <optional>
The specific Android options
Properties
Name Type Argument Description
googleKey string <optional>
The Google Cloud Messaging Key. Required For Android
projectNumber string <optional>
The Google Project Number * For ADM - Amazon Push **
adm object <optional>
The specific ADM options
Properties
Name Type Argument Description
clientId string <optional>
The client id to connect to the Amazon Device Messaging services
clientSecret string <optional>
The client secret (password) to connect to the Amazon Device Messaging services * For Windows **
windows object <optional>
The specific Windows options
Properties
Name Type Argument Description
protocolType string <optional>
mpns or wns
sid string <optional>
*for wns only* - (Package security identifier) used to connect to the windows push notification services
clientSecret string <optional>
*for wns only* - The client secret (password) to connect to the windows push notification services
Returns:
A promise that will resolve with the Array of variant objects or if a variant is specified, just the variant object
Type
Promise
Example
adminClient(baseUrl, settings)
    .then((client) => {
      client.variants.create(variantOptions)
        .then((variant) => {
        console.log(variant) // {...}
      });
    });

<inner> find(options)

A function to get all the variants of a particular type for a push application or just 1 variant of a type for an application
Parameters:
Name Type Description
options object An options object
Properties
Name Type Argument Description
pushAppId string The id of the push application
type string The type variant. - ex: android, ios, ....
variantId string <optional>
the variantId to get
Returns:
A promise that will resolve with the Array of variant objects or if a variant is specified, just the variant object
Type
Promise
Example
adminClient(baseUrl, settings)
    .then((client) => {
      client.variants.find(variantOptions)
        .then((variants) => {
        console.log(variants) // [{...},{...}, ...]
      });
    });

<inner> remove(options)

A function to remove a variant of a particular type for a push application
Parameters:
Name Type Description
options object An options object
Properties
Name Type Argument Description
pushAppId string The id of the push application
type string The type variant. - ex: android, ios, ....
variantId string the variantId to get * Windows Variant Only**
windows object <optional>
Properties
Name Type Argument Description
protocalType string <optional>
mpns or wns
Returns:
A promise that resolves with No Content.
Type
Promise
Example
adminClient(baseUrl, settings)
    .then((client) => {
      client.variants.remove(variantOptions)
        .then(() => {
        console.log('success')
      });
    });

<inner> reset(options)

A function to reset an existing Variants Secret
Parameters:
Name Type Description
options object An options object
Properties
Name Type Argument Description
pushAppId string The id of the push application
type string The type variant. - ex: android, ios, ....
variantId string the variantId to reset * Windows Variant Only**
windows object <optional>
Properties
Name Type Argument Description
protocalType string <optional>
mpns or wns
Returns:
A promise that resolves with the update variant
Type
Promise
Example
adminClient(baseUrl, settings)
    .then((client) => {
      client.variants.reset(variantOptions)
        .then((variant) => {
          console.log(variant); // {...}
      });
    });

<inner> update(options)

A function to update an existing Variant.
Parameters:
Name Type Description
options object An options object that is the JSON representation of the Variant to Update
Properties
Name Type Argument Description
pushAppId string The id of the push application
variantId string The id of the variant to be updated
type string The type variant. - ex: android, ios, .... All Variants will have a type, name, and an optional description
name string The name of the variant
description string <optional>
The description of the variant * For SimplePush ** Nothing else required * For iOS **
ios object <optional>
The specific iOS options
Properties
Name Type Argument Description
passphrase string <optional>
The APNs passphrase that is needed to establish a connection to any of Apple's APNs Push Servers.
certficate string | Buffer | Stream <optional>
the full location of the APNs certificate that is needed to establish a connection to any of Apple's APNs Push Servers.
production boolean <optional>
defaults to false - flag to indicate if a connection to Apples production or sandbox APNS server * For Android **
android object <optional>
The specific Android options
Properties
Name Type Argument Description
googleKey string <optional>
The Google Cloud Messaging Key. Required For Android
projectNumber string <optional>
The Google Project Number * For ADM - Amazon Push **
adm object <optional>
The specific ADM options
Properties
Name Type Argument Description
clientId string <optional>
The client id to connect to the Amazon Device Messaging services
clientSecret string <optional>
The client secret (password) to connect to the Amazon Device Messaging services * For Windows **
windows object <optional>
The specific Windows options
Properties
Name Type Argument Description
protocolType string <optional>
mpns or wns
sid string <optional>
*for wns only* - (Package security identifier) used to connect to the windows push notification services
clientSecret string <optional>
*for wns only* - The client secret (password) to connect to the windows push notification services
Returns:
A promise that resolves with No Content
Type
Promise
Example
adminClient(baseUrl, settings)
    .then((client) => {
      client.variants.update(variantToUpdate)
        .then(() => {
        console.log('success')
      });
    });