"use strict";
/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2025.10.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.AdminApi = void 0;
const runtime = __importStar(require("../runtime"));
const index_1 = require("../models/index");
/**
 *
 */
class AdminApi extends runtime.BaseAPI {
    /**
     * Read-only view list all installed apps
     */
    async adminAppsListRaw(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 = `/admin/apps/`;
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, 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();
    }
    /**
     * Read-only view list all installed models
     */
    async adminModelsListRaw(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 = `/admin/models/`;
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, 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();
    }
    /**
     * Settings view
     */
    async adminSettingsPartialUpdateRaw(requestParameters, initOverrides) {
        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/`;
        const response = await this.request({
            path: urlPath,
            method: 'PATCH',
            headers: headerParameters,
            query: queryParameters,
            body: (0, index_1.PatchedSettingsRequestToJSON)(requestParameters['patchedSettingsRequest']),
        }, 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();
    }
    /**
     * Settings view
     */
    async adminSettingsRetrieveRaw(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 = `/admin/settings/`;
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, 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();
    }
    /**
     * Settings view
     */
    async adminSettingsUpdateRaw(requestParameters, initOverrides) {
        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/`;
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: (0, index_1.SettingsRequestToJSON)(requestParameters['settingsRequest']),
        }, 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();
    }
    /**
     * Get system information.
     */
    async adminSystemCreateRaw(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 = `/admin/system/`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        }, 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();
    }
    /**
     * Get system information.
     */
    async adminSystemRetrieveRaw(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 = `/admin/system/`;
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, 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();
    }
    /**
     * VersionHistory Viewset
     */
    async adminVersionHistoryListRaw(requestParameters, initOverrides) {
        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/`;
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, 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();
    }
    /**
     * VersionHistory Viewset
     */
    async adminVersionHistoryRetrieveRaw(requestParameters, initOverrides) {
        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'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, 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();
    }
    /**
     * Get running and latest version.
     */
    async adminVersionRetrieveRaw(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 = `/admin/version/`;
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, 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;
//# sourceMappingURL=AdminApi.js.map