Skip to content

Commit

Permalink
added missing forms endpoints and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharpandey13 committed Nov 8, 2024
1 parent b6cd08e commit 02bdf7f
Show file tree
Hide file tree
Showing 4 changed files with 1,701 additions and 97 deletions.
320 changes: 314 additions & 6 deletions src/management/__generated/managers/flows-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -18,20 +36,91 @@ const { BaseAPI } = runtime;
*
*/
export class FlowsManager extends BaseAPI {
/**
* Delete a flow
*
* @throws {RequiredError}
*/
async delete(
requestParameters: DeleteFlowsByIdRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<void>> {
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<ApiResponse<void>> {
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<ApiResponse<void>> {
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<ApiResponse<GetFlows200ResponseOneOf>>;
async getFlows(
async getAll(
requestParameters?: GetFlowsRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<Array<GetFlows200ResponseOneOfInner>>>;
async getFlows(
async getAll(
requestParameters: GetFlowsRequest = {},
initOverrides?: InitOverride
): Promise<ApiResponse<GetFlows200Response>> {
Expand Down Expand Up @@ -78,7 +167,7 @@ export class FlowsManager extends BaseAPI {
*
* @throws {RequiredError}
*/
async getFlowsById(
async get(
requestParameters: GetFlowsByIdRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<PostFlows201Response>> {
Expand Down Expand Up @@ -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<ApiResponse<GetFlowsExecutions200ResponseOneOf>>;
async getAllExecutions(
requestParameters?: GetFlowsExecutionsRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<Array<GetFlowsExecutions200ResponseOneOfInner>>>;
async getAllExecutions(
requestParameters: GetFlowsExecutionsRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<GetFlowsExecutions200Response>> {
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<ApiResponse<GetFlowsExecutionsByExecutionId200Response>> {
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<ApiResponse<GetFlowsVaultConnections200ResponseOneOf>>;
async getAllConnections(
requestParameters?: GetFlowsVaultConnectionsRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<Array<GetFlowsVaultConnections200ResponseOneOfInner>>>;
async getAllConnections(
requestParameters: GetFlowsVaultConnectionsRequest = {},
initOverrides?: InitOverride
): Promise<ApiResponse<GetFlowsVaultConnections200Response>> {
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<ApiResponse<PostFlowsVaultConnections201Response>> {
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
Expand All @@ -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<ApiResponse<PostFlowsVaultConnections201Response>> {
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<ApiResponse<PostFlows201Response>> {
Expand All @@ -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<ApiResponse<PostFlowsVaultConnections201Response>> {
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);
}
}
Loading

0 comments on commit 02bdf7f

Please sign in to comment.