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

export interface SchemaRetrieveRequest {
    format?: FormatEnum;
    lang?: LangEnum;
}

/**
 *
 */
export class SchemaApi extends runtime.BaseAPI {
    /**
     * Creates request options for schemaRetrieve without sending the request
     */
    async schemaRetrieveRequestOpts(
        requestParameters: SchemaRetrieveRequest,
    ): Promise<runtime.RequestOpts> {
        const queryParameters: any = {};

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

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

        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 = `/schema/`;

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

    /**
     * OpenApi3 schema for this API. Format can be selected via content negotiation.  - YAML: application/vnd.oai.openapi - JSON: application/vnd.oai.openapi+json
     */
    async schemaRetrieveRaw(
        requestParameters: SchemaRetrieveRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<{ [key: string]: any }>> {
        const requestOptions = await this.schemaRetrieveRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse<any>(response);
    }

    /**
     * OpenApi3 schema for this API. Format can be selected via content negotiation.  - YAML: application/vnd.oai.openapi - JSON: application/vnd.oai.openapi+json
     */
    async schemaRetrieve(
        requestParameters: SchemaRetrieveRequest = {},
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<{ [key: string]: any }> {
        const response = await this.schemaRetrieveRaw(requestParameters, initOverrides);
        return await response.value();
    }
}
