/* 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 { Config } from "../models/index";
import { ConfigFromJSON } from "../models/index";
import * as runtime from "../runtime";

/**
 *
 */
export class RootApi extends runtime.BaseAPI {
    /**
     * Creates request options for rootConfigRetrieve without sending the request
     */
    async rootConfigRetrieveRequestOpts(): 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 = `/root/config/`;

        return {
            path: urlPath,
            method: "GET",
            headers: headerParameters,
            query: queryParameters,
        };
    }

    /**
     * Retrieve public configuration options
     */
    async rootConfigRetrieveRaw(
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Config>> {
        const requestOptions = await this.rootConfigRetrieveRequestOpts();
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * Retrieve public configuration options
     */
    async rootConfigRetrieve(
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Config> {
        const response = await this.rootConfigRetrieveRaw(initOverrides);
        return await response.value();
    }
}
