From ae09b1038bd8136d5d8b96cf7370954d03d2f38d Mon Sep 17 00:00:00 2001 From: Tushar Pandey Date: Wed, 23 Oct 2024 16:22:57 +0530 Subject: [PATCH 1/5] intial forms impl --- src/management/__generated/index.ts | 4 + .../__generated/managers/flows-manager.ts | 163 ++ .../__generated/managers/forms-manager.ts | 159 ++ src/management/__generated/managers/index.ts | 2 + src/management/__generated/models/index.ts | 1712 ++++++++++++++++- 5 files changed, 1955 insertions(+), 85 deletions(-) create mode 100644 src/management/__generated/managers/flows-manager.ts create mode 100644 src/management/__generated/managers/forms-manager.ts diff --git a/src/management/__generated/index.ts b/src/management/__generated/index.ts index 3850ad31b..ffa6462e2 100644 --- a/src/management/__generated/index.ts +++ b/src/management/__generated/index.ts @@ -14,6 +14,8 @@ import { DeviceCredentialsManager, EmailTemplatesManager, EmailsManager, + FlowsManager, + FormsManager, GrantsManager, GuardianManager, HooksManager, @@ -53,6 +55,8 @@ export abstract class ManagementClientBase { public readonly deviceCredentials = new DeviceCredentialsManager(this.configuration); public readonly emailTemplates = new EmailTemplatesManager(this.configuration); public readonly emails = new EmailsManager(this.configuration); + public readonly flows = new FlowsManager(this.configuration); + public readonly forms = new FormsManager(this.configuration); public readonly grants = new GrantsManager(this.configuration); public readonly guardian = new GuardianManager(this.configuration); public readonly hooks = new HooksManager(this.configuration); diff --git a/src/management/__generated/managers/flows-manager.ts b/src/management/__generated/managers/flows-manager.ts new file mode 100644 index 000000000..5cfa12f64 --- /dev/null +++ b/src/management/__generated/managers/flows-manager.ts @@ -0,0 +1,163 @@ +import * as runtime from '../../../lib/runtime.js'; +import type { InitOverride, ApiResponse } from '../../../lib/runtime.js'; +import type { + GetFlows200Response, + PatchFlowsByIdRequest, + PostFlows201Response, + PostFlowsRequest, + GetFlows200ResponseOneOf, + GetFlows200ResponseOneOfInner, + GetFlowsRequest, + GetFlowsByIdRequest, + PatchFlowsByIdOperationRequest, +} from '../models/index.js'; + +const { BaseAPI } = runtime; + +/** + * + */ +export class FlowsManager extends BaseAPI { + /** + * Get flows + * + * @throws {RequiredError} + */ + async getFlows( + requestParameters: GetFlowsRequest & { include_totals: true }, + initOverrides?: InitOverride + ): Promise>; + async getFlows( + requestParameters?: GetFlowsRequest, + initOverrides?: InitOverride + ): Promise>>; + async getFlows( + requestParameters: GetFlowsRequest = {}, + initOverrides?: InitOverride + ): Promise> { + const queryParameters = runtime.applyQueryParams(requestParameters, [ + { + key: 'page', + config: {}, + }, + { + key: 'per_page', + config: {}, + }, + { + key: 'include_totals', + config: {}, + }, + { + key: 'hydrate', + config: { + isArray: true, + isCollectionFormatMulti: true, + }, + }, + { + key: 'synchronous', + config: {}, + }, + ]); + + const response = await this.request( + { + path: `/flows`, + method: 'GET', + query: queryParameters, + }, + initOverrides + ); + + return runtime.JSONApiResponse.fromResponse(response); + } + + /** + * Get a flow + * + * @throws {RequiredError} + */ + async getFlowsById( + requestParameters: GetFlowsByIdRequest, + initOverrides?: InitOverride + ): Promise> { + runtime.validateRequiredRequestParams(requestParameters, ['id']); + + const queryParameters = runtime.applyQueryParams(requestParameters, [ + { + key: 'hydrate', + config: { + isArray: true, + isCollectionFormatMulti: true, + }, + }, + ]); + + const response = await this.request( + { + path: `/flows/{id}`.replace('{id}', encodeURIComponent(String(requestParameters.id))), + method: 'GET', + query: queryParameters, + }, + initOverrides + ); + + return runtime.JSONApiResponse.fromResponse(response); + } + + /** + * Update a flow + * + * @throws {RequiredError} + */ + async patchFlowsById( + requestParameters: PatchFlowsByIdOperationRequest, + bodyParameters: PatchFlowsByIdRequest, + initOverrides?: InitOverride + ): Promise> { + runtime.validateRequiredRequestParams(requestParameters, ['id']); + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + const response = await this.request( + { + path: `/flows/{id}`.replace('{id}', encodeURIComponent(String(requestParameters.id))), + method: 'PATCH', + headers: headerParameters, + body: bodyParameters, + }, + initOverrides + ); + + return runtime.JSONApiResponse.fromResponse(response); + } + + /** + * Create a flow + * + * @throws {RequiredError} + */ + async postFlows( + bodyParameters: PostFlowsRequest, + initOverrides?: InitOverride + ): Promise> { + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + const response = await this.request( + { + path: `/flows`, + method: 'POST', + headers: headerParameters, + body: bodyParameters, + }, + initOverrides + ); + + return runtime.JSONApiResponse.fromResponse(response); + } +} diff --git a/src/management/__generated/managers/forms-manager.ts b/src/management/__generated/managers/forms-manager.ts new file mode 100644 index 000000000..89cb280c7 --- /dev/null +++ b/src/management/__generated/managers/forms-manager.ts @@ -0,0 +1,159 @@ +import * as runtime from '../../../lib/runtime.js'; +import type { InitOverride, ApiResponse } from '../../../lib/runtime.js'; +import type { + GetForms200Response, + PatchFormsByIdRequest, + PostForms201Response, + PostFormsRequest, + GetForms200ResponseOneOf, + GetForms200ResponseOneOfInner, + GetFormsRequest, + GetFormsByIdRequest, + PatchFormsByIdOperationRequest, +} from '../models/index.js'; + +const { BaseAPI } = runtime; + +/** + * + */ +export class FormsManager extends BaseAPI { + /** + * Get forms + * + * @throws {RequiredError} + */ + async getForms( + requestParameters: GetFormsRequest & { include_totals: true }, + initOverrides?: InitOverride + ): Promise>; + async getForms( + requestParameters?: GetFormsRequest, + initOverrides?: InitOverride + ): Promise>>; + async getForms( + requestParameters: GetFormsRequest = {}, + initOverrides?: InitOverride + ): Promise> { + const queryParameters = runtime.applyQueryParams(requestParameters, [ + { + key: 'page', + config: {}, + }, + { + key: 'per_page', + config: {}, + }, + { + key: 'include_totals', + config: {}, + }, + { + key: 'hydrate', + config: { + isArray: true, + isCollectionFormatMulti: true, + }, + }, + ]); + + const response = await this.request( + { + path: `/forms`, + method: 'GET', + query: queryParameters, + }, + initOverrides + ); + + return runtime.JSONApiResponse.fromResponse(response); + } + + /** + * Get a form + * + * @throws {RequiredError} + */ + async getFormsById( + requestParameters: GetFormsByIdRequest, + initOverrides?: InitOverride + ): Promise> { + runtime.validateRequiredRequestParams(requestParameters, ['id']); + + const queryParameters = runtime.applyQueryParams(requestParameters, [ + { + key: 'hydrate', + config: { + isArray: true, + isCollectionFormatMulti: true, + }, + }, + ]); + + const response = await this.request( + { + path: `/forms/{id}`.replace('{id}', encodeURIComponent(String(requestParameters.id))), + method: 'GET', + query: queryParameters, + }, + initOverrides + ); + + return runtime.JSONApiResponse.fromResponse(response); + } + + /** + * Update a form + * + * @throws {RequiredError} + */ + async patchFormsById( + requestParameters: PatchFormsByIdOperationRequest, + bodyParameters: PatchFormsByIdRequest, + initOverrides?: InitOverride + ): Promise> { + runtime.validateRequiredRequestParams(requestParameters, ['id']); + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + const response = await this.request( + { + path: `/forms/{id}`.replace('{id}', encodeURIComponent(String(requestParameters.id))), + method: 'PATCH', + headers: headerParameters, + body: bodyParameters, + }, + initOverrides + ); + + return runtime.JSONApiResponse.fromResponse(response); + } + + /** + * Create a form + * + * @throws {RequiredError} + */ + async postForms( + bodyParameters: PostFormsRequest, + initOverrides?: InitOverride + ): Promise> { + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + const response = await this.request( + { + path: `/forms`, + method: 'POST', + headers: headerParameters, + body: bodyParameters, + }, + initOverrides + ); + + return runtime.JSONApiResponse.fromResponse(response); + } +} diff --git a/src/management/__generated/managers/index.ts b/src/management/__generated/managers/index.ts index d169c1eae..9b417e017 100644 --- a/src/management/__generated/managers/index.ts +++ b/src/management/__generated/managers/index.ts @@ -10,6 +10,8 @@ export * from './custom-domains-manager.js'; export * from './device-credentials-manager.js'; export * from './email-templates-manager.js'; export * from './emails-manager.js'; +export * from './flows-manager.js'; +export * from './forms-manager.js'; export * from './grants-manager.js'; export * from './guardian-manager.js'; export * from './hooks-manager.js'; diff --git a/src/management/__generated/models/index.ts b/src/management/__generated/models/index.ts index 9b77657e0..f43caab4d 100644 --- a/src/management/__generated/models/index.ts +++ b/src/management/__generated/models/index.ts @@ -5484,6 +5484,91 @@ export interface GetExecution200ResponseResultsInner { */ ended_at: string; } +/** + * + */ +export type GetFlows200Response = Array | GetFlows200ResponseOneOf; +/** + * + */ +export interface GetFlows200ResponseOneOf { + /** + */ + start: number; + /** + */ + limit: number; + /** + */ + total: number; + /** + */ + flows: Array; +} +/** + * + */ +export interface GetFlows200ResponseOneOfInner { + /** + */ + id: string; + /** + */ + name: string; + /** + */ + created_at: string; + /** + */ + updated_at: string; + /** + */ + executed_at?: string; +} +/** + * + */ +export type GetForms200Response = Array | GetForms200ResponseOneOf; +/** + * + */ +export interface GetForms200ResponseOneOf { + /** + */ + start: number; + /** + */ + limit: number; + /** + */ + total: number; + /** + */ + forms: Array; +} +/** + * + */ +export interface GetForms200ResponseOneOfInner { + /** + */ + id: string; + /** + */ + name: string; + /** + */ + created_at: string; + /** + */ + updated_at: string; + /** + */ + embedded_at?: string; + /** + */ + submitted_at?: string; +} /** * */ @@ -8608,6 +8693,46 @@ export interface PatchEnabledConnectionsByConnectionIdRequest { */ show_as_button?: boolean; } +/** + * + */ +export interface PatchFlowsByIdRequest { + /** + */ + name?: string; + /** + */ + actions?: Array; +} +/** + * + */ +export interface PatchFormsByIdRequest { + /** + */ + name?: string; + /** + */ + messages?: PostFormsRequestMessages; + /** + */ + languages?: PostFormsRequestLanguages; + /** + */ + translations?: { [key: string]: any }; + /** + */ + nodes?: Array; + /** + */ + start?: PostFormsRequestStart; + /** + */ + ending?: PostFormsRequestEnding; + /** + */ + style?: PostFormsRequestStyle; +} /** * */ @@ -9734,154 +9859,1426 @@ export type PostDeployDraftVersionRequest = ActionsDraftUpdate; /** * */ -export interface PostDeviceCredentials201Response { +export interface PostDeviceCredentials201Response { + [key: string]: any | any; + /** + * The credential's identifier + * + */ + id: string; +} +/** + * + */ +export interface PostEmailTemplatesRequest { + /** + * Template name. Can be `verify_email`, `verify_email_by_code`, `reset_email`, `welcome_email`, `blocked_account`, `stolen_credentials`, `enrollment_email`, `mfa_oob_code`, `user_invitation`, `change_password` (legacy), or `password_reset` (legacy). + * + */ + template: PostEmailTemplatesRequestTemplateEnum; + /** + * Body of the email template. + * + */ + body: string | null; + /** + * Senders `from` email address. + * + */ + from: string | null; + /** + * URL to redirect the user to after a successful action. + * + */ + resultUrl?: string | null; + /** + * Subject line of the email. + * + */ + subject: string | null; + /** + * Syntax of the template body. + * + */ + syntax: string | null; + /** + * Lifetime in seconds that the link within the email will be valid for. + * + */ + urlLifetimeInSeconds?: number | null; + /** + * Whether the `reset_email` and `verify_email` templates should include the user's email address as the `email` parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true. + * + */ + includeEmailInRedirect?: boolean; + /** + * Whether the template is enabled (true) or disabled (false). + * + */ + enabled: boolean | null; +} + +export const PostEmailTemplatesRequestTemplateEnum = { + verify_email: 'verify_email', + verify_email_by_code: 'verify_email_by_code', + reset_email: 'reset_email', + welcome_email: 'welcome_email', + blocked_account: 'blocked_account', + stolen_credentials: 'stolen_credentials', + enrollment_email: 'enrollment_email', + mfa_oob_code: 'mfa_oob_code', + user_invitation: 'user_invitation', + change_password: 'change_password', + password_reset: 'password_reset', +} as const; +export type PostEmailTemplatesRequestTemplateEnum = + (typeof PostEmailTemplatesRequestTemplateEnum)[keyof typeof PostEmailTemplatesRequestTemplateEnum]; + +/** + * + */ +export interface PostEmailVerification201Response { + [key: string]: any | any; + /** + * URL representing the ticket. + * + */ + ticket: string; +} +/** + * + */ +export interface PostEmailVerificationRequest { + /** + * URL the user will be redirected to in the classic Universal Login experience once the ticket is used. + * + */ + result_url?: string; + /** + * user_id of for whom the ticket should be created. + * + */ + user_id: string; + /** + * ID of the client. If provided for tenants using New Universal Login experience, the user will be prompted to redirect to the default login route of the corresponding application once the ticket is used. See Configuring Default Login Routes for more details. + * + */ + client_id?: string; + /** + * (Optional) Organization ID – the ID of the Organization. If provided, organization parameters will be made available to the email template and organization branding will be applied to the prompt. In addition, the redirect link in the prompt will include organization_id and organization_name query string parameters. + * + */ + organization_id?: string; + /** + * Number of seconds for which the ticket is valid before expiration. If unspecified or set to 0, this value defaults to 432000 seconds (5 days). + * + */ + ttl_sec?: number; + /** + * Whether to include the email address as part of the returnUrl in the reset_email (true), or not (false). + * + */ + includeEmailInRedirect?: boolean; + /** + */ + identity?: PostVerificationEmailRequestIdentity; +} +/** + * + */ +export interface PostEnabledConnectionsRequest { + /** + * Single connection ID to add to the organization. + * + */ + connection_id: string; + /** + * When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection. + * + */ + assign_membership_on_login?: boolean; + /** + * Determines whether organization signup should be enabled for this organization connection. Only applicable for database connections. Default: false. + * + */ + is_signup_enabled?: boolean; + /** + * Determines whether a connection should be displayed on this organization’s login prompt. Only applicable for enterprise connections. Default: true. + * + */ + show_as_button?: boolean; +} +/** + * + */ +export interface PostFlows201Response { + /** + */ + id: string; + /** + */ + name: string; + /** + */ + actions?: Array; + /** + */ + created_at: string; + /** + */ + updated_at: string; + /** + */ + executed_at?: string; +} +/** + * + */ +export interface PostFlowsRequest { + /** + */ + name: string; + /** + */ + actions?: Array; +} +/** + * + */ +export interface PostForms201Response { + /** + */ + id: string; + /** + */ + name: string; + /** + */ + messages?: PostFormsRequestMessages; + /** + */ + languages?: PostFormsRequestLanguages; + /** + */ + translations?: { [key: string]: any }; + /** + */ + nodes?: Array; + /** + */ + start?: PostFormsRequestStart; + /** + */ + ending?: PostFormsRequestEnding; + /** + */ + style?: PostFormsRequestStyle; + /** + */ + created_at: string; + /** + */ + updated_at: string; + /** + */ + embedded_at?: string; + /** + */ + submitted_at?: string; +} +/** + * + */ +export interface PostFormsRequest { + /** + */ + name: string; + /** + */ + messages?: PostFormsRequestMessages; + /** + */ + languages?: PostFormsRequestLanguages; + /** + */ + translations?: { [key: string]: any }; + /** + */ + nodes?: Array; + /** + */ + start?: PostFormsRequestStart; + /** + */ + ending?: PostFormsRequestEnding; + /** + */ + style?: PostFormsRequestStyle; +} +/** + * + */ +export interface PostFormsRequestEnding { + /** + */ + redirection?: PostFormsRequestEndingRedirection; + /** + */ + after_submit?: PostFormsRequestEndingAfterSubmit; + /** + */ + coordinates?: PostFormsRequestNodesInnerAnyOfCoordinates; + /** + */ + resume_flow?: PostFormsRequestEndingResumeFlowEnum; +} + +export const PostFormsRequestEndingResumeFlowEnum = { + true: true, +} as const; +export type PostFormsRequestEndingResumeFlowEnum = + (typeof PostFormsRequestEndingResumeFlowEnum)[keyof typeof PostFormsRequestEndingResumeFlowEnum]; + +/** + * + */ +export interface PostFormsRequestEndingAfterSubmit { + /** + */ + flow_id?: string; +} +/** + * + */ +export interface PostFormsRequestEndingRedirection { + /** + */ + delay?: number; + /** + */ + target: string; +} +/** + * + */ +export interface PostFormsRequestLanguages { + /** + */ + primary?: string; + /** + */ + _default?: string; +} +/** + * + */ +export interface PostFormsRequestMessages { + /** + */ + errors?: { [key: string]: any }; + /** + */ + custom?: { [key: string]: any }; +} +/** + * + */ +export type PostFormsRequestNodesInner = + | PostFormsRequestNodesInnerAnyOf + | PostFormsRequestNodesInnerAnyOf1 + | PostFormsRequestNodesInnerAnyOf2; +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf { + /** + */ + id: string; + /** + */ + type: PostFormsRequestNodesInnerAnyOfTypeEnum; + /** + */ + coordinates?: PostFormsRequestNodesInnerAnyOfCoordinates; + /** + */ + alias?: string; + /** + */ + config: PostFormsRequestNodesInnerAnyOfConfig; +} + +export const PostFormsRequestNodesInnerAnyOfTypeEnum = { + FLOW: 'FLOW', +} as const; +export type PostFormsRequestNodesInnerAnyOfTypeEnum = + (typeof PostFormsRequestNodesInnerAnyOfTypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOfTypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf1 { + /** + */ + id: string; + /** + */ + type: PostFormsRequestNodesInnerAnyOf1TypeEnum; + /** + */ + coordinates?: PostFormsRequestNodesInnerAnyOfCoordinates; + /** + */ + alias?: string; + /** + */ + config?: PostFormsRequestNodesInnerAnyOf1Config; +} + +export const PostFormsRequestNodesInnerAnyOf1TypeEnum = { + ROUTER: 'ROUTER', +} as const; +export type PostFormsRequestNodesInnerAnyOf1TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf1TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf1TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf1Config { + /** + */ + rules?: Array; + /** + */ + fallback?: PostFormsRequestNodesInnerAnyOfConfigNextNode; +} +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf1ConfigRulesInner { + /** + */ + id: string; + /** + */ + alias?: string; + /** + */ + condition: any | null; + /** + */ + next_node?: PostFormsRequestNodesInnerAnyOfConfigNextNode; +} +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2 { + /** + */ + id: string; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2TypeEnum; + /** + */ + coordinates?: PostFormsRequestNodesInnerAnyOfCoordinates; + /** + */ + alias?: string; + /** + */ + config?: PostFormsRequestNodesInnerAnyOf2Config; +} + +export const PostFormsRequestNodesInnerAnyOf2TypeEnum = { + STEP: 'STEP', +} as const; +export type PostFormsRequestNodesInnerAnyOf2TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2Config { + /** + */ + components?: Array; + /** + */ + next_node?: PostFormsRequestNodesInnerAnyOfConfigNextNode; +} +/** + * + */ +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInner = + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf1 + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2; +/** + * + */ +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf = + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf1 + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf2 + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf3 + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf4 + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf5 + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf6; +/** + * + */ +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf1 = + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf1AnyOf + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf1AnyOf1; +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf1AnyOf { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf1AnyOfTypeEnum; + /** + */ + config: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf1AnyOfConfig; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf1AnyOfTypeEnum = { + GMAPS_ADDRESS: 'GMAPS_ADDRESS', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf1AnyOfTypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf1AnyOfTypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf1AnyOfTypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf1AnyOf1 { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf1AnyOf1TypeEnum; + /** + */ + config: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf1AnyOf1Config; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf1AnyOf1TypeEnum = { + RECAPTCHA: 'RECAPTCHA', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf1AnyOf1TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf1AnyOf1TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf1AnyOf1TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf1AnyOf1Config { + /** + */ + site_key: string; + /** + */ + secret_key: string; +} +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf1AnyOfConfig { + /** + */ + api_key: string; +} +/** + * + */ +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2 = + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf1 + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf10 + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11 + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf12 + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf13 + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf14 + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf15 + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf2 + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf3 + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf4 + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf5 + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf6 + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf7 + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf8 + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf9; +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOfTypeEnum; + /** + */ + config: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOfConfig; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOfTypeEnum = { + BOOLEAN: 'BOOLEAN', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOfTypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOfTypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOfTypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf1 { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf1TypeEnum; + /** + */ + config?: { [key: string]: any }; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf1TypeEnum = { + CARDS: 'CARDS', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf1TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf1TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf1TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf10 { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf10TypeEnum; + /** + */ + config: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf10Config; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf10TypeEnum = { + PASSWORD: 'PASSWORD', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf10TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf10TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf10TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf10Config { + /** + */ + hash?: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf10ConfigHashEnum; + /** + */ + placeholder?: string; + /** + */ + min_length?: number; + /** + */ + max_length?: number; + /** + */ + complexity?: boolean; + /** + */ + nist?: boolean; + /** + */ + strength_meter?: boolean; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf10ConfigHashEnum = { + NONE: 'NONE', + MD5: 'MD5', + SHA1: 'SHA1', + SHA256: 'SHA256', + SHA512: 'SHA512', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf10ConfigHashEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf10ConfigHashEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf10ConfigHashEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11 { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11TypeEnum; + /** + */ + config: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11Config; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11TypeEnum = { + PAYMENT: 'PAYMENT', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11Config { + /** + */ + provider?: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigProviderEnum; + /** + */ + charge: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigCharge; + /** + */ + credentials: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigCredentials; + /** + */ + customer?: { [key: string]: any }; + /** + */ + fields?: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigFields; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigProviderEnum = + { + STRIPE: 'STRIPE', + } as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigProviderEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigProviderEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigProviderEnum]; + +/** + * + */ +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigCharge = + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOf + | PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOf1; +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOf { + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOfTypeEnum; + /** + */ + one_off: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOfOneOff; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOfTypeEnum = + { + ONE_OFF: 'ONE_OFF', + } as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOfTypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOfTypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOfTypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOf1 { + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOf1TypeEnum; + /** + */ + subscription: { [key: string]: any }; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOf1TypeEnum = + { + SUBSCRIPTION: 'SUBSCRIPTION', + } as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOf1TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOf1TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOf1TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOfOneOff { + [key: string]: any | any; + /** + */ + amount: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOfOneOffAmount; + /** + */ + currency: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOfOneOffCurrencyEnum; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOfOneOffCurrencyEnum = + { + AUD: 'AUD', + CAD: 'CAD', + CHF: 'CHF', + EUR: 'EUR', + GBP: 'GBP', + INR: 'INR', + MXN: 'MXN', + SEK: 'SEK', + USD: 'USD', + } as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOfOneOffCurrencyEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOfOneOffCurrencyEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOfOneOffCurrencyEnum]; + +/** + * + */ +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigChargeAnyOfOneOffAmount = + number | string; +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigCredentials { + /** + */ + public_key: string; + /** + */ + private_key: string; +} +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigFields { + /** + */ + card_number?: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigFieldsCardNumber; + /** + */ + expiration_date?: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigFieldsCardNumber; + /** + */ + security_code?: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigFieldsCardNumber; + /** + */ + trustmarks?: boolean; +} +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf11ConfigFieldsCardNumber { + /** + */ + label?: string; + /** + */ + placeholder?: string; +} +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf12 { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf12TypeEnum; + /** + */ + config?: object; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf12TypeEnum = { + SOCIAL: 'SOCIAL', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf12TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf12TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf12TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf13 { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf13TypeEnum; + /** + */ + config?: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf13Config; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf13TypeEnum = { + TEL: 'TEL', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf13TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf13TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf13TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf13Config {} +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf14 { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf14TypeEnum; + /** + */ + config?: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf13Config; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf14TypeEnum = { + TEXT: 'TEXT', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf14TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf14TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf14TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf15 { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf15TypeEnum; + /** + */ + config?: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf6Config; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf15TypeEnum = { + URL: 'URL', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf15TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf15TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf15TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf2 { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf2TypeEnum; + /** + */ + config?: { [key: string]: any }; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf2TypeEnum = { + CHOICE: 'CHOICE', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf2TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf2TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf2TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf3 { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf3TypeEnum; + /** + */ + config: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf3Config; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf3TypeEnum = { + CUSTOM: 'CUSTOM', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf3TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf3TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf3TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf3Config { + /** + */ + schema: { [key: string]: any }; + /** + */ + code: string; + /** + */ + css?: string; + /** + */ + params?: { [key: string]: any }; +} +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf4 { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf4TypeEnum; + /** + */ + config: { [key: string]: any }; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf4TypeEnum = { + DATE: 'DATE', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf4TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf4TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf4TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf5 { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf5TypeEnum; + /** + */ + config?: { [key: string]: any }; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf5TypeEnum = { + DROPDOWN: 'DROPDOWN', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf5TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf5TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf5TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf6 { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf6TypeEnum; + /** + */ + config?: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf6Config; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf6TypeEnum = { + EMAIL: 'EMAIL', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf6TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf6TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf6TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf6Config { + /** + */ + default_value?: string; + /** + */ + placeholder?: string; +} +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf7 { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf7TypeEnum; + /** + */ + config?: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf7Config; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf7TypeEnum = { + FILE: 'FILE', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf7TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf7TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf7TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf7Config { + /** + */ + multiple?: boolean; + /** + */ + storage?: { [key: string]: any }; + /** + */ + categories?: Array; + /** + */ + extensions?: Array; + /** + */ + maxSize?: number; + /** + */ + maxFiles?: number; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf7ConfigCategoriesEnum = + { + AUDIO: 'AUDIO', + VIDEO: 'VIDEO', + IMAGE: 'IMAGE', + DOCUMENT: 'DOCUMENT', + ARCHIVE: 'ARCHIVE', + } as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf7ConfigCategoriesEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf7ConfigCategoriesEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf7ConfigCategoriesEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf8 { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf8TypeEnum; + /** + */ + config?: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf8Config; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf8TypeEnum = { + LEGAL: 'LEGAL', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf8TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf8TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf8TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf8Config { + /** + */ + text?: string; +} +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf9 { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf9TypeEnum; + /** + */ + config?: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf9Config; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf9TypeEnum = { + NUMBER: 'NUMBER', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf9TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf9TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf9TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf9Config { + /** + */ + default_value?: number; + /** + */ + placeholder?: string; + /** + */ + min_value?: number; + /** + */ + max_value?: number; +} +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOfConfig { + /** + */ + default_value?: boolean; + /** + */ + options?: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOfConfigOptions; +} +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOfConfigOptions { + /** + */ + _true?: string; + /** + */ + _false?: string; +} +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOfTypeEnum; + /** + */ + config?: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOfConfig; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOfTypeEnum = { + DIVIDER: 'DIVIDER', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOfTypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOfTypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOfTypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf1 { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf1TypeEnum; + /** + */ + config?: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf1Config; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf1TypeEnum = { + HTML: 'HTML', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf1TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf1TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf1TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf1Config { + /** + */ + content?: string; +} +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf2 { + [key: string]: any | any; + /** + */ + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf2TypeEnum; + /** + */ + config?: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf2Config; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf2TypeEnum = { + IMAGE: 'IMAGE', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf2TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf2TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf2TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf2Config { + /** + */ + src: string; + /** + */ + position?: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf2ConfigPositionEnum; + /** + */ + height?: number; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf2ConfigPositionEnum = { + LEFT: 'LEFT', + CENTER: 'CENTER', + RIGHT: 'RIGHT', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf2ConfigPositionEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf2ConfigPositionEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf2ConfigPositionEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf3 { [key: string]: any | any; /** - * The credential's identifier - * */ - id: string; + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf3TypeEnum; + /** + */ + config: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf3Config; } + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf3TypeEnum = { + JUMP_BUTTON: 'JUMP_BUTTON', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf3TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf3TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf3TypeEnum]; + /** * */ -export interface PostEmailTemplatesRequest { +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf3Config { /** - * Template name. Can be `verify_email`, `verify_email_by_code`, `reset_email`, `welcome_email`, `blocked_account`, `stolen_credentials`, `enrollment_email`, `mfa_oob_code`, `user_invitation`, `change_password` (legacy), or `password_reset` (legacy). - * */ - template: PostEmailTemplatesRequestTemplateEnum; + text: string; /** - * Body of the email template. - * */ - body: string | null; + next_node: PostFormsRequestNodesInnerAnyOfConfigNextNode; /** - * Senders `from` email address. - * */ - from: string | null; + style?: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf3ConfigStyle; +} +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf3ConfigStyle { /** - * URL to redirect the user to after a successful action. - * */ - resultUrl?: string | null; + background_color?: string; +} +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf4 { + [key: string]: any | any; /** - * Subject line of the email. - * */ - subject: string | null; + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf4TypeEnum; /** - * Syntax of the template body. - * */ - syntax: string | null; + config: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf4Config; +} + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf4TypeEnum = { + NEXT_BUTTON: 'NEXT_BUTTON', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf4TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf4TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf4TypeEnum]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf4Config { /** - * Lifetime in seconds that the link within the email will be valid for. - * */ - urlLifetimeInSeconds?: number | null; + text: string; +} +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf5 { + [key: string]: any | any; /** - * Whether the `reset_email` and `verify_email` templates should include the user's email address as the `email` parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true. - * */ - includeEmailInRedirect?: boolean; + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf5TypeEnum; /** - * Whether the template is enabled (true) or disabled (false). - * */ - enabled: boolean | null; + config: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf4Config; } -export const PostEmailTemplatesRequestTemplateEnum = { - verify_email: 'verify_email', - verify_email_by_code: 'verify_email_by_code', - reset_email: 'reset_email', - welcome_email: 'welcome_email', - blocked_account: 'blocked_account', - stolen_credentials: 'stolen_credentials', - enrollment_email: 'enrollment_email', - mfa_oob_code: 'mfa_oob_code', - user_invitation: 'user_invitation', - change_password: 'change_password', - password_reset: 'password_reset', +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf5TypeEnum = { + PREVIOUS_BUTTON: 'PREVIOUS_BUTTON', } as const; -export type PostEmailTemplatesRequestTemplateEnum = - (typeof PostEmailTemplatesRequestTemplateEnum)[keyof typeof PostEmailTemplatesRequestTemplateEnum]; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf5TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf5TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf5TypeEnum]; /** * */ -export interface PostEmailVerification201Response { +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf6 { [key: string]: any | any; /** - * URL representing the ticket. - * */ - ticket: string; + type: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf6TypeEnum; + /** + */ + config?: PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf1Config; } + +export const PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf6TypeEnum = { + RICH_TEXT: 'RICH_TEXT', +} as const; +export type PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf6TypeEnum = + (typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf6TypeEnum)[keyof typeof PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOf6TypeEnum]; + /** * */ -export interface PostEmailVerificationRequest { +export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOfAnyOfConfig { /** - * URL the user will be redirected to in the classic Universal Login experience once the ticket is used. - * */ - result_url?: string; + text?: string; +} +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOfConfig { /** - * user_id of for whom the ticket should be created. - * */ - user_id: string; + flow_id: string; /** - * ID of the client. If provided for tenants using New Universal Login experience, the user will be prompted to redirect to the default login route of the corresponding application once the ticket is used. See Configuring Default Login Routes for more details. - * */ - client_id?: string; + next_node?: PostFormsRequestNodesInnerAnyOfConfigNextNode; +} +/** + * + */ +export type PostFormsRequestNodesInnerAnyOfConfigNextNode = + | PostFormsRequestNodesInnerAnyOfConfigNextNodeAnyOf + | string; + +/** + * + */ +export const PostFormsRequestNodesInnerAnyOfConfigNextNodeAnyOf = { + ending: '$ending', +} as const; +export type PostFormsRequestNodesInnerAnyOfConfigNextNodeAnyOf = + (typeof PostFormsRequestNodesInnerAnyOfConfigNextNodeAnyOf)[keyof typeof PostFormsRequestNodesInnerAnyOfConfigNextNodeAnyOf]; + +/** + * + */ +export interface PostFormsRequestNodesInnerAnyOfCoordinates { /** - * (Optional) Organization ID – the ID of the Organization. If provided, organization parameters will be made available to the email template and organization branding will be applied to the prompt. In addition, the redirect link in the prompt will include organization_id and organization_name query string parameters. - * */ - organization_id?: string; + x: number; /** - * Number of seconds for which the ticket is valid before expiration. If unspecified or set to 0, this value defaults to 432000 seconds (5 days). - * */ - ttl_sec?: number; + y: number; +} +/** + * + */ +export interface PostFormsRequestStart { /** - * Whether to include the email address as part of the returnUrl in the reset_email (true), or not (false). - * */ - includeEmailInRedirect?: boolean; + hidden_fields?: Array; /** */ - identity?: PostVerificationEmailRequestIdentity; + next_node?: PostFormsRequestNodesInnerAnyOfConfigNextNode; + /** + */ + coordinates?: PostFormsRequestNodesInnerAnyOfCoordinates; } /** * */ -export interface PostEnabledConnectionsRequest { - /** - * Single connection ID to add to the organization. - * - */ - connection_id: string; +export interface PostFormsRequestStartHiddenFieldsInner { /** - * When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection. - * */ - assign_membership_on_login?: boolean; + key: string; /** - * Determines whether organization signup should be enabled for this organization connection. Only applicable for database connections. Default: false. - * */ - is_signup_enabled?: boolean; + value?: string; +} +/** + * + */ +export interface PostFormsRequestStyle { /** - * Determines whether a connection should be displayed on this organization’s login prompt. Only applicable for enterprise connections. Default: true. - * */ - show_as_button?: boolean; + css?: string; } /** * @@ -14540,6 +15937,151 @@ export interface GetProviderRequest { */ include_fields?: boolean; } + +/** + * + */ +export const GetFlowsHydrateEnum = { + form_count: 'form_count', +} as const; +export type GetFlowsHydrateEnum = (typeof GetFlowsHydrateEnum)[keyof typeof GetFlowsHydrateEnum]; + +/** + * + */ +export interface GetFlowsRequest { + /** + * Page index of the results to return. First page is 0. + * + */ + page?: number; + /** + * Number of results per page. Defaults to 50. + * + */ + per_page?: number; + /** + * Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). + * + */ + include_totals?: boolean; + /** + * hydration param + * + */ + hydrate?: Array; + /** + * flag to filter by sync/async flows + * + */ + synchronous?: boolean; +} + +/** + * + */ +export const GetFlowsByIdHydrateEnum = { + form_count: 'form_count', +} as const; +export type GetFlowsByIdHydrateEnum = + (typeof GetFlowsByIdHydrateEnum)[keyof typeof GetFlowsByIdHydrateEnum]; + +/** + * + */ +export interface GetFlowsByIdRequest { + /** + * Flow identifier + * + */ + id: string; + /** + * hydration param + * + */ + hydrate?: Array; +} +/** + * + */ +export interface PatchFlowsByIdOperationRequest { + /** + * Flow identifier + * + */ + id: string; +} + +/** + * + */ +export const GetFormsHydrateEnum = { + flow_count: 'flow_count', + links: 'links', +} as const; +export type GetFormsHydrateEnum = (typeof GetFormsHydrateEnum)[keyof typeof GetFormsHydrateEnum]; + +/** + * + */ +export interface GetFormsRequest { + /** + * Page index of the results to return. First page is 0. + * + */ + page?: number; + /** + * Number of results per page. Defaults to 50. + * + */ + per_page?: number; + /** + * Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). + * + */ + include_totals?: boolean; + /** + * hydration param + * + */ + hydrate?: Array; +} + +/** + * + */ +export const GetFormsByIdHydrateEnum = { + flow_count: 'flow_count', + links: 'links', +} as const; +export type GetFormsByIdHydrateEnum = + (typeof GetFormsByIdHydrateEnum)[keyof typeof GetFormsByIdHydrateEnum]; + +/** + * + */ +export interface GetFormsByIdRequest { + /** + * Form identifier + * + */ + id: string; + /** + * hydration param + * + */ + hydrate?: Array; +} +/** + * + */ +export interface PatchFormsByIdOperationRequest { + /** + * Form identifier + * + */ + id: string; +} /** * */ From 863eaf0f2be5caad05a8e5cf0a2bfcfc58c3a3f0 Mon Sep 17 00:00:00 2001 From: Tushar Pandey Date: Wed, 23 Oct 2024 16:23:31 +0530 Subject: [PATCH 2/5] simplified testing with util functions --- test/management/flows.test.ts | 76 +++++++++++++++++++++++++++++++++++ test/management/tests.util.ts | 41 +++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 test/management/flows.test.ts create mode 100644 test/management/tests.util.ts diff --git a/test/management/flows.test.ts b/test/management/flows.test.ts new file mode 100644 index 000000000..cfa7775e6 --- /dev/null +++ b/test/management/flows.test.ts @@ -0,0 +1,76 @@ +import nock from 'nock'; +import { FlowsManager } from '../../src/index.js'; +import { ManagementClient } from '../../src/index.js'; +import { + checkForPromise, + checkErrorHandler, + checkRequestInterceptor, + checkOperation, +} from './tests.util.js'; +import { GetFlows200Response } from '../../src/index.js'; + +const DOMAIN = `tenant.auth0.com`; +const API_URL = `https://${DOMAIN}/api/v2`; +const token = 'TOKEN'; + +describe('FlowsManager', () => { + const flowsManager: FlowsManager = new ManagementClient({ domain: DOMAIN, token }).flows; + + describe('getFlows', () => { + // expected response from the API + const expectedResponse: GetFlows200Response = [ + { + id: 'flw_123', + name: 'test', + created_at: '2024-10-23T09:29:24.286Z', + updated_at: '2024-10-23T09:29:24.286Z', + executed_at: '2024-10-23T09:29:24.286Z', + }, + ]; + + // getFlows method + const operation = flowsManager.getFlows(); + + // clean all previous nocks + nock.cleanAll(); + + // nock the API with success scenario + let request: nock.Scope = nock(API_URL).get('/flows').reply(200, expectedResponse); + checkForPromise(operation); + checkRequestInterceptor(operation, request, '/flows'); + checkOperation(operation, expectedResponse); + + // nock the API with error scenario + request = nock(API_URL).get('/flows').reply(500); + checkErrorHandler(operation); + }); + + describe('getFlows', () => { + // expected response from the API + const expectedResponse: GetFlows200Response = [ + { + id: 'flw_123', + name: 'test', + created_at: '2024-10-23T09:29:24.286Z', + updated_at: '2024-10-23T09:29:24.286Z', + executed_at: '2024-10-23T09:29:24.286Z', + }, + ]; + + // getFlows method + const operation = flowsManager.getFlows(); + + // clean all previous nocks + nock.cleanAll(); + + // nock the API with success scenario + let request: nock.Scope = nock(API_URL).get('/flows').reply(200, expectedResponse); + checkForPromise(operation); + checkRequestInterceptor(operation, request, '/flows'); + checkOperation(operation, expectedResponse); + + // nock the API with error scenario + request = nock(API_URL).get('/flows').reply(500); + checkErrorHandler(operation); + }); +}); diff --git a/test/management/tests.util.ts b/test/management/tests.util.ts new file mode 100644 index 000000000..9b552de92 --- /dev/null +++ b/test/management/tests.util.ts @@ -0,0 +1,41 @@ +import nock from 'nock'; +import { ApiResponse } from '../../src/lib/models.js'; + +// this is not technically not required as type checking will automatically check fot this +// but including it for the sake of completeness +export function checkForPromise(operation: any | Promise>): void { + it('should return a promise if no callback is given', (done) => { + expect(operation instanceof Promise).toBeTruthy(); + operation.then(done.bind(null, null)).catch(done.bind(null, null)); + }); +} + +export function checkErrorHandler(operation: Promise>): void { + it('should pass any errors to the promise catch handler', () => { + nock.cleanAll(); + + return operation.catch((err) => { + expect(err).toBeDefined(); + }); + }); +} + +// this function checks if a request is made to the specified endpoint in a given method. +// it is used to check if the correct endpoint is being called in the tests +export function checkRequestInterceptor( + operation: Promise, + request: nock.Scope, + endpoint: string +): void { + it(`should make a request to ${endpoint}`, async () => { + await operation; + expect(request.isDone()).toBeTruthy(); + }); +} + +export function checkOperation(operation: Promise>, expectedResponse: T): void { + it('should test the method', async () => { + const result = await operation; + expect(result.data).toEqual(expectedResponse); + }); +} From 23af401784e27925448db7fff92b3ee7438fb31f Mon Sep 17 00:00:00 2001 From: Tushar Pandey Date: Sun, 27 Oct 2024 12:44:45 +0530 Subject: [PATCH 3/5] updated flows intial tests with new unit test template --- test/management/flows.test.ts | 91 ++++++++++++------------------ test/management/tests.util.ts | 102 +++++++++++++++++++++++++++++++--- 2 files changed, 129 insertions(+), 64 deletions(-) diff --git a/test/management/flows.test.ts b/test/management/flows.test.ts index cfa7775e6..605a27ca5 100644 --- a/test/management/flows.test.ts +++ b/test/management/flows.test.ts @@ -1,76 +1,57 @@ -import nock from 'nock'; import { FlowsManager } from '../../src/index.js'; import { ManagementClient } from '../../src/index.js'; -import { - checkForPromise, - checkErrorHandler, - checkRequestInterceptor, - checkOperation, -} from './tests.util.js'; -import { GetFlows200Response } from '../../src/index.js'; +import { checkMethod } from './tests.util.js'; +import { GetFlows200Response, PostFlows201Response } from '../../src/index.js'; const DOMAIN = `tenant.auth0.com`; -const API_URL = `https://${DOMAIN}/api/v2`; const token = 'TOKEN'; describe('FlowsManager', () => { const flowsManager: FlowsManager = new ManagementClient({ domain: DOMAIN, token }).flows; + // this is the test for the method getFlows() + // it calls a GET endpoint and does not take any input parameters or body describe('getFlows', () => { - // expected response from the API - const expectedResponse: GetFlows200Response = [ - { - id: 'flw_123', - name: 'test', - created_at: '2024-10-23T09:29:24.286Z', - updated_at: '2024-10-23T09:29:24.286Z', - executed_at: '2024-10-23T09:29:24.286Z', - }, - ]; - - // getFlows method const operation = flowsManager.getFlows(); + const expectedResponse: GetFlows200Response = {}; + const uri = `/flows`; + const method = 'get'; - // clean all previous nocks - nock.cleanAll(); + checkMethod({ operation, expectedResponse, uri, method }); + }); - // nock the API with success scenario - let request: nock.Scope = nock(API_URL).get('/flows').reply(200, expectedResponse); - checkForPromise(operation); - checkRequestInterceptor(operation, request, '/flows'); - checkOperation(operation, expectedResponse); + // this is the test for the method getFlowsById() + // it calls a GET endpoint and takes input parameters but no input body + describe('getFlowsById', () => { + const operation = flowsManager.getFlowsById({ id: 'flowId' }); + const expectedResponse: PostFlows201Response = {}; + const uri = `/flows/flowId`; + const method = 'get'; - // nock the API with error scenario - request = nock(API_URL).get('/flows').reply(500); - checkErrorHandler(operation); + checkMethod({ operation, expectedResponse, uri, method }); }); - describe('getFlows', () => { - // expected response from the API - const expectedResponse: GetFlows200Response = [ - { - id: 'flw_123', - name: 'test', - created_at: '2024-10-23T09:29:24.286Z', - updated_at: '2024-10-23T09:29:24.286Z', - executed_at: '2024-10-23T09:29:24.286Z', - }, - ]; - - // getFlows method - const operation = flowsManager.getFlows(); + // this is the test for the method patchFlowsById() + // it calls a PATCH endpoint and takes input parameters and body + describe('patchFlowsById', () => { + const requestBody: { name: string } = { name: 'flowName' }; + const operation = flowsManager.patchFlowsById({ id: 'flowId' }, requestBody); + const expectedResponse: PostFlows201Response = {}; + const uri = `/flows/flowId`; + const method = 'patch'; - // clean all previous nocks - nock.cleanAll(); + checkMethod({ operation, expectedResponse, uri, method, requestBody }); + }); - // nock the API with success scenario - let request: nock.Scope = nock(API_URL).get('/flows').reply(200, expectedResponse); - checkForPromise(operation); - checkRequestInterceptor(operation, request, '/flows'); - checkOperation(operation, expectedResponse); + // this is the test for the method postFlows() + // it calls a POST endpoint and takes only a body + describe('postFlows', () => { + const requestBody: { name: string } = { name: 'flowName' }; + const operation = flowsManager.postFlows(requestBody); + const expectedResponse: PostFlows201Response = {}; + const uri = `/flows`; + const method = 'post'; - // nock the API with error scenario - request = nock(API_URL).get('/flows').reply(500); - checkErrorHandler(operation); + checkMethod({ operation, expectedResponse, uri, method, requestBody }); }); }); diff --git a/test/management/tests.util.ts b/test/management/tests.util.ts index 9b552de92..2ba06fbf1 100644 --- a/test/management/tests.util.ts +++ b/test/management/tests.util.ts @@ -1,8 +1,24 @@ -import nock from 'nock'; +// tests.util.ts +// this file contains commmon test functions that are used to test sdk endpoints +// since the management api managers are essentially wrappers around the REST endpoints, +// these functions end up being repeated for all the managers, this file aims to reduce repetition +// it performs basic sanity checks, input output checks and error handling checks + +import nock, { RequestBodyMatcher } from 'nock'; import { ApiResponse } from '../../src/lib/models.js'; +const DOMAIN = `tenant.auth0.com`; +const API_URL = `https://${DOMAIN}/api/v2`; + // this is not technically not required as type checking will automatically check fot this // but including it for the sake of completeness +/** + * Checks if the given operation returns a promise when no callback is provided. + * + * @template T - The type of the response expected from the promise. + * @param {any | Promise>} operation - The operation to check, which can be either a promise or any other type. + * @returns {void} + */ export function checkForPromise(operation: any | Promise>): void { it('should return a promise if no callback is given', (done) => { expect(operation instanceof Promise).toBeTruthy(); @@ -10,6 +26,18 @@ export function checkForPromise(operation: any | Promise>): vo }); } +/** + * Utility function to test if an operation correctly handles errors. + * + * @template T - The type of the response expected from the operation. + * @param {Promise>} operation - The promise representing the operation to be tested. + * @returns {void} - This function does not return anything. + * + * @example + * ```typescript + * checkErrorHandler(someApiOperation); + * ``` + */ export function checkErrorHandler(operation: Promise>): void { it('should pass any errors to the promise catch handler', () => { nock.cleanAll(); @@ -20,22 +48,78 @@ export function checkErrorHandler(operation: Promise>): void { }); } -// this function checks if a request is made to the specified endpoint in a given method. -// it is used to check if the correct endpoint is being called in the tests -export function checkRequestInterceptor( - operation: Promise, - request: nock.Scope, - endpoint: string -): void { - it(`should make a request to ${endpoint}`, async () => { +/** + * Verifies that a given operation makes a request to the specified endpoint. + * + * @template T - The type of the result of the operation. + * @param operation - A promise representing the operation to be checked. + * @param request - The nock scope representing the expected request. + */ +export function checkRequestInterceptor(operation: Promise, request: nock.Scope): void { + it(`should make a request to the endpoint`, async () => { await operation; expect(request.isDone()).toBeTruthy(); }); } +/** + * Tests an asynchronous operation by comparing its result to an expected response. + * + * @template T - The type of the expected response data. + * @param {Promise>} operation - The asynchronous operation to be tested. + * @param {T} expectedResponse - The expected response data to compare against the operation's result. + */ export function checkOperation(operation: Promise>, expectedResponse: T): void { it('should test the method', async () => { const result = await operation; expect(result.data).toEqual(expectedResponse); }); } + +export type CheckMethodParams = { + operation: Promise>; + expectedResponse: any; + uri: string | RegExp | { (uri: string): boolean }; + method: string; + requestBody?: RequestBodyMatcher | any; +}; + +// this function combines the above functions to check an SDK manager method. +/** + * Checks the given manager method by intercepting the request and validating the response. + * + * Following checks are performed: + * 1. The operation is a promise. + * 2. The operation is rejected in case of an error. + * 3. The request is made to the specified endpoint in the given method. + * 4. The response from the operation is as expected. + * + * @template T - The type of the expected response. + * @param {Object} params - The parameters for the checkMethod function. + * @param {Promise>} params.operation - The operation to be tested. + * @param {any} params.expectedResponse - The expected response from the operation. + * @param {string | RegExp | ((uri: string) => boolean)} params.uri - The URI to intercept. + * @param {string} params.method - The HTTP method to intercept (e.g., 'GET', 'POST'). + * @param {RequestBodyMatcher | any} [params.requestBody] - The optional request body to match. + */ +export const checkMethod = ({ + operation, + expectedResponse, + uri, + method, + requestBody, +}: CheckMethodParams): void => { + // nock the API with success scenario + let request: nock.Scope = nock(API_URL) + .intercept(uri, method, requestBody) + .reply(200, expectedResponse); + + // check for various success checks + checkForPromise(operation); + checkRequestInterceptor(operation, request); + checkOperation(operation, expectedResponse); + + // nock the API with error scenario + request = nock(API_URL).intercept(uri, method, requestBody).reply(500); + checkErrorHandler(operation); +}; From b6cd08e3b89ff09bc42e2bbf0d304af439988b1a Mon Sep 17 00:00:00 2001 From: Tushar Pandey Date: Fri, 8 Nov 2024 18:48:03 +0530 Subject: [PATCH 4/5] updated crud test utils, now, if no expectedResponse is provided to checkMethod(), an empty object of type T is created and request is nocked with it --- test/management/tests.util.ts | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/test/management/tests.util.ts b/test/management/tests.util.ts index 2ba06fbf1..837b0657c 100644 --- a/test/management/tests.util.ts +++ b/test/management/tests.util.ts @@ -72,13 +72,17 @@ export function checkRequestInterceptor(operation: Promise, request: nock. export function checkOperation(operation: Promise>, expectedResponse: T): void { it('should test the method', async () => { const result = await operation; - expect(result.data).toEqual(expectedResponse); + expect(result.data).toEqual( + // only compare if the expected response is defined (api returns data), in this case + // expectedResponse is an empty object + result.data ? expectedResponse : undefined + ); }); } export type CheckMethodParams = { operation: Promise>; - expectedResponse: any; + expectedResponse?: T; uri: string | RegExp | { (uri: string): boolean }; method: string; requestBody?: RequestBodyMatcher | any; @@ -102,22 +106,25 @@ export type CheckMethodParams = { * @param {string} params.method - The HTTP method to intercept (e.g., 'GET', 'POST'). * @param {RequestBodyMatcher | any} [params.requestBody] - The optional request body to match. */ -export const checkMethod = ({ +export const checkMethod = >({ operation, - expectedResponse, uri, method, requestBody, -}: CheckMethodParams): void => { + expectedResponse, +}: MethodParams): void => { + // set the expected response to an empty object if it is not provided + const finalExpectedResponse: T = expectedResponse ?? {}; + // nock the API with success scenario let request: nock.Scope = nock(API_URL) .intercept(uri, method, requestBody) - .reply(200, expectedResponse); + .reply(200, finalExpectedResponse as any); // check for various success checks checkForPromise(operation); checkRequestInterceptor(operation, request); - checkOperation(operation, expectedResponse); + checkOperation(operation, finalExpectedResponse); // nock the API with error scenario request = nock(API_URL).intercept(uri, method, requestBody).reply(500); From 02bdf7f9652c9f9268da2a7177c0ba4812f35e48 Mon Sep 17 00:00:00 2001 From: Tushar Pandey Date: Fri, 8 Nov 2024 18:48:41 +0530 Subject: [PATCH 5/5] added missing forms endpoints and tests --- .../__generated/managers/flows-manager.ts | 320 +++- .../__generated/managers/forms-manager.ts | 35 +- src/management/__generated/models/index.ts | 1281 ++++++++++++++++- test/management/flows.test.ts | 162 ++- 4 files changed, 1701 insertions(+), 97 deletions(-) diff --git a/src/management/__generated/managers/flows-manager.ts b/src/management/__generated/managers/flows-manager.ts index 5cfa12f64..ab8da3bee 100644 --- a/src/management/__generated/managers/flows-manager.ts +++ b/src/management/__generated/managers/flows-manager.ts @@ -2,14 +2,32 @@ import * as runtime from '../../../lib/runtime.js'; import type { InitOverride, ApiResponse } from '../../../lib/runtime.js'; import type { GetFlows200Response, + GetFlowsExecutions200Response, + GetFlowsExecutionsByExecutionId200Response, + GetFlowsVaultConnections200Response, PatchFlowsByIdRequest, + PatchFlowsVaultConnectionsByIdRequest, PostFlows201Response, PostFlowsRequest, + PostFlowsVaultConnections201Response, + PostFlowsVaultConnectionsRequest, GetFlows200ResponseOneOf, GetFlows200ResponseOneOfInner, + GetFlowsExecutions200ResponseOneOf, + GetFlowsExecutions200ResponseOneOfInner, + GetFlowsVaultConnections200ResponseOneOf, + GetFlowsVaultConnections200ResponseOneOfInner, + DeleteFlowsByIdRequest, + DeleteFlowsExecutionsByExecutionIdRequest, + DeleteFlowsVaultConnectionsByIdRequest, GetFlowsRequest, GetFlowsByIdRequest, + GetFlowsExecutionsRequest, + GetFlowsExecutionsByExecutionIdRequest, + GetFlowsVaultConnectionsRequest, + GetFlowsVaultConnectionsByIdRequest, PatchFlowsByIdOperationRequest, + PatchFlowsVaultConnectionsByIdOperationRequest, } from '../models/index.js'; const { BaseAPI } = runtime; @@ -18,20 +36,91 @@ const { BaseAPI } = runtime; * */ export class FlowsManager extends BaseAPI { + /** + * Delete a flow + * + * @throws {RequiredError} + */ + async delete( + requestParameters: DeleteFlowsByIdRequest, + initOverrides?: InitOverride + ): Promise> { + runtime.validateRequiredRequestParams(requestParameters, ['id']); + + const response = await this.request( + { + path: `/flows/{id}`.replace('{id}', encodeURIComponent(String(requestParameters.id))), + method: 'DELETE', + }, + initOverrides + ); + + return runtime.VoidApiResponse.fromResponse(response); + } + + /** + * Delete a flow execution + * + * @throws {RequiredError} + */ + async deleteExecution( + requestParameters: DeleteFlowsExecutionsByExecutionIdRequest, + initOverrides?: InitOverride + ): Promise> { + runtime.validateRequiredRequestParams(requestParameters, ['flow_id', 'execution_id']); + + const response = await this.request( + { + path: `/flows/{flow_id}/executions/{execution_id}` + .replace('{flow_id}', encodeURIComponent(String(requestParameters.flow_id))) + .replace('{execution_id}', encodeURIComponent(String(requestParameters.execution_id))), + method: 'DELETE', + }, + initOverrides + ); + + return runtime.VoidApiResponse.fromResponse(response); + } + + /** + * Delete a Flows Vault connection + * + * @throws {RequiredError} + */ + async deleteConnection( + requestParameters: DeleteFlowsVaultConnectionsByIdRequest, + initOverrides?: InitOverride + ): Promise> { + runtime.validateRequiredRequestParams(requestParameters, ['id']); + + const response = await this.request( + { + path: `/flows/vault/connections/{id}`.replace( + '{id}', + encodeURIComponent(String(requestParameters.id)) + ), + method: 'DELETE', + }, + initOverrides + ); + + return runtime.VoidApiResponse.fromResponse(response); + } + /** * Get flows * * @throws {RequiredError} */ - async getFlows( + async getAll( requestParameters: GetFlowsRequest & { include_totals: true }, initOverrides?: InitOverride ): Promise>; - async getFlows( + async getAll( requestParameters?: GetFlowsRequest, initOverrides?: InitOverride ): Promise>>; - async getFlows( + async getAll( requestParameters: GetFlowsRequest = {}, initOverrides?: InitOverride ): Promise> { @@ -78,7 +167,7 @@ export class FlowsManager extends BaseAPI { * * @throws {RequiredError} */ - async getFlowsById( + async get( requestParameters: GetFlowsByIdRequest, initOverrides?: InitOverride ): Promise> { @@ -106,12 +195,173 @@ export class FlowsManager extends BaseAPI { return runtime.JSONApiResponse.fromResponse(response); } + /** + * Get flow executions + * + * @throws {RequiredError} + */ + async getAllExecutions( + requestParameters: GetFlowsExecutionsRequest & { include_totals: true }, + initOverrides?: InitOverride + ): Promise>; + async getAllExecutions( + requestParameters?: GetFlowsExecutionsRequest, + initOverrides?: InitOverride + ): Promise>>; + async getAllExecutions( + requestParameters: GetFlowsExecutionsRequest, + initOverrides?: InitOverride + ): Promise> { + runtime.validateRequiredRequestParams(requestParameters, ['flow_id']); + + const queryParameters = runtime.applyQueryParams(requestParameters, [ + { + key: 'page', + config: {}, + }, + { + key: 'per_page', + config: {}, + }, + { + key: 'include_totals', + config: {}, + }, + { + key: 'from', + config: {}, + }, + { + key: 'take', + config: {}, + }, + ]); + + const response = await this.request( + { + path: `/flows/{flow_id}/executions`.replace( + '{flow_id}', + encodeURIComponent(String(requestParameters.flow_id)) + ), + method: 'GET', + query: queryParameters, + }, + initOverrides + ); + + return runtime.JSONApiResponse.fromResponse(response); + } + + /** + * Get a flow execution + * + * @throws {RequiredError} + */ + async getExecution( + requestParameters: GetFlowsExecutionsByExecutionIdRequest, + initOverrides?: InitOverride + ): Promise> { + runtime.validateRequiredRequestParams(requestParameters, ['flow_id', 'execution_id']); + + const queryParameters = runtime.applyQueryParams(requestParameters, [ + { + key: 'hydrate', + config: { + isArray: true, + isCollectionFormatMulti: true, + }, + }, + ]); + + const response = await this.request( + { + path: `/flows/{flow_id}/executions/{execution_id}` + .replace('{flow_id}', encodeURIComponent(String(requestParameters.flow_id))) + .replace('{execution_id}', encodeURIComponent(String(requestParameters.execution_id))), + method: 'GET', + query: queryParameters, + }, + initOverrides + ); + + return runtime.JSONApiResponse.fromResponse(response); + } + + /** + * Get Flows Vault connection list + * + * @throws {RequiredError} + */ + async getAllConnections( + requestParameters: GetFlowsVaultConnectionsRequest & { include_totals: true }, + initOverrides?: InitOverride + ): Promise>; + async getAllConnections( + requestParameters?: GetFlowsVaultConnectionsRequest, + initOverrides?: InitOverride + ): Promise>>; + async getAllConnections( + requestParameters: GetFlowsVaultConnectionsRequest = {}, + initOverrides?: InitOverride + ): Promise> { + const queryParameters = runtime.applyQueryParams(requestParameters, [ + { + key: 'page', + config: {}, + }, + { + key: 'per_page', + config: {}, + }, + { + key: 'include_totals', + config: {}, + }, + ]); + + const response = await this.request( + { + path: `/flows/vault/connections`, + method: 'GET', + query: queryParameters, + }, + initOverrides + ); + + return runtime.JSONApiResponse.fromResponse(response); + } + + /** + * Get a Flows Vault connection + * + * @throws {RequiredError} + */ + async getConnection( + requestParameters: GetFlowsVaultConnectionsByIdRequest, + initOverrides?: InitOverride + ): Promise> { + runtime.validateRequiredRequestParams(requestParameters, ['id']); + + const response = await this.request( + { + path: `/flows/vault/connections/{id}`.replace( + '{id}', + encodeURIComponent(String(requestParameters.id)) + ), + method: 'GET', + }, + initOverrides + ); + + return runtime.JSONApiResponse.fromResponse(response); + } + /** * Update a flow * * @throws {RequiredError} */ - async patchFlowsById( + async update( requestParameters: PatchFlowsByIdOperationRequest, bodyParameters: PatchFlowsByIdRequest, initOverrides?: InitOverride @@ -135,12 +385,44 @@ export class FlowsManager extends BaseAPI { return runtime.JSONApiResponse.fromResponse(response); } + /** + * Update a Flows Vault connection + * + * @throws {RequiredError} + */ + async updateConnection( + requestParameters: PatchFlowsVaultConnectionsByIdOperationRequest, + bodyParameters: PatchFlowsVaultConnectionsByIdRequest, + initOverrides?: InitOverride + ): Promise> { + runtime.validateRequiredRequestParams(requestParameters, ['id']); + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + const response = await this.request( + { + path: `/flows/vault/connections/{id}`.replace( + '{id}', + encodeURIComponent(String(requestParameters.id)) + ), + method: 'PATCH', + headers: headerParameters, + body: bodyParameters, + }, + initOverrides + ); + + return runtime.JSONApiResponse.fromResponse(response); + } + /** * Create a flow * * @throws {RequiredError} */ - async postFlows( + async create( bodyParameters: PostFlowsRequest, initOverrides?: InitOverride ): Promise> { @@ -160,4 +442,30 @@ export class FlowsManager extends BaseAPI { return runtime.JSONApiResponse.fromResponse(response); } + + /** + * Create a Flows Vault connection + * + * @throws {RequiredError} + */ + async createConnection( + bodyParameters: PostFlowsVaultConnectionsRequest, + initOverrides?: InitOverride + ): Promise> { + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + const response = await this.request( + { + path: `/flows/vault/connections`, + method: 'POST', + headers: headerParameters, + body: bodyParameters, + }, + initOverrides + ); + + return runtime.JSONApiResponse.fromResponse(response); + } } diff --git a/src/management/__generated/managers/forms-manager.ts b/src/management/__generated/managers/forms-manager.ts index 89cb280c7..d7b385173 100644 --- a/src/management/__generated/managers/forms-manager.ts +++ b/src/management/__generated/managers/forms-manager.ts @@ -7,6 +7,7 @@ import type { PostFormsRequest, GetForms200ResponseOneOf, GetForms200ResponseOneOfInner, + DeleteFormsByIdRequest, GetFormsRequest, GetFormsByIdRequest, PatchFormsByIdOperationRequest, @@ -18,20 +19,42 @@ const { BaseAPI } = runtime; * */ export class FormsManager extends BaseAPI { + /** + * Delete a form + * + * @throws {RequiredError} + */ + async delete( + requestParameters: DeleteFormsByIdRequest, + initOverrides?: InitOverride + ): Promise> { + runtime.validateRequiredRequestParams(requestParameters, ['id']); + + const response = await this.request( + { + path: `/forms/{id}`.replace('{id}', encodeURIComponent(String(requestParameters.id))), + method: 'DELETE', + }, + initOverrides + ); + + return runtime.VoidApiResponse.fromResponse(response); + } + /** * Get forms * * @throws {RequiredError} */ - async getForms( + async getAll( requestParameters: GetFormsRequest & { include_totals: true }, initOverrides?: InitOverride ): Promise>; - async getForms( + async getAll( requestParameters?: GetFormsRequest, initOverrides?: InitOverride ): Promise>>; - async getForms( + async getAll( requestParameters: GetFormsRequest = {}, initOverrides?: InitOverride ): Promise> { @@ -74,7 +97,7 @@ export class FormsManager extends BaseAPI { * * @throws {RequiredError} */ - async getFormsById( + async get( requestParameters: GetFormsByIdRequest, initOverrides?: InitOverride ): Promise> { @@ -107,7 +130,7 @@ export class FormsManager extends BaseAPI { * * @throws {RequiredError} */ - async patchFormsById( + async update( requestParameters: PatchFormsByIdOperationRequest, bodyParameters: PatchFormsByIdRequest, initOverrides?: InitOverride @@ -136,7 +159,7 @@ export class FormsManager extends BaseAPI { * * @throws {RequiredError} */ - async postForms( + async create( bodyParameters: PostFormsRequest, initOverrides?: InitOverride ): Promise> { diff --git a/src/management/__generated/models/index.ts b/src/management/__generated/models/index.ts index f43caab4d..3c89ac721 100644 --- a/src/management/__generated/models/index.ts +++ b/src/management/__generated/models/index.ts @@ -5525,6 +5525,195 @@ export interface GetFlows200ResponseOneOfInner { */ executed_at?: string; } +/** + * + */ +export type GetFlowsExecutions200Response = + | Array + | GetFlowsExecutions200ResponseOneOf; +/** + * + */ +export interface GetFlowsExecutions200ResponseOneOf { + /** + */ + start: number; + /** + */ + limit: number; + /** + */ + total: number; + /** + */ + executions: Array; +} +/** + * + */ +export interface GetFlowsExecutions200ResponseOneOfInner { + /** + * Flow execution identifier + * + */ + id: string; + /** + * Trace id + * + */ + trace_id: string; + /** + * Journey id + * + */ + journey_id?: string; + /** + * Execution status + * + */ + status: string; + /** + * The ISO 8601 formatted date when this flow execution was created. + * + */ + created_at: string; + /** + * The ISO 8601 formatted date when this flow execution was updated. + * + */ + updated_at: string; + /** + * The ISO 8601 formatted date when this flow execution started. + * + */ + started_at?: string; + /** + * The ISO 8601 formatted date when this flow execution ended. + * + */ + ended_at?: string; +} +/** + * + */ +export interface GetFlowsExecutionsByExecutionId200Response { + /** + * Flow execution identifier + * + */ + id: string; + /** + * Trace id + * + */ + trace_id: string; + /** + * Journey id + * + */ + journey_id?: string; + /** + * Execution status + * + */ + status: string; + /** + * Flow execution debug. + * + */ + debug?: { [key: string]: any }; + /** + * The ISO 8601 formatted date when this flow execution was created. + * + */ + created_at: string; + /** + * The ISO 8601 formatted date when this flow execution was updated. + * + */ + updated_at: string; + /** + * The ISO 8601 formatted date when this flow execution started. + * + */ + started_at?: string; + /** + * The ISO 8601 formatted date when this flow execution ended. + * + */ + ended_at?: string; +} +/** + * + */ +export type GetFlowsVaultConnections200Response = + | Array + | GetFlowsVaultConnections200ResponseOneOf; +/** + * + */ +export interface GetFlowsVaultConnections200ResponseOneOf { + /** + */ + start: number; + /** + */ + limit: number; + /** + */ + total: number; + /** + */ + connections: Array; +} +/** + * + */ +export interface GetFlowsVaultConnections200ResponseOneOfInner { + /** + * Flows Vault Connection identifier. + * + */ + id: string; + /** + * Flows Vault Connection app identifier. + * + */ + app_id: string; + /** + * Flows Vault Connection name. + * + */ + name: string; + /** + * Flows Vault Connection custom account name. + * + */ + account_name?: string; + /** + * Whether the Flows Vault Connection is configured. + * + */ + ready: boolean; + /** + * The ISO 8601 formatted date when this Flows Vault Connection was created. + * + */ + created_at: string; + /** + * The ISO 8601 formatted date when this Flows Vault Connection was updated. + * + */ + updated_at: string; + /** + * The ISO 8601 formatted date when this Flows Vault Connection was refreshed. + * + */ + refreshed_at?: string; + /** + */ + fingerprint: string; +} /** * */ @@ -8704,6 +8893,37 @@ export interface PatchFlowsByIdRequest { */ actions?: Array; } +/** + * + */ +export interface PatchFlowsVaultConnectionsByIdRequest { + /** + * Flows Vault Connection name. + * + */ + name?: string; + /** + */ + setup?: PatchFlowsVaultConnectionsByIdRequestSetup; +} +/** + * Flows Vault Connection configuration. + */ +export type PatchFlowsVaultConnectionsByIdRequestSetup = + | PostFlowsVaultConnectionsRequestAnyOf11Setup + | PostFlowsVaultConnectionsRequestAnyOf12SetupAnyOf + | PostFlowsVaultConnectionsRequestAnyOf15SetupAnyOf + | PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOf + | PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOf1 + | PostFlowsVaultConnectionsRequestAnyOf18Setup + | PostFlowsVaultConnectionsRequestAnyOf1Setup + | PostFlowsVaultConnectionsRequestAnyOf2Setup + | PostFlowsVaultConnectionsRequestAnyOf3Setup + | PostFlowsVaultConnectionsRequestAnyOf4Setup + | PostFlowsVaultConnectionsRequestAnyOf5Setup + | PostFlowsVaultConnectionsRequestAnyOf7Setup + | PostFlowsVaultConnectionsRequestAnyOf9Setup + | PostFlowsVaultConnectionsRequestAnyOfSetup; /** * */ @@ -9931,117 +10151,930 @@ export const PostEmailTemplatesRequestTemplateEnum = { change_password: 'change_password', password_reset: 'password_reset', } as const; -export type PostEmailTemplatesRequestTemplateEnum = - (typeof PostEmailTemplatesRequestTemplateEnum)[keyof typeof PostEmailTemplatesRequestTemplateEnum]; +export type PostEmailTemplatesRequestTemplateEnum = + (typeof PostEmailTemplatesRequestTemplateEnum)[keyof typeof PostEmailTemplatesRequestTemplateEnum]; + +/** + * + */ +export interface PostEmailVerification201Response { + [key: string]: any | any; + /** + * URL representing the ticket. + * + */ + ticket: string; +} +/** + * + */ +export interface PostEmailVerificationRequest { + /** + * URL the user will be redirected to in the classic Universal Login experience once the ticket is used. + * + */ + result_url?: string; + /** + * user_id of for whom the ticket should be created. + * + */ + user_id: string; + /** + * ID of the client. If provided for tenants using New Universal Login experience, the user will be prompted to redirect to the default login route of the corresponding application once the ticket is used. See Configuring Default Login Routes for more details. + * + */ + client_id?: string; + /** + * (Optional) Organization ID – the ID of the Organization. If provided, organization parameters will be made available to the email template and organization branding will be applied to the prompt. In addition, the redirect link in the prompt will include organization_id and organization_name query string parameters. + * + */ + organization_id?: string; + /** + * Number of seconds for which the ticket is valid before expiration. If unspecified or set to 0, this value defaults to 432000 seconds (5 days). + * + */ + ttl_sec?: number; + /** + * Whether to include the email address as part of the returnUrl in the reset_email (true), or not (false). + * + */ + includeEmailInRedirect?: boolean; + /** + */ + identity?: PostVerificationEmailRequestIdentity; +} +/** + * + */ +export interface PostEnabledConnectionsRequest { + /** + * Single connection ID to add to the organization. + * + */ + connection_id: string; + /** + * When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection. + * + */ + assign_membership_on_login?: boolean; + /** + * Determines whether organization signup should be enabled for this organization connection. Only applicable for database connections. Default: false. + * + */ + is_signup_enabled?: boolean; + /** + * Determines whether a connection should be displayed on this organization’s login prompt. Only applicable for enterprise connections. Default: true. + * + */ + show_as_button?: boolean; +} +/** + * + */ +export interface PostFlows201Response { + /** + */ + id: string; + /** + */ + name: string; + /** + */ + actions?: Array; + /** + */ + created_at: string; + /** + */ + updated_at: string; + /** + */ + executed_at?: string; +} +/** + * + */ +export interface PostFlowsRequest { + /** + */ + name: string; + /** + */ + actions?: Array; +} +/** + * + */ +export interface PostFlowsVaultConnections201Response { + /** + * Flows Vault Connection identifier. + * + */ + id: string; + /** + * Flows Vault Connection app identifier. + * + */ + app_id: string; + /** + * Flows Vault Connection environment. + * + */ + environment?: string; + /** + * Flows Vault Connection name. + * + */ + name: string; + /** + * Flows Vault Connection custom account name. + * + */ + account_name?: string; + /** + * Whether the Flows Vault Connection is configured. + * + */ + ready: boolean; + /** + * The ISO 8601 formatted date when this Flows Vault Connection was created. + * + */ + created_at: string; + /** + * The ISO 8601 formatted date when this Flows Vault Connection was updated. + * + */ + updated_at: string; + /** + * The ISO 8601 formatted date when this Flows Vault Connection was refreshed. + * + */ + refreshed_at?: string; + /** + */ + fingerprint: string; +} +/** + * + */ +export type PostFlowsVaultConnectionsRequest = + | PostFlowsVaultConnectionsRequestAnyOf + | PostFlowsVaultConnectionsRequestAnyOf1 + | PostFlowsVaultConnectionsRequestAnyOf10 + | PostFlowsVaultConnectionsRequestAnyOf11 + | PostFlowsVaultConnectionsRequestAnyOf12 + | PostFlowsVaultConnectionsRequestAnyOf13 + | PostFlowsVaultConnectionsRequestAnyOf14 + | PostFlowsVaultConnectionsRequestAnyOf15 + | PostFlowsVaultConnectionsRequestAnyOf16 + | PostFlowsVaultConnectionsRequestAnyOf17 + | PostFlowsVaultConnectionsRequestAnyOf18 + | PostFlowsVaultConnectionsRequestAnyOf19 + | PostFlowsVaultConnectionsRequestAnyOf2 + | PostFlowsVaultConnectionsRequestAnyOf20 + | PostFlowsVaultConnectionsRequestAnyOf3 + | PostFlowsVaultConnectionsRequestAnyOf4 + | PostFlowsVaultConnectionsRequestAnyOf5 + | PostFlowsVaultConnectionsRequestAnyOf6 + | PostFlowsVaultConnectionsRequestAnyOf7 + | PostFlowsVaultConnectionsRequestAnyOf8 + | PostFlowsVaultConnectionsRequestAnyOf9; +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf { + [key: string]: any | any; + /** + */ + app_id?: PostFlowsVaultConnectionsRequestAnyOfAppIdEnum; + /** + */ + setup?: PostFlowsVaultConnectionsRequestAnyOfSetup; +} + +export const PostFlowsVaultConnectionsRequestAnyOfAppIdEnum = { + ACTIVECAMPAIGN: 'ACTIVECAMPAIGN', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOfAppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOfAppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOfAppIdEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf1 { + [key: string]: any | any; + /** + */ + app_id?: PostFlowsVaultConnectionsRequestAnyOf1AppIdEnum; + /** + */ + setup?: PostFlowsVaultConnectionsRequestAnyOf1Setup; +} + +export const PostFlowsVaultConnectionsRequestAnyOf1AppIdEnum = { + AIRTABLE: 'AIRTABLE', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf1AppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf1AppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf1AppIdEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf10 { + [key: string]: any | any; + /** + */ + app_id?: PostFlowsVaultConnectionsRequestAnyOf10AppIdEnum; + /** + */ + setup?: PostFlowsVaultConnectionsRequestAnyOf10Setup; +} + +export const PostFlowsVaultConnectionsRequestAnyOf10AppIdEnum = { + MAILCHIMP: 'MAILCHIMP', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf10AppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf10AppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf10AppIdEnum]; + +/** + * + */ +export type PostFlowsVaultConnectionsRequestAnyOf10Setup = + | PostFlowsVaultConnectionsRequestAnyOf4Setup + | PostFlowsVaultConnectionsRequestAnyOf5Setup; +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf11 { + [key: string]: any | any; + /** + */ + app_id?: PostFlowsVaultConnectionsRequestAnyOf11AppIdEnum; + /** + */ + setup?: PostFlowsVaultConnectionsRequestAnyOf11Setup; +} + +export const PostFlowsVaultConnectionsRequestAnyOf11AppIdEnum = { + MAILJET: 'MAILJET', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf11AppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf11AppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf11AppIdEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf11Setup { + /** + */ + type: PostFlowsVaultConnectionsRequestAnyOf11SetupTypeEnum; + /** + */ + api_key: string; + /** + */ + secret_key: string; +} + +export const PostFlowsVaultConnectionsRequestAnyOf11SetupTypeEnum = { + API_KEY: 'API_KEY', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf11SetupTypeEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf11SetupTypeEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf11SetupTypeEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf12 { + [key: string]: any | any; + /** + */ + app_id?: PostFlowsVaultConnectionsRequestAnyOf12AppIdEnum; + /** + */ + setup?: PostFlowsVaultConnectionsRequestAnyOf12Setup; +} + +export const PostFlowsVaultConnectionsRequestAnyOf12AppIdEnum = { + PIPEDRIVE: 'PIPEDRIVE', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf12AppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf12AppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf12AppIdEnum]; + +/** + * + */ +export type PostFlowsVaultConnectionsRequestAnyOf12Setup = + | PostFlowsVaultConnectionsRequestAnyOf12SetupAnyOf + | PostFlowsVaultConnectionsRequestAnyOf5Setup; +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf12SetupAnyOf { + /** + */ + type: PostFlowsVaultConnectionsRequestAnyOf12SetupAnyOfTypeEnum; + /** + */ + token: string; +} + +export const PostFlowsVaultConnectionsRequestAnyOf12SetupAnyOfTypeEnum = { + TOKEN: 'TOKEN', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf12SetupAnyOfTypeEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf12SetupAnyOfTypeEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf12SetupAnyOfTypeEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf13 { + [key: string]: any | any; + /** + */ + app_id?: PostFlowsVaultConnectionsRequestAnyOf13AppIdEnum; + /** + */ + setup?: PostFlowsVaultConnectionsRequestAnyOf5Setup; +} + +export const PostFlowsVaultConnectionsRequestAnyOf13AppIdEnum = { + SALESFORCE: 'SALESFORCE', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf13AppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf13AppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf13AppIdEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf14 { + [key: string]: any | any; + /** + */ + app_id?: PostFlowsVaultConnectionsRequestAnyOf14AppIdEnum; + /** + */ + setup?: PostFlowsVaultConnectionsRequestAnyOf1Setup; +} + +export const PostFlowsVaultConnectionsRequestAnyOf14AppIdEnum = { + SENDGRID: 'SENDGRID', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf14AppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf14AppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf14AppIdEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf15 { + [key: string]: any | any; + /** + */ + app_id?: PostFlowsVaultConnectionsRequestAnyOf15AppIdEnum; + /** + */ + setup?: PostFlowsVaultConnectionsRequestAnyOf15Setup; +} + +export const PostFlowsVaultConnectionsRequestAnyOf15AppIdEnum = { + SLACK: 'SLACK', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf15AppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf15AppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf15AppIdEnum]; + +/** + * + */ +export type PostFlowsVaultConnectionsRequestAnyOf15Setup = + | PostFlowsVaultConnectionsRequestAnyOf15SetupAnyOf + | PostFlowsVaultConnectionsRequestAnyOf5Setup; +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf15SetupAnyOf { + /** + */ + type: PostFlowsVaultConnectionsRequestAnyOf15SetupAnyOfTypeEnum; + /** + */ + url: string; +} + +export const PostFlowsVaultConnectionsRequestAnyOf15SetupAnyOfTypeEnum = { + WEBHOOK: 'WEBHOOK', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf15SetupAnyOfTypeEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf15SetupAnyOfTypeEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf15SetupAnyOfTypeEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf16 { + [key: string]: any | any; + /** + */ + app_id?: PostFlowsVaultConnectionsRequestAnyOf16AppIdEnum; + /** + */ + setup?: PostFlowsVaultConnectionsRequestAnyOf16Setup; +} + +export const PostFlowsVaultConnectionsRequestAnyOf16AppIdEnum = { + STRIPE: 'STRIPE', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf16AppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf16AppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf16AppIdEnum]; + +/** + * + */ +export type PostFlowsVaultConnectionsRequestAnyOf16Setup = + | PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOf + | PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOf1; +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOf { + /** + */ + type: PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOfTypeEnum; + /** + */ + private_key: string; + /** + */ + public_key: string; +} + +export const PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOfTypeEnum = { + KEY_PAIR: 'KEY_PAIR', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOfTypeEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOfTypeEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOfTypeEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOf1 { + [key: string]: any | any; + /** + */ + type?: PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOf1TypeEnum; + /** + */ + code?: string; + /** + */ + environment?: PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOf1EnvironmentEnum; +} + +export const PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOf1TypeEnum = { + OAUTH_CODE: 'OAUTH_CODE', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOf1TypeEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOf1TypeEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOf1TypeEnum]; + +export const PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOf1EnvironmentEnum = { + live: 'live', + test: 'test', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOf1EnvironmentEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOf1EnvironmentEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf16SetupAnyOf1EnvironmentEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf17 { + [key: string]: any | any; + /** + */ + app_id?: PostFlowsVaultConnectionsRequestAnyOf17AppIdEnum; + /** + */ + setup?: PostFlowsVaultConnectionsRequestAnyOf12SetupAnyOf; +} + +export const PostFlowsVaultConnectionsRequestAnyOf17AppIdEnum = { + TELEGRAM: 'TELEGRAM', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf17AppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf17AppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf17AppIdEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf18 { + [key: string]: any | any; + /** + */ + app_id?: PostFlowsVaultConnectionsRequestAnyOf18AppIdEnum; + /** + */ + setup?: PostFlowsVaultConnectionsRequestAnyOf18Setup; +} + +export const PostFlowsVaultConnectionsRequestAnyOf18AppIdEnum = { + TWILIO: 'TWILIO', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf18AppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf18AppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf18AppIdEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf18Setup { + /** + */ + type: PostFlowsVaultConnectionsRequestAnyOf18SetupTypeEnum; + /** + */ + account_id: string; + /** + */ + api_key: string; +} + +export const PostFlowsVaultConnectionsRequestAnyOf18SetupTypeEnum = { + API_KEY: 'API_KEY', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf18SetupTypeEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf18SetupTypeEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf18SetupTypeEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf19 { + [key: string]: any | any; + /** + */ + app_id?: PostFlowsVaultConnectionsRequestAnyOf19AppIdEnum; + /** + */ + setup?: PostFlowsVaultConnectionsRequestAnyOf12SetupAnyOf; +} + +export const PostFlowsVaultConnectionsRequestAnyOf19AppIdEnum = { + WHATSAPP: 'WHATSAPP', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf19AppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf19AppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf19AppIdEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf1Setup { + /** + */ + type: PostFlowsVaultConnectionsRequestAnyOf1SetupTypeEnum; + /** + */ + api_key: string; +} + +export const PostFlowsVaultConnectionsRequestAnyOf1SetupTypeEnum = { + API_KEY: 'API_KEY', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf1SetupTypeEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf1SetupTypeEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf1SetupTypeEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf2 { + [key: string]: any | any; + /** + */ + app_id?: PostFlowsVaultConnectionsRequestAnyOf2AppIdEnum; + /** + */ + setup?: PostFlowsVaultConnectionsRequestAnyOf2Setup; +} + +export const PostFlowsVaultConnectionsRequestAnyOf2AppIdEnum = { + AUTH0: 'AUTH0', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf2AppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf2AppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf2AppIdEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf20 { + [key: string]: any | any; + /** + */ + app_id?: PostFlowsVaultConnectionsRequestAnyOf20AppIdEnum; + /** + */ + setup?: PostFlowsVaultConnectionsRequestAnyOf15SetupAnyOf; +} + +export const PostFlowsVaultConnectionsRequestAnyOf20AppIdEnum = { + ZAPIER: 'ZAPIER', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf20AppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf20AppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf20AppIdEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf2Setup { + /** + */ + type: PostFlowsVaultConnectionsRequestAnyOf2SetupTypeEnum; + /** + */ + client_id: string; + /** + */ + client_secret: string; + /** + */ + domain: string; +} + +export const PostFlowsVaultConnectionsRequestAnyOf2SetupTypeEnum = { + OAUTH_APP: 'OAUTH_APP', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf2SetupTypeEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf2SetupTypeEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf2SetupTypeEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf3 { + [key: string]: any | any; + /** + */ + app_id?: PostFlowsVaultConnectionsRequestAnyOf3AppIdEnum; + /** + */ + setup?: PostFlowsVaultConnectionsRequestAnyOf3Setup; +} + +export const PostFlowsVaultConnectionsRequestAnyOf3AppIdEnum = { + BIGQUERY: 'BIGQUERY', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf3AppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf3AppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf3AppIdEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf3Setup { + /** + */ + type?: PostFlowsVaultConnectionsRequestAnyOf3SetupTypeEnum; + /** + */ + project_id?: string; + /** + */ + private_key?: string; + /** + */ + client_email?: string; +} + +export const PostFlowsVaultConnectionsRequestAnyOf3SetupTypeEnum = { + OAUTH_JWT: 'OAUTH_JWT', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf3SetupTypeEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf3SetupTypeEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf3SetupTypeEnum]; /** * */ -export interface PostEmailVerification201Response { +export interface PostFlowsVaultConnectionsRequestAnyOf4 { [key: string]: any | any; /** - * URL representing the ticket. - * */ - ticket: string; + app_id?: PostFlowsVaultConnectionsRequestAnyOf4AppIdEnum; + /** + */ + setup?: PostFlowsVaultConnectionsRequestAnyOf4Setup; } + +export const PostFlowsVaultConnectionsRequestAnyOf4AppIdEnum = { + CLEARBIT: 'CLEARBIT', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf4AppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf4AppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf4AppIdEnum]; + /** * */ -export interface PostEmailVerificationRequest { +export interface PostFlowsVaultConnectionsRequestAnyOf4Setup { /** - * URL the user will be redirected to in the classic Universal Login experience once the ticket is used. - * */ - result_url?: string; + type: PostFlowsVaultConnectionsRequestAnyOf4SetupTypeEnum; /** - * user_id of for whom the ticket should be created. - * */ - user_id: string; + secret_key: string; +} + +export const PostFlowsVaultConnectionsRequestAnyOf4SetupTypeEnum = { + API_KEY: 'API_KEY', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf4SetupTypeEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf4SetupTypeEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf4SetupTypeEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf5 { + [key: string]: any | any; /** - * ID of the client. If provided for tenants using New Universal Login experience, the user will be prompted to redirect to the default login route of the corresponding application once the ticket is used. See Configuring Default Login Routes for more details. - * */ - client_id?: string; + app_id?: PostFlowsVaultConnectionsRequestAnyOf5AppIdEnum; /** - * (Optional) Organization ID – the ID of the Organization. If provided, organization parameters will be made available to the email template and organization branding will be applied to the prompt. In addition, the redirect link in the prompt will include organization_id and organization_name query string parameters. - * */ - organization_id?: string; + setup?: PostFlowsVaultConnectionsRequestAnyOf5Setup; +} + +export const PostFlowsVaultConnectionsRequestAnyOf5AppIdEnum = { + DOCUSIGN: 'DOCUSIGN', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf5AppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf5AppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf5AppIdEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf5Setup { + [key: string]: any | any; /** - * Number of seconds for which the ticket is valid before expiration. If unspecified or set to 0, this value defaults to 432000 seconds (5 days). - * */ - ttl_sec?: number; + type?: PostFlowsVaultConnectionsRequestAnyOf5SetupTypeEnum; /** - * Whether to include the email address as part of the returnUrl in the reset_email (true), or not (false). - * */ - includeEmailInRedirect?: boolean; + code?: string; +} + +export const PostFlowsVaultConnectionsRequestAnyOf5SetupTypeEnum = { + OAUTH_CODE: 'OAUTH_CODE', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf5SetupTypeEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf5SetupTypeEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf5SetupTypeEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf6 { + [key: string]: any | any; /** */ - identity?: PostVerificationEmailRequestIdentity; + app_id?: PostFlowsVaultConnectionsRequestAnyOf6AppIdEnum; + /** + */ + setup?: PostFlowsVaultConnectionsRequestAnyOf5Setup; } + +export const PostFlowsVaultConnectionsRequestAnyOf6AppIdEnum = { + GOOGLE_SHEETS: 'GOOGLE_SHEETS', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf6AppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf6AppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf6AppIdEnum]; + /** * */ -export interface PostEnabledConnectionsRequest { +export interface PostFlowsVaultConnectionsRequestAnyOf7 { + [key: string]: any | any; /** - * Single connection ID to add to the organization. - * */ - connection_id: string; + app_id?: PostFlowsVaultConnectionsRequestAnyOf7AppIdEnum; /** - * When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection. - * */ - assign_membership_on_login?: boolean; + setup?: PostFlowsVaultConnectionsRequestAnyOf7Setup; +} + +export const PostFlowsVaultConnectionsRequestAnyOf7AppIdEnum = { + HTTP: 'HTTP', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf7AppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf7AppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf7AppIdEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf7Setup { /** - * Determines whether organization signup should be enabled for this organization connection. Only applicable for database connections. Default: false. - * */ - is_signup_enabled?: boolean; + type: PostFlowsVaultConnectionsRequestAnyOf7SetupTypeEnum; /** - * Determines whether a connection should be displayed on this organization’s login prompt. Only applicable for enterprise connections. Default: true. - * */ - show_as_button?: boolean; + token: string; } + +export const PostFlowsVaultConnectionsRequestAnyOf7SetupTypeEnum = { + BEARER: 'BEARER', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf7SetupTypeEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf7SetupTypeEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf7SetupTypeEnum]; + /** * */ -export interface PostFlows201Response { +export interface PostFlowsVaultConnectionsRequestAnyOf8 { + [key: string]: any | any; /** */ - id: string; + app_id?: PostFlowsVaultConnectionsRequestAnyOf8AppIdEnum; /** */ - name: string; + setup?: PostFlowsVaultConnectionsRequestAnyOf8Setup; +} + +export const PostFlowsVaultConnectionsRequestAnyOf8AppIdEnum = { + HUBSPOT: 'HUBSPOT', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf8AppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf8AppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf8AppIdEnum]; + +/** + * + */ +export type PostFlowsVaultConnectionsRequestAnyOf8Setup = + | PostFlowsVaultConnectionsRequestAnyOf1Setup + | PostFlowsVaultConnectionsRequestAnyOf5Setup; +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf9 { + [key: string]: any | any; /** */ - actions?: Array; + app_id?: PostFlowsVaultConnectionsRequestAnyOf9AppIdEnum; /** */ - created_at: string; + setup?: PostFlowsVaultConnectionsRequestAnyOf9Setup; +} + +export const PostFlowsVaultConnectionsRequestAnyOf9AppIdEnum = { + JWT: 'JWT', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf9AppIdEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf9AppIdEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf9AppIdEnum]; + +/** + * + */ +export interface PostFlowsVaultConnectionsRequestAnyOf9Setup { + [key: string]: any | any; /** */ - updated_at: string; + type: PostFlowsVaultConnectionsRequestAnyOf9SetupTypeEnum; /** */ - executed_at?: string; + algorithm: PostFlowsVaultConnectionsRequestAnyOf9SetupAlgorithmEnum; } + +export const PostFlowsVaultConnectionsRequestAnyOf9SetupTypeEnum = { + JWT: 'JWT', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf9SetupTypeEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf9SetupTypeEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf9SetupTypeEnum]; + +export const PostFlowsVaultConnectionsRequestAnyOf9SetupAlgorithmEnum = { + HS256: 'HS256', + HS384: 'HS384', + HS512: 'HS512', + RS256: 'RS256', + RS384: 'RS384', + RS512: 'RS512', + ES256: 'ES256', + ES384: 'ES384', + ES512: 'ES512', + PS256: 'PS256', + PS384: 'PS384', + PS512: 'PS512', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOf9SetupAlgorithmEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOf9SetupAlgorithmEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOf9SetupAlgorithmEnum]; + /** * */ -export interface PostFlowsRequest { +export interface PostFlowsVaultConnectionsRequestAnyOfSetup { /** */ - name: string; + type: PostFlowsVaultConnectionsRequestAnyOfSetupTypeEnum; /** */ - actions?: Array; + api_key: string; + /** + */ + base_url?: string; } + +export const PostFlowsVaultConnectionsRequestAnyOfSetupTypeEnum = { + API_KEY: 'API_KEY', +} as const; +export type PostFlowsVaultConnectionsRequestAnyOfSetupTypeEnum = + (typeof PostFlowsVaultConnectionsRequestAnyOfSetupTypeEnum)[keyof typeof PostFlowsVaultConnectionsRequestAnyOfSetupTypeEnum]; + /** * */ @@ -15937,6 +16970,41 @@ export interface GetProviderRequest { */ include_fields?: boolean; } +/** + * + */ +export interface DeleteFlowsByIdRequest { + /** + * Flow id + * + */ + id: string; +} +/** + * + */ +export interface DeleteFlowsExecutionsByExecutionIdRequest { + /** + * Flows id + * + */ + flow_id: string; + /** + * Flow execution identifier + * + */ + execution_id: string; +} +/** + * + */ +export interface DeleteFlowsVaultConnectionsByIdRequest { + /** + * Vault connection id + * + */ + id: string; +} /** * @@ -16001,6 +17069,101 @@ export interface GetFlowsByIdRequest { */ hydrate?: Array; } +/** + * + */ +export interface GetFlowsExecutionsRequest { + /** + * Flow id + * + */ + flow_id: string; + /** + * Page index of the results to return. First page is 0. + * + */ + page?: number; + /** + * Number of results per page. Defaults to 50. + * + */ + per_page?: number; + /** + * Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). + * + */ + include_totals?: boolean; + /** + * Optional Id from which to start selection. + * + */ + from?: string; + /** + * Number of results per page. Defaults to 50. + * + */ + take?: number; +} + +/** + * + */ +export const GetFlowsExecutionsByExecutionIdHydrateEnum = { + debug: 'debug', +} as const; +export type GetFlowsExecutionsByExecutionIdHydrateEnum = + (typeof GetFlowsExecutionsByExecutionIdHydrateEnum)[keyof typeof GetFlowsExecutionsByExecutionIdHydrateEnum]; + +/** + * + */ +export interface GetFlowsExecutionsByExecutionIdRequest { + /** + * Flow id + * + */ + flow_id: string; + /** + * Flow execution id + * + */ + execution_id: string; + /** + * Hydration param + * + */ + hydrate?: Array; +} +/** + * + */ +export interface GetFlowsVaultConnectionsRequest { + /** + * Page index of the results to return. First page is 0. + * + */ + page?: number; + /** + * Number of results per page. Defaults to 50. + * + */ + per_page?: number; + /** + * Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). + * + */ + include_totals?: boolean; +} +/** + * + */ +export interface GetFlowsVaultConnectionsByIdRequest { + /** + * Flows Vault connection ID + * + */ + id: string; +} /** * */ @@ -16011,6 +17174,26 @@ export interface PatchFlowsByIdOperationRequest { */ id: string; } +/** + * + */ +export interface PatchFlowsVaultConnectionsByIdOperationRequest { + /** + * Flows Vault connection ID + * + */ + id: string; +} +/** + * + */ +export interface DeleteFormsByIdRequest { + /** + * Form id + * + */ + id: string; +} /** * diff --git a/test/management/flows.test.ts b/test/management/flows.test.ts index 605a27ca5..52092d7b8 100644 --- a/test/management/flows.test.ts +++ b/test/management/flows.test.ts @@ -1,7 +1,6 @@ import { FlowsManager } from '../../src/index.js'; import { ManagementClient } from '../../src/index.js'; import { checkMethod } from './tests.util.js'; -import { GetFlows200Response, PostFlows201Response } from '../../src/index.js'; const DOMAIN = `tenant.auth0.com`; const token = 'TOKEN'; @@ -9,49 +8,140 @@ const token = 'TOKEN'; describe('FlowsManager', () => { const flowsManager: FlowsManager = new ManagementClient({ domain: DOMAIN, token }).flows; - // this is the test for the method getFlows() - // it calls a GET endpoint and does not take any input parameters or body - describe('getFlows', () => { - const operation = flowsManager.getFlows(); - const expectedResponse: GetFlows200Response = {}; - const uri = `/flows`; - const method = 'get'; + describe('flows crud methods', () => { + // this is the test for the method getFlows() + // it calls a GET endpoint and does not take any input parameters or body + describe('getFlows', () => { + const operation = flowsManager.getAll(); + const uri = `/flows`; + const method = 'get'; - checkMethod({ operation, expectedResponse, uri, method }); - }); + checkMethod({ operation, uri, method }); + }); + + // this is the test for the method getFlowsById() + // it calls a GET endpoint and takes input parameters but no input body + describe('getFlowsById', () => { + const operation = flowsManager.get({ id: 'flowId' }); + const uri = `/flows/flowId`; + const method = 'get'; + + checkMethod({ operation, uri, method }); + }); + + // this is the test for the method patchFlowsById() + // it calls a PATCH endpoint and takes input parameters and body + describe('patchFlowsById', () => { + const requestBody: { name: string } = { name: 'flowName' }; + const operation = flowsManager.update({ id: 'flowId' }, requestBody); + const uri = `/flows/flowId`; + const method = 'patch'; + + checkMethod({ operation, uri, method, requestBody }); + }); - // this is the test for the method getFlowsById() - // it calls a GET endpoint and takes input parameters but no input body - describe('getFlowsById', () => { - const operation = flowsManager.getFlowsById({ id: 'flowId' }); - const expectedResponse: PostFlows201Response = {}; - const uri = `/flows/flowId`; - const method = 'get'; + describe('deleteFlowsById', () => { + const operation = flowsManager.delete({ id: 'flowId' }); + const uri = `/flows/flowId`; + const method = 'delete'; - checkMethod({ operation, expectedResponse, uri, method }); + checkMethod({ operation, uri, method }); + }); + + // this is the test for the method postFlows() + // it calls a POST endpoint and takes only a body + describe('postFlows', () => { + const requestBody: { name: string } = { name: 'flowName' }; + const operation = flowsManager.create(requestBody); + const uri = `/flows`; + const method = 'post'; + checkMethod({ operation, uri, method, requestBody }); + }); }); - // this is the test for the method patchFlowsById() - // it calls a PATCH endpoint and takes input parameters and body - describe('patchFlowsById', () => { - const requestBody: { name: string } = { name: 'flowName' }; - const operation = flowsManager.patchFlowsById({ id: 'flowId' }, requestBody); - const expectedResponse: PostFlows201Response = {}; - const uri = `/flows/flowId`; - const method = 'patch'; + describe('connections crud methods', () => { + // this is the test for the method getConnections() + // it calls a GET endpoint and does not take any input parameters or body + describe('getConnections', () => { + const operation = flowsManager.getAllConnections(); + const uri = `/flows/vault/connections`; + const method = 'get'; + + checkMethod({ operation, uri, method }); + }); + + // this is the test for the method getConnectionsById() + // it calls a GET endpoint and takes input parameters but no input body + describe('getConnectionsById', () => { + const operation = flowsManager.getConnection({ id: 'connectionId' }); + const uri = `/flows/vault/connections/connectionId`; + const method = 'get'; + + checkMethod({ operation, uri, method }); + }); - checkMethod({ operation, expectedResponse, uri, method, requestBody }); + // this is the test for the method patchConnectionsById() + // it calls a PATCH endpoint and takes input parameters and body + describe('patchConnectionsById', () => { + const requestBody: { name: string } = { name: 'flowName' }; + const operation = flowsManager.updateConnection({ id: 'connectionId' }, requestBody); + const uri = `/flows/vault/connections/connectionId`; + const method = 'patch'; + + checkMethod({ operation, uri, method, requestBody }); + }); + + describe('deleteConnectionsById', () => { + const operation = flowsManager.deleteConnection({ id: 'connectionId' }); + const uri = `/flows/vault/connections/connectionId`; + const method = 'delete'; + + checkMethod({ operation, uri, method }); + }); + + // this is the test for the method postConnections() + // it calls a POST endpoint and takes only a body + describe('postConnections', () => { + const requestBody: { name: string } = { name: 'flowName' }; + const operation = flowsManager.createConnection(requestBody); + const uri = `/flows/vault/connections`; + const method = 'post'; + checkMethod({ operation, uri, method, requestBody }); + }); }); - // this is the test for the method postFlows() - // it calls a POST endpoint and takes only a body - describe('postFlows', () => { - const requestBody: { name: string } = { name: 'flowName' }; - const operation = flowsManager.postFlows(requestBody); - const expectedResponse: PostFlows201Response = {}; - const uri = `/flows`; - const method = 'post'; + describe('execution crud methods', () => { + // this is the test for the method getAllExecutions() + // it calls a GET endpoint and does not take any input parameters or body + describe('getExecutions', () => { + const operation = flowsManager.getAllExecutions({ flow_id: 'flowId' }); + const uri = `/flows/flowId/executions`; + const method = 'get'; + + checkMethod({ operation, uri, method }); + }); + + // this is the test for the method getExecution() + describe('getExecutionsById', () => { + const operation = flowsManager.getExecution({ + flow_id: 'flowId', + execution_id: 'executionId', + }); + const uri = `/flows/flowId/executions/executionId`; + const method = 'get'; + + checkMethod({ operation, uri, method }); + }); + + describe('deleteExecutionsById', () => { + const operation = flowsManager.deleteExecution({ + flow_id: 'flowId', + execution_id: 'executionId', + }); + const uri = `/flows/flowId/executions/executionId`; + const method = 'delete'; - checkMethod({ operation, expectedResponse, uri, method, requestBody }); + checkMethod({ operation, uri, method }); + }); }); });