"use strict";
/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2026.2.0-rc5
 * 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.AdminFileListUsageEnum = exports.AdminFileDestroyUsageEnum = exports.AdminApi = void 0;
const runtime = __importStar(require("../runtime"));
const index_1 = require("../models/index");
/**
 *
 */
class AdminApi extends runtime.BaseAPI {
    /**
     * Creates request options for adminAppsList without sending the request
     */
    async adminAppsListRequestOpts() {
        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 = `/admin/apps/`;
        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * Read-only view list all installed apps
     */
    async adminAppsListRaw(initOverrides) {
        const requestOptions = await this.adminAppsListRequestOpts();
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(index_1.AppFromJSON));
    }
    /**
     * Read-only view list all installed apps
     */
    async adminAppsList(initOverrides) {
        const response = await this.adminAppsListRaw(initOverrides);
        return await response.value();
    }
    /**
     * Creates request options for adminFileCreate without sending the request
     */
    async adminFileCreateRequestOpts(requestParameters) {
        if (requestParameters['file'] == null) {
            throw new runtime.RequiredError('file', 'Required parameter "file" was null or undefined when calling adminFileCreate().');
        }
        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['name'] != null) {
            formParams.append('name', requestParameters['name']);
        }
        if (requestParameters['usage'] != null) {
            formParams.append('usage', requestParameters['usage']);
        }
        let urlPath = `/admin/file/`;
        return {
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: formParams,
        };
    }
    /**
     * Upload file to storage backend.
     */
    async adminFileCreateRaw(requestParameters, initOverrides) {
        const requestOptions = await this.adminFileCreateRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * Upload file to storage backend.
     */
    async adminFileCreate(requestParameters, initOverrides) {
        await this.adminFileCreateRaw(requestParameters, initOverrides);
    }
    /**
     * Creates request options for adminFileDestroy without sending the request
     */
    async adminFileDestroyRequestOpts(requestParameters) {
        const queryParameters = {};
        if (requestParameters['name'] != null) {
            queryParameters['name'] = requestParameters['name'];
        }
        if (requestParameters['usage'] != null) {
            queryParameters['usage'] = requestParameters['usage'];
        }
        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 = `/admin/file/`;
        return {
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * Delete file from storage backend.
     */
    async adminFileDestroyRaw(requestParameters, initOverrides) {
        const requestOptions = await this.adminFileDestroyRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * Delete file from storage backend.
     */
    async adminFileDestroy(requestParameters = {}, initOverrides) {
        await this.adminFileDestroyRaw(requestParameters, initOverrides);
    }
    /**
     * Creates request options for adminFileList without sending the request
     */
    async adminFileListRequestOpts(requestParameters) {
        const queryParameters = {};
        if (requestParameters['manageableOnly'] != null) {
            queryParameters['manageable_only'] = requestParameters['manageableOnly'];
        }
        if (requestParameters['search'] != null) {
            queryParameters['search'] = requestParameters['search'];
        }
        if (requestParameters['usage'] != null) {
            queryParameters['usage'] = requestParameters['usage'];
        }
        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 = `/admin/file/`;
        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * List files from storage backend.
     */
    async adminFileListRaw(requestParameters, initOverrides) {
        const requestOptions = await this.adminFileListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(index_1.FileListFromJSON));
    }
    /**
     * List files from storage backend.
     */
    async adminFileList(requestParameters = {}, initOverrides) {
        const response = await this.adminFileListRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Creates request options for adminFileUsedByList without sending the request
     */
    async adminFileUsedByListRequestOpts(requestParameters) {
        const queryParameters = {};
        if (requestParameters['name'] != null) {
            queryParameters['name'] = requestParameters['name'];
        }
        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 = `/admin/file/used_by/`;
        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     */
    async adminFileUsedByListRaw(requestParameters, initOverrides) {
        const requestOptions = await this.adminFileUsedByListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(index_1.UsedByFromJSON));
    }
    /**
     */
    async adminFileUsedByList(requestParameters = {}, initOverrides) {
        const response = await this.adminFileUsedByListRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Creates request options for adminModelsList without sending the request
     */
    async adminModelsListRequestOpts() {
        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 = `/admin/models/`;
        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * Read-only view list all installed models
     */
    async adminModelsListRaw(initOverrides) {
        const requestOptions = await this.adminModelsListRequestOpts();
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(index_1.AppFromJSON));
    }
    /**
     * Read-only view list all installed models
     */
    async adminModelsList(initOverrides) {
        const response = await this.adminModelsListRaw(initOverrides);
        return await response.value();
    }
    /**
     * Creates request options for adminSettingsPartialUpdate without sending the request
     */
    async adminSettingsPartialUpdateRequestOpts(requestParameters) {
        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 = `/admin/settings/`;
        return {
            path: urlPath,
            method: 'PATCH',
            headers: headerParameters,
            query: queryParameters,
            body: (0, index_1.PatchedSettingsRequestToJSON)(requestParameters['patchedSettingsRequest']),
        };
    }
    /**
     * Settings view
     */
    async adminSettingsPartialUpdateRaw(requestParameters, initOverrides) {
        const requestOptions = await this.adminSettingsPartialUpdateRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.SettingsFromJSON)(jsonValue));
    }
    /**
     * Settings view
     */
    async adminSettingsPartialUpdate(requestParameters = {}, initOverrides) {
        const response = await this.adminSettingsPartialUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Creates request options for adminSettingsRetrieve without sending the request
     */
    async adminSettingsRetrieveRequestOpts() {
        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 = `/admin/settings/`;
        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * Settings view
     */
    async adminSettingsRetrieveRaw(initOverrides) {
        const requestOptions = await this.adminSettingsRetrieveRequestOpts();
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.SettingsFromJSON)(jsonValue));
    }
    /**
     * Settings view
     */
    async adminSettingsRetrieve(initOverrides) {
        const response = await this.adminSettingsRetrieveRaw(initOverrides);
        return await response.value();
    }
    /**
     * Creates request options for adminSettingsUpdate without sending the request
     */
    async adminSettingsUpdateRequestOpts(requestParameters) {
        if (requestParameters['settingsRequest'] == null) {
            throw new runtime.RequiredError('settingsRequest', 'Required parameter "settingsRequest" was null or undefined when calling adminSettingsUpdate().');
        }
        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 = `/admin/settings/`;
        return {
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: (0, index_1.SettingsRequestToJSON)(requestParameters['settingsRequest']),
        };
    }
    /**
     * Settings view
     */
    async adminSettingsUpdateRaw(requestParameters, initOverrides) {
        const requestOptions = await this.adminSettingsUpdateRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.SettingsFromJSON)(jsonValue));
    }
    /**
     * Settings view
     */
    async adminSettingsUpdate(requestParameters, initOverrides) {
        const response = await this.adminSettingsUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Creates request options for adminSystemCreate without sending the request
     */
    async adminSystemCreateRequestOpts() {
        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 = `/admin/system/`;
        return {
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * Get system information.
     */
    async adminSystemCreateRaw(initOverrides) {
        const requestOptions = await this.adminSystemCreateRequestOpts();
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.SystemInfoFromJSON)(jsonValue));
    }
    /**
     * Get system information.
     */
    async adminSystemCreate(initOverrides) {
        const response = await this.adminSystemCreateRaw(initOverrides);
        return await response.value();
    }
    /**
     * Creates request options for adminSystemRetrieve without sending the request
     */
    async adminSystemRetrieveRequestOpts() {
        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 = `/admin/system/`;
        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * Get system information.
     */
    async adminSystemRetrieveRaw(initOverrides) {
        const requestOptions = await this.adminSystemRetrieveRequestOpts();
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.SystemInfoFromJSON)(jsonValue));
    }
    /**
     * Get system information.
     */
    async adminSystemRetrieve(initOverrides) {
        const response = await this.adminSystemRetrieveRaw(initOverrides);
        return await response.value();
    }
    /**
     * Creates request options for adminVersionHistoryList without sending the request
     */
    async adminVersionHistoryListRequestOpts(requestParameters) {
        const queryParameters = {};
        if (requestParameters['build'] != null) {
            queryParameters['build'] = requestParameters['build'];
        }
        if (requestParameters['ordering'] != null) {
            queryParameters['ordering'] = requestParameters['ordering'];
        }
        if (requestParameters['search'] != null) {
            queryParameters['search'] = requestParameters['search'];
        }
        if (requestParameters['version'] != null) {
            queryParameters['version'] = requestParameters['version'];
        }
        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 = `/admin/version/history/`;
        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * VersionHistory Viewset
     */
    async adminVersionHistoryListRaw(requestParameters, initOverrides) {
        const requestOptions = await this.adminVersionHistoryListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(index_1.VersionHistoryFromJSON));
    }
    /**
     * VersionHistory Viewset
     */
    async adminVersionHistoryList(requestParameters = {}, initOverrides) {
        const response = await this.adminVersionHistoryListRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Creates request options for adminVersionHistoryRetrieve without sending the request
     */
    async adminVersionHistoryRetrieveRequestOpts(requestParameters) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling adminVersionHistoryRetrieve().');
        }
        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 = `/admin/version/history/{id}/`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * VersionHistory Viewset
     */
    async adminVersionHistoryRetrieveRaw(requestParameters, initOverrides) {
        const requestOptions = await this.adminVersionHistoryRetrieveRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.VersionHistoryFromJSON)(jsonValue));
    }
    /**
     * VersionHistory Viewset
     */
    async adminVersionHistoryRetrieve(requestParameters, initOverrides) {
        const response = await this.adminVersionHistoryRetrieveRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Creates request options for adminVersionRetrieve without sending the request
     */
    async adminVersionRetrieveRequestOpts() {
        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 = `/admin/version/`;
        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * Get running and latest version.
     */
    async adminVersionRetrieveRaw(initOverrides) {
        const requestOptions = await this.adminVersionRetrieveRequestOpts();
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.VersionFromJSON)(jsonValue));
    }
    /**
     * Get running and latest version.
     */
    async adminVersionRetrieve(initOverrides) {
        const response = await this.adminVersionRetrieveRaw(initOverrides);
        return await response.value();
    }
}
exports.AdminApi = AdminApi;
/**
 * @export
 */
exports.AdminFileDestroyUsageEnum = {
    Media: 'media',
    UnknownDefaultOpenApi: '11184809'
};
/**
 * @export
 */
exports.AdminFileListUsageEnum = {
    Media: 'media',
    UnknownDefaultOpenApi: '11184809'
};
//# sourceMappingURL=AdminApi.js.map