diff --git a/Source/SelfService/Web/apis/integrations/CacheKeys.ts b/Source/SelfService/Web/apis/integrations/CacheKeys.ts index c30569f5c..e32b3bd41 100644 --- a/Source/SelfService/Web/apis/integrations/CacheKeys.ts +++ b/Source/SelfService/Web/apis/integrations/CacheKeys.ts @@ -2,6 +2,9 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. export enum CACHE_KEYS { + //CommandMappingApi + ConnectionCommandMappings_GET = 'connection_command_get', + //ConnectionsApi Connections_GET = 'connections_get', ConnectionsConnectorDeployment_GET = 'connections_connector_deployment_get', diff --git a/Source/SelfService/Web/apis/integrations/commandMappingApi.hooks.ts b/Source/SelfService/Web/apis/integrations/commandMappingApi.hooks.ts new file mode 100644 index 000000000..5089bbb54 --- /dev/null +++ b/Source/SelfService/Web/apis/integrations/commandMappingApi.hooks.ts @@ -0,0 +1,34 @@ +// Copyright (c) Aigonix. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +import { useQuery, useMutation } from '@tanstack/react-query'; + +import { API_CONFIGURATION } from './api'; +import { CACHE_KEYS } from './CacheKeys'; +import { ConnectionsIdCommandsGetRequest, ConnectionsIdCommandsCommandIdCreatePostRequest, CommandMappingApi } from './generated'; + +let apiInstance: CommandMappingApi | undefined; + +const getOrCreateApi = () => { + if (!apiInstance) { + apiInstance = new CommandMappingApi(API_CONFIGURATION); + } + return apiInstance; +}; + +export const useConnectionsIdCommandsGet = (params: ConnectionsIdCommandsGetRequest) => { + const api = getOrCreateApi(); + return useQuery({ + queryKey: [CACHE_KEYS.ConnectionCommandMappings_GET, params.id], + queryFn: api.connectionsIdCommandsGet.bind(api, params), + staleTime: 60000, + }); +}; + +export const useConnectionsIdCommandsCommandIdCreatePostRequest = () => { + const api = getOrCreateApi(); + return useMutation({ + mutationFn: (params: ConnectionsIdCommandsCommandIdCreatePostRequest) => + api.connectionsIdCommandsCommandIdCreatePost(params), + }); +}; diff --git a/Source/SelfService/Web/apis/integrations/generated/.openapi-generator/FILES b/Source/SelfService/Web/apis/integrations/generated/.openapi-generator/FILES index 5f25d3a5b..ada69f75f 100644 --- a/Source/SelfService/Web/apis/integrations/generated/.openapi-generator/FILES +++ b/Source/SelfService/Web/apis/integrations/generated/.openapi-generator/FILES @@ -2,6 +2,7 @@ apis/AsyncApiApi.ts apis/BaseMetadataApi.ts apis/CommandApi.ts +apis/CommandMappingApi.ts apis/ConnectionConfigurationApi.ts apis/ConnectionRestApiApi.ts apis/ConnectionWebhookApi.ts @@ -23,9 +24,13 @@ apis/TableMetadataAssistantApi.ts apis/index.ts index.ts models/AccountAccess.ts +models/ApiParameter.ts models/ColumnMetadata.ts models/ColumnRecommendation.ts models/ColumnRecommendations.ts +models/CommandHeader.ts +models/CommandMappingModel.ts +models/CommandMappingModelIEnumerableResult.ts models/ConnectionConfiguration.ts models/ConnectionConfigurationResult.ts models/ConnectionModel.ts @@ -33,6 +38,7 @@ models/ConnectionModelArrayResult.ts models/ConnectionModelResult.ts models/ConnectionPrograms.ts models/ConnectionStatus.ts +models/CreateCommand.ts models/CredentialStatus.ts models/DescribedJqDto.ts models/DescribedLinqDto.ts @@ -58,6 +64,7 @@ models/MappableTable.ts models/MappableTableColumn.ts models/MappableTableResult.ts models/MappedField.ts +models/MappedParameter.ts models/MappingReference.ts models/MdpConfiguration.ts models/MdpConfigurationResult.ts @@ -69,6 +76,7 @@ models/ModelIndex.ts models/NoSuchReadModelResult.ts models/NotFoundResult.ts models/Parameter.ts +models/ParameterMode.ts models/ProblemDetails.ts models/ProgramDetails.ts models/ProgramMetadataHeader.ts @@ -95,6 +103,8 @@ models/TableListingEntryIEnumerableResult.ts models/TableSummaryDto.ts models/TopicAccess.ts models/TopicAccessDto.ts +models/UpdateCommandNames.ts +models/UpdateCommandParameters.ts models/WebhookServiceStatus.ts models/WebhookStatusDto.ts models/WebhookTargetStatus.ts diff --git a/Source/SelfService/Web/apis/integrations/generated/apis/CommandMappingApi.ts b/Source/SelfService/Web/apis/integrations/generated/apis/CommandMappingApi.ts new file mode 100644 index 000000000..771486c11 --- /dev/null +++ b/Source/SelfService/Web/apis/integrations/generated/apis/CommandMappingApi.ts @@ -0,0 +1,517 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Aigonix.Bridge.M3 + * Bridge API - made for Aigonix Studio + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import type { + CommandHeader, + CommandMappingModelIEnumerableResult, + CreateCommand, + NoSuchReadModelResult, + ProblemDetails, + UpdateCommandNames, + UpdateCommandParameters, +} from '../models/index'; +import { + CommandHeaderFromJSON, + CommandHeaderToJSON, + CommandMappingModelIEnumerableResultFromJSON, + CommandMappingModelIEnumerableResultToJSON, + CreateCommandFromJSON, + CreateCommandToJSON, + NoSuchReadModelResultFromJSON, + NoSuchReadModelResultToJSON, + ProblemDetailsFromJSON, + ProblemDetailsToJSON, + UpdateCommandNamesFromJSON, + UpdateCommandNamesToJSON, + UpdateCommandParametersFromJSON, + UpdateCommandParametersToJSON, +} from '../models/index'; + +export interface ConnectionsIdCommandsCommandIdCreatePostRequest { + id: string; + commandId: string; + createCommand?: CreateCommand; +} + +export interface ConnectionsIdCommandsCommandIdDeleteRequest { + id: string; + commandId: string; +} + +export interface ConnectionsIdCommandsCommandIdDeployPostRequest { + id: string; + commandId: string; +} + +export interface ConnectionsIdCommandsCommandIdGetRequest { + id: string; + commandId: string; +} + +export interface ConnectionsIdCommandsCommandIdParametersGetRequest { + id: string; + commandId: string; +} + +export interface ConnectionsIdCommandsCommandIdParametersPostRequest { + id: string; + commandId: string; + updateCommandParameters?: UpdateCommandParameters; +} + +export interface ConnectionsIdCommandsCommandIdPostRequest { + id: string; + commandId: string; + updateCommandNames?: UpdateCommandNames; +} + +export interface ConnectionsIdCommandsCommandIdUndeployPostRequest { + id: string; + commandId: string; +} + +export interface ConnectionsIdCommandsGetRequest { + id: string; + startIndex?: number; + pageSize?: number; +} + +/** + * + */ +export class CommandMappingApi extends runtime.BaseAPI { + + /** + * POST to Update command name, namespace and description + */ + async connectionsIdCommandsCommandIdCreatePostRaw(requestParameters: ConnectionsIdCommandsCommandIdCreatePostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.id === null || requestParameters.id === undefined) { + throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling connectionsIdCommandsCommandIdCreatePost.'); + } + + if (requestParameters.commandId === null || requestParameters.commandId === undefined) { + throw new runtime.RequiredError('commandId','Required parameter requestParameters.commandId was null or undefined when calling connectionsIdCommandsCommandIdCreatePost.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["X-Organization-Id"] = this.configuration.apiKey("X-Organization-Id"); // X-Organization-Id authentication + } + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("Bearer", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/connections/{id}/commands/{commandId}/create`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"commandId"}}`, encodeURIComponent(String(requestParameters.commandId))), + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: CreateCommandToJSON(requestParameters.createCommand), + }, initOverrides); + + return new runtime.VoidApiResponse(response); + } + + /** + * POST to Update command name, namespace and description + */ + async connectionsIdCommandsCommandIdCreatePost(requestParameters: ConnectionsIdCommandsCommandIdCreatePostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + await this.connectionsIdCommandsCommandIdCreatePostRaw(requestParameters, initOverrides); + } + + /** + * DELETE the mapping of a program to a command. + */ + async connectionsIdCommandsCommandIdDeleteRaw(requestParameters: ConnectionsIdCommandsCommandIdDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.id === null || requestParameters.id === undefined) { + throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling connectionsIdCommandsCommandIdDelete.'); + } + + if (requestParameters.commandId === null || requestParameters.commandId === undefined) { + throw new runtime.RequiredError('commandId','Required parameter requestParameters.commandId was null or undefined when calling connectionsIdCommandsCommandIdDelete.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["X-Organization-Id"] = this.configuration.apiKey("X-Organization-Id"); // X-Organization-Id authentication + } + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("Bearer", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/connections/{id}/commands/{commandId}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"commandId"}}`, encodeURIComponent(String(requestParameters.commandId))), + method: 'DELETE', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.VoidApiResponse(response); + } + + /** + * DELETE the mapping of a program to a command. + */ + async connectionsIdCommandsCommandIdDelete(requestParameters: ConnectionsIdCommandsCommandIdDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + await this.connectionsIdCommandsCommandIdDeleteRaw(requestParameters, initOverrides); + } + + /** + * Deploy the command mapping + */ + async connectionsIdCommandsCommandIdDeployPostRaw(requestParameters: ConnectionsIdCommandsCommandIdDeployPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.id === null || requestParameters.id === undefined) { + throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling connectionsIdCommandsCommandIdDeployPost.'); + } + + if (requestParameters.commandId === null || requestParameters.commandId === undefined) { + throw new runtime.RequiredError('commandId','Required parameter requestParameters.commandId was null or undefined when calling connectionsIdCommandsCommandIdDeployPost.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["X-Organization-Id"] = this.configuration.apiKey("X-Organization-Id"); // X-Organization-Id authentication + } + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("Bearer", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/connections/{id}/commands/{commandId}/deploy`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"commandId"}}`, encodeURIComponent(String(requestParameters.commandId))), + method: 'POST', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.VoidApiResponse(response); + } + + /** + * Deploy the command mapping + */ + async connectionsIdCommandsCommandIdDeployPost(requestParameters: ConnectionsIdCommandsCommandIdDeployPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + await this.connectionsIdCommandsCommandIdDeployPostRaw(requestParameters, initOverrides); + } + + /** + * GET all command mappings of program to command(s) for a connection. + */ + async connectionsIdCommandsCommandIdGetRaw(requestParameters: ConnectionsIdCommandsCommandIdGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.id === null || requestParameters.id === undefined) { + throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling connectionsIdCommandsCommandIdGet.'); + } + + if (requestParameters.commandId === null || requestParameters.commandId === undefined) { + throw new runtime.RequiredError('commandId','Required parameter requestParameters.commandId was null or undefined when calling connectionsIdCommandsCommandIdGet.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["X-Organization-Id"] = this.configuration.apiKey("X-Organization-Id"); // X-Organization-Id authentication + } + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("Bearer", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/connections/{id}/commands/{commandId}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"commandId"}}`, encodeURIComponent(String(requestParameters.commandId))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => CommandMappingModelIEnumerableResultFromJSON(jsonValue)); + } + + /** + * GET all command mappings of program to command(s) for a connection. + */ + async connectionsIdCommandsCommandIdGet(requestParameters: ConnectionsIdCommandsCommandIdGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.connectionsIdCommandsCommandIdGetRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * GET the mapped parameters for a command + */ + async connectionsIdCommandsCommandIdParametersGetRaw(requestParameters: ConnectionsIdCommandsCommandIdParametersGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.id === null || requestParameters.id === undefined) { + throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling connectionsIdCommandsCommandIdParametersGet.'); + } + + if (requestParameters.commandId === null || requestParameters.commandId === undefined) { + throw new runtime.RequiredError('commandId','Required parameter requestParameters.commandId was null or undefined when calling connectionsIdCommandsCommandIdParametersGet.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["X-Organization-Id"] = this.configuration.apiKey("X-Organization-Id"); // X-Organization-Id authentication + } + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("Bearer", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/connections/{id}/commands/{commandId}/parameters`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"commandId"}}`, encodeURIComponent(String(requestParameters.commandId))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.VoidApiResponse(response); + } + + /** + * GET the mapped parameters for a command + */ + async connectionsIdCommandsCommandIdParametersGet(requestParameters: ConnectionsIdCommandsCommandIdParametersGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + await this.connectionsIdCommandsCommandIdParametersGetRaw(requestParameters, initOverrides); + } + + /** + * POST to Update parameter mappings for a command + */ + async connectionsIdCommandsCommandIdParametersPostRaw(requestParameters: ConnectionsIdCommandsCommandIdParametersPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.id === null || requestParameters.id === undefined) { + throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling connectionsIdCommandsCommandIdParametersPost.'); + } + + if (requestParameters.commandId === null || requestParameters.commandId === undefined) { + throw new runtime.RequiredError('commandId','Required parameter requestParameters.commandId was null or undefined when calling connectionsIdCommandsCommandIdParametersPost.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["X-Organization-Id"] = this.configuration.apiKey("X-Organization-Id"); // X-Organization-Id authentication + } + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("Bearer", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/connections/{id}/commands/{commandId}/parameters`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"commandId"}}`, encodeURIComponent(String(requestParameters.commandId))), + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: UpdateCommandParametersToJSON(requestParameters.updateCommandParameters), + }, initOverrides); + + return new runtime.VoidApiResponse(response); + } + + /** + * POST to Update parameter mappings for a command + */ + async connectionsIdCommandsCommandIdParametersPost(requestParameters: ConnectionsIdCommandsCommandIdParametersPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + await this.connectionsIdCommandsCommandIdParametersPostRaw(requestParameters, initOverrides); + } + + /** + * POST to update command name, namespace and description + */ + async connectionsIdCommandsCommandIdPostRaw(requestParameters: ConnectionsIdCommandsCommandIdPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.id === null || requestParameters.id === undefined) { + throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling connectionsIdCommandsCommandIdPost.'); + } + + if (requestParameters.commandId === null || requestParameters.commandId === undefined) { + throw new runtime.RequiredError('commandId','Required parameter requestParameters.commandId was null or undefined when calling connectionsIdCommandsCommandIdPost.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["X-Organization-Id"] = this.configuration.apiKey("X-Organization-Id"); // X-Organization-Id authentication + } + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("Bearer", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/connections/{id}/commands/{commandId}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"commandId"}}`, encodeURIComponent(String(requestParameters.commandId))), + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: UpdateCommandNamesToJSON(requestParameters.updateCommandNames), + }, initOverrides); + + return new runtime.VoidApiResponse(response); + } + + /** + * POST to update command name, namespace and description + */ + async connectionsIdCommandsCommandIdPost(requestParameters: ConnectionsIdCommandsCommandIdPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + await this.connectionsIdCommandsCommandIdPostRaw(requestParameters, initOverrides); + } + + /** + * POST to undeploy the command mapping + */ + async connectionsIdCommandsCommandIdUndeployPostRaw(requestParameters: ConnectionsIdCommandsCommandIdUndeployPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.id === null || requestParameters.id === undefined) { + throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling connectionsIdCommandsCommandIdUndeployPost.'); + } + + if (requestParameters.commandId === null || requestParameters.commandId === undefined) { + throw new runtime.RequiredError('commandId','Required parameter requestParameters.commandId was null or undefined when calling connectionsIdCommandsCommandIdUndeployPost.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["X-Organization-Id"] = this.configuration.apiKey("X-Organization-Id"); // X-Organization-Id authentication + } + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("Bearer", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/connections/{id}/commands/{commandId}/undeploy`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"commandId"}}`, encodeURIComponent(String(requestParameters.commandId))), + method: 'POST', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.VoidApiResponse(response); + } + + /** + * POST to undeploy the command mapping + */ + async connectionsIdCommandsCommandIdUndeployPost(requestParameters: ConnectionsIdCommandsCommandIdUndeployPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + await this.connectionsIdCommandsCommandIdUndeployPostRaw(requestParameters, initOverrides); + } + + /** + * GET all command mappings for a connection + */ + async connectionsIdCommandsGetRaw(requestParameters: ConnectionsIdCommandsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + if (requestParameters.id === null || requestParameters.id === undefined) { + throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling connectionsIdCommandsGet.'); + } + + const queryParameters: any = {}; + + if (requestParameters.startIndex !== undefined) { + queryParameters['startIndex'] = requestParameters.startIndex; + } + + if (requestParameters.pageSize !== undefined) { + queryParameters['pageSize'] = requestParameters.pageSize; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["X-Organization-Id"] = this.configuration.apiKey("X-Organization-Id"); // X-Organization-Id authentication + } + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("Bearer", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/connections/{id}/commands`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(CommandHeaderFromJSON)); + } + + /** + * GET all command mappings for a connection + */ + async connectionsIdCommandsGet(requestParameters: ConnectionsIdCommandsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const response = await this.connectionsIdCommandsGetRaw(requestParameters, initOverrides); + return await response.value(); + } + +} diff --git a/Source/SelfService/Web/apis/integrations/generated/apis/index.ts b/Source/SelfService/Web/apis/integrations/generated/apis/index.ts index 0574265bb..a00c2a604 100644 --- a/Source/SelfService/Web/apis/integrations/generated/apis/index.ts +++ b/Source/SelfService/Web/apis/integrations/generated/apis/index.ts @@ -3,6 +3,7 @@ export * from './AsyncApiApi'; export * from './BaseMetadataApi'; export * from './CommandApi'; +export * from './CommandMappingApi'; export * from './ConnectionConfigurationApi'; export * from './ConnectionRestApiApi'; export * from './ConnectionWebhookApi'; diff --git a/Source/SelfService/Web/apis/integrations/generated/models/ApiParameter.ts b/Source/SelfService/Web/apis/integrations/generated/models/ApiParameter.ts new file mode 100644 index 000000000..76104022e --- /dev/null +++ b/Source/SelfService/Web/apis/integrations/generated/models/ApiParameter.ts @@ -0,0 +1,104 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Aigonix.Bridge.M3 + * Bridge API - made for Aigonix Studio + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { FieldType } from './FieldType'; +import { + FieldTypeFromJSON, + FieldTypeFromJSONTyped, + FieldTypeToJSON, +} from './FieldType'; + +/** + * + * @export + * @interface ApiParameter + */ +export interface ApiParameter { + /** + * + * @type {string} + * @memberof ApiParameter + */ + name?: string; + /** + * + * @type {string} + * @memberof ApiParameter + */ + description?: string; + /** + * + * @type {FieldType} + * @memberof ApiParameter + */ + type?: FieldType; + /** + * + * @type {number} + * @memberof ApiParameter + */ + length?: number; + /** + * + * @type {boolean} + * @memberof ApiParameter + */ + required?: boolean; +} + +/** + * Check if a given object implements the ApiParameter interface. + */ +export function instanceOfApiParameter(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function ApiParameterFromJSON(json: any): ApiParameter { + return ApiParameterFromJSONTyped(json, false); +} + +export function ApiParameterFromJSONTyped(json: any, ignoreDiscriminator: boolean): ApiParameter { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'name': !exists(json, 'name') ? undefined : json['name'], + 'description': !exists(json, 'description') ? undefined : json['description'], + 'type': !exists(json, 'type') ? undefined : FieldTypeFromJSON(json['type']), + 'length': !exists(json, 'length') ? undefined : json['length'], + 'required': !exists(json, 'required') ? undefined : json['required'], + }; +} + +export function ApiParameterToJSON(value?: ApiParameter | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'name': value.name, + 'description': value.description, + 'type': FieldTypeToJSON(value.type), + 'length': value.length, + 'required': value.required, + }; +} + diff --git a/Source/SelfService/Web/apis/integrations/generated/models/CommandHeader.ts b/Source/SelfService/Web/apis/integrations/generated/models/CommandHeader.ts new file mode 100644 index 000000000..797a53dbb --- /dev/null +++ b/Source/SelfService/Web/apis/integrations/generated/models/CommandHeader.ts @@ -0,0 +1,148 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Aigonix.Bridge.M3 + * Bridge API - made for Aigonix Studio + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface CommandHeader + */ +export interface CommandHeader { + /** + * + * @type {string} + * @memberof CommandHeader + */ + connection?: string; + /** + * + * @type {string} + * @memberof CommandHeader + */ + m3Program?: string; + /** + * + * @type {string} + * @memberof CommandHeader + */ + m3Transaction?: string; + /** + * + * @type {string} + * @memberof CommandHeader + */ + id?: string; + /** + * + * @type {string} + * @memberof CommandHeader + */ + name?: string; + /** + * + * @type {string} + * @memberof CommandHeader + */ + description?: string; + /** + * + * @type {string} + * @memberof CommandHeader + */ + namespace?: string; + /** + * + * @type {Date} + * @memberof CommandHeader + */ + createdAt?: Date; + /** + * The last time (if any) the command mapping was deployed. May be null if + * it has never been deployed + * @type {Date} + * @memberof CommandHeader + */ + deployedAt?: Date | null; + /** + * The last deployed version, if any. May be null if it has never been + * deployed + * @type {number} + * @memberof CommandHeader + */ + deployedVersion?: number | null; + /** + * The last deployed version that has been confirmed by the remote service. + * May be null if it has never been confirmed or if it has been deployed. + * @type {number} + * @memberof CommandHeader + */ + confirmedDeployedVersion?: number | null; +} + +/** + * Check if a given object implements the CommandHeader interface. + */ +export function instanceOfCommandHeader(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function CommandHeaderFromJSON(json: any): CommandHeader { + return CommandHeaderFromJSONTyped(json, false); +} + +export function CommandHeaderFromJSONTyped(json: any, ignoreDiscriminator: boolean): CommandHeader { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'connection': !exists(json, 'connection') ? undefined : json['connection'], + 'm3Program': !exists(json, 'm3Program') ? undefined : json['m3Program'], + 'm3Transaction': !exists(json, 'm3Transaction') ? undefined : json['m3Transaction'], + 'id': !exists(json, 'id') ? undefined : json['id'], + 'name': !exists(json, 'name') ? undefined : json['name'], + 'description': !exists(json, 'description') ? undefined : json['description'], + 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], + 'createdAt': !exists(json, 'createdAt') ? undefined : (new Date(json['createdAt'])), + 'deployedAt': !exists(json, 'deployedAt') ? undefined : (json['deployedAt'] === null ? null : new Date(json['deployedAt'])), + 'deployedVersion': !exists(json, 'deployedVersion') ? undefined : json['deployedVersion'], + 'confirmedDeployedVersion': !exists(json, 'confirmedDeployedVersion') ? undefined : json['confirmedDeployedVersion'], + }; +} + +export function CommandHeaderToJSON(value?: CommandHeader | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'connection': value.connection, + 'm3Program': value.m3Program, + 'm3Transaction': value.m3Transaction, + 'id': value.id, + 'name': value.name, + 'description': value.description, + 'namespace': value.namespace, + 'createdAt': value.createdAt === undefined ? undefined : (value.createdAt.toISOString()), + 'deployedAt': value.deployedAt === undefined ? undefined : (value.deployedAt === null ? null : value.deployedAt.toISOString()), + 'deployedVersion': value.deployedVersion, + 'confirmedDeployedVersion': value.confirmedDeployedVersion, + }; +} + diff --git a/Source/SelfService/Web/apis/integrations/generated/models/CommandMappingModel.ts b/Source/SelfService/Web/apis/integrations/generated/models/CommandMappingModel.ts new file mode 100644 index 000000000..50ada68ec --- /dev/null +++ b/Source/SelfService/Web/apis/integrations/generated/models/CommandMappingModel.ts @@ -0,0 +1,168 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Aigonix.Bridge.M3 + * Bridge API - made for Aigonix Studio + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { MappedParameter } from './MappedParameter'; +import { + MappedParameterFromJSON, + MappedParameterFromJSONTyped, + MappedParameterToJSON, +} from './MappedParameter'; + +/** + * + * @export + * @interface CommandMappingModel + */ +export interface CommandMappingModel { + /** + * The connection this command mapping belongs to + * @type {string} + * @memberof CommandMappingModel + */ + connection: string; + /** + * The id of the command mapping within the context of the connection + * @type {string} + * @memberof CommandMappingModel + */ + id: string; + /** + * + * @type {Date} + * @memberof CommandMappingModel + */ + createdAt: Date; + /** + * The name of the command-type this mapping describes + * @type {string} + * @memberof CommandMappingModel + */ + name: string; + /** + * Optional description of the command mapping + * @type {string} + * @memberof CommandMappingModel + */ + description?: string; + /** + * The namespace of the command mapping + * @type {string} + * @memberof CommandMappingModel + */ + namespace?: string; + /** + * The M3 program that this command mapping is for + * @type {string} + * @memberof CommandMappingModel + */ + m3Program?: string; + /** + * The M3 program transaction that this command mapping is for + * @type {string} + * @memberof CommandMappingModel + */ + m3Transaction?: string; + /** + * The parameter mappings for the command + * @type {Array} + * @memberof CommandMappingModel + */ + parameterMappings: Array; + /** + * The last time (if any) the command mapping was deployed. May be null if + * it has never been deployed + * @type {Date} + * @memberof CommandMappingModel + */ + deployedAt?: Date | null; + /** + * The last deployed version, if any. May be null if it has never been + * deployed + * @type {number} + * @memberof CommandMappingModel + */ + deployedVersion?: number | null; + /** + * The last deployed version that has been confirmed by the remote service. + * May be null if it has never been confirmed or if it has been deployed. + * @type {number} + * @memberof CommandMappingModel + */ + confirmedDeployedVersion?: number | null; +} + +/** + * Check if a given object implements the CommandMappingModel interface. + */ +export function instanceOfCommandMappingModel(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "connection" in value; + isInstance = isInstance && "id" in value; + isInstance = isInstance && "createdAt" in value; + isInstance = isInstance && "name" in value; + isInstance = isInstance && "parameterMappings" in value; + + return isInstance; +} + +export function CommandMappingModelFromJSON(json: any): CommandMappingModel { + return CommandMappingModelFromJSONTyped(json, false); +} + +export function CommandMappingModelFromJSONTyped(json: any, ignoreDiscriminator: boolean): CommandMappingModel { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'connection': json['connection'], + 'id': json['id'], + 'createdAt': (new Date(json['createdAt'])), + 'name': json['name'], + 'description': !exists(json, 'description') ? undefined : json['description'], + 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], + 'm3Program': !exists(json, 'm3Program') ? undefined : json['m3Program'], + 'm3Transaction': !exists(json, 'm3Transaction') ? undefined : json['m3Transaction'], + 'parameterMappings': ((json['parameterMappings'] as Array).map(MappedParameterFromJSON)), + 'deployedAt': !exists(json, 'deployedAt') ? undefined : (json['deployedAt'] === null ? null : new Date(json['deployedAt'])), + 'deployedVersion': !exists(json, 'deployedVersion') ? undefined : json['deployedVersion'], + 'confirmedDeployedVersion': !exists(json, 'confirmedDeployedVersion') ? undefined : json['confirmedDeployedVersion'], + }; +} + +export function CommandMappingModelToJSON(value?: CommandMappingModel | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'connection': value.connection, + 'id': value.id, + 'createdAt': (value.createdAt.toISOString()), + 'name': value.name, + 'description': value.description, + 'namespace': value.namespace, + 'm3Program': value.m3Program, + 'm3Transaction': value.m3Transaction, + 'parameterMappings': ((value.parameterMappings as Array).map(MappedParameterToJSON)), + 'deployedAt': value.deployedAt === undefined ? undefined : (value.deployedAt === null ? null : value.deployedAt.toISOString()), + 'deployedVersion': value.deployedVersion, + 'confirmedDeployedVersion': value.confirmedDeployedVersion, + }; +} + diff --git a/Source/SelfService/Web/apis/integrations/generated/models/CommandMappingModelIEnumerableResult.ts b/Source/SelfService/Web/apis/integrations/generated/models/CommandMappingModelIEnumerableResult.ts new file mode 100644 index 000000000..5bb93e480 --- /dev/null +++ b/Source/SelfService/Web/apis/integrations/generated/models/CommandMappingModelIEnumerableResult.ts @@ -0,0 +1,88 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Aigonix.Bridge.M3 + * Bridge API - made for Aigonix Studio + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { CommandMappingModel } from './CommandMappingModel'; +import { + CommandMappingModelFromJSON, + CommandMappingModelFromJSONTyped, + CommandMappingModelToJSON, +} from './CommandMappingModel'; +import type { Link } from './Link'; +import { + LinkFromJSON, + LinkFromJSONTyped, + LinkToJSON, +} from './Link'; + +/** + * A result with the value (if any) and links to other resources (if any) + * @export + * @interface CommandMappingModelIEnumerableResult + */ +export interface CommandMappingModelIEnumerableResult { + /** + * The value of the result - may be null if no value is present (yet) + * @type {Array} + * @memberof CommandMappingModelIEnumerableResult + */ + value?: Array | null; + /** + * Links to other resources. There will usually be a self link, but there + * may be other links as well with relations that indicate what the link is. + * @type {Array} + * @memberof CommandMappingModelIEnumerableResult + */ + links: Array; +} + +/** + * Check if a given object implements the CommandMappingModelIEnumerableResult interface. + */ +export function instanceOfCommandMappingModelIEnumerableResult(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "links" in value; + + return isInstance; +} + +export function CommandMappingModelIEnumerableResultFromJSON(json: any): CommandMappingModelIEnumerableResult { + return CommandMappingModelIEnumerableResultFromJSONTyped(json, false); +} + +export function CommandMappingModelIEnumerableResultFromJSONTyped(json: any, ignoreDiscriminator: boolean): CommandMappingModelIEnumerableResult { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'value': !exists(json, 'value') ? undefined : (json['value'] === null ? null : (json['value'] as Array).map(CommandMappingModelFromJSON)), + 'links': ((json['links'] as Array).map(LinkFromJSON)), + }; +} + +export function CommandMappingModelIEnumerableResultToJSON(value?: CommandMappingModelIEnumerableResult | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'value': value.value === undefined ? undefined : (value.value === null ? null : (value.value as Array).map(CommandMappingModelToJSON)), + 'links': ((value.links as Array).map(LinkToJSON)), + }; +} + diff --git a/Source/SelfService/Web/apis/integrations/generated/models/CreateCommand.ts b/Source/SelfService/Web/apis/integrations/generated/models/CreateCommand.ts new file mode 100644 index 000000000..5f7b2b886 --- /dev/null +++ b/Source/SelfService/Web/apis/integrations/generated/models/CreateCommand.ts @@ -0,0 +1,97 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Aigonix.Bridge.M3 + * Bridge API - made for Aigonix Studio + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface CreateCommand + */ +export interface CreateCommand { + /** + * + * @type {string} + * @memberof CreateCommand + */ + m3Program?: string; + /** + * + * @type {string} + * @memberof CreateCommand + */ + m3Transaction?: string; + /** + * + * @type {string} + * @memberof CreateCommand + */ + commandName?: string; + /** + * + * @type {string} + * @memberof CreateCommand + */ + commandDescription?: string; + /** + * + * @type {string} + * @memberof CreateCommand + */ + namespace?: string; +} + +/** + * Check if a given object implements the CreateCommand interface. + */ +export function instanceOfCreateCommand(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function CreateCommandFromJSON(json: any): CreateCommand { + return CreateCommandFromJSONTyped(json, false); +} + +export function CreateCommandFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateCommand { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'm3Program': !exists(json, 'm3Program') ? undefined : json['m3Program'], + 'm3Transaction': !exists(json, 'm3Transaction') ? undefined : json['m3Transaction'], + 'commandName': !exists(json, 'commandName') ? undefined : json['commandName'], + 'commandDescription': !exists(json, 'commandDescription') ? undefined : json['commandDescription'], + 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], + }; +} + +export function CreateCommandToJSON(value?: CreateCommand | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'm3Program': value.m3Program, + 'm3Transaction': value.m3Transaction, + 'commandName': value.commandName, + 'commandDescription': value.commandDescription, + 'namespace': value.namespace, + }; +} + diff --git a/Source/SelfService/Web/apis/integrations/generated/models/MappedParameter.ts b/Source/SelfService/Web/apis/integrations/generated/models/MappedParameter.ts new file mode 100644 index 000000000..fc1fdad04 --- /dev/null +++ b/Source/SelfService/Web/apis/integrations/generated/models/MappedParameter.ts @@ -0,0 +1,110 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Aigonix.Bridge.M3 + * Bridge API - made for Aigonix Studio + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { ApiParameter } from './ApiParameter'; +import { + ApiParameterFromJSON, + ApiParameterFromJSONTyped, + ApiParameterToJSON, +} from './ApiParameter'; +import type { ParameterMode } from './ParameterMode'; +import { + ParameterModeFromJSON, + ParameterModeFromJSONTyped, + ParameterModeToJSON, +} from './ParameterMode'; + +/** + * + * @export + * @interface MappedParameter + */ +export interface MappedParameter { + /** + * + * @type {ApiParameter} + * @memberof MappedParameter + */ + parameter?: ApiParameter; + /** + * + * @type {string} + * @memberof MappedParameter + */ + mappedName?: string; + /** + * + * @type {string} + * @memberof MappedParameter + */ + mappedDescription?: string; + /** + * + * @type {ParameterMode} + * @memberof MappedParameter + */ + mode?: ParameterMode; + /** + * + * @type {string} + * @memberof MappedParameter + */ + defaultValue?: string | null; +} + +/** + * Check if a given object implements the MappedParameter interface. + */ +export function instanceOfMappedParameter(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function MappedParameterFromJSON(json: any): MappedParameter { + return MappedParameterFromJSONTyped(json, false); +} + +export function MappedParameterFromJSONTyped(json: any, ignoreDiscriminator: boolean): MappedParameter { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'parameter': !exists(json, 'parameter') ? undefined : ApiParameterFromJSON(json['parameter']), + 'mappedName': !exists(json, 'mappedName') ? undefined : json['mappedName'], + 'mappedDescription': !exists(json, 'mappedDescription') ? undefined : json['mappedDescription'], + 'mode': !exists(json, 'mode') ? undefined : ParameterModeFromJSON(json['mode']), + 'defaultValue': !exists(json, 'defaultValue') ? undefined : json['defaultValue'], + }; +} + +export function MappedParameterToJSON(value?: MappedParameter | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'parameter': ApiParameterToJSON(value.parameter), + 'mappedName': value.mappedName, + 'mappedDescription': value.mappedDescription, + 'mode': ParameterModeToJSON(value.mode), + 'defaultValue': value.defaultValue, + }; +} + diff --git a/Source/SelfService/Web/apis/integrations/generated/models/ParameterMode.ts b/Source/SelfService/Web/apis/integrations/generated/models/ParameterMode.ts new file mode 100644 index 000000000..501d4a8bf --- /dev/null +++ b/Source/SelfService/Web/apis/integrations/generated/models/ParameterMode.ts @@ -0,0 +1,40 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Aigonix.Bridge.M3 + * Bridge API - made for Aigonix Studio + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * + * @export + */ +export const ParameterMode = { + NUMBER_0: 0, + NUMBER_1: 1, + NUMBER_2: 2, + NUMBER_3: 3 +} as const; +export type ParameterMode = typeof ParameterMode[keyof typeof ParameterMode]; + + +export function ParameterModeFromJSON(json: any): ParameterMode { + return ParameterModeFromJSONTyped(json, false); +} + +export function ParameterModeFromJSONTyped(json: any, ignoreDiscriminator: boolean): ParameterMode { + return json as ParameterMode; +} + +export function ParameterModeToJSON(value?: ParameterMode | null): any { + return value as any; +} + diff --git a/Source/SelfService/Web/apis/integrations/generated/models/UpdateCommandNames.ts b/Source/SelfService/Web/apis/integrations/generated/models/UpdateCommandNames.ts new file mode 100644 index 000000000..6730ab8f3 --- /dev/null +++ b/Source/SelfService/Web/apis/integrations/generated/models/UpdateCommandNames.ts @@ -0,0 +1,81 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Aigonix.Bridge.M3 + * Bridge API - made for Aigonix Studio + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface UpdateCommandNames + */ +export interface UpdateCommandNames { + /** + * + * @type {string} + * @memberof UpdateCommandNames + */ + name?: string; + /** + * + * @type {string} + * @memberof UpdateCommandNames + */ + description?: string; + /** + * + * @type {string} + * @memberof UpdateCommandNames + */ + namespace?: string; +} + +/** + * Check if a given object implements the UpdateCommandNames interface. + */ +export function instanceOfUpdateCommandNames(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function UpdateCommandNamesFromJSON(json: any): UpdateCommandNames { + return UpdateCommandNamesFromJSONTyped(json, false); +} + +export function UpdateCommandNamesFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpdateCommandNames { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'name': !exists(json, 'name') ? undefined : json['name'], + 'description': !exists(json, 'description') ? undefined : json['description'], + 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], + }; +} + +export function UpdateCommandNamesToJSON(value?: UpdateCommandNames | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'name': value.name, + 'description': value.description, + 'namespace': value.namespace, + }; +} + diff --git a/Source/SelfService/Web/apis/integrations/generated/models/UpdateCommandParameters.ts b/Source/SelfService/Web/apis/integrations/generated/models/UpdateCommandParameters.ts new file mode 100644 index 000000000..9c32fd5a3 --- /dev/null +++ b/Source/SelfService/Web/apis/integrations/generated/models/UpdateCommandParameters.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Aigonix.Bridge.M3 + * Bridge API - made for Aigonix Studio + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { MappedParameter } from './MappedParameter'; +import { + MappedParameterFromJSON, + MappedParameterFromJSONTyped, + MappedParameterToJSON, +} from './MappedParameter'; + +/** + * Body of a request to set a command mapping. + * @export + * @interface UpdateCommandParameters + */ +export interface UpdateCommandParameters { + /** + * + * @type {Array} + * @memberof UpdateCommandParameters + */ + parameters: Array; +} + +/** + * Check if a given object implements the UpdateCommandParameters interface. + */ +export function instanceOfUpdateCommandParameters(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "parameters" in value; + + return isInstance; +} + +export function UpdateCommandParametersFromJSON(json: any): UpdateCommandParameters { + return UpdateCommandParametersFromJSONTyped(json, false); +} + +export function UpdateCommandParametersFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpdateCommandParameters { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'parameters': ((json['parameters'] as Array).map(MappedParameterFromJSON)), + }; +} + +export function UpdateCommandParametersToJSON(value?: UpdateCommandParameters | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'parameters': ((value.parameters as Array).map(MappedParameterToJSON)), + }; +} + diff --git a/Source/SelfService/Web/apis/integrations/generated/models/index.ts b/Source/SelfService/Web/apis/integrations/generated/models/index.ts index 8a1e76d87..6595b12ef 100644 --- a/Source/SelfService/Web/apis/integrations/generated/models/index.ts +++ b/Source/SelfService/Web/apis/integrations/generated/models/index.ts @@ -1,9 +1,13 @@ /* tslint:disable */ /* eslint-disable */ export * from './AccountAccess'; +export * from './ApiParameter'; export * from './ColumnMetadata'; export * from './ColumnRecommendation'; export * from './ColumnRecommendations'; +export * from './CommandHeader'; +export * from './CommandMappingModel'; +export * from './CommandMappingModelIEnumerableResult'; export * from './ConnectionConfiguration'; export * from './ConnectionConfigurationResult'; export * from './ConnectionModel'; @@ -11,6 +15,7 @@ export * from './ConnectionModelArrayResult'; export * from './ConnectionModelResult'; export * from './ConnectionPrograms'; export * from './ConnectionStatus'; +export * from './CreateCommand'; export * from './CredentialStatus'; export * from './DescribedJqDto'; export * from './DescribedLinqDto'; @@ -36,6 +41,7 @@ export * from './MappableTable'; export * from './MappableTableColumn'; export * from './MappableTableResult'; export * from './MappedField'; +export * from './MappedParameter'; export * from './MappingReference'; export * from './MdpConfiguration'; export * from './MdpConfigurationResult'; @@ -47,6 +53,7 @@ export * from './ModelIndex'; export * from './NoSuchReadModelResult'; export * from './NotFoundResult'; export * from './Parameter'; +export * from './ParameterMode'; export * from './ProblemDetails'; export * from './ProgramDetails'; export * from './ProgramMetadataHeader'; @@ -73,6 +80,8 @@ export * from './TableListingEntryIEnumerableResult'; export * from './TableSummaryDto'; export * from './TopicAccess'; export * from './TopicAccessDto'; +export * from './UpdateCommandNames'; +export * from './UpdateCommandParameters'; export * from './WebhookServiceStatus'; export * from './WebhookStatusDto'; export * from './WebhookTargetStatus'; diff --git a/Source/SelfService/Web/apis/integrations/programMetadataApi.hooks.ts b/Source/SelfService/Web/apis/integrations/programMetadataApi.hooks.ts index 5e66ad6df..c90a238a8 100644 --- a/Source/SelfService/Web/apis/integrations/programMetadataApi.hooks.ts +++ b/Source/SelfService/Web/apis/integrations/programMetadataApi.hooks.ts @@ -34,12 +34,7 @@ export const useConnectionsIdMetadataProgramsSearchGet = (params: ConnectionsIdM export const useConnectionsIdMetadataProgramsProgramProgramGet = (params: ConnectionsIdMetadataProgramsProgramProgramGetRequest) => { const api = getOrCreateApi(); return useQuery({ - queryKey: [ - CACHE_KEYS.ConnectionProgramMetadata_GET, - CACHE_KEYS.ConnectionProgramMetadataProgram_GET, - params.id, - params.program, - ], + queryKey: [CACHE_KEYS.ConnectionProgramMetadataProgram_GET, params.id, params.program], queryFn: api.connectionsIdMetadataProgramsProgramProgramGet.bind(api, params), staleTime: 60000, enabled: !!params.id && !!params.program, diff --git a/Source/SelfService/Web/integrations/connection/connectionDetails/commands/command/CommandForm.tsx b/Source/SelfService/Web/integrations/connection/connectionDetails/commands/command/CommandForm.tsx index 23ee73861..5509d21b7 100644 --- a/Source/SelfService/Web/integrations/connection/connectionDetails/commands/command/CommandForm.tsx +++ b/Source/SelfService/Web/integrations/connection/connectionDetails/commands/command/CommandForm.tsx @@ -6,40 +6,67 @@ import React from 'react'; import { useNavigate } from 'react-router-dom'; import { enqueueSnackbar } from 'notistack'; +import { CreateCommand } from '../../../../../apis/integrations/generated'; +import { useConnectionsIdCommandsCommandIdCreatePostRequest } from '../../../../../apis/integrations/commandMappingApi.hooks'; + import { Form } from '@dolittle/design-system'; -type NewCommandFormParameters = { - commandName: string; - namespace: string; - description: string; +function generateUUID() { + let d = new Date().getTime(); + let d2 = ((typeof performance !== 'undefined') && performance.now && (performance.now() * 1000)) || 0; + + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { + let r = Math.random() * 16; + if (d > 0) { + r = (d + r) % 16 | 0; + d = Math.floor(d / 16); + } else { + r = (d2 + r) % 16 | 0; + d2 = Math.floor(d2 / 16); + } + return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16); + }); +}; + +type NewCommandFormParameters = CreateCommand & { + id?: string; + commandId?: string; }; export type CommandFormProps = { + connectionId: string; + selectedProgramName: string; + selectedTransactionName: string; children: React.ReactNode; }; -export const CommandForm = ({ children }: CommandFormProps) => { +export const CommandForm = ({ connectionId, selectedProgramName, selectedTransactionName, children }: CommandFormProps) => { const navigate = useNavigate(); + const saveCommandMutation = useConnectionsIdCommandsCommandIdCreatePostRequest(); - const handleNewCommandSave = (values: any) => { - // saveMessageMappingMutation.mutate({ + const handleNewCommandSave = (values: NewCommandFormParameters) => { + // saveCommandMutation.mutate({ // id: connectionId, - // message: values.name, - // table: selectedTableName, - // setMessageMappingRequestArguments: { - // description: values.description, - // fields: values.fields, - // jqFilter: values.jqFilter, + // commandId: generateUUID(), + // createCommand: { + // commandName: values.commandName, + // commandDescription: values.commandDescription, + // namespace: values.namespace, + // m3Program: 'AAS350MI', //SelectedProgramName + // m3Transaction: 'LstVoucherHeads',//SelectedTransactionName // }, // }, { // onSuccess() { // navigate(`..`); - // enqueueSnackbar('Message successfully created.'); + // enqueueSnackbar(`Command '${values.commandName}' successfully created.`); // }, // onError() { - // enqueueSnackbar('Something went wrong when trying to save the message.', { variant: 'error' }); + // enqueueSnackbar('Something went wrong when trying to save the command.', { variant: 'error' }); // }, // }); + // console.log(values, 'values'); + // console.log(selectedProgramName, 'selectedProgramName'); + // console.log(selectedTransactionName, 'selectedTransactionName'); navigate('..'); enqueueSnackbar('Command successfully created.'); @@ -49,8 +76,8 @@ export const CommandForm = ({ children }: CommandFormProps) => { initialValues={{ commandName: '', + commandDescription: '', namespace: '', - description: '', }} onSubmit={handleNewCommandSave} > diff --git a/Source/SelfService/Web/integrations/connection/connectionDetails/commands/command/CommandSection.tsx b/Source/SelfService/Web/integrations/connection/connectionDetails/commands/command/CommandSection.tsx index 71a31cc96..76513f54d 100644 --- a/Source/SelfService/Web/integrations/connection/connectionDetails/commands/command/CommandSection.tsx +++ b/Source/SelfService/Web/integrations/connection/connectionDetails/commands/command/CommandSection.tsx @@ -142,22 +142,21 @@ const programTransactionDummyData: ProgramTransaction[] = [ export type CommandSectionProps = { connectionId: string; selectedProgramName: string; + selectedTransactionName: GridRowId[]; + onSelectedTransactionNameChanged: (newSelectedTransactionName: GridRowId[]) => void; onBackToSearchResultsClicked: () => void; }; -export const CommandSection = ({ connectionId, selectedProgramName, onBackToSearchResultsClicked }: CommandSectionProps) => { +export const CommandSection = ({ connectionId, selectedProgramName, selectedTransactionName, onSelectedTransactionNameChanged, onBackToSearchResultsClicked }: CommandSectionProps) => { const [quickFilterValue, setQuickFilterValue] = useState(''); - const [selectionModel, setSelectionModel] = useState([]); // TODO: Needs error handling. - const query = useConnectionsIdMetadataProgramsProgramProgramGet({ id: connectionId, program: selectedProgramName }); + const { data: programTransactionsResult, isLoading, isInitialLoading } = useConnectionsIdMetadataProgramsProgramProgramGet({ + id: connectionId, + program: 'AAS350MI', //selectedProgramName + }); - // const { data: mappableTableResult, isLoading, isInitialLoading } = useConnectionsIdMessageMappingsTablesTableGet({ - // id: connectionId, - // table: selectedTableName, - // }); - - const searchResults = query.data || []; + console.log('programTransactionsResult', programTransactionsResult); const gridFilters: GridFilterModel = useMemo(() => { return { @@ -167,9 +166,7 @@ export const CommandSection = ({ connectionId, selectedProgramName, onBackToSear }; }, [quickFilterValue]); - const selectedRowName = selectionModel.length ? `Selected transaction: ${selectionModel[0]}` : ''; - - console.log('searchResults', searchResults); + const displaySelectedTransactionName = selectedTransactionName.length ? `Selected transaction: ${selectedTransactionName[0]}` : ''; return ( onSelectedTransactionNameChanged(newSelection)} components={{ - Toolbar: () => {selectedRowName} + Toolbar: () => {displaySelectedTransactionName} }} /> -