UNPKG

@fulltag/kinde-mgmt-sdk

Version:

Automatically generated SDK for the Kinde Mgmt API

1,659 lines (1,617 loc) 356 kB
// src/runtime.ts var BASE_PATH = "https://app.kinde.com".replace(/\/+$/, ""); var Configuration = class { constructor(configuration = {}) { this.configuration = configuration; } set config(configuration) { this.configuration = configuration; } get basePath() { return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH; } get fetchApi() { return this.configuration.fetchApi; } get middleware() { return this.configuration.middleware || []; } get queryParamsStringify() { return this.configuration.queryParamsStringify || querystring; } get username() { return this.configuration.username; } get password() { return this.configuration.password; } get apiKey() { const apiKey = this.configuration.apiKey; if (apiKey) { return typeof apiKey === "function" ? apiKey : () => apiKey; } return void 0; } get accessToken() { const accessToken = this.configuration.accessToken; if (accessToken) { return typeof accessToken === "function" ? accessToken : async () => accessToken; } return void 0; } get headers() { return this.configuration.headers; } get credentials() { return this.configuration.credentials; } }; var DefaultConfig = new Configuration(); var BaseAPI = class _BaseAPI { constructor(configuration = DefaultConfig) { this.configuration = configuration; this.middleware = configuration.middleware; } static jsonRegex = new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$", "i"); middleware; withMiddleware(...middlewares) { const next = this.clone(); next.middleware = next.middleware.concat(...middlewares); return next; } withPreMiddleware(...preMiddlewares) { const middlewares = preMiddlewares.map((pre) => ({ pre })); return this.withMiddleware(...middlewares); } withPostMiddleware(...postMiddlewares) { const middlewares = postMiddlewares.map((post) => ({ post })); return this.withMiddleware(...middlewares); } /** * Check if the given MIME is a JSON MIME. * JSON MIME examples: * application/json * application/json; charset=UTF8 * APPLICATION/JSON * application/vnd.company+json * @param mime - MIME (Multipurpose Internet Mail Extensions) * @return True if the given MIME is JSON, false otherwise. */ isJsonMime(mime) { if (!mime) { return false; } return _BaseAPI.jsonRegex.test(mime); } async request(context, initOverrides) { const { url, init } = await this.createFetchParams(context, initOverrides); const response = await this.fetchApi(url, init); if (response && (response.status >= 200 && response.status < 300)) { return response; } throw new ResponseError(response, "Response returned an error code"); } async createFetchParams(context, initOverrides) { let url = this.configuration.basePath + context.path; if (context.query !== void 0 && Object.keys(context.query).length !== 0) { url += "?" + this.configuration.queryParamsStringify(context.query); } const headers = Object.assign({}, this.configuration.headers, context.headers); Object.keys(headers).forEach((key) => headers[key] === void 0 ? delete headers[key] : {}); const initOverrideFn = typeof initOverrides === "function" ? initOverrides : async () => initOverrides; const initParams = { method: context.method, headers, body: context.body, credentials: this.configuration.credentials }; const overriddenInit = { ...initParams, ...await initOverrideFn({ init: initParams, context }) }; let body; if (isFormData(overriddenInit.body) || overriddenInit.body instanceof URLSearchParams || isBlob(overriddenInit.body)) { body = overriddenInit.body; } else if (this.isJsonMime(headers["Content-Type"])) { body = JSON.stringify(overriddenInit.body); } else { body = overriddenInit.body; } const init = { ...overriddenInit, body }; return { url, init }; } fetchApi = async (url, init) => { let fetchParams = { url, init }; for (const middleware of this.middleware) { if (middleware.pre) { fetchParams = await middleware.pre({ fetch: this.fetchApi, ...fetchParams }) || fetchParams; } } let response = void 0; try { response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init); } catch (e) { for (const middleware of this.middleware) { if (middleware.onError) { response = await middleware.onError({ fetch: this.fetchApi, url: fetchParams.url, init: fetchParams.init, error: e, response: response ? response.clone() : void 0 }) || response; } } if (response === void 0) { if (e instanceof Error) { throw new FetchError(e, "The request failed and the interceptors did not return an alternative response"); } else { throw e; } } } for (const middleware of this.middleware) { if (middleware.post) { response = await middleware.post({ fetch: this.fetchApi, url: fetchParams.url, init: fetchParams.init, response: response.clone() }) || response; } } return response; }; /** * Create a shallow clone of `this` by constructing a new instance * and then shallow cloning data members. */ clone() { const constructor = this.constructor; const next = new constructor(this.configuration); next.middleware = this.middleware.slice(); return next; } }; function isBlob(value) { return typeof Blob !== "undefined" && value instanceof Blob; } function isFormData(value) { return typeof FormData !== "undefined" && value instanceof FormData; } var ResponseError = class extends Error { constructor(response, msg) { super(msg); this.response = response; } name = "ResponseError"; }; var FetchError = class extends Error { constructor(cause, msg) { super(msg); this.cause = cause; } name = "FetchError"; }; var RequiredError = class extends Error { constructor(field, msg) { super(msg); this.field = field; } name = "RequiredError"; }; var COLLECTION_FORMATS = { csv: ",", ssv: " ", tsv: " ", pipes: "|" }; function querystring(params, prefix = "") { return Object.keys(params).map((key) => querystringSingleKey(key, params[key], prefix)).filter((part) => part.length > 0).join("&"); } function querystringSingleKey(key, value, keyPrefix = "") { const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); if (value instanceof Array) { const multiValue = value.map((singleValue) => encodeURIComponent(String(singleValue))).join(`&${encodeURIComponent(fullKey)}=`); return `${encodeURIComponent(fullKey)}=${multiValue}`; } if (value instanceof Set) { const valueAsArray = Array.from(value); return querystringSingleKey(key, valueAsArray, keyPrefix); } if (value instanceof Date) { return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`; } if (value instanceof Object) { return querystring(value, fullKey); } return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`; } function mapValues(data, fn) { return Object.keys(data).reduce( (acc, key) => ({ ...acc, [key]: fn(data[key]) }), {} ); } function canConsumeForm(consumes) { for (const consume of consumes) { if ("multipart/form-data" === consume.contentType) { return true; } } return false; } var JSONApiResponse = class { constructor(raw, transformer = (jsonValue) => jsonValue) { this.raw = raw; this.transformer = transformer; } async value() { return this.transformer(await this.raw.json()); } }; var VoidApiResponse = class { constructor(raw) { this.raw = raw; } async value() { return void 0; } }; var BlobApiResponse = class { constructor(raw) { this.raw = raw; } async value() { return await this.raw.blob(); } }; var TextApiResponse = class { constructor(raw) { this.raw = raw; } async value() { return await this.raw.text(); } }; // src/models/AddAPIsRequest.ts function instanceOfAddAPIsRequest(value) { if (!("name" in value) || value["name"] === void 0) return false; if (!("audience" in value) || value["audience"] === void 0) return false; return true; } function AddAPIsRequestFromJSON(json) { return AddAPIsRequestFromJSONTyped(json, false); } function AddAPIsRequestFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "name": json["name"], "audience": json["audience"] }; } function AddAPIsRequestToJSON(json) { return AddAPIsRequestToJSONTyped(json, false); } function AddAPIsRequestToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "name": value["name"], "audience": value["audience"] }; } // src/models/AddOrganizationUsersRequestUsersInner.ts function instanceOfAddOrganizationUsersRequestUsersInner(value) { return true; } function AddOrganizationUsersRequestUsersInnerFromJSON(json) { return AddOrganizationUsersRequestUsersInnerFromJSONTyped(json, false); } function AddOrganizationUsersRequestUsersInnerFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "id": json["id"] == null ? void 0 : json["id"], "roles": json["roles"] == null ? void 0 : json["roles"], "permissions": json["permissions"] == null ? void 0 : json["permissions"] }; } function AddOrganizationUsersRequestUsersInnerToJSON(json) { return AddOrganizationUsersRequestUsersInnerToJSONTyped(json, false); } function AddOrganizationUsersRequestUsersInnerToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "id": value["id"], "roles": value["roles"], "permissions": value["permissions"] }; } // src/models/AddOrganizationUsersRequest.ts function instanceOfAddOrganizationUsersRequest(value) { return true; } function AddOrganizationUsersRequestFromJSON(json) { return AddOrganizationUsersRequestFromJSONTyped(json, false); } function AddOrganizationUsersRequestFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "users": json["users"] == null ? void 0 : json["users"].map(AddOrganizationUsersRequestUsersInnerFromJSON) }; } function AddOrganizationUsersRequestToJSON(json) { return AddOrganizationUsersRequestToJSONTyped(json, false); } function AddOrganizationUsersRequestToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "users": value["users"] == null ? void 0 : value["users"].map(AddOrganizationUsersRequestUsersInnerToJSON) }; } // src/models/AddOrganizationUsersResponse.ts function instanceOfAddOrganizationUsersResponse(value) { return true; } function AddOrganizationUsersResponseFromJSON(json) { return AddOrganizationUsersResponseFromJSONTyped(json, false); } function AddOrganizationUsersResponseFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "code": json["code"] == null ? void 0 : json["code"], "message": json["message"] == null ? void 0 : json["message"], "usersAdded": json["users_added"] == null ? void 0 : json["users_added"] }; } function AddOrganizationUsersResponseToJSON(json) { return AddOrganizationUsersResponseToJSONTyped(json, false); } function AddOrganizationUsersResponseToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "code": value["code"], "message": value["message"], "users_added": value["usersAdded"] }; } // src/models/ApiResult.ts function instanceOfApiResult(value) { return true; } function ApiResultFromJSON(json) { return ApiResultFromJSONTyped(json, false); } function ApiResultFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "result": json["result"] == null ? void 0 : json["result"] }; } function ApiResultToJSON(json) { return ApiResultToJSONTyped(json, false); } function ApiResultToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "result": value["result"] }; } // src/models/Applications.ts function instanceOfApplications(value) { return true; } function ApplicationsFromJSON(json) { return ApplicationsFromJSONTyped(json, false); } function ApplicationsFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "id": json["id"] == null ? void 0 : json["id"], "name": json["name"] == null ? void 0 : json["name"], "type": json["type"] == null ? void 0 : json["type"] }; } function ApplicationsToJSON(json) { return ApplicationsToJSONTyped(json, false); } function ApplicationsToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "id": value["id"], "name": value["name"], "type": value["type"] }; } // src/models/AuthorizeAppApiResponse.ts function instanceOfAuthorizeAppApiResponse(value) { return true; } function AuthorizeAppApiResponseFromJSON(json) { return AuthorizeAppApiResponseFromJSONTyped(json, false); } function AuthorizeAppApiResponseFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "message": json["message"] == null ? void 0 : json["message"], "code": json["code"] == null ? void 0 : json["code"], "applicationsDisconnected": json["applications_disconnected"] == null ? void 0 : json["applications_disconnected"], "applicationsConnected": json["applications_connected"] == null ? void 0 : json["applications_connected"] }; } function AuthorizeAppApiResponseToJSON(json) { return AuthorizeAppApiResponseToJSONTyped(json, false); } function AuthorizeAppApiResponseToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "message": value["message"], "code": value["code"], "applications_disconnected": value["applicationsDisconnected"], "applications_connected": value["applicationsConnected"] }; } // src/models/Category.ts function instanceOfCategory(value) { return true; } function CategoryFromJSON(json) { return CategoryFromJSONTyped(json, false); } function CategoryFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "id": json["id"] == null ? void 0 : json["id"], "name": json["name"] == null ? void 0 : json["name"] }; } function CategoryToJSON(json) { return CategoryToJSONTyped(json, false); } function CategoryToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "id": value["id"], "name": value["name"] }; } // src/models/ConnectedAppsAccessToken.ts function instanceOfConnectedAppsAccessToken(value) { return true; } function ConnectedAppsAccessTokenFromJSON(json) { return ConnectedAppsAccessTokenFromJSONTyped(json, false); } function ConnectedAppsAccessTokenFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "accessToken": json["access_token"] == null ? void 0 : json["access_token"], "accessTokenExpiry": json["access_token_expiry"] == null ? void 0 : json["access_token_expiry"] }; } function ConnectedAppsAccessTokenToJSON(json) { return ConnectedAppsAccessTokenToJSONTyped(json, false); } function ConnectedAppsAccessTokenToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "access_token": value["accessToken"], "access_token_expiry": value["accessTokenExpiry"] }; } // src/models/ConnectedAppsAuthUrl.ts function instanceOfConnectedAppsAuthUrl(value) { return true; } function ConnectedAppsAuthUrlFromJSON(json) { return ConnectedAppsAuthUrlFromJSONTyped(json, false); } function ConnectedAppsAuthUrlFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "url": json["url"] == null ? void 0 : json["url"], "sessionId": json["session_id"] == null ? void 0 : json["session_id"] }; } function ConnectedAppsAuthUrlToJSON(json) { return ConnectedAppsAuthUrlToJSONTyped(json, false); } function ConnectedAppsAuthUrlToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "url": value["url"], "session_id": value["sessionId"] }; } // src/models/Connection.ts function instanceOfConnection(value) { return true; } function ConnectionFromJSON(json) { return ConnectionFromJSONTyped(json, false); } function ConnectionFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "id": json["id"] == null ? void 0 : json["id"], "name": json["name"] == null ? void 0 : json["name"], "displayName": json["display_name"] == null ? void 0 : json["display_name"], "strategy": json["strategy"] == null ? void 0 : json["strategy"] }; } function ConnectionToJSON(json) { return ConnectionToJSONTyped(json, false); } function ConnectionToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "id": value["id"], "name": value["name"], "display_name": value["displayName"], "strategy": value["strategy"] }; } // src/models/CreateApisResponseApi.ts function instanceOfCreateApisResponseApi(value) { return true; } function CreateApisResponseApiFromJSON(json) { return CreateApisResponseApiFromJSONTyped(json, false); } function CreateApisResponseApiFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "id": json["id"] == null ? void 0 : json["id"] }; } function CreateApisResponseApiToJSON(json) { return CreateApisResponseApiToJSONTyped(json, false); } function CreateApisResponseApiToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "id": value["id"] }; } // src/models/CreateApisResponse.ts function instanceOfCreateApisResponse(value) { return true; } function CreateApisResponseFromJSON(json) { return CreateApisResponseFromJSONTyped(json, false); } function CreateApisResponseFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "message": json["message"] == null ? void 0 : json["message"], "code": json["code"] == null ? void 0 : json["code"], "api": json["api"] == null ? void 0 : CreateApisResponseApiFromJSON(json["api"]) }; } function CreateApisResponseToJSON(json) { return CreateApisResponseToJSONTyped(json, false); } function CreateApisResponseToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "message": value["message"], "code": value["code"], "api": CreateApisResponseApiToJSON(value["api"]) }; } // src/models/CreateApplicationRequest.ts var CreateApplicationRequestTypeEnum = { Reg: "reg", Spa: "spa", M2m: "m2m" }; function instanceOfCreateApplicationRequest(value) { if (!("name" in value) || value["name"] === void 0) return false; if (!("type" in value) || value["type"] === void 0) return false; return true; } function CreateApplicationRequestFromJSON(json) { return CreateApplicationRequestFromJSONTyped(json, false); } function CreateApplicationRequestFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "name": json["name"], "type": json["type"] }; } function CreateApplicationRequestToJSON(json) { return CreateApplicationRequestToJSONTyped(json, false); } function CreateApplicationRequestToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "name": value["name"], "type": value["type"] }; } // src/models/CreateApplicationResponseApplication.ts function instanceOfCreateApplicationResponseApplication(value) { return true; } function CreateApplicationResponseApplicationFromJSON(json) { return CreateApplicationResponseApplicationFromJSONTyped(json, false); } function CreateApplicationResponseApplicationFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "id": json["id"] == null ? void 0 : json["id"], "clientId": json["client_id"] == null ? void 0 : json["client_id"], "clientSecret": json["client_secret"] == null ? void 0 : json["client_secret"] }; } function CreateApplicationResponseApplicationToJSON(json) { return CreateApplicationResponseApplicationToJSONTyped(json, false); } function CreateApplicationResponseApplicationToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "id": value["id"], "client_id": value["clientId"], "client_secret": value["clientSecret"] }; } // src/models/CreateApplicationResponse.ts function instanceOfCreateApplicationResponse(value) { return true; } function CreateApplicationResponseFromJSON(json) { return CreateApplicationResponseFromJSONTyped(json, false); } function CreateApplicationResponseFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "code": json["code"] == null ? void 0 : json["code"], "message": json["message"] == null ? void 0 : json["message"], "application": json["application"] == null ? void 0 : CreateApplicationResponseApplicationFromJSON(json["application"]) }; } function CreateApplicationResponseToJSON(json) { return CreateApplicationResponseToJSONTyped(json, false); } function CreateApplicationResponseToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "code": value["code"], "message": value["message"], "application": CreateApplicationResponseApplicationToJSON(value["application"]) }; } // src/models/CreateCategoryRequest.ts var CreateCategoryRequestContextEnum = { Org: "org", Usr: "usr" }; function instanceOfCreateCategoryRequest(value) { if (!("name" in value) || value["name"] === void 0) return false; if (!("context" in value) || value["context"] === void 0) return false; return true; } function CreateCategoryRequestFromJSON(json) { return CreateCategoryRequestFromJSONTyped(json, false); } function CreateCategoryRequestFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "name": json["name"], "context": json["context"] }; } function CreateCategoryRequestToJSON(json) { return CreateCategoryRequestToJSONTyped(json, false); } function CreateCategoryRequestToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "name": value["name"], "context": value["context"] }; } // src/models/CreateCategoryResponseCategory.ts function instanceOfCreateCategoryResponseCategory(value) { return true; } function CreateCategoryResponseCategoryFromJSON(json) { return CreateCategoryResponseCategoryFromJSONTyped(json, false); } function CreateCategoryResponseCategoryFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "id": json["id"] == null ? void 0 : json["id"] }; } function CreateCategoryResponseCategoryToJSON(json) { return CreateCategoryResponseCategoryToJSONTyped(json, false); } function CreateCategoryResponseCategoryToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "id": value["id"] }; } // src/models/CreateCategoryResponse.ts function instanceOfCreateCategoryResponse(value) { return true; } function CreateCategoryResponseFromJSON(json) { return CreateCategoryResponseFromJSONTyped(json, false); } function CreateCategoryResponseFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "message": json["message"] == null ? void 0 : json["message"], "code": json["code"] == null ? void 0 : json["code"], "category": json["category"] == null ? void 0 : CreateCategoryResponseCategoryFromJSON(json["category"]) }; } function CreateCategoryResponseToJSON(json) { return CreateCategoryResponseToJSONTyped(json, false); } function CreateCategoryResponseToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "message": value["message"], "code": value["code"], "category": CreateCategoryResponseCategoryToJSON(value["category"]) }; } // src/models/CreateConnectionRequest.ts var CreateConnectionRequestStrategyEnum = { Oauth2apple: "oauth2:apple", Oauth2azureAd: "oauth2:azure_ad", Oauth2bitbucket: "oauth2:bitbucket", Oauth2discord: "oauth2:discord", Oauth2facebook: "oauth2:facebook", Oauth2github: "oauth2:github", Oauth2gitlab: "oauth2:gitlab", Oauth2google: "oauth2:google", Oauth2linkedin: "oauth2:linkedin", Oauth2microsoft: "oauth2:microsoft", Oauth2patreon: "oauth2:patreon", Oauth2slack: "oauth2:slack", Oauth2stripe: "oauth2:stripe", Oauth2twitch: "oauth2:twitch", Oauth2twitter: "oauth2:twitter", Oauth2xero: "oauth2:xero", Samlcustom: "saml:custom", WsfedazureAd: "wsfed:azure_ad" }; function instanceOfCreateConnectionRequest(value) { if (!("name" in value) || value["name"] === void 0) return false; if (!("displayName" in value) || value["displayName"] === void 0) return false; if (!("strategy" in value) || value["strategy"] === void 0) return false; return true; } function CreateConnectionRequestFromJSON(json) { return CreateConnectionRequestFromJSONTyped(json, false); } function CreateConnectionRequestFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "name": json["name"], "displayName": json["display_name"], "strategy": json["strategy"], "enabledApplications": json["enabled_applications"] == null ? void 0 : json["enabled_applications"], "options": json["options"] == null ? void 0 : json["options"] }; } function CreateConnectionRequestToJSON(json) { return CreateConnectionRequestToJSONTyped(json, false); } function CreateConnectionRequestToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "name": value["name"], "display_name": value["displayName"], "strategy": value["strategy"], "enabled_applications": value["enabledApplications"], "options": value["options"] }; } // src/models/CreateConnectionResponseConnection.ts function instanceOfCreateConnectionResponseConnection(value) { return true; } function CreateConnectionResponseConnectionFromJSON(json) { return CreateConnectionResponseConnectionFromJSONTyped(json, false); } function CreateConnectionResponseConnectionFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "id": json["id"] == null ? void 0 : json["id"] }; } function CreateConnectionResponseConnectionToJSON(json) { return CreateConnectionResponseConnectionToJSONTyped(json, false); } function CreateConnectionResponseConnectionToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "id": value["id"] }; } // src/models/CreateConnectionResponse.ts function instanceOfCreateConnectionResponse(value) { return true; } function CreateConnectionResponseFromJSON(json) { return CreateConnectionResponseFromJSONTyped(json, false); } function CreateConnectionResponseFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "message": json["message"] == null ? void 0 : json["message"], "code": json["code"] == null ? void 0 : json["code"], "connection": json["connection"] == null ? void 0 : CreateConnectionResponseConnectionFromJSON(json["connection"]) }; } function CreateConnectionResponseToJSON(json) { return CreateConnectionResponseToJSONTyped(json, false); } function CreateConnectionResponseToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "message": value["message"], "code": value["code"], "connection": CreateConnectionResponseConnectionToJSON(value["connection"]) }; } // src/models/CreateFeatureFlagRequest.ts var CreateFeatureFlagRequestTypeEnum = { Str: "str", Int: "int", Bool: "bool" }; var CreateFeatureFlagRequestAllowOverrideLevelEnum = { Env: "env", Org: "org", Usr: "usr" }; function instanceOfCreateFeatureFlagRequest(value) { if (!("name" in value) || value["name"] === void 0) return false; if (!("key" in value) || value["key"] === void 0) return false; if (!("type" in value) || value["type"] === void 0) return false; if (!("defaultValue" in value) || value["defaultValue"] === void 0) return false; return true; } function CreateFeatureFlagRequestFromJSON(json) { return CreateFeatureFlagRequestFromJSONTyped(json, false); } function CreateFeatureFlagRequestFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "name": json["name"], "description": json["description"] == null ? void 0 : json["description"], "key": json["key"], "type": json["type"], "allowOverrideLevel": json["allow_override_level"] == null ? void 0 : json["allow_override_level"], "defaultValue": json["default_value"] }; } function CreateFeatureFlagRequestToJSON(json) { return CreateFeatureFlagRequestToJSONTyped(json, false); } function CreateFeatureFlagRequestToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "name": value["name"], "description": value["description"], "key": value["key"], "type": value["type"], "allow_override_level": value["allowOverrideLevel"], "default_value": value["defaultValue"] }; } // src/models/CreateIdentityResponseIdentity.ts function instanceOfCreateIdentityResponseIdentity(value) { return true; } function CreateIdentityResponseIdentityFromJSON(json) { return CreateIdentityResponseIdentityFromJSONTyped(json, false); } function CreateIdentityResponseIdentityFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "id": json["id"] == null ? void 0 : json["id"] }; } function CreateIdentityResponseIdentityToJSON(json) { return CreateIdentityResponseIdentityToJSONTyped(json, false); } function CreateIdentityResponseIdentityToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "id": value["id"] }; } // src/models/CreateIdentityResponse.ts function instanceOfCreateIdentityResponse(value) { return true; } function CreateIdentityResponseFromJSON(json) { return CreateIdentityResponseFromJSONTyped(json, false); } function CreateIdentityResponseFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "message": json["message"] == null ? void 0 : json["message"], "code": json["code"] == null ? void 0 : json["code"], "identity": json["identity"] == null ? void 0 : CreateIdentityResponseIdentityFromJSON(json["identity"]) }; } function CreateIdentityResponseToJSON(json) { return CreateIdentityResponseToJSONTyped(json, false); } function CreateIdentityResponseToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "message": value["message"], "code": value["code"], "identity": CreateIdentityResponseIdentityToJSON(value["identity"]) }; } // src/models/CreateOrganizationRequest.ts var CreateOrganizationRequestFeatureFlagsEnum = { Str: "str", Int: "int", Bool: "bool" }; function instanceOfCreateOrganizationRequest(value) { if (!("name" in value) || value["name"] === void 0) return false; return true; } function CreateOrganizationRequestFromJSON(json) { return CreateOrganizationRequestFromJSONTyped(json, false); } function CreateOrganizationRequestFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "name": json["name"], "featureFlags": json["feature_flags"] == null ? void 0 : json["feature_flags"], "externalId": json["external_id"] == null ? void 0 : json["external_id"], "backgroundColor": json["background_color"] == null ? void 0 : json["background_color"], "buttonColor": json["button_color"] == null ? void 0 : json["button_color"], "buttonTextColor": json["button_text_color"] == null ? void 0 : json["button_text_color"], "linkColor": json["link_color"] == null ? void 0 : json["link_color"], "backgroundColorDark": json["background_color_dark"] == null ? void 0 : json["background_color_dark"], "buttonColorDark": json["button_color_dark"] == null ? void 0 : json["button_color_dark"], "buttonTextColorDark": json["button_text_color_dark"] == null ? void 0 : json["button_text_color_dark"], "linkColorDark": json["link_color_dark"] == null ? void 0 : json["link_color_dark"], "themeCode": json["theme_code"] == null ? void 0 : json["theme_code"], "handle": json["handle"] == null ? void 0 : json["handle"], "isAllowRegistrations": json["is_allow_registrations"] == null ? void 0 : json["is_allow_registrations"], "isCustomAuthConnectionsEnabled": json["is_custom_auth_connections_enabled"] == null ? void 0 : json["is_custom_auth_connections_enabled"] }; } function CreateOrganizationRequestToJSON(json) { return CreateOrganizationRequestToJSONTyped(json, false); } function CreateOrganizationRequestToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "name": value["name"], "feature_flags": value["featureFlags"], "external_id": value["externalId"], "background_color": value["backgroundColor"], "button_color": value["buttonColor"], "button_text_color": value["buttonTextColor"], "link_color": value["linkColor"], "background_color_dark": value["backgroundColorDark"], "button_color_dark": value["buttonColorDark"], "button_text_color_dark": value["buttonTextColorDark"], "link_color_dark": value["linkColorDark"], "theme_code": value["themeCode"], "handle": value["handle"], "is_allow_registrations": value["isAllowRegistrations"], "is_custom_auth_connections_enabled": value["isCustomAuthConnectionsEnabled"] }; } // src/models/CreateOrganizationResponseOrganization.ts function instanceOfCreateOrganizationResponseOrganization(value) { return true; } function CreateOrganizationResponseOrganizationFromJSON(json) { return CreateOrganizationResponseOrganizationFromJSONTyped(json, false); } function CreateOrganizationResponseOrganizationFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "code": json["code"] == null ? void 0 : json["code"] }; } function CreateOrganizationResponseOrganizationToJSON(json) { return CreateOrganizationResponseOrganizationToJSONTyped(json, false); } function CreateOrganizationResponseOrganizationToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "code": value["code"] }; } // src/models/CreateOrganizationResponse.ts function instanceOfCreateOrganizationResponse(value) { return true; } function CreateOrganizationResponseFromJSON(json) { return CreateOrganizationResponseFromJSONTyped(json, false); } function CreateOrganizationResponseFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "message": json["message"] == null ? void 0 : json["message"], "code": json["code"] == null ? void 0 : json["code"], "organization": json["organization"] == null ? void 0 : CreateOrganizationResponseOrganizationFromJSON(json["organization"]) }; } function CreateOrganizationResponseToJSON(json) { return CreateOrganizationResponseToJSONTyped(json, false); } function CreateOrganizationResponseToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "message": value["message"], "code": value["code"], "organization": CreateOrganizationResponseOrganizationToJSON(value["organization"]) }; } // src/models/CreateOrganizationUserPermissionRequest.ts function instanceOfCreateOrganizationUserPermissionRequest(value) { return true; } function CreateOrganizationUserPermissionRequestFromJSON(json) { return CreateOrganizationUserPermissionRequestFromJSONTyped(json, false); } function CreateOrganizationUserPermissionRequestFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "permissionId": json["permission_id"] == null ? void 0 : json["permission_id"] }; } function CreateOrganizationUserPermissionRequestToJSON(json) { return CreateOrganizationUserPermissionRequestToJSONTyped(json, false); } function CreateOrganizationUserPermissionRequestToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "permission_id": value["permissionId"] }; } // src/models/CreateOrganizationUserRoleRequest.ts function instanceOfCreateOrganizationUserRoleRequest(value) { return true; } function CreateOrganizationUserRoleRequestFromJSON(json) { return CreateOrganizationUserRoleRequestFromJSONTyped(json, false); } function CreateOrganizationUserRoleRequestFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "roleId": json["role_id"] == null ? void 0 : json["role_id"] }; } function CreateOrganizationUserRoleRequestToJSON(json) { return CreateOrganizationUserRoleRequestToJSONTyped(json, false); } function CreateOrganizationUserRoleRequestToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "role_id": value["roleId"] }; } // src/models/CreatePermissionRequest.ts function instanceOfCreatePermissionRequest(value) { return true; } function CreatePermissionRequestFromJSON(json) { return CreatePermissionRequestFromJSONTyped(json, false); } function CreatePermissionRequestFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "name": json["name"] == null ? void 0 : json["name"], "description": json["description"] == null ? void 0 : json["description"], "key": json["key"] == null ? void 0 : json["key"] }; } function CreatePermissionRequestToJSON(json) { return CreatePermissionRequestToJSONTyped(json, false); } function CreatePermissionRequestToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "name": value["name"], "description": value["description"], "key": value["key"] }; } // src/models/CreatePropertyRequest.ts var CreatePropertyRequestTypeEnum = { SingleLineText: "single_line_text", MultiLineText: "multi_line_text" }; var CreatePropertyRequestContextEnum = { Org: "org", Usr: "usr" }; function instanceOfCreatePropertyRequest(value) { if (!("name" in value) || value["name"] === void 0) return false; if (!("key" in value) || value["key"] === void 0) return false; if (!("type" in value) || value["type"] === void 0) return false; if (!("context" in value) || value["context"] === void 0) return false; if (!("isPrivate" in value) || value["isPrivate"] === void 0) return false; if (!("categoryId" in value) || value["categoryId"] === void 0) return false; return true; } function CreatePropertyRequestFromJSON(json) { return CreatePropertyRequestFromJSONTyped(json, false); } function CreatePropertyRequestFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "name": json["name"], "description": json["description"] == null ? void 0 : json["description"], "key": json["key"], "type": json["type"], "context": json["context"], "isPrivate": json["is_private"], "categoryId": json["category_id"] }; } function CreatePropertyRequestToJSON(json) { return CreatePropertyRequestToJSONTyped(json, false); } function CreatePropertyRequestToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "name": value["name"], "description": value["description"], "key": value["key"], "type": value["type"], "context": value["context"], "is_private": value["isPrivate"], "category_id": value["categoryId"] }; } // src/models/CreatePropertyResponseProperty.ts function instanceOfCreatePropertyResponseProperty(value) { return true; } function CreatePropertyResponsePropertyFromJSON(json) { return CreatePropertyResponsePropertyFromJSONTyped(json, false); } function CreatePropertyResponsePropertyFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "id": json["id"] == null ? void 0 : json["id"] }; } function CreatePropertyResponsePropertyToJSON(json) { return CreatePropertyResponsePropertyToJSONTyped(json, false); } function CreatePropertyResponsePropertyToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "id": value["id"] }; } // src/models/CreatePropertyResponse.ts function instanceOfCreatePropertyResponse(value) { return true; } function CreatePropertyResponseFromJSON(json) { return CreatePropertyResponseFromJSONTyped(json, false); } function CreatePropertyResponseFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "message": json["message"] == null ? void 0 : json["message"], "code": json["code"] == null ? void 0 : json["code"], "property": json["property"] == null ? void 0 : CreatePropertyResponsePropertyFromJSON(json["property"]) }; } function CreatePropertyResponseToJSON(json) { return CreatePropertyResponseToJSONTyped(json, false); } function CreatePropertyResponseToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "message": value["message"], "code": value["code"], "property": CreatePropertyResponsePropertyToJSON(value["property"]) }; } // src/models/CreateRoleRequest.ts function instanceOfCreateRoleRequest(value) { return true; } function CreateRoleRequestFromJSON(json) { return CreateRoleRequestFromJSONTyped(json, false); } function CreateRoleRequestFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "name": json["name"] == null ? void 0 : json["name"], "description": json["description"] == null ? void 0 : json["description"], "key": json["key"] == null ? void 0 : json["key"], "isDefaultRole": json["is_default_role"] == null ? void 0 : json["is_default_role"] }; } function CreateRoleRequestToJSON(json) { return CreateRoleRequestToJSONTyped(json, false); } function CreateRoleRequestToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "name": value["name"], "description": value["description"], "key": value["key"], "is_default_role": value["isDefaultRole"] }; } // src/models/CreateSubscriberSuccessResponseSubscriber.ts function instanceOfCreateSubscriberSuccessResponseSubscriber(value) { return true; } function CreateSubscriberSuccessResponseSubscriberFromJSON(json) { return CreateSubscriberSuccessResponseSubscriberFromJSONTyped(json, false); } function CreateSubscriberSuccessResponseSubscriberFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "subscriberId": json["subscriber_id"] == null ? void 0 : json["subscriber_id"] }; } function CreateSubscriberSuccessResponseSubscriberToJSON(json) { return CreateSubscriberSuccessResponseSubscriberToJSONTyped(json, false); } function CreateSubscriberSuccessResponseSubscriberToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "subscriber_id": value["subscriberId"] }; } // src/models/CreateSubscriberSuccessResponse.ts function instanceOfCreateSubscriberSuccessResponse(value) { return true; } function CreateSubscriberSuccessResponseFromJSON(json) { return CreateSubscriberSuccessResponseFromJSONTyped(json, false); } function CreateSubscriberSuccessResponseFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "subscriber": json["subscriber"] == null ? void 0 : CreateSubscriberSuccessResponseSubscriberFromJSON(json["subscriber"]) }; } function CreateSubscriberSuccessResponseToJSON(json) { return CreateSubscriberSuccessResponseToJSONTyped(json, false); } function CreateSubscriberSuccessResponseToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "subscriber": CreateSubscriberSuccessResponseSubscriberToJSON(value["subscriber"]) }; } // src/models/CreateUserIdentityRequest.ts var CreateUserIdentityRequestTypeEnum = { Email: "email", Username: "username", Phone: "phone", Enterprise: "enterprise" }; function instanceOfCreateUserIdentityRequest(value) { return true; } function CreateUserIdentityRequestFromJSON(json) { return CreateUserIdentityRequestFromJSONTyped(json, false); } function CreateUserIdentityRequestFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "value": json["value"] == null ? void 0 : json["value"], "type": json["type"] == null ? void 0 : json["type"], "phoneCountryId": json["phone_country_id"] == null ? void 0 : json["phone_country_id"] }; } function CreateUserIdentityRequestToJSON(json) { return CreateUserIdentityRequestToJSONTyped(json, false); } function CreateUserIdentityRequestToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "value": value["value"], "type": value["type"], "phone_country_id": value["phoneCountryId"] }; } // src/models/CreateUserRequestIdentitiesInnerDetails.ts function instanceOfCreateUserRequestIdentitiesInnerDetails(value) { return true; } function CreateUserRequestIdentitiesInnerDetailsFromJSON(json) { return CreateUserRequestIdentitiesInnerDetailsFromJSONTyped(json, false); } function CreateUserRequestIdentitiesInnerDetailsFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "email": json["email"] == null ? void 0 : json["email"], "phone": json["phone"] == null ? void 0 : json["phone"], "username": json["username"] == null ? void 0 : json["username"] }; } function CreateUserRequestIdentitiesInnerDetailsToJSON(json) { return CreateUserRequestIdentitiesInnerDetailsToJSONTyped(json, false); } function CreateUserRequestIdentitiesInnerDetailsToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "email": value["email"], "phone": value["phone"], "username": value["username"] }; } // src/models/CreateUserRequestIdentitiesInner.ts var CreateUserRequestIdentitiesInnerTypeEnum = { Email: "email", Phone: "phone", Username: "username" }; function instanceOfCreateUserRequestIdentitiesInner(value) { return true; } function CreateUserRequestIdentitiesInnerFromJSON(json) { return CreateUserRequestIdentitiesInnerFromJSONTyped(json, false); } function CreateUserRequestIdentitiesInnerFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "type": json["type"] == null ? void 0 : json["type"], "details": json["details"] == null ? void 0 : CreateUserRequestIdentitiesInnerDetailsFromJSON(json["details"]) }; } function CreateUserRequestIdentitiesInnerToJSON(json) { return CreateUserRequestIdentitiesInnerToJSONTyped(json, false); } function CreateUserRequestIdentitiesInnerToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "type": value["type"], "details": CreateUserRequestIdentitiesInnerDetailsToJSON(value["details"]) }; } // src/models/CreateUserRequestProfile.ts function instanceOfCreateUserRequestProfile(value) { return true; } function CreateUserRequestProfileFromJSON(json) { return CreateUserRequestProfileFromJSONTyped(json, false); } function CreateUserRequestProfileFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "givenName": json["given_name"] == null ? void 0 : json["given_name"], "familyName": json["family_name"] == null ? void 0 : json["family_name"] }; } function CreateUserRequestProfileToJSON(json) { return CreateUserRequestProfileToJSONTyped(json, false); } function CreateUserRequestProfileToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { "given_name": value["givenName"], "family_name": value["familyName"] }; } // src/models/CreateUserRequest.ts function instanceOfCreateUserRequest(value) { return true; } function CreateUserRequestFromJSON(json) { return CreateUserRequestFromJSONTyped(json, false); } function CreateUserRequestFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { "profile": json["profile"] == null ? void 0 : CreateUserRequestProfileFromJSON(json["profile"]), "organizationCode": json["organization_code"] == null ? void 0 : json["organization_code"], "providedId": json["provided_id"] =