/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2026.5.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.
 */

import type {
    App,
    FileList,
    PatchedSettingsRequest,
    Settings,
    SettingsRequest,
    SystemInfo,
    UsageEnum,
    UsedBy,
    Version,
    VersionHistory,
} from "../models/index";
import {
    AppFromJSON,
    FileListFromJSON,
    PatchedSettingsRequestToJSON,
    SettingsFromJSON,
    SettingsRequestToJSON,
    SystemInfoFromJSON,
    UsedByFromJSON,
    VersionFromJSON,
    VersionHistoryFromJSON,
} from "../models/index";
import * as runtime from "../runtime";

export interface AdminFileCreateRequest {
    file: Blob;
    name?: string;
    usage?: string;
}

export interface AdminFileDestroyRequest {
    name?: string;
    usage?: UsageEnum;
}

export interface AdminFileListRequest {
    manageableOnly?: boolean;
    search?: string;
    usage?: UsageEnum;
}

export interface AdminFileUsedByListRequest {
    name?: string;
}

export interface AdminSettingsPartialUpdateRequest {
    patchedSettingsRequest?: PatchedSettingsRequest;
}

export interface AdminSettingsUpdateRequest {
    settingsRequest: SettingsRequest;
}

export interface AdminVersionHistoryListRequest {
    build?: string;
    ordering?: string;
    search?: string;
    version?: string;
}

export interface AdminVersionHistoryRetrieveRequest {
    id: number;
}

/**
 *
 */
export class AdminApi extends runtime.BaseAPI {
    /**
     * Creates request options for adminAppsList without sending the request
     */
    async adminAppsListRequestOpts(): Promise<runtime.RequestOpts> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        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?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Array<App>>> {
        const requestOptions = await this.adminAppsListRequestOpts();
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(AppFromJSON));
    }

    /**
     * Read-only view list all installed apps
     */
    async adminAppsList(
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Array<App>> {
        const response = await this.adminAppsListRaw(initOverrides);
        return await response.value();
    }

    /**
     * Creates request options for adminFileCreate without sending the request
     */
    async adminFileCreateRequestOpts(
        requestParameters: AdminFileCreateRequest,
    ): Promise<runtime.RequestOpts> {
        if (requestParameters["file"] == null) {
            throw new runtime.RequiredError(
                "file",
                'Required parameter "file" was null or undefined when calling adminFileCreate().',
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        const consumes: runtime.Consume[] = [{ contentType: "multipart/form-data" }];
        // @ts-ignore: canConsumeForm may be unused
        const canConsumeForm = runtime.canConsumeForm(consumes);

        let formParams: { append(param: string, value: any): any };
        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"] as any);
        }

        if (requestParameters["name"] != null) {
            formParams.append("name", requestParameters["name"] as any);
        }

        if (requestParameters["usage"] != null) {
            formParams.append("usage", requestParameters["usage"] as any);
        }

        let urlPath = `/admin/file/`;

        return {
            path: urlPath,
            method: "POST",
            headers: headerParameters,
            query: queryParameters,
            body: formParams,
        };
    }

    /**
     * Upload file to storage backend.
     */
    async adminFileCreateRaw(
        requestParameters: AdminFileCreateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<void>> {
        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: AdminFileCreateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<void> {
        await this.adminFileCreateRaw(requestParameters, initOverrides);
    }

    /**
     * Creates request options for adminFileDestroy without sending the request
     */
    async adminFileDestroyRequestOpts(
        requestParameters: AdminFileDestroyRequest,
    ): Promise<runtime.RequestOpts> {
        const queryParameters: any = {};

        if (requestParameters["name"] != null) {
            queryParameters["name"] = requestParameters["name"];
        }

        if (requestParameters["usage"] != null) {
            queryParameters["usage"] = requestParameters["usage"];
        }

        const headerParameters: runtime.HTTPHeaders = {};

        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: AdminFileDestroyRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<void>> {
        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: AdminFileDestroyRequest = {},
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<void> {
        await this.adminFileDestroyRaw(requestParameters, initOverrides);
    }

    /**
     * Creates request options for adminFileList without sending the request
     */
    async adminFileListRequestOpts(
        requestParameters: AdminFileListRequest,
    ): Promise<runtime.RequestOpts> {
        const queryParameters: any = {};

        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: runtime.HTTPHeaders = {};

        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: AdminFileListRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Array<FileList>>> {
        const requestOptions = await this.adminFileListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) =>
            jsonValue.map(FileListFromJSON),
        );
    }

    /**
     * List files from storage backend.
     */
    async adminFileList(
        requestParameters: AdminFileListRequest = {},
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Array<FileList>> {
        const response = await this.adminFileListRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Creates request options for adminFileUsedByList without sending the request
     */
    async adminFileUsedByListRequestOpts(
        requestParameters: AdminFileUsedByListRequest,
    ): Promise<runtime.RequestOpts> {
        const queryParameters: any = {};

        if (requestParameters["name"] != null) {
            queryParameters["name"] = requestParameters["name"];
        }

        const headerParameters: runtime.HTTPHeaders = {};

        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: AdminFileUsedByListRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Array<UsedBy>>> {
        const requestOptions = await this.adminFileUsedByListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(UsedByFromJSON));
    }

    /**
     */
    async adminFileUsedByList(
        requestParameters: AdminFileUsedByListRequest = {},
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Array<UsedBy>> {
        const response = await this.adminFileUsedByListRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Creates request options for adminModelsList without sending the request
     */
    async adminModelsListRequestOpts(): Promise<runtime.RequestOpts> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        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?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Array<App>>> {
        const requestOptions = await this.adminModelsListRequestOpts();
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(AppFromJSON));
    }

    /**
     * Read-only view list all installed models
     */
    async adminModelsList(
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Array<App>> {
        const response = await this.adminModelsListRaw(initOverrides);
        return await response.value();
    }

    /**
     * Creates request options for adminSettingsPartialUpdate without sending the request
     */
    async adminSettingsPartialUpdateRequestOpts(
        requestParameters: AdminSettingsPartialUpdateRequest,
    ): Promise<runtime.RequestOpts> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        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: PatchedSettingsRequestToJSON(requestParameters["patchedSettingsRequest"]),
        };
    }

    /**
     * Settings view
     */
    async adminSettingsPartialUpdateRaw(
        requestParameters: AdminSettingsPartialUpdateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Settings>> {
        const requestOptions = await this.adminSettingsPartialUpdateRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => SettingsFromJSON(jsonValue));
    }

    /**
     * Settings view
     */
    async adminSettingsPartialUpdate(
        requestParameters: AdminSettingsPartialUpdateRequest = {},
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Settings> {
        const response = await this.adminSettingsPartialUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Creates request options for adminSettingsRetrieve without sending the request
     */
    async adminSettingsRetrieveRequestOpts(): Promise<runtime.RequestOpts> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        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?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Settings>> {
        const requestOptions = await this.adminSettingsRetrieveRequestOpts();
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => SettingsFromJSON(jsonValue));
    }

    /**
     * Settings view
     */
    async adminSettingsRetrieve(
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Settings> {
        const response = await this.adminSettingsRetrieveRaw(initOverrides);
        return await response.value();
    }

    /**
     * Creates request options for adminSettingsUpdate without sending the request
     */
    async adminSettingsUpdateRequestOpts(
        requestParameters: AdminSettingsUpdateRequest,
    ): Promise<runtime.RequestOpts> {
        if (requestParameters["settingsRequest"] == null) {
            throw new runtime.RequiredError(
                "settingsRequest",
                'Required parameter "settingsRequest" was null or undefined when calling adminSettingsUpdate().',
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        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: SettingsRequestToJSON(requestParameters["settingsRequest"]),
        };
    }

    /**
     * Settings view
     */
    async adminSettingsUpdateRaw(
        requestParameters: AdminSettingsUpdateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Settings>> {
        const requestOptions = await this.adminSettingsUpdateRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => SettingsFromJSON(jsonValue));
    }

    /**
     * Settings view
     */
    async adminSettingsUpdate(
        requestParameters: AdminSettingsUpdateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Settings> {
        const response = await this.adminSettingsUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Creates request options for adminSystemCreate without sending the request
     */
    async adminSystemCreateRequestOpts(): Promise<runtime.RequestOpts> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        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?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<SystemInfo>> {
        const requestOptions = await this.adminSystemCreateRequestOpts();
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => SystemInfoFromJSON(jsonValue));
    }

    /**
     * Get system information.
     */
    async adminSystemCreate(
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<SystemInfo> {
        const response = await this.adminSystemCreateRaw(initOverrides);
        return await response.value();
    }

    /**
     * Creates request options for adminSystemRetrieve without sending the request
     */
    async adminSystemRetrieveRequestOpts(): Promise<runtime.RequestOpts> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        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?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<SystemInfo>> {
        const requestOptions = await this.adminSystemRetrieveRequestOpts();
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => SystemInfoFromJSON(jsonValue));
    }

    /**
     * Get system information.
     */
    async adminSystemRetrieve(
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<SystemInfo> {
        const response = await this.adminSystemRetrieveRaw(initOverrides);
        return await response.value();
    }

    /**
     * Creates request options for adminVersionHistoryList without sending the request
     */
    async adminVersionHistoryListRequestOpts(
        requestParameters: AdminVersionHistoryListRequest,
    ): Promise<runtime.RequestOpts> {
        const queryParameters: any = {};

        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: runtime.HTTPHeaders = {};

        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: AdminVersionHistoryListRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Array<VersionHistory>>> {
        const requestOptions = await this.adminVersionHistoryListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) =>
            jsonValue.map(VersionHistoryFromJSON),
        );
    }

    /**
     * VersionHistory Viewset
     */
    async adminVersionHistoryList(
        requestParameters: AdminVersionHistoryListRequest = {},
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Array<VersionHistory>> {
        const response = await this.adminVersionHistoryListRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Creates request options for adminVersionHistoryRetrieve without sending the request
     */
    async adminVersionHistoryRetrieveRequestOpts(
        requestParameters: AdminVersionHistoryRetrieveRequest,
    ): Promise<runtime.RequestOpts> {
        if (requestParameters["id"] == null) {
            throw new runtime.RequiredError(
                "id",
                'Required parameter "id" was null or undefined when calling adminVersionHistoryRetrieve().',
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        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: AdminVersionHistoryRetrieveRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<VersionHistory>> {
        const requestOptions = await this.adminVersionHistoryRetrieveRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) =>
            VersionHistoryFromJSON(jsonValue),
        );
    }

    /**
     * VersionHistory Viewset
     */
    async adminVersionHistoryRetrieve(
        requestParameters: AdminVersionHistoryRetrieveRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<VersionHistory> {
        const response = await this.adminVersionHistoryRetrieveRaw(
            requestParameters,
            initOverrides,
        );
        return await response.value();
    }

    /**
     * Creates request options for adminVersionRetrieve without sending the request
     */
    async adminVersionRetrieveRequestOpts(): Promise<runtime.RequestOpts> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        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?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Version>> {
        const requestOptions = await this.adminVersionRetrieveRequestOpts();
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => VersionFromJSON(jsonValue));
    }

    /**
     * Get running and latest version.
     */
    async adminVersionRetrieve(
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Version> {
        const response = await this.adminVersionRetrieveRaw(initOverrides);
        return await response.value();
    }
}
