"use strict";
/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2025.12.0-rc1
 * Contact: hello@goauthentik.io
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowsInstancesListDesignationEnum = exports.FlowsInstancesListDeniedActionEnum = exports.FlowsBindingsListPolicyEngineModeEnum = exports.FlowsBindingsListInvalidResponseActionEnum = exports.FlowsApi = void 0;
const runtime = __importStar(require("../runtime"));
const index_1 = require("../models/index");
/**
 *
 */
class FlowsApi extends runtime.BaseAPI {
    /**
     * FlowStageBinding Viewset
     */
    async flowsBindingsCreateRaw(requestParameters, initOverrides) {
        if (requestParameters['flowStageBindingRequest'] == null) {
            throw new runtime.RequiredError('flowStageBindingRequest', 'Required parameter "flowStageBindingRequest" was null or undefined when calling flowsBindingsCreate().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/bindings/`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: (0, index_1.FlowStageBindingRequestToJSON)(requestParameters['flowStageBindingRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.FlowStageBindingFromJSON)(jsonValue));
    }
    /**
     * FlowStageBinding Viewset
     */
    async flowsBindingsCreate(requestParameters, initOverrides) {
        const response = await this.flowsBindingsCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * FlowStageBinding Viewset
     */
    async flowsBindingsDestroyRaw(requestParameters, initOverrides) {
        if (requestParameters['fsbUuid'] == null) {
            throw new runtime.RequiredError('fsbUuid', 'Required parameter "fsbUuid" was null or undefined when calling flowsBindingsDestroy().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/bindings/{fsb_uuid}/`;
        urlPath = urlPath.replace(`{${"fsb_uuid"}}`, encodeURIComponent(String(requestParameters['fsbUuid'])));
        const response = await this.request({
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * FlowStageBinding Viewset
     */
    async flowsBindingsDestroy(requestParameters, initOverrides) {
        await this.flowsBindingsDestroyRaw(requestParameters, initOverrides);
    }
    /**
     * FlowStageBinding Viewset
     */
    async flowsBindingsListRaw(requestParameters, initOverrides) {
        const queryParameters = {};
        if (requestParameters['evaluateOnPlan'] != null) {
            queryParameters['evaluate_on_plan'] = requestParameters['evaluateOnPlan'];
        }
        if (requestParameters['fsbUuid'] != null) {
            queryParameters['fsb_uuid'] = requestParameters['fsbUuid'];
        }
        if (requestParameters['invalidResponseAction'] != null) {
            queryParameters['invalid_response_action'] = requestParameters['invalidResponseAction'];
        }
        if (requestParameters['order'] != null) {
            queryParameters['order'] = requestParameters['order'];
        }
        if (requestParameters['ordering'] != null) {
            queryParameters['ordering'] = requestParameters['ordering'];
        }
        if (requestParameters['page'] != null) {
            queryParameters['page'] = requestParameters['page'];
        }
        if (requestParameters['pageSize'] != null) {
            queryParameters['page_size'] = requestParameters['pageSize'];
        }
        if (requestParameters['pbmUuid'] != null) {
            queryParameters['pbm_uuid'] = requestParameters['pbmUuid'];
        }
        if (requestParameters['policies'] != null) {
            queryParameters['policies'] = requestParameters['policies'];
        }
        if (requestParameters['policyEngineMode'] != null) {
            queryParameters['policy_engine_mode'] = requestParameters['policyEngineMode'];
        }
        if (requestParameters['reEvaluatePolicies'] != null) {
            queryParameters['re_evaluate_policies'] = requestParameters['reEvaluatePolicies'];
        }
        if (requestParameters['search'] != null) {
            queryParameters['search'] = requestParameters['search'];
        }
        if (requestParameters['stage'] != null) {
            queryParameters['stage'] = requestParameters['stage'];
        }
        if (requestParameters['target'] != null) {
            queryParameters['target'] = requestParameters['target'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/bindings/`;
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.PaginatedFlowStageBindingListFromJSON)(jsonValue));
    }
    /**
     * FlowStageBinding Viewset
     */
    async flowsBindingsList(requestParameters = {}, initOverrides) {
        const response = await this.flowsBindingsListRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * FlowStageBinding Viewset
     */
    async flowsBindingsPartialUpdateRaw(requestParameters, initOverrides) {
        if (requestParameters['fsbUuid'] == null) {
            throw new runtime.RequiredError('fsbUuid', 'Required parameter "fsbUuid" was null or undefined when calling flowsBindingsPartialUpdate().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/bindings/{fsb_uuid}/`;
        urlPath = urlPath.replace(`{${"fsb_uuid"}}`, encodeURIComponent(String(requestParameters['fsbUuid'])));
        const response = await this.request({
            path: urlPath,
            method: 'PATCH',
            headers: headerParameters,
            query: queryParameters,
            body: (0, index_1.PatchedFlowStageBindingRequestToJSON)(requestParameters['patchedFlowStageBindingRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.FlowStageBindingFromJSON)(jsonValue));
    }
    /**
     * FlowStageBinding Viewset
     */
    async flowsBindingsPartialUpdate(requestParameters, initOverrides) {
        const response = await this.flowsBindingsPartialUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * FlowStageBinding Viewset
     */
    async flowsBindingsRetrieveRaw(requestParameters, initOverrides) {
        if (requestParameters['fsbUuid'] == null) {
            throw new runtime.RequiredError('fsbUuid', 'Required parameter "fsbUuid" was null or undefined when calling flowsBindingsRetrieve().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/bindings/{fsb_uuid}/`;
        urlPath = urlPath.replace(`{${"fsb_uuid"}}`, encodeURIComponent(String(requestParameters['fsbUuid'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.FlowStageBindingFromJSON)(jsonValue));
    }
    /**
     * FlowStageBinding Viewset
     */
    async flowsBindingsRetrieve(requestParameters, initOverrides) {
        const response = await this.flowsBindingsRetrieveRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * FlowStageBinding Viewset
     */
    async flowsBindingsUpdateRaw(requestParameters, initOverrides) {
        if (requestParameters['fsbUuid'] == null) {
            throw new runtime.RequiredError('fsbUuid', 'Required parameter "fsbUuid" was null or undefined when calling flowsBindingsUpdate().');
        }
        if (requestParameters['flowStageBindingRequest'] == null) {
            throw new runtime.RequiredError('flowStageBindingRequest', 'Required parameter "flowStageBindingRequest" was null or undefined when calling flowsBindingsUpdate().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/bindings/{fsb_uuid}/`;
        urlPath = urlPath.replace(`{${"fsb_uuid"}}`, encodeURIComponent(String(requestParameters['fsbUuid'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: (0, index_1.FlowStageBindingRequestToJSON)(requestParameters['flowStageBindingRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.FlowStageBindingFromJSON)(jsonValue));
    }
    /**
     * FlowStageBinding Viewset
     */
    async flowsBindingsUpdate(requestParameters, initOverrides) {
        const response = await this.flowsBindingsUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Get a list of all objects that use this object
     */
    async flowsBindingsUsedByListRaw(requestParameters, initOverrides) {
        if (requestParameters['fsbUuid'] == null) {
            throw new runtime.RequiredError('fsbUuid', 'Required parameter "fsbUuid" was null or undefined when calling flowsBindingsUsedByList().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/bindings/{fsb_uuid}/used_by/`;
        urlPath = urlPath.replace(`{${"fsb_uuid"}}`, encodeURIComponent(String(requestParameters['fsbUuid'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(index_1.UsedByFromJSON));
    }
    /**
     * Get a list of all objects that use this object
     */
    async flowsBindingsUsedByList(requestParameters, initOverrides) {
        const response = await this.flowsBindingsUsedByListRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Get the next pending challenge from the currently active flow.
     */
    async flowsExecutorGetRaw(requestParameters, initOverrides) {
        if (requestParameters['flowSlug'] == null) {
            throw new runtime.RequiredError('flowSlug', 'Required parameter "flowSlug" was null or undefined when calling flowsExecutorGet().');
        }
        if (requestParameters['query'] == null) {
            throw new runtime.RequiredError('query', 'Required parameter "query" was null or undefined when calling flowsExecutorGet().');
        }
        const queryParameters = {};
        if (requestParameters['query'] != null) {
            queryParameters['query'] = requestParameters['query'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/executor/{flow_slug}/`;
        urlPath = urlPath.replace(`{${"flow_slug"}}`, encodeURIComponent(String(requestParameters['flowSlug'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ChallengeTypesFromJSON)(jsonValue));
    }
    /**
     * Get the next pending challenge from the currently active flow.
     */
    async flowsExecutorGet(requestParameters, initOverrides) {
        const response = await this.flowsExecutorGetRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Solve the previously retrieved challenge and advanced to the next stage.
     */
    async flowsExecutorSolveRaw(requestParameters, initOverrides) {
        if (requestParameters['flowSlug'] == null) {
            throw new runtime.RequiredError('flowSlug', 'Required parameter "flowSlug" was null or undefined when calling flowsExecutorSolve().');
        }
        if (requestParameters['query'] == null) {
            throw new runtime.RequiredError('query', 'Required parameter "query" was null or undefined when calling flowsExecutorSolve().');
        }
        const queryParameters = {};
        if (requestParameters['query'] != null) {
            queryParameters['query'] = requestParameters['query'];
        }
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/executor/{flow_slug}/`;
        urlPath = urlPath.replace(`{${"flow_slug"}}`, encodeURIComponent(String(requestParameters['flowSlug'])));
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: (0, index_1.FlowChallengeResponseRequestToJSON)(requestParameters['flowChallengeResponseRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ChallengeTypesFromJSON)(jsonValue));
    }
    /**
     * Solve the previously retrieved challenge and advanced to the next stage.
     */
    async flowsExecutorSolve(requestParameters, initOverrides) {
        const response = await this.flowsExecutorSolveRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Get current flow state and record it
     */
    async flowsInspectorGetRaw(requestParameters, initOverrides) {
        if (requestParameters['flowSlug'] == null) {
            throw new runtime.RequiredError('flowSlug', 'Required parameter "flowSlug" was null or undefined when calling flowsInspectorGet().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/inspector/{flow_slug}/`;
        urlPath = urlPath.replace(`{${"flow_slug"}}`, encodeURIComponent(String(requestParameters['flowSlug'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.FlowInspectionFromJSON)(jsonValue));
    }
    /**
     * Get current flow state and record it
     */
    async flowsInspectorGet(requestParameters, initOverrides) {
        const response = await this.flowsInspectorGetRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Clear flow cache
     */
    async flowsInstancesCacheClearCreateRaw(initOverrides) {
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/instances/cache_clear/`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * Clear flow cache
     */
    async flowsInstancesCacheClearCreate(initOverrides) {
        await this.flowsInstancesCacheClearCreateRaw(initOverrides);
    }
    /**
     * Info about cached flows
     */
    async flowsInstancesCacheInfoRetrieveRaw(initOverrides) {
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/instances/cache_info/`;
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.CacheFromJSON)(jsonValue));
    }
    /**
     * Info about cached flows
     */
    async flowsInstancesCacheInfoRetrieve(initOverrides) {
        const response = await this.flowsInstancesCacheInfoRetrieveRaw(initOverrides);
        return await response.value();
    }
    /**
     * Flow Viewset
     */
    async flowsInstancesCreateRaw(requestParameters, initOverrides) {
        if (requestParameters['flowRequest'] == null) {
            throw new runtime.RequiredError('flowRequest', 'Required parameter "flowRequest" was null or undefined when calling flowsInstancesCreate().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/instances/`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: (0, index_1.FlowRequestToJSON)(requestParameters['flowRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.FlowFromJSON)(jsonValue));
    }
    /**
     * Flow Viewset
     */
    async flowsInstancesCreate(requestParameters, initOverrides) {
        const response = await this.flowsInstancesCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Flow Viewset
     */
    async flowsInstancesDestroyRaw(requestParameters, initOverrides) {
        if (requestParameters['slug'] == null) {
            throw new runtime.RequiredError('slug', 'Required parameter "slug" was null or undefined when calling flowsInstancesDestroy().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/instances/{slug}/`;
        urlPath = urlPath.replace(`{${"slug"}}`, encodeURIComponent(String(requestParameters['slug'])));
        const response = await this.request({
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * Flow Viewset
     */
    async flowsInstancesDestroy(requestParameters, initOverrides) {
        await this.flowsInstancesDestroyRaw(requestParameters, initOverrides);
    }
    /**
     * Return diagram for flow with slug `slug`, in the format used by flowchart.js
     */
    async flowsInstancesDiagramRetrieveRaw(requestParameters, initOverrides) {
        if (requestParameters['slug'] == null) {
            throw new runtime.RequiredError('slug', 'Required parameter "slug" was null or undefined when calling flowsInstancesDiagramRetrieve().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/instances/{slug}/diagram/`;
        urlPath = urlPath.replace(`{${"slug"}}`, encodeURIComponent(String(requestParameters['slug'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.FlowDiagramFromJSON)(jsonValue));
    }
    /**
     * Return diagram for flow with slug `slug`, in the format used by flowchart.js
     */
    async flowsInstancesDiagramRetrieve(requestParameters, initOverrides) {
        const response = await this.flowsInstancesDiagramRetrieveRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Execute flow for current user
     */
    async flowsInstancesExecuteRetrieveRaw(requestParameters, initOverrides) {
        if (requestParameters['slug'] == null) {
            throw new runtime.RequiredError('slug', 'Required parameter "slug" was null or undefined when calling flowsInstancesExecuteRetrieve().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/instances/{slug}/execute/`;
        urlPath = urlPath.replace(`{${"slug"}}`, encodeURIComponent(String(requestParameters['slug'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.LinkFromJSON)(jsonValue));
    }
    /**
     * Execute flow for current user
     */
    async flowsInstancesExecuteRetrieve(requestParameters, initOverrides) {
        const response = await this.flowsInstancesExecuteRetrieveRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Export flow to .yaml file
     */
    async flowsInstancesExportRetrieveRaw(requestParameters, initOverrides) {
        if (requestParameters['slug'] == null) {
            throw new runtime.RequiredError('slug', 'Required parameter "slug" was null or undefined when calling flowsInstancesExportRetrieve().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/instances/{slug}/export/`;
        urlPath = urlPath.replace(`{${"slug"}}`, encodeURIComponent(String(requestParameters['slug'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.BlobApiResponse(response);
    }
    /**
     * Export flow to .yaml file
     */
    async flowsInstancesExportRetrieve(requestParameters, initOverrides) {
        const response = await this.flowsInstancesExportRetrieveRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Import flow from .yaml file
     */
    async flowsInstancesImportCreateRaw(requestParameters, initOverrides) {
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        const consumes = [
            { contentType: 'multipart/form-data' },
        ];
        // @ts-ignore: canConsumeForm may be unused
        const canConsumeForm = runtime.canConsumeForm(consumes);
        let formParams;
        let useForm = false;
        // use FormData to transmit files using content-type "multipart/form-data"
        useForm = canConsumeForm;
        if (useForm) {
            formParams = new FormData();
        }
        else {
            formParams = new URLSearchParams();
        }
        if (requestParameters['file'] != null) {
            formParams.append('file', requestParameters['file']);
        }
        if (requestParameters['clear'] != null) {
            formParams.append('clear', requestParameters['clear']);
        }
        let urlPath = `/flows/instances/import/`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: formParams,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.FlowImportResultFromJSON)(jsonValue));
    }
    /**
     * Import flow from .yaml file
     */
    async flowsInstancesImportCreate(requestParameters = {}, initOverrides) {
        const response = await this.flowsInstancesImportCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Flow Viewset
     */
    async flowsInstancesListRaw(requestParameters, initOverrides) {
        const queryParameters = {};
        if (requestParameters['deniedAction'] != null) {
            queryParameters['denied_action'] = requestParameters['deniedAction'];
        }
        if (requestParameters['designation'] != null) {
            queryParameters['designation'] = requestParameters['designation'];
        }
        if (requestParameters['flowUuid'] != null) {
            queryParameters['flow_uuid'] = requestParameters['flowUuid'];
        }
        if (requestParameters['name'] != null) {
            queryParameters['name'] = requestParameters['name'];
        }
        if (requestParameters['ordering'] != null) {
            queryParameters['ordering'] = requestParameters['ordering'];
        }
        if (requestParameters['page'] != null) {
            queryParameters['page'] = requestParameters['page'];
        }
        if (requestParameters['pageSize'] != null) {
            queryParameters['page_size'] = requestParameters['pageSize'];
        }
        if (requestParameters['search'] != null) {
            queryParameters['search'] = requestParameters['search'];
        }
        if (requestParameters['slug'] != null) {
            queryParameters['slug'] = requestParameters['slug'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/instances/`;
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.PaginatedFlowListFromJSON)(jsonValue));
    }
    /**
     * Flow Viewset
     */
    async flowsInstancesList(requestParameters = {}, initOverrides) {
        const response = await this.flowsInstancesListRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Flow Viewset
     */
    async flowsInstancesPartialUpdateRaw(requestParameters, initOverrides) {
        if (requestParameters['slug'] == null) {
            throw new runtime.RequiredError('slug', 'Required parameter "slug" was null or undefined when calling flowsInstancesPartialUpdate().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/instances/{slug}/`;
        urlPath = urlPath.replace(`{${"slug"}}`, encodeURIComponent(String(requestParameters['slug'])));
        const response = await this.request({
            path: urlPath,
            method: 'PATCH',
            headers: headerParameters,
            query: queryParameters,
            body: (0, index_1.PatchedFlowRequestToJSON)(requestParameters['patchedFlowRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.FlowFromJSON)(jsonValue));
    }
    /**
     * Flow Viewset
     */
    async flowsInstancesPartialUpdate(requestParameters, initOverrides) {
        const response = await this.flowsInstancesPartialUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Flow Viewset
     */
    async flowsInstancesRetrieveRaw(requestParameters, initOverrides) {
        if (requestParameters['slug'] == null) {
            throw new runtime.RequiredError('slug', 'Required parameter "slug" was null or undefined when calling flowsInstancesRetrieve().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/instances/{slug}/`;
        urlPath = urlPath.replace(`{${"slug"}}`, encodeURIComponent(String(requestParameters['slug'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.FlowFromJSON)(jsonValue));
    }
    /**
     * Flow Viewset
     */
    async flowsInstancesRetrieve(requestParameters, initOverrides) {
        const response = await this.flowsInstancesRetrieveRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Set Flow background
     */
    async flowsInstancesSetBackgroundCreateRaw(requestParameters, initOverrides) {
        if (requestParameters['slug'] == null) {
            throw new runtime.RequiredError('slug', 'Required parameter "slug" was null or undefined when calling flowsInstancesSetBackgroundCreate().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        const consumes = [
            { contentType: 'multipart/form-data' },
        ];
        // @ts-ignore: canConsumeForm may be unused
        const canConsumeForm = runtime.canConsumeForm(consumes);
        let formParams;
        let useForm = false;
        // use FormData to transmit files using content-type "multipart/form-data"
        useForm = canConsumeForm;
        if (useForm) {
            formParams = new FormData();
        }
        else {
            formParams = new URLSearchParams();
        }
        if (requestParameters['file'] != null) {
            formParams.append('file', requestParameters['file']);
        }
        if (requestParameters['clear'] != null) {
            formParams.append('clear', requestParameters['clear']);
        }
        let urlPath = `/flows/instances/{slug}/set_background/`;
        urlPath = urlPath.replace(`{${"slug"}}`, encodeURIComponent(String(requestParameters['slug'])));
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: formParams,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * Set Flow background
     */
    async flowsInstancesSetBackgroundCreate(requestParameters, initOverrides) {
        await this.flowsInstancesSetBackgroundCreateRaw(requestParameters, initOverrides);
    }
    /**
     * Set Flow background (as URL)
     */
    async flowsInstancesSetBackgroundUrlCreateRaw(requestParameters, initOverrides) {
        if (requestParameters['slug'] == null) {
            throw new runtime.RequiredError('slug', 'Required parameter "slug" was null or undefined when calling flowsInstancesSetBackgroundUrlCreate().');
        }
        if (requestParameters['filePathRequest'] == null) {
            throw new runtime.RequiredError('filePathRequest', 'Required parameter "filePathRequest" was null or undefined when calling flowsInstancesSetBackgroundUrlCreate().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/instances/{slug}/set_background_url/`;
        urlPath = urlPath.replace(`{${"slug"}}`, encodeURIComponent(String(requestParameters['slug'])));
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: (0, index_1.FilePathRequestToJSON)(requestParameters['filePathRequest']),
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * Set Flow background (as URL)
     */
    async flowsInstancesSetBackgroundUrlCreate(requestParameters, initOverrides) {
        await this.flowsInstancesSetBackgroundUrlCreateRaw(requestParameters, initOverrides);
    }
    /**
     * Flow Viewset
     */
    async flowsInstancesUpdateRaw(requestParameters, initOverrides) {
        if (requestParameters['slug'] == null) {
            throw new runtime.RequiredError('slug', 'Required parameter "slug" was null or undefined when calling flowsInstancesUpdate().');
        }
        if (requestParameters['flowRequest'] == null) {
            throw new runtime.RequiredError('flowRequest', 'Required parameter "flowRequest" was null or undefined when calling flowsInstancesUpdate().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/instances/{slug}/`;
        urlPath = urlPath.replace(`{${"slug"}}`, encodeURIComponent(String(requestParameters['slug'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: (0, index_1.FlowRequestToJSON)(requestParameters['flowRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.FlowFromJSON)(jsonValue));
    }
    /**
     * Flow Viewset
     */
    async flowsInstancesUpdate(requestParameters, initOverrides) {
        const response = await this.flowsInstancesUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Get a list of all objects that use this object
     */
    async flowsInstancesUsedByListRaw(requestParameters, initOverrides) {
        if (requestParameters['slug'] == null) {
            throw new runtime.RequiredError('slug', 'Required parameter "slug" was null or undefined when calling flowsInstancesUsedByList().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/flows/instances/{slug}/used_by/`;
        urlPath = urlPath.replace(`{${"slug"}}`, encodeURIComponent(String(requestParameters['slug'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(index_1.UsedByFromJSON));
    }
    /**
     * Get a list of all objects that use this object
     */
    async flowsInstancesUsedByList(requestParameters, initOverrides) {
        const response = await this.flowsInstancesUsedByListRaw(requestParameters, initOverrides);
        return await response.value();
    }
}
exports.FlowsApi = FlowsApi;
/**
 * @export
 */
exports.FlowsBindingsListInvalidResponseActionEnum = {
    Restart: 'restart',
    RestartWithContext: 'restart_with_context',
    Retry: 'retry',
    UnknownDefaultOpenApi: '11184809'
};
/**
 * @export
 */
exports.FlowsBindingsListPolicyEngineModeEnum = {
    All: 'all',
    Any: 'any',
    UnknownDefaultOpenApi: '11184809'
};
/**
 * @export
 */
exports.FlowsInstancesListDeniedActionEnum = {
    Continue: 'continue',
    Message: 'message',
    MessageContinue: 'message_continue',
    UnknownDefaultOpenApi: '11184809'
};
/**
 * @export
 */
exports.FlowsInstancesListDesignationEnum = {
    Authentication: 'authentication',
    Authorization: 'authorization',
    Enrollment: 'enrollment',
    Invalidation: 'invalidation',
    Recovery: 'recovery',
    StageConfiguration: 'stage_configuration',
    Unenrollment: 'unenrollment',
    UnknownDefaultOpenApi: '11184809'
};
//# sourceMappingURL=FlowsApi.js.map