Skip to content
Snippets Groups Projects
WorkflowExecutionService.ts 8.90 KiB
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { DevWorkflowExecutionIn } from '../models/DevWorkflowExecutionIn';
import type { WorkflowExecutionIn } from '../models/WorkflowExecutionIn';
import type { WorkflowExecutionOut } from '../models/WorkflowExecutionOut';
import type { WorkflowExecutionStatus } from '../models/WorkflowExecutionStatus';
import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';
export class WorkflowExecutionService {
    /**
     * Start a new workflow execution
     * Start a new workflow execution. Workflow versions wit status `DEPRECATED` or `DENIED` can't be started.
     *
     * Permission `workflow_execution:create` required if workflow versions status is `PUBLISHED`,
     * otherwise `workflow_execution:create_any` required.
     * @param requestBody
     * @returns WorkflowExecutionOut Successful Response
     * @throws ApiError
     */
    public static workflowExecutionStartWorkflow(
        requestBody: WorkflowExecutionIn,
    ): CancelablePromise<WorkflowExecutionOut> {
        return __request(OpenAPI, {
            method: 'POST',
            url: '/workflow_executions',
            body: requestBody,
            mediaType: 'application/json',
            errors: {
                400: `Error decoding JWT Token`,
                401: `Not Authenticated`,
                403: `Not Authorized`,
                404: `Entity not Found`,
                422: `Validation Error`,
            },
        });
    }
    /**
     * Get all workflow executions
     * Get all workflow executions.
     *
     * This endpoint enforces keyset pagination. To iterate over all workflow executions, follow the link provided in the
     * `Link` header.
     * A missing `Link` header indicates that you iterated over all workflow executions with the current filters.
     *
     * Permission `workflow_execution:list` required, if `executor_id` is the same as the current user,
     * otherwise `workflow_execution:list_all` required.
     * @param executorId Filter for workflow executions by a user. If none, Permission `workflow_execution:read_any` required.
     * @param executionStatus Filter for status of workflow execution
     * @param workflowVersionId Filter for workflow version
     * @param workflowId Filter for workflow
     * @param startAfter Filter for workflow executions that started after this UNIX timestamp
     * @param startBefore Filter for workflow executions that started before this UNIX timestamp
     * @param idAfter Id of the item to start the query from. DO NOT SET MANUALLY.
     * @param perPage Number of items to list per page
     * @param sort Sort order of items with creation time
     * @returns WorkflowExecutionOut Successful Response
     * @throws ApiError
     */
    public static workflowExecutionListWorkflowExecutions(
        executorId?: string,
        executionStatus?: Array<WorkflowExecutionStatus>,
        workflowVersionId?: string,
        workflowId?: string,
        startAfter?: number,
        startBefore?: number,
        idAfter?: string,
        perPage: number = 20,
        sort: 'asc' | 'desc' = 'desc',
    ): CancelablePromise<Array<WorkflowExecutionOut>> {
        return __request(OpenAPI, {
            method: 'GET',
            url: '/workflow_executions',
            query: {
                'executor_id': executorId,
                'execution_status': executionStatus,
                'workflow_version_id': workflowVersionId,
                'workflow_id': workflowId,
                'start_after': startAfter,
                'start_before': startBefore,
                'id_after': idAfter,
                'per_page': perPage,
                'sort': sort,
            },
            errors: {
                400: `Error decoding JWT Token`,
                401: `Not Authenticated`,
                403: `Not Authorized`,
                404: `Entity not Found`,
                422: `Validation Error`,
            },
        });
    }
    /**
     * Start a workflow execution with arbitrary git repository
     * Start a new workflow execution from an arbitrary git repository.
     *
     * For private Gitlab repositories, a Project Access Token with the role Reporter and scope `read_api` is needed.
     *
     * For private GitHub repositories, a Personal Access Token (classic) with scope `repo` is needed.
     *
     * Permission `workflow:create` required.
     * @param requestBody
     * @returns WorkflowExecutionOut Successful Response
     * @throws ApiError
     */
    public static workflowExecutionStartArbitraryWorkflow(
        requestBody: DevWorkflowExecutionIn,
    ): CancelablePromise<WorkflowExecutionOut> {
        return __request(OpenAPI, {
            method: 'POST',
            url: '/workflow_executions/arbitrary',
            body: requestBody,
            mediaType: 'application/json',
            errors: {
                400: `Error decoding JWT Token`,
                401: `Not Authenticated`,
                403: `Not Authorized`,
                404: `Entity not Found`,
                422: `Validation Error`,
            },
        });
    }
    /**
     * Get a workflow execution
     * Get a specific workflow execution.
     *
     * Permission `workflow_execution:read` required if the current user started the workflow execution,
     * otherwise `workflow_execution:read_any` required.
     * @param eid ID of a workflow execution.
     * @returns WorkflowExecutionOut Successful Response
     * @throws ApiError
     */
    public static workflowExecutionGetWorkflowExecution(
        eid: string,
    ): CancelablePromise<WorkflowExecutionOut> {
        return __request(OpenAPI, {
            method: 'GET',
            url: '/workflow_executions/{eid}',
            path: {
                'eid': eid,
            },
            errors: {
                400: `Error decoding JWT Token`,
                401: `Not Authenticated`,
                403: `Not Authorized`,
                404: `Entity not Found`,
                422: `Validation Error`,
            },
        });
    }
    /**
     * Delete a workflow execution
     * Delete a specific workflow execution.
     *
     * Permission `workflow_execution:delete` required if the current user started the workflow execution,
     * otherwise `workflow_execution:delete_any` required.
     * @param eid ID of a workflow execution.
     * @returns void
     * @throws ApiError
     */
    public static workflowExecutionDeleteWorkflowExecution(
        eid: string,
    ): CancelablePromise<void> {
        return __request(OpenAPI, {
            method: 'DELETE',
            url: '/workflow_executions/{eid}',
            path: {
                'eid': eid,
            },
            errors: {
                400: `Error decoding JWT Token`,
                401: `Not Authenticated`,
                403: `Not Authorized`,
                404: `Entity not Found`,
                422: `Validation Error`,
            },
        });
    }
    /**
     * Get the parameters of a workflow execution
     * Get the parameters of a specific workflow execution.
     *
     * Permission `workflow_execution:read` required if the current user started the workflow execution,
     * otherwise `workflow_execution:read_any` required.
     * @param eid ID of a workflow execution.
     * @returns any Successful Response
     * @throws ApiError
     */
    public static workflowExecutionGetWorkflowExecutionParams(
        eid: string,
    ): CancelablePromise<Record<string, any>> {
        return __request(OpenAPI, {
            method: 'GET',
            url: '/workflow_executions/{eid}/params',
            path: {
                'eid': eid,
            },
            errors: {
                400: `Error decoding JWT Token`,
                401: `Not Authenticated`,
                403: `Not Authorized`,
                404: `Entity not Found`,
                422: `Validation Error`,
            },
        });
    }
    /**
     * Cancel a workflow execution
     * Cancel a running workflow execution.
     *
     * Permission `workflow_execution:cancel` required if the current user started the workflow execution,
     * otherwise `workflow_execution:cancel_any` required.
     * @param eid ID of a workflow execution.
     * @returns void
     * @throws ApiError
     */
    public static workflowExecutionCancelWorkflowExecution(
        eid: string,
    ): CancelablePromise<void> {
        return __request(OpenAPI, {
            method: 'POST',
            url: '/workflow_executions/{eid}/cancel',
            path: {
                'eid': eid,
            },
            errors: {
                400: `Error decoding JWT Token`,
                401: `Not Authenticated`,
                403: `Not Authorized`,
                404: `Entity not Found`,
                422: `Validation Error`,
            },
        });
    }
}