UNPKG

@kinde-oss/kinde-nodejs-sdk

Version:

Kinde Nodejs SDK allows integrate with Express server using middleware, helpers function

223 lines (208 loc) 14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /** * Kinde Management API * Provides endpoints to manage your Kinde Businesses * * The version of the OpenAPI document: 1 * Contact: support@kinde.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. * */ /** * The User model module. * @module model/User * @version 1 */ var User = /*#__PURE__*/function () { /** * Constructs a new <code>User</code>. * @alias module:model/User */ function User() { _classCallCheck(this, User); User.initialize(this); } /** * Initializes the fields of this object. * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). * Only for internal use. */ _createClass(User, null, [{ key: "initialize", value: function initialize(obj) {} /** * Constructs a <code>User</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/User} obj Optional instance to populate. * @return {module:model/User} The populated <code>User</code> instance. */ }, { key: "constructFromObject", value: function constructFromObject(data, obj) { if (data) { obj = obj || new User(); if (data.hasOwnProperty('id')) { obj['id'] = _ApiClient["default"].convertToType(data['id'], 'String'); } if (data.hasOwnProperty('provided_id')) { obj['provided_id'] = _ApiClient["default"].convertToType(data['provided_id'], 'String'); } if (data.hasOwnProperty('email')) { obj['email'] = _ApiClient["default"].convertToType(data['email'], 'String'); } if (data.hasOwnProperty('last_name')) { obj['last_name'] = _ApiClient["default"].convertToType(data['last_name'], 'String'); } if (data.hasOwnProperty('first_name')) { obj['first_name'] = _ApiClient["default"].convertToType(data['first_name'], 'String'); } if (data.hasOwnProperty('full_name')) { obj['full_name'] = _ApiClient["default"].convertToType(data['full_name'], 'String'); } if (data.hasOwnProperty('is_suspended')) { obj['is_suspended'] = _ApiClient["default"].convertToType(data['is_suspended'], 'Boolean'); } if (data.hasOwnProperty('picture')) { obj['picture'] = _ApiClient["default"].convertToType(data['picture'], 'String'); } if (data.hasOwnProperty('total_sign_ins')) { obj['total_sign_ins'] = _ApiClient["default"].convertToType(data['total_sign_ins'], 'Number'); } if (data.hasOwnProperty('failed_sign_ins')) { obj['failed_sign_ins'] = _ApiClient["default"].convertToType(data['failed_sign_ins'], 'Number'); } if (data.hasOwnProperty('last_signed_in')) { obj['last_signed_in'] = _ApiClient["default"].convertToType(data['last_signed_in'], 'String'); } if (data.hasOwnProperty('created_on')) { obj['created_on'] = _ApiClient["default"].convertToType(data['created_on'], 'String'); } } return obj; } /** * Validates the JSON data with respect to <code>User</code>. * @param {Object} data The plain JavaScript object bearing properties of interest. * @return {boolean} to indicate whether the JSON data is valid with respect to <code>User</code>. */ }, { key: "validateJSON", value: function validateJSON(data) { // ensure the json data is a string if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); } // ensure the json data is a string if (data['provided_id'] && !(typeof data['provided_id'] === 'string' || data['provided_id'] instanceof String)) { throw new Error("Expected the field `provided_id` to be a primitive type in the JSON string but got " + data['provided_id']); } // ensure the json data is a string if (data['email'] && !(typeof data['email'] === 'string' || data['email'] instanceof String)) { throw new Error("Expected the field `email` to be a primitive type in the JSON string but got " + data['email']); } // ensure the json data is a string if (data['last_name'] && !(typeof data['last_name'] === 'string' || data['last_name'] instanceof String)) { throw new Error("Expected the field `last_name` to be a primitive type in the JSON string but got " + data['last_name']); } // ensure the json data is a string if (data['first_name'] && !(typeof data['first_name'] === 'string' || data['first_name'] instanceof String)) { throw new Error("Expected the field `first_name` to be a primitive type in the JSON string but got " + data['first_name']); } // ensure the json data is a string if (data['full_name'] && !(typeof data['full_name'] === 'string' || data['full_name'] instanceof String)) { throw new Error("Expected the field `full_name` to be a primitive type in the JSON string but got " + data['full_name']); } // ensure the json data is a string if (data['picture'] && !(typeof data['picture'] === 'string' || data['picture'] instanceof String)) { throw new Error("Expected the field `picture` to be a primitive type in the JSON string but got " + data['picture']); } // ensure the json data is a string if (data['last_signed_in'] && !(typeof data['last_signed_in'] === 'string' || data['last_signed_in'] instanceof String)) { throw new Error("Expected the field `last_signed_in` to be a primitive type in the JSON string but got " + data['last_signed_in']); } // ensure the json data is a string if (data['created_on'] && !(typeof data['created_on'] === 'string' || data['created_on'] instanceof String)) { throw new Error("Expected the field `created_on` to be a primitive type in the JSON string but got " + data['created_on']); } return true; } }]); return User; }(); /** * Unique id of the user in Kinde. * @member {String} id */ User.prototype['id'] = undefined; /** * External id for user. * @member {String} provided_id */ User.prototype['provided_id'] = undefined; /** * Default email address of the user in Kinde. * @member {String} email */ User.prototype['email'] = undefined; /** * User's last name. * @member {String} last_name */ User.prototype['last_name'] = undefined; /** * User's first name. * @member {String} first_name */ User.prototype['first_name'] = undefined; /** * User's full name. * @member {String} full_name */ User.prototype['full_name'] = undefined; /** * Whether the user is currently suspended or not. * @member {Boolean} is_suspended */ User.prototype['is_suspended'] = undefined; /** * User's profile picture URL. * @member {String} picture */ User.prototype['picture'] = undefined; /** * Total number of user sign ins. * @member {Number} total_sign_ins */ User.prototype['total_sign_ins'] = undefined; /** * Number of consecutive failed user sign ins. * @member {Number} failed_sign_ins */ User.prototype['failed_sign_ins'] = undefined; /** * Last sign in date in ISO 8601 format. * @member {String} last_signed_in */ User.prototype['last_signed_in'] = undefined; /** * Date of user creation in ISO 8601 format. * @member {String} created_on */ User.prototype['created_on'] = undefined; var _default = User; exports["default"] = _default;