/* 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 { DeliveryMethodEnum, PaginatedSSFStreamList, SSFStream } from "../models/index";
import { PaginatedSSFStreamListFromJSON, SSFStreamFromJSON } from "../models/index";
import * as runtime from "../runtime";

export interface SsfStreamsDestroyRequest {
    uuid: string;
}

export interface SsfStreamsListRequest {
    deliveryMethod?: DeliveryMethodEnum;
    endpointUrl?: string;
    ordering?: string;
    page?: number;
    pageSize?: number;
    provider?: number;
    search?: string;
}

export interface SsfStreamsRetrieveRequest {
    uuid: string;
}

/**
 *
 */
export class SsfApi extends runtime.BaseAPI {
    /**
     * Creates request options for ssfStreamsDestroy without sending the request
     */
    async ssfStreamsDestroyRequestOpts(
        requestParameters: SsfStreamsDestroyRequest,
    ): Promise<runtime.RequestOpts> {
        if (requestParameters["uuid"] == null) {
            throw new runtime.RequiredError(
                "uuid",
                'Required parameter "uuid" was null or undefined when calling ssfStreamsDestroy().',
            );
        }

        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 = `/ssf/streams/{uuid}/`;
        urlPath = urlPath.replace(
            `{${"uuid"}}`,
            encodeURIComponent(String(requestParameters["uuid"])),
        );

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

    /**
     * SSFStream Viewset
     */
    async ssfStreamsDestroyRaw(
        requestParameters: SsfStreamsDestroyRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<void>> {
        const requestOptions = await this.ssfStreamsDestroyRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     * SSFStream Viewset
     */
    async ssfStreamsDestroy(
        requestParameters: SsfStreamsDestroyRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<void> {
        await this.ssfStreamsDestroyRaw(requestParameters, initOverrides);
    }

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

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

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

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

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

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

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

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

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

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

    /**
     * SSFStream Viewset
     */
    async ssfStreamsListRaw(
        requestParameters: SsfStreamsListRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<PaginatedSSFStreamList>> {
        const requestOptions = await this.ssfStreamsListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * SSFStream Viewset
     */
    async ssfStreamsList(
        requestParameters: SsfStreamsListRequest = {},
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<PaginatedSSFStreamList> {
        const response = await this.ssfStreamsListRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

        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 = `/ssf/streams/{uuid}/`;
        urlPath = urlPath.replace(
            `{${"uuid"}}`,
            encodeURIComponent(String(requestParameters["uuid"])),
        );

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

    /**
     * SSFStream Viewset
     */
    async ssfStreamsRetrieveRaw(
        requestParameters: SsfStreamsRetrieveRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<SSFStream>> {
        const requestOptions = await this.ssfStreamsRetrieveRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * SSFStream Viewset
     */
    async ssfStreamsRetrieve(
        requestParameters: SsfStreamsRetrieveRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<SSFStream> {
        const response = await this.ssfStreamsRetrieveRaw(requestParameters, initOverrides);
        return await response.value();
    }
}
