@kinde-oss/kinde-nodejs-sdk
Version:
Kinde Nodejs SDK allows integrate with Express server using middleware, helpers function
223 lines (216 loc) • 16 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _ApiClient = _interopRequireDefault(require("../ApiClient"));
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.
*
*/
/**
* FeatureFlags service.
* @module api/FeatureFlagsApi
* @version 1
*/
var FeatureFlagsApi = /*#__PURE__*/function () {
/**
* Constructs a new FeatureFlagsApi.
* @alias module:api/FeatureFlagsApi
* @class
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
function FeatureFlagsApi(apiClient) {
_classCallCheck(this, FeatureFlagsApi);
this.apiClient = apiClient || _ApiClient["default"].instance;
}
/**
* Callback function to receive the result of the createFeatureFlag operation.
* @callback module:api/FeatureFlagsApi~createFeatureFlagCallback
* @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 feature flag
* Create feature flag.
* @param {String} name The name of the flag.
* @param {String} description Description of the flag purpose.
* @param {String} key The flag identifier to use in code.
* @param {module:model/String} type The variable type.
* @param {module:model/String} allowOverrideLevel Allow the flag to be overridden at a different level.
* @param {String} defaultValue Default value for the flag used by environments and organizations.
* @param {module:api/FeatureFlagsApi~createFeatureFlagCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/SuccessResponse}
*/
_createClass(FeatureFlagsApi, [{
key: "createFeatureFlag",
value: function createFeatureFlag(name, description, key, type, allowOverrideLevel, defaultValue, callback) {
var postBody = null;
// verify the required parameter 'name' is set
if (name === undefined || name === null) {
throw new Error("Missing the required parameter 'name' when calling createFeatureFlag");
}
// verify the required parameter 'description' is set
if (description === undefined || description === null) {
throw new Error("Missing the required parameter 'description' when calling createFeatureFlag");
}
// verify the required parameter 'key' is set
if (key === undefined || key === null) {
throw new Error("Missing the required parameter 'key' when calling createFeatureFlag");
}
// verify the required parameter 'type' is set
if (type === undefined || type === null) {
throw new Error("Missing the required parameter 'type' when calling createFeatureFlag");
}
// verify the required parameter 'allowOverrideLevel' is set
if (allowOverrideLevel === undefined || allowOverrideLevel === null) {
throw new Error("Missing the required parameter 'allowOverrideLevel' when calling createFeatureFlag");
}
// verify the required parameter 'defaultValue' is set
if (defaultValue === undefined || defaultValue === null) {
throw new Error("Missing the required parameter 'defaultValue' when calling createFeatureFlag");
}
var pathParams = {};
var queryParams = {
'name': name,
'description': description,
'key': key,
'type': type,
'allow_override_level': allowOverrideLevel,
'default_value': defaultValue
};
var headerParams = {};
var formParams = {};
var authNames = ['kindeBearerAuth'];
var contentTypes = [];
var accepts = ['application/json', 'application/json; charset=utf-8'];
var returnType = _SuccessResponse["default"];
return this.apiClient.callApi('/api/v1/feature_flags', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
}
/**
* Callback function to receive the result of the deleteFeatureFlag operation.
* @callback module:api/FeatureFlagsApi~deleteFeatureFlagCallback
* @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.
*/
/**
* Delete a feature flag
* Delete feature flag
* @param {String} featureFlagKey The identifier for the feature flag.
* @param {module:api/FeatureFlagsApi~deleteFeatureFlagCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/SuccessResponse}
*/
}, {
key: "deleteFeatureFlag",
value: function deleteFeatureFlag(featureFlagKey, callback) {
var postBody = null;
// verify the required parameter 'featureFlagKey' is set
if (featureFlagKey === undefined || featureFlagKey === null) {
throw new Error("Missing the required parameter 'featureFlagKey' when calling deleteFeatureFlag");
}
var pathParams = {
'feature_flag_key': featureFlagKey
};
var queryParams = {};
var headerParams = {};
var formParams = {};
var authNames = ['kindeBearerAuth'];
var contentTypes = [];
var accepts = ['application/json', 'application/json; charset=utf-8'];
var returnType = _SuccessResponse["default"];
return this.apiClient.callApi('/api/v1/feature_flags/{feature_flag_key}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
}
/**
* Callback function to receive the result of the updateFeatureFlag operation.
* @callback module:api/FeatureFlagsApi~updateFeatureFlagCallback
* @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 feature flag
* Update feature flag.
* @param {String} featureFlagKey The identifier for the feature flag.
* @param {String} name The name of the flag.
* @param {String} description Description of the flag purpose.
* @param {String} key The flag identifier to use in code.
* @param {module:model/String} type The variable type
* @param {module:model/String} allowOverrideLevel Allow the flag to be overridden at a different level.
* @param {String} defaultValue Default value for the flag used by environments and organizations.
* @param {module:api/FeatureFlagsApi~updateFeatureFlagCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/SuccessResponse}
*/
}, {
key: "updateFeatureFlag",
value: function updateFeatureFlag(featureFlagKey, name, description, key, type, allowOverrideLevel, defaultValue, callback) {
var postBody = null;
// verify the required parameter 'featureFlagKey' is set
if (featureFlagKey === undefined || featureFlagKey === null) {
throw new Error("Missing the required parameter 'featureFlagKey' when calling updateFeatureFlag");
}
// verify the required parameter 'name' is set
if (name === undefined || name === null) {
throw new Error("Missing the required parameter 'name' when calling updateFeatureFlag");
}
// verify the required parameter 'description' is set
if (description === undefined || description === null) {
throw new Error("Missing the required parameter 'description' when calling updateFeatureFlag");
}
// verify the required parameter 'key' is set
if (key === undefined || key === null) {
throw new Error("Missing the required parameter 'key' when calling updateFeatureFlag");
}
// verify the required parameter 'type' is set
if (type === undefined || type === null) {
throw new Error("Missing the required parameter 'type' when calling updateFeatureFlag");
}
// verify the required parameter 'allowOverrideLevel' is set
if (allowOverrideLevel === undefined || allowOverrideLevel === null) {
throw new Error("Missing the required parameter 'allowOverrideLevel' when calling updateFeatureFlag");
}
// verify the required parameter 'defaultValue' is set
if (defaultValue === undefined || defaultValue === null) {
throw new Error("Missing the required parameter 'defaultValue' when calling updateFeatureFlag");
}
var pathParams = {
'feature_flag_key': featureFlagKey
};
var queryParams = {
'name': name,
'description': description,
'key': key,
'type': type,
'allow_override_level': allowOverrideLevel,
'default_value': defaultValue
};
var headerParams = {};
var formParams = {};
var authNames = ['kindeBearerAuth'];
var contentTypes = [];
var accepts = ['application/json', 'application/json; charset=utf-8'];
var returnType = _SuccessResponse["default"];
return this.apiClient.callApi('/api/v1/feature_flags/{feature_flag_key}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
}
}]);
return FeatureFlagsApi;
}();
exports["default"] = FeatureFlagsApi;