square-connect
Version:
JavaScript client library for the Square Connect v2 API
124 lines (101 loc) • 8.72 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 CustomerCreationSourceFilter = require('./CustomerCreationSourceFilter');
var CustomerTextFilter = require('./CustomerTextFilter');
var FilterValue = require('./FilterValue');
var TimeRange = require('./TimeRange');
/**
* The CustomerFilter model module.
* @module model/CustomerFilter
*/
/**
* Constructs a new <code>CustomerFilter</code>.
* Represents a set of `CustomerQuery` filters used to limit the set of `Customers` returned by `SearchCustomers`.
* @alias module:model/CustomerFilter
* @class
*/
var exports = function() {
var _this = this;
};
/**
* Constructs a <code>CustomerFilter</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/CustomerFilter} obj Optional instance to populate.
* @return {module:model/CustomerFilter} The populated <code>CustomerFilter</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();
if (data.hasOwnProperty('creation_source')) {
obj['creation_source'] = CustomerCreationSourceFilter.constructFromObject(data['creation_source']);
}
if (data.hasOwnProperty('created_at')) {
obj['created_at'] = TimeRange.constructFromObject(data['created_at']);
}
if (data.hasOwnProperty('updated_at')) {
obj['updated_at'] = TimeRange.constructFromObject(data['updated_at']);
}
if (data.hasOwnProperty('email_address')) {
obj['email_address'] = CustomerTextFilter.constructFromObject(data['email_address']);
}
if (data.hasOwnProperty('phone_number')) {
obj['phone_number'] = CustomerTextFilter.constructFromObject(data['phone_number']);
}
if (data.hasOwnProperty('reference_id')) {
obj['reference_id'] = CustomerTextFilter.constructFromObject(data['reference_id']);
}
if (data.hasOwnProperty('group_ids')) {
obj['group_ids'] = FilterValue.constructFromObject(data['group_ids']);
}
}
return obj;
}
/**
* A filter to select customers based on their creation source.
* @member {module:model/CustomerCreationSourceFilter} creation_source
*/
exports.prototype['creation_source'] = undefined;
/**
* A filter to select customers based on when they were created.
* @member {module:model/TimeRange} created_at
*/
exports.prototype['created_at'] = undefined;
/**
* A filter to select customers based on when they were updated.
* @member {module:model/TimeRange} updated_at
*/
exports.prototype['updated_at'] = undefined;
/**
* A filter to [select customers by email address](https://developer.squareup.com/docs/docs/customers-api/cookbook/search-customers#search-by-email-address) visible to the seller. This filter is case insensitive. For [exact matching](https://developer.squareup.com/docs/docs/customers-api/cookbook/search-customers#exact-search-by-email-address), this filter causes the search to return customer profiles whose `email_address` field value are identical to the email address provided in the query. For [fuzzy matching](https://developer.squareup.com/docs/docs/customers-api/cookbook/search-customers#fuzzy-search-by-email-address), this filter causes the search to return customer profiles whose `email_address` field value has a token-wise partial match against the filtering expression in the query. For example, with `Steven gmail` provided in a search query, the search returns customers whose email address can be `steven.johnson@gmail.com` or `mygmail@stevensbakery.com`. Email addresses are tokenized by replacing, by spaces, punctuations including periods (`.`), underscores (`_`), and the `@` symbols. A match is found if a tokenized email address contains all the tokens in the search query, irrespective of the token order.
* @member {module:model/CustomerTextFilter} email_address
*/
exports.prototype['email_address'] = undefined;
/**
* A filter to [select customers by their phone numbers](https://developer.squareup.com/docs/docs/customers-api/cookbook/search-customers#search-by-phone-number) visible to the seller. This filter is case insensitive. For [exact matching](https://developer.squareup.com/docs/docs/customers-api/cookbook/search-customers#exact-search-by-phone-number), this filter causes the search to return customers whose phone number matches the specified query expression. The number in the query must be of an E.164-compliant form. In particular, it must include the leading `+` sign followed by a contry code and then a subscriber number. The standard E.614 form of a US phone number is `+12061112222` of the domestic version or `+0012061112222` of the international version. The E.164-compliant variations include `+1 (206) 111-2222` or `+001 (206) 111-2222`, respectively. To match the query expression, stored customers' phone numbers are converted to the standard E.164 form of the national and internationalized versions. For [fuzzy matching](https://developer.squareup.com/docs/docs/customers-api/cookbook/search-customers#fuzzy-search-by-phone-number), this filter causes the search to return customers whose phone number matches partially the token or tokens provided in the query expression. For example, if the search query contains `415-123-45`, the filter selects those customers with phone numbers of `415-123-4567` or `234-151-2345`. The search does not return customers with the phone number of `415-123-4678`. Similarly, if the search query contains `415` as part of the phone number, the search returns those customers with phone numbers of `(415)-123-4567`, `(123) 415-1567`, and `1 (415) 123-4567`.
* @member {module:model/CustomerTextFilter} phone_number
*/
exports.prototype['phone_number'] = undefined;
/**
* A filter to [select customers by their reference IDs](https://developer.squareup.com/docs/docs/customers-api/cookbook/search-customers#search-by-reference-id). This filter is case insensitive. [Exact matching](https://developer.squareup.com/docs/docs/customers-api/cookbook/search-customers#exact-search-by-reference-id) of a customer's reference ID against a query's reference ID is evaluated as exact match between two strings, character by character in the given order. [Fuzzy matching](https://developer.squareup.com/docs/docs/customers-api/cookbook/search-customers#fuzzy-search-by-reference-id) of stored reference IDs against queried reference IDs works exactly the same as fuzzy matching on email addresses. Non-alphanumeric characters are replaced by spaces to tokenize stored and queried reference IDs. A match is found if a tokenized stored reference ID contains all tokens specified in any order in the query. For example, a query of `NYC M` will match customer profiles with the `reference_id` value of `NYC_M_35_JOHNSON` and `NYC_27_MURRAY`.
* @member {module:model/CustomerTextFilter} reference_id
*/
exports.prototype['reference_id'] = undefined;
/**
* A filter to select customers based on their group membership. The `group_ids` is a JSON object of the following general format: ``` \"group_ids\": { \"any\": [\"{group_a_id}\", \"{group_b_id}\", ...], \"all\": [\"{group_1_id}\", \"{group_2_id}\", ...], 'none\": [\"{group_i_id}\", \"{group_ii_id}\", ...] } ``` You can use any combination of the above `group_ids` fields (also known as `FilterValue` properties) to specify how customers are selected based on their group membership. With the `any` option, the search returns customers in Groups `A` or `B` or ... of the list. With the `all` option, the search returns customers in Groups `1` and `2` and ... of the list. With the `none` option, the search returns customers not in Groups `i` and not in `ii` and not in ... of the list. If any of the search conditions are not met, including when an invalid or non-existent group ID is provided, the result is an empty list. You can use the `group_ids` search filter with other available filters. You cannot use the `group_ids` filter to select customers based on segment membership.
* @member {module:model/FilterValue} group_ids
*/
exports.prototype['group_ids'] = undefined;
module.exports = exports;