/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2025.10.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 {
  GenericError,
  PaginatedSSFStreamList,
  SSFStream,
  ValidationError,
} from '../models/index';
import {
    GenericErrorFromJSON,
    GenericErrorToJSON,
    PaginatedSSFStreamListFromJSON,
    PaginatedSSFStreamListToJSON,
    SSFStreamFromJSON,
    SSFStreamToJSON,
    ValidationErrorFromJSON,
    ValidationErrorToJSON,
} from '../models/index';

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

export interface SsfStreamsRetrieveRequest {
    uuid: string;
}

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

    /**
     * SSFStream Viewset
     */
    async ssfStreamsListRaw(requestParameters: SsfStreamsListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedSSFStreamList>> {
        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/`;

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

    /**
     * SSFStream Viewset
     */
    async ssfStreamsRetrieveRaw(requestParameters: SsfStreamsRetrieveRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SSFStream>> {
        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'])));

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

}

/**
 * @export
 */
export const SsfStreamsListDeliveryMethodEnum = {
    HttpsSchemasOpenidNetSeceventRiscDeliveryMethodPoll: 'https://schemas.openid.net/secevent/risc/delivery-method/poll',
    HttpsSchemasOpenidNetSeceventRiscDeliveryMethodPush: 'https://schemas.openid.net/secevent/risc/delivery-method/push',
    UnknownDefaultOpenApi: '11184809'
} as const;
export type SsfStreamsListDeliveryMethodEnum = typeof SsfStreamsListDeliveryMethodEnum[keyof typeof SsfStreamsListDeliveryMethodEnum];
