lib/WixClient.js
function APIBuilder() {
    /**
     * Creates a {@link Wix} API object with the give credentials.
     * @method
     * @param {APIBuilder.APICredentials} data JSON data containing credentials for the API
     * @throws an exception if signatures don't match when using the API with the instance param
     * @throws an exception if API credentials are missing
     * @returns {Wix} a Wix API interface object
     */
    this.withCredentials = function(data) {
        if(!data.hasOwnProperty('secretKey')) {
            throwMissingValue('secretKey');
        }
        if(!data.hasOwnProperty('appId')) {
            throwMissingValue('appId')
        }
        if(!data.hasOwnProperty('instanceId') && !data.hasOwnProperty('instance')) {
            throwMissingValue('instanceId or instance')
        }

        var i = null;
        if(data.hasOwnProperty('instanceId')) {
            i = data.instanceId;
        } else {
            i = wixconnect.parseInstance(data.instance, data.secretKey).instanceId;
        }
        return new Wix(data.secretKey, data.appId, i);
    };
}
function APIBuilder() {
    /**
     * Creates a {@link Wix} API object with the give credentials.
     * @method
     * @param {APIBuilder.APICredentials} data JSON data containing credentials for the API
     * @throws an exception if signatures don't match when using the API with the instance param
     * @throws an exception if API credentials are missing
     * @returns {Wix} a Wix API interface object
     */
    this.withCredentials = function(data) {
        if(!data.hasOwnProperty('secretKey')) {
            throwMissingValue('secretKey');
        }
        if(!data.hasOwnProperty('appId')) {
            throwMissingValue('appId')
        }
        if(!data.hasOwnProperty('instanceId') && !data.hasOwnProperty('instance')) {
            throwMissingValue('instanceId or instance')
        }

        var i = null;
        if(data.hasOwnProperty('instanceId')) {
            i = data.instanceId;
        } else {
            i = wixconnect.parseInstance(data.instance, data.secretKey).instanceId;
        }
        return new Wix(data.secretKey, data.appId, i);
    };
}
function APIBuilder ( ) { /**
     * Creates a {@link Wix} API object with the give credentials.
     * @method
     * @param {APIBuilder.APICredentials} data JSON data containing credentials for the API
     * @throws an exception if signatures don't match when using the API with the instance param
     * @throws an exception if API credentials are missing
     * @returns {Wix} a Wix API interface object
     */ this . withCredentials = function ( data ) { if ( ! data . hasOwnProperty ( 'secretKey' ) ) { throwMissingValue ( 'secretKey' ) ; } if ( ! data . hasOwnProperty ( 'appId' ) ) { throwMissingValue ( 'appId' ) } if ( ! data . hasOwnProperty ( 'instanceId' ) && ! data . hasOwnProperty ( 'instance' ) ) { throwMissingValue ( 'instanceId or instance' ) } var i = null ; if ( data . hasOwnProperty ( 'instanceId' ) ) { i = data . instanceId ; } else { i = wixconnect . parseInstance ( data . instance , data . secretKey ) . instanceId ; } return new Wix ( data . secretKey , data . appId , i ) ; } ; }
Credentials to access the Wix API. Must specific either an instance or an instanceId property
@typedef {Object} APIBuilder.APICredentials
@alias APICredentials
@property {!String} secretKey Your applications Secret Key
@property {!string} appId Your applications App Id
@property {?String} instanceId Your applications instanceId
@property {?String} instance The instance passed to your server from Wix
 
Builder used to create new instances of the {@link Wix} object
@class
@alias APIBuilder
@constructor
Credentials to access the Wix API . Must specific either an instance or an instanceId property