UNPKG

@kinde-oss/kinde-nodejs-sdk

Version:

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

168 lines (161 loc) 12.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); var _ErrorResponse = _interopRequireDefault(require("../model/ErrorResponse")); var _RedirectCallbackUrls = _interopRequireDefault(require("../model/RedirectCallbackUrls")); 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. * */ /** * Callbacks service. * @module api/CallbacksApi * @version 1 */ var CallbacksApi = /*#__PURE__*/function () { /** * Constructs a new CallbacksApi. * @alias module:api/CallbacksApi * @class * @param {module:ApiClient} [apiClient] Optional API client implementation to use, * default to {@link module:ApiClient#instance} if unspecified. */ function CallbacksApi(apiClient) { _classCallCheck(this, CallbacksApi); this.apiClient = apiClient || _ApiClient["default"].instance; } /** * Callback function to receive the result of the addRedirectCallbackURLs operation. * @callback module:api/CallbacksApi~addRedirectCallbackURLsCallback * @param {String} error Error message, if any. * @param data This operation does not return a value. * @param {String} response The complete HTTP response. */ /** * Add Redirect Callback URLs * Add additional redirect callback URLs. * @param {String} appId The identifier for the application. * @param {Array.<String>} urls Array of callback urls. * @param {module:api/CallbacksApi~addRedirectCallbackURLsCallback} callback The callback function, accepting three arguments: error, data, response */ _createClass(CallbacksApi, [{ key: "addRedirectCallbackURLs", value: function addRedirectCallbackURLs(appId, urls, callback) { var postBody = null; // verify the required parameter 'appId' is set if (appId === undefined || appId === null) { throw new Error("Missing the required parameter 'appId' when calling addRedirectCallbackURLs"); } // verify the required parameter 'urls' is set if (urls === undefined || urls === null) { throw new Error("Missing the required parameter 'urls' when calling addRedirectCallbackURLs"); } var pathParams = { 'app_id': appId }; var queryParams = { 'urls': this.apiClient.buildCollectionParam(urls, 'multi') }; var headerParams = {}; var formParams = {}; var authNames = ['kindeBearerAuth']; var contentTypes = []; var accepts = []; var returnType = null; return this.apiClient.callApi('/api/v1/applications/{app_id}/auth_redirect_urls', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the getCallbackURLs operation. * @callback module:api/CallbacksApi~getCallbackURLsCallback * @param {String} error Error message, if any. * @param {module:model/RedirectCallbackUrls} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * List Callback URLs * Returns an application's redirect callback URLs. * @param {String} appId The identifier for the application. * @param {module:api/CallbacksApi~getCallbackURLsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/RedirectCallbackUrls} */ }, { key: "getCallbackURLs", value: function getCallbackURLs(appId, callback) { var postBody = null; // verify the required parameter 'appId' is set if (appId === undefined || appId === null) { throw new Error("Missing the required parameter 'appId' when calling getCallbackURLs"); } var pathParams = { 'app_id': appId }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = ['kindeBearerAuth']; var contentTypes = []; var accepts = ['application/json; charset=utf-8']; var returnType = _RedirectCallbackUrls["default"]; return this.apiClient.callApi('/api/v1/applications/{app_id}/auth_redirect_urls', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the replaceRedirectCallbackURLs operation. * @callback module:api/CallbacksApi~replaceRedirectCallbackURLsCallback * @param {String} error Error message, if any. * @param data This operation does not return a value. * @param {String} response The complete HTTP response. */ /** * Replace redirect callback URLs * Replace all redirect callback URLs. * @param {String} appId The identifier for the application. * @param {Array.<String>} urls Array of callback urls. * @param {module:api/CallbacksApi~replaceRedirectCallbackURLsCallback} callback The callback function, accepting three arguments: error, data, response */ }, { key: "replaceRedirectCallbackURLs", value: function replaceRedirectCallbackURLs(appId, urls, callback) { var postBody = null; // verify the required parameter 'appId' is set if (appId === undefined || appId === null) { throw new Error("Missing the required parameter 'appId' when calling replaceRedirectCallbackURLs"); } // verify the required parameter 'urls' is set if (urls === undefined || urls === null) { throw new Error("Missing the required parameter 'urls' when calling replaceRedirectCallbackURLs"); } var pathParams = { 'app_id': appId }; var queryParams = { 'urls': this.apiClient.buildCollectionParam(urls, 'multi') }; var headerParams = {}; var formParams = {}; var authNames = ['kindeBearerAuth']; var contentTypes = []; var accepts = []; var returnType = null; return this.apiClient.callApi('/api/v1/applications/{app_id}/auth_redirect_urls', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } }]); return CallbacksApi; }(); exports["default"] = CallbacksApi;