square-connect
Version:
JavaScript client library for the Square Connect v2 API
95 lines (77 loc) • 2.77 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');
/**
* The Error model module.
* @module model/Error
*/
/**
* Constructs a new <code>Error</code>.
* Represents an error encountered during a request to the Connect API. See [Handling errors](#handlingerrors) for more information.
* @alias module:model/Error
* @class
* @param category {String} The high-level category for the error. See [ErrorCategory](#type-errorcategory) for possible values
* @param code {String} The specific code of the error. See [ErrorCode](#type-errorcode) for possible values
*/
var exports = function(category, code) {
var _this = this;
_this['category'] = category;
_this['code'] = code;
};
/**
* Constructs a <code>Error</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/Error} obj Optional instance to populate.
* @return {module:model/Error} The populated <code>Error</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();
if (data.hasOwnProperty('category')) {
obj['category'] = ApiClient.convertToType(data['category'], 'String');
}
if (data.hasOwnProperty('code')) {
obj['code'] = ApiClient.convertToType(data['code'], 'String');
}
if (data.hasOwnProperty('detail')) {
obj['detail'] = ApiClient.convertToType(data['detail'], 'String');
}
if (data.hasOwnProperty('field')) {
obj['field'] = ApiClient.convertToType(data['field'], 'String');
}
}
return obj;
}
/**
* The high-level category for the error. See [ErrorCategory](#type-errorcategory) for possible values
* @member {String} category
*/
exports.prototype['category'] = undefined;
/**
* The specific code of the error. See [ErrorCode](#type-errorcode) for possible values
* @member {String} code
*/
exports.prototype['code'] = undefined;
/**
* A human-readable description of the error for debugging purposes.
* @member {String} detail
*/
exports.prototype['detail'] = undefined;
/**
* The name of the field provided in the original request (if any) that the error pertains to.
* @member {String} field
*/
exports.prototype['field'] = undefined;
module.exports = exports;