square-connect
Version:
JavaScript client library for the Square Connect v2 API
232 lines (197 loc) • 7.51 kB
JavaScript
/**
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* Swagger Codegen version: 2.3.0-SNAPSHOT
*
*/
var ApiClient = require('../ApiClient');
var Address = require('./Address');
var Card = require('./Card');
var CustomerGroupInfo = require('./CustomerGroupInfo');
var CustomerPreferences = require('./CustomerPreferences');
/**
* The Customer model module.
* @module model/Customer
*/
/**
* Constructs a new <code>Customer</code>.
* Represents a Square customer profile, which can have one or more cards on file associated with it.
* @alias module:model/Customer
* @class
*/
var exports = function() {
var _this = this;
};
/**
* Constructs a <code>Customer</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/Customer} obj Optional instance to populate.
* @return {module:model/Customer} The populated <code>Customer</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();
if (data.hasOwnProperty('id')) {
obj['id'] = ApiClient.convertToType(data['id'], 'String');
}
if (data.hasOwnProperty('created_at')) {
obj['created_at'] = ApiClient.convertToType(data['created_at'], 'String');
}
if (data.hasOwnProperty('updated_at')) {
obj['updated_at'] = ApiClient.convertToType(data['updated_at'], 'String');
}
if (data.hasOwnProperty('cards')) {
obj['cards'] = ApiClient.convertToType(data['cards'], [Card]);
}
if (data.hasOwnProperty('given_name')) {
obj['given_name'] = ApiClient.convertToType(data['given_name'], 'String');
}
if (data.hasOwnProperty('family_name')) {
obj['family_name'] = ApiClient.convertToType(data['family_name'], 'String');
}
if (data.hasOwnProperty('nickname')) {
obj['nickname'] = ApiClient.convertToType(data['nickname'], 'String');
}
if (data.hasOwnProperty('company_name')) {
obj['company_name'] = ApiClient.convertToType(data['company_name'], 'String');
}
if (data.hasOwnProperty('email_address')) {
obj['email_address'] = ApiClient.convertToType(data['email_address'], 'String');
}
if (data.hasOwnProperty('address')) {
obj['address'] = Address.constructFromObject(data['address']);
}
if (data.hasOwnProperty('phone_number')) {
obj['phone_number'] = ApiClient.convertToType(data['phone_number'], 'String');
}
if (data.hasOwnProperty('birthday')) {
obj['birthday'] = ApiClient.convertToType(data['birthday'], 'String');
}
if (data.hasOwnProperty('reference_id')) {
obj['reference_id'] = ApiClient.convertToType(data['reference_id'], 'String');
}
if (data.hasOwnProperty('note')) {
obj['note'] = ApiClient.convertToType(data['note'], 'String');
}
if (data.hasOwnProperty('preferences')) {
obj['preferences'] = CustomerPreferences.constructFromObject(data['preferences']);
}
if (data.hasOwnProperty('groups')) {
obj['groups'] = ApiClient.convertToType(data['groups'], [CustomerGroupInfo]);
}
if (data.hasOwnProperty('creation_source')) {
obj['creation_source'] = ApiClient.convertToType(data['creation_source'], 'String');
}
if (data.hasOwnProperty('group_ids')) {
obj['group_ids'] = ApiClient.convertToType(data['group_ids'], ['String']);
}
if (data.hasOwnProperty('segment_ids')) {
obj['segment_ids'] = ApiClient.convertToType(data['segment_ids'], ['String']);
}
}
return obj;
}
/**
* A unique Square-assigned ID for the customer profile.
* @member {String} id
*/
exports.prototype['id'] = undefined;
/**
* The timestamp when the customer profile was created, in RFC 3339 format.
* @member {String} created_at
*/
exports.prototype['created_at'] = undefined;
/**
* The timestamp when the customer profile was last updated, in RFC 3339 format.
* @member {String} updated_at
*/
exports.prototype['updated_at'] = undefined;
/**
* Payment details of cards stored on file for the customer profile.
* @member {Array.<module:model/Card>} cards
*/
exports.prototype['cards'] = undefined;
/**
* The given (i.e., first) name associated with the customer profile.
* @member {String} given_name
*/
exports.prototype['given_name'] = undefined;
/**
* The family (i.e., last) name associated with the customer profile.
* @member {String} family_name
*/
exports.prototype['family_name'] = undefined;
/**
* A nickname for the customer profile.
* @member {String} nickname
*/
exports.prototype['nickname'] = undefined;
/**
* A business name associated with the customer profile.
* @member {String} company_name
*/
exports.prototype['company_name'] = undefined;
/**
* The email address associated with the customer profile.
* @member {String} email_address
*/
exports.prototype['email_address'] = undefined;
/**
* The physical address associated with the customer profile.
* @member {module:model/Address} address
*/
exports.prototype['address'] = undefined;
/**
* The 11-digit phone number associated with the customer profile.
* @member {String} phone_number
*/
exports.prototype['phone_number'] = undefined;
/**
* The birthday associated with the customer profile, in RFC 3339 format. Year is optional, timezone and times are not allowed. For example: `0000-09-01T00:00:00-00:00` indicates a birthday on September 1st. `1998-09-01T00:00:00-00:00` indications a birthday on September 1st __1998__.
* @member {String} birthday
*/
exports.prototype['birthday'] = undefined;
/**
* An optional, second ID used to associate the customer profile with an entity in another system.
* @member {String} reference_id
*/
exports.prototype['reference_id'] = undefined;
/**
* A custom note associated with the customer profile.
* @member {String} note
*/
exports.prototype['note'] = undefined;
/**
* Represents general customer preferences.
* @member {module:model/CustomerPreferences} preferences
*/
exports.prototype['preferences'] = undefined;
/**
* The customer groups and segments the customer belongs to. This deprecated field has been replaced with the dedicated `group_ids` for customer groups and the dedicated `segment_ids` field for customer segments. You can retrieve information about a given customer group and segment respectively using the Customer Groups API and Customer Segments API.
* @member {Array.<module:model/CustomerGroupInfo>} groups
*/
exports.prototype['groups'] = undefined;
/**
* A creation source represents the method used to create the customer profile. See [CustomerCreationSource](#type-customercreationsource) for possible values
* @member {String} creation_source
*/
exports.prototype['creation_source'] = undefined;
/**
* The IDs of customer groups the customer belongs to.
* @member {Array.<String>} group_ids
*/
exports.prototype['group_ids'] = undefined;
/**
* The IDs of segments the customer belongs to.
* @member {Array.<String>} segment_ids
*/
exports.prototype['segment_ids'] = undefined;
module.exports = exports;