/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2026.2.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 * as runtime from '../runtime';
import type {
  Config,
  GenericError,
  ValidationError,
} from '../models/index';
import {
    ConfigFromJSON,
    ConfigToJSON,
    GenericErrorFromJSON,
    GenericErrorToJSON,
    ValidationErrorFromJSON,
    ValidationErrorToJSON,
} from '../models/index';

/**
 * 
 */
export class RootApi extends runtime.BaseAPI {

    /**
     * Retrieve public configuration options
     */
    async rootConfigRetrieveRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Config>> {
        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/`;

        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, 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();
    }

}
