@kinde-oss/kinde-nodejs-sdk
Version:
Kinde Nodejs SDK allows integrate with Express server using middleware, helpers function
158 lines (151 loc) • 12.5 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _ApiClient = _interopRequireDefault(require("../ApiClient"));
var _CreatePermissionRequest = _interopRequireDefault(require("../model/CreatePermissionRequest"));
var _ErrorResponse = _interopRequireDefault(require("../model/ErrorResponse"));
var _SuccessResponse = _interopRequireDefault(require("../model/SuccessResponse"));
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.
*
*/
/**
* Permissions service.
* @module api/PermissionsApi
* @version 1
*/
var PermissionsApi = /*#__PURE__*/function () {
/**
* Constructs a new PermissionsApi.
* @alias module:api/PermissionsApi
* @class
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
function PermissionsApi(apiClient) {
_classCallCheck(this, PermissionsApi);
this.apiClient = apiClient || _ApiClient["default"].instance;
}
/**
* Callback function to receive the result of the createPermission operation.
* @callback module:api/PermissionsApi~createPermissionCallback
* @param {String} error Error message, if any.
* @param {module:model/SuccessResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Create a new permission
* Create permission.
* @param {Object} opts Optional parameters
* @param {module:model/CreatePermissionRequest} opts.createPermissionRequest Permission details.
* @param {module:api/PermissionsApi~createPermissionCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/SuccessResponse}
*/
_createClass(PermissionsApi, [{
key: "createPermission",
value: function createPermission(opts, callback) {
opts = opts || {};
var postBody = opts['createPermissionRequest'];
var pathParams = {};
var queryParams = {};
var headerParams = {};
var formParams = {};
var authNames = ['kindeBearerAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json; charset=utf-8'];
var returnType = _SuccessResponse["default"];
return this.apiClient.callApi('/api/v1/permissions', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
}
/**
* Callback function to receive the result of the getPermissions operation.
* @callback module:api/PermissionsApi~getPermissionsCallback
* @param {String} error Error message, if any.
* @param {module:model/SuccessResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* List Permissions
* The returned list can be sorted by permission name or permission ID in ascending or descending order. The number of records to return at a time can also be controlled using the `page_size` query string parameter.
* @param {Object} opts Optional parameters
* @param {module:model/String} opts.sort Field and order to sort the result by.
* @param {Number} opts.pageSize Number of results per page. Defaults to 10 if parameter not sent.
* @param {String} opts.nextToken A string to get the next page of results if there are more results.
* @param {module:api/PermissionsApi~getPermissionsCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/SuccessResponse}
*/
}, {
key: "getPermissions",
value: function getPermissions(opts, callback) {
opts = opts || {};
var postBody = null;
var pathParams = {};
var queryParams = {
'sort': opts['sort'],
'page_size': opts['pageSize'],
'next_token': opts['nextToken']
};
var headerParams = {};
var formParams = {};
var authNames = ['kindeBearerAuth'];
var contentTypes = [];
var accepts = ['application/json; charset=utf-8'];
var returnType = _SuccessResponse["default"];
return this.apiClient.callApi('/api/v1/permissions', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
}
/**
* Callback function to receive the result of the updatePermissions operation.
* @callback module:api/PermissionsApi~updatePermissionsCallback
* @param {String} error Error message, if any.
* @param {module:model/SuccessResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Update a permission
* Update permission
* @param {Number} permissionId The identifier for the permission.
* @param {Object} opts Optional parameters
* @param {module:model/CreatePermissionRequest} opts.createPermissionRequest Permission details.
* @param {module:api/PermissionsApi~updatePermissionsCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/SuccessResponse}
*/
}, {
key: "updatePermissions",
value: function updatePermissions(permissionId, opts, callback) {
opts = opts || {};
var postBody = opts['createPermissionRequest'];
// verify the required parameter 'permissionId' is set
if (permissionId === undefined || permissionId === null) {
throw new Error("Missing the required parameter 'permissionId' when calling updatePermissions");
}
var pathParams = {
'permission_id': permissionId
};
var queryParams = {};
var headerParams = {};
var formParams = {};
var authNames = ['kindeBearerAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json; charset=utf-8'];
var returnType = _SuccessResponse["default"];
return this.apiClient.callApi('/api/v1/permissions/{permission_id}', 'PATCH', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
}
}]);
return PermissionsApi;
}();
exports["default"] = PermissionsApi;