@kinde-oss/kinde-nodejs-sdk
Version:
Kinde Nodejs SDK allows integrate with Express server using middleware, helpers function
151 lines (144 loc) • 12.8 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _ApiClient = _interopRequireDefault(require("../ApiClient"));
var _Application = _interopRequireDefault(require("./Application"));
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 _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
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 GetApplicationsResponse model module.
* @module model/GetApplicationsResponse
* @version 1
*/
var GetApplicationsResponse = /*#__PURE__*/function () {
/**
* Constructs a new <code>GetApplicationsResponse</code>.
* @alias module:model/GetApplicationsResponse
*/
function GetApplicationsResponse() {
_classCallCheck(this, GetApplicationsResponse);
GetApplicationsResponse.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(GetApplicationsResponse, null, [{
key: "initialize",
value: function initialize(obj) {}
/**
* Constructs a <code>GetApplicationsResponse</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/GetApplicationsResponse} obj Optional instance to populate.
* @return {module:model/GetApplicationsResponse} The populated <code>GetApplicationsResponse</code> instance.
*/
}, {
key: "constructFromObject",
value: function constructFromObject(data, obj) {
if (data) {
obj = obj || new GetApplicationsResponse();
if (data.hasOwnProperty('code')) {
obj['code'] = _ApiClient["default"].convertToType(data['code'], 'String');
}
if (data.hasOwnProperty('message')) {
obj['message'] = _ApiClient["default"].convertToType(data['message'], 'String');
}
if (data.hasOwnProperty('organizations')) {
obj['organizations'] = _ApiClient["default"].convertToType(data['organizations'], [_Application["default"]]);
}
if (data.hasOwnProperty('next_token')) {
obj['next_token'] = _ApiClient["default"].convertToType(data['next_token'], 'String');
}
}
return obj;
}
/**
* Validates the JSON data with respect to <code>GetApplicationsResponse</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>GetApplicationsResponse</code>.
*/
}, {
key: "validateJSON",
value: function validateJSON(data) {
// ensure the json data is a string
if (data['code'] && !(typeof data['code'] === 'string' || data['code'] instanceof String)) {
throw new Error("Expected the field `code` to be a primitive type in the JSON string but got " + data['code']);
}
// ensure the json data is a string
if (data['message'] && !(typeof data['message'] === 'string' || data['message'] instanceof String)) {
throw new Error("Expected the field `message` to be a primitive type in the JSON string but got " + data['message']);
}
if (data['organizations']) {
// data not null
// ensure the json data is an array
if (!Array.isArray(data['organizations'])) {
throw new Error("Expected the field `organizations` to be an array in the JSON data but got " + data['organizations']);
}
// validate the optional field `organizations` (array)
var _iterator = _createForOfIteratorHelper(data['organizations']),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var item = _step.value;
_Application["default"].validateJsonObject(item);
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
;
}
// ensure the json data is a string
if (data['next_token'] && !(typeof data['next_token'] === 'string' || data['next_token'] instanceof String)) {
throw new Error("Expected the field `next_token` to be a primitive type in the JSON string but got " + data['next_token']);
}
return true;
}
}]);
return GetApplicationsResponse;
}();
/**
* Response code.
* @member {String} code
*/
GetApplicationsResponse.prototype['code'] = undefined;
/**
* Response message.
* @member {String} message
*/
GetApplicationsResponse.prototype['message'] = undefined;
/**
* @member {Array.<module:model/Application>} organizations
*/
GetApplicationsResponse.prototype['organizations'] = undefined;
/**
* Pagination token.
* @member {String} next_token
*/
GetApplicationsResponse.prototype['next_token'] = undefined;
var _default = GetApplicationsResponse;
exports["default"] = _default;