/* 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 {
    DataExport,
    Event,
    EventActions,
    EventRequest,
    EventStats,
    EventTopPerUser,
    EventVolume,
    Notification,
    NotificationRequest,
    NotificationRule,
    NotificationRuleRequest,
    NotificationTransport,
    NotificationTransportRequest,
    NotificationTransportTest,
    PaginatedEventList,
    PaginatedNotificationList,
    PaginatedNotificationRuleList,
    PaginatedNotificationTransportList,
    PatchedEventRequest,
    PatchedNotificationRequest,
    PatchedNotificationRuleRequest,
    PatchedNotificationTransportRequest,
    SeverityEnum,
    TransportModeEnum,
    TypeCreate,
    UsedBy,
} from "../models/index";
import {
    DataExportFromJSON,
    EventFromJSON,
    EventRequestToJSON,
    EventStatsFromJSON,
    EventTopPerUserFromJSON,
    EventVolumeFromJSON,
    NotificationFromJSON,
    NotificationRequestToJSON,
    NotificationRuleFromJSON,
    NotificationRuleRequestToJSON,
    NotificationTransportFromJSON,
    NotificationTransportRequestToJSON,
    NotificationTransportTestFromJSON,
    PaginatedEventListFromJSON,
    PaginatedNotificationListFromJSON,
    PaginatedNotificationRuleListFromJSON,
    PaginatedNotificationTransportListFromJSON,
    PatchedEventRequestToJSON,
    PatchedNotificationRequestToJSON,
    PatchedNotificationRuleRequestToJSON,
    PatchedNotificationTransportRequestToJSON,
    TypeCreateFromJSON,
    UsedByFromJSON,
} from "../models/index";
import * as runtime from "../runtime";

export interface EventsEventsCreateRequest {
    eventRequest: EventRequest;
}

export interface EventsEventsDestroyRequest {
    eventUuid: string;
}

export interface EventsEventsExportCreateRequest {
    action?: string;
    actions?: Array<EventActions>;
    brandName?: string;
    clientIp?: string;
    contextAuthorizedApp?: string;
    contextDevice?: string;
    contextModelApp?: string;
    contextModelName?: string;
    contextModelPk?: string;
    ordering?: string;
    search?: string;
    username?: string;
}

export interface EventsEventsListRequest {
    action?: string;
    actions?: Array<EventActions>;
    brandName?: string;
    clientIp?: string;
    contextAuthorizedApp?: string;
    contextDevice?: string;
    contextModelApp?: string;
    contextModelName?: string;
    contextModelPk?: string;
    ordering?: string;
    page?: number;
    pageSize?: number;
    search?: string;
    username?: string;
}

export interface EventsEventsPartialUpdateRequest {
    eventUuid: string;
    patchedEventRequest?: PatchedEventRequest;
}

export interface EventsEventsRetrieveRequest {
    eventUuid: string;
}

export interface EventsEventsStatsRetrieveRequest {
    countSteps: Array<string>;
    action?: string;
    actions?: Array<EventActions>;
    brandName?: string;
    clientIp?: string;
    contextAuthorizedApp?: string;
    contextDevice?: string;
    contextModelApp?: string;
    contextModelName?: string;
    contextModelPk?: string;
    ordering?: string;
    search?: string;
    username?: string;
}

export interface EventsEventsTopPerUserListRequest {
    action?: string;
    topN?: number;
}

export interface EventsEventsUpdateRequest {
    eventUuid: string;
    eventRequest: EventRequest;
}

export interface EventsEventsVolumeListRequest {
    action?: string;
    actions?: Array<EventActions>;
    brandName?: string;
    clientIp?: string;
    contextAuthorizedApp?: string;
    contextDevice?: string;
    contextModelApp?: string;
    contextModelName?: string;
    contextModelPk?: string;
    historyDays?: number;
    ordering?: string;
    search?: string;
    username?: string;
}

export interface EventsNotificationsDestroyRequest {
    uuid: string;
}

export interface EventsNotificationsListRequest {
    body?: string;
    created?: Date;
    event?: string;
    ordering?: string;
    page?: number;
    pageSize?: number;
    search?: string;
    seen?: boolean;
    severity?: SeverityEnum;
    user?: number;
}

export interface EventsNotificationsPartialUpdateRequest {
    uuid: string;
    patchedNotificationRequest?: PatchedNotificationRequest;
}

export interface EventsNotificationsRetrieveRequest {
    uuid: string;
}

export interface EventsNotificationsUpdateRequest {
    uuid: string;
    notificationRequest?: NotificationRequest;
}

export interface EventsNotificationsUsedByListRequest {
    uuid: string;
}

export interface EventsRulesCreateRequest {
    notificationRuleRequest: NotificationRuleRequest;
}

export interface EventsRulesDestroyRequest {
    pbmUuid: string;
}

export interface EventsRulesListRequest {
    destinationGroupName?: string;
    name?: string;
    ordering?: string;
    page?: number;
    pageSize?: number;
    search?: string;
    severity?: SeverityEnum;
}

export interface EventsRulesPartialUpdateRequest {
    pbmUuid: string;
    patchedNotificationRuleRequest?: PatchedNotificationRuleRequest;
}

export interface EventsRulesRetrieveRequest {
    pbmUuid: string;
}

export interface EventsRulesUpdateRequest {
    pbmUuid: string;
    notificationRuleRequest: NotificationRuleRequest;
}

export interface EventsRulesUsedByListRequest {
    pbmUuid: string;
}

export interface EventsTransportsCreateRequest {
    notificationTransportRequest: NotificationTransportRequest;
}

export interface EventsTransportsDestroyRequest {
    uuid: string;
}

export interface EventsTransportsListRequest {
    mode?: TransportModeEnum;
    name?: string;
    ordering?: string;
    page?: number;
    pageSize?: number;
    search?: string;
    sendOnce?: boolean;
    webhookUrl?: string;
}

export interface EventsTransportsPartialUpdateRequest {
    uuid: string;
    patchedNotificationTransportRequest?: PatchedNotificationTransportRequest;
}

export interface EventsTransportsRetrieveRequest {
    uuid: string;
}

export interface EventsTransportsTestCreateRequest {
    uuid: string;
}

export interface EventsTransportsUpdateRequest {
    uuid: string;
    notificationTransportRequest: NotificationTransportRequest;
}

export interface EventsTransportsUsedByListRequest {
    uuid: string;
}

/**
 *
 */
export class EventsApi extends runtime.BaseAPI {
    /**
     * Creates request options for eventsEventsActionsList without sending the request
     */
    async eventsEventsActionsListRequestOpts(): 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 = `/events/events/actions/`;

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

    /**
     * Get all actions
     */
    async eventsEventsActionsListRaw(
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Array<TypeCreate>>> {
        const requestOptions = await this.eventsEventsActionsListRequestOpts();
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * Get all actions
     */
    async eventsEventsActionsList(
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Array<TypeCreate>> {
        const response = await this.eventsEventsActionsListRaw(initOverrides);
        return await response.value();
    }

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

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters["Content-Type"] = "application/json";

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/events/events/`;

        return {
            path: urlPath,
            method: "POST",
            headers: headerParameters,
            query: queryParameters,
            body: EventRequestToJSON(requestParameters["eventRequest"]),
        };
    }

    /**
     * Event Read-Only Viewset
     */
    async eventsEventsCreateRaw(
        requestParameters: EventsEventsCreateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Event>> {
        const requestOptions = await this.eventsEventsCreateRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * Event Read-Only Viewset
     */
    async eventsEventsCreate(
        requestParameters: EventsEventsCreateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Event> {
        const response = await this.eventsEventsCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

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

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

    /**
     * Event Read-Only Viewset
     */
    async eventsEventsDestroyRaw(
        requestParameters: EventsEventsDestroyRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<void>> {
        const requestOptions = await this.eventsEventsDestroyRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Event Read-Only Viewset
     */
    async eventsEventsDestroy(
        requestParameters: EventsEventsDestroyRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<void> {
        await this.eventsEventsDestroyRaw(requestParameters, initOverrides);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * Create a data export for this data type. Note that the export is generated asynchronously: this method returns a `DataExport` object that will initially have `completed=false` as well as the permanent URL to that object in the `Location` header. You can poll that URL until `completed=true`, at which point the `file_url` property will contain a URL to download
     */
    async eventsEventsExportCreateRaw(
        requestParameters: EventsEventsExportCreateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<DataExport>> {
        const requestOptions = await this.eventsEventsExportCreateRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * Create a data export for this data type. Note that the export is generated asynchronously: this method returns a `DataExport` object that will initially have `completed=false` as well as the permanent URL to that object in the `Location` header. You can poll that URL until `completed=true`, at which point the `file_url` property will contain a URL to download
     */
    async eventsEventsExportCreate(
        requestParameters: EventsEventsExportCreateRequest = {},
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<DataExport> {
        const response = await this.eventsEventsExportCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

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

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

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

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

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

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

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

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

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

        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["search"] != null) {
            queryParameters["search"] = requestParameters["search"];
        }

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

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

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

    /**
     * Event Read-Only Viewset
     */
    async eventsEventsListRaw(
        requestParameters: EventsEventsListRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<PaginatedEventList>> {
        const requestOptions = await this.eventsEventsListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * Event Read-Only Viewset
     */
    async eventsEventsList(
        requestParameters: EventsEventsListRequest = {},
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<PaginatedEventList> {
        const response = await this.eventsEventsListRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters["Content-Type"] = "application/json";

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/events/events/{event_uuid}/`;
        urlPath = urlPath.replace(
            `{${"event_uuid"}}`,
            encodeURIComponent(String(requestParameters["eventUuid"])),
        );

        return {
            path: urlPath,
            method: "PATCH",
            headers: headerParameters,
            query: queryParameters,
            body: PatchedEventRequestToJSON(requestParameters["patchedEventRequest"]),
        };
    }

    /**
     * Event Read-Only Viewset
     */
    async eventsEventsPartialUpdateRaw(
        requestParameters: EventsEventsPartialUpdateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Event>> {
        const requestOptions = await this.eventsEventsPartialUpdateRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * Event Read-Only Viewset
     */
    async eventsEventsPartialUpdate(
        requestParameters: EventsEventsPartialUpdateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Event> {
        const response = await this.eventsEventsPartialUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

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

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

    /**
     * Event Read-Only Viewset
     */
    async eventsEventsRetrieveRaw(
        requestParameters: EventsEventsRetrieveRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Event>> {
        const requestOptions = await this.eventsEventsRetrieveRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * Event Read-Only Viewset
     */
    async eventsEventsRetrieve(
        requestParameters: EventsEventsRetrieveRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Event> {
        const response = await this.eventsEventsRetrieveRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

        const queryParameters: any = {};

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * Get event stats for specified filters and count steps
     */
    async eventsEventsStatsRetrieveRaw(
        requestParameters: EventsEventsStatsRetrieveRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<EventStats>> {
        const requestOptions = await this.eventsEventsStatsRetrieveRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * Get event stats for specified filters and count steps
     */
    async eventsEventsStatsRetrieve(
        requestParameters: EventsEventsStatsRetrieveRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<EventStats> {
        const response = await this.eventsEventsStatsRetrieveRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

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

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

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

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

    /**
     * Get the top_n events grouped by user count
     */
    async eventsEventsTopPerUserListRaw(
        requestParameters: EventsEventsTopPerUserListRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Array<EventTopPerUser>>> {
        const requestOptions = await this.eventsEventsTopPerUserListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * Get the top_n events grouped by user count
     */
    async eventsEventsTopPerUserList(
        requestParameters: EventsEventsTopPerUserListRequest = {},
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Array<EventTopPerUser>> {
        const response = await this.eventsEventsTopPerUserListRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

        if (requestParameters["eventRequest"] == null) {
            throw new runtime.RequiredError(
                "eventRequest",
                'Required parameter "eventRequest" was null or undefined when calling eventsEventsUpdate().',
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters["Content-Type"] = "application/json";

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/events/events/{event_uuid}/`;
        urlPath = urlPath.replace(
            `{${"event_uuid"}}`,
            encodeURIComponent(String(requestParameters["eventUuid"])),
        );

        return {
            path: urlPath,
            method: "PUT",
            headers: headerParameters,
            query: queryParameters,
            body: EventRequestToJSON(requestParameters["eventRequest"]),
        };
    }

    /**
     * Event Read-Only Viewset
     */
    async eventsEventsUpdateRaw(
        requestParameters: EventsEventsUpdateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Event>> {
        const requestOptions = await this.eventsEventsUpdateRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * Event Read-Only Viewset
     */
    async eventsEventsUpdate(
        requestParameters: EventsEventsUpdateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Event> {
        const response = await this.eventsEventsUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * Get event volume for specified filters and timeframe
     */
    async eventsEventsVolumeListRaw(
        requestParameters: EventsEventsVolumeListRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Array<EventVolume>>> {
        const requestOptions = await this.eventsEventsVolumeListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * Get event volume for specified filters and timeframe
     */
    async eventsEventsVolumeList(
        requestParameters: EventsEventsVolumeListRequest = {},
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Array<EventVolume>> {
        const response = await this.eventsEventsVolumeListRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

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

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

    /**
     * Notification Viewset
     */
    async eventsNotificationsDestroyRaw(
        requestParameters: EventsNotificationsDestroyRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<void>> {
        const requestOptions = await this.eventsNotificationsDestroyRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Notification Viewset
     */
    async eventsNotificationsDestroy(
        requestParameters: EventsNotificationsDestroyRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<void> {
        await this.eventsNotificationsDestroyRaw(requestParameters, initOverrides);
    }

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

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

        if (requestParameters["created"] != null) {
            queryParameters["created"] = (requestParameters["created"] as any).toISOString();
        }

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

        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["search"] != null) {
            queryParameters["search"] = requestParameters["search"];
        }

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

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

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

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

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

    /**
     * Notification Viewset
     */
    async eventsNotificationsListRaw(
        requestParameters: EventsNotificationsListRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<PaginatedNotificationList>> {
        const requestOptions = await this.eventsNotificationsListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * Notification Viewset
     */
    async eventsNotificationsList(
        requestParameters: EventsNotificationsListRequest = {},
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<PaginatedNotificationList> {
        const response = await this.eventsNotificationsListRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Creates request options for eventsNotificationsMarkAllSeenCreate without sending the request
     */
    async eventsNotificationsMarkAllSeenCreateRequestOpts(): 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 = `/events/notifications/mark_all_seen/`;

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

    /**
     * Mark all the user\'s notifications as seen
     */
    async eventsNotificationsMarkAllSeenCreateRaw(
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<void>> {
        const requestOptions = await this.eventsNotificationsMarkAllSeenCreateRequestOpts();
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Mark all the user\'s notifications as seen
     */
    async eventsNotificationsMarkAllSeenCreate(
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<void> {
        await this.eventsNotificationsMarkAllSeenCreateRaw(initOverrides);
    }

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

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters["Content-Type"] = "application/json";

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/events/notifications/{uuid}/`;
        urlPath = urlPath.replace(
            `{${"uuid"}}`,
            encodeURIComponent(String(requestParameters["uuid"])),
        );

        return {
            path: urlPath,
            method: "PATCH",
            headers: headerParameters,
            query: queryParameters,
            body: PatchedNotificationRequestToJSON(requestParameters["patchedNotificationRequest"]),
        };
    }

    /**
     * Notification Viewset
     */
    async eventsNotificationsPartialUpdateRaw(
        requestParameters: EventsNotificationsPartialUpdateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Notification>> {
        const requestOptions =
            await this.eventsNotificationsPartialUpdateRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * Notification Viewset
     */
    async eventsNotificationsPartialUpdate(
        requestParameters: EventsNotificationsPartialUpdateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Notification> {
        const response = await this.eventsNotificationsPartialUpdateRaw(
            requestParameters,
            initOverrides,
        );
        return await response.value();
    }

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

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

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

    /**
     * Notification Viewset
     */
    async eventsNotificationsRetrieveRaw(
        requestParameters: EventsNotificationsRetrieveRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Notification>> {
        const requestOptions = await this.eventsNotificationsRetrieveRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * Notification Viewset
     */
    async eventsNotificationsRetrieve(
        requestParameters: EventsNotificationsRetrieveRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Notification> {
        const response = await this.eventsNotificationsRetrieveRaw(
            requestParameters,
            initOverrides,
        );
        return await response.value();
    }

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

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters["Content-Type"] = "application/json";

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/events/notifications/{uuid}/`;
        urlPath = urlPath.replace(
            `{${"uuid"}}`,
            encodeURIComponent(String(requestParameters["uuid"])),
        );

        return {
            path: urlPath,
            method: "PUT",
            headers: headerParameters,
            query: queryParameters,
            body: NotificationRequestToJSON(requestParameters["notificationRequest"]),
        };
    }

    /**
     * Notification Viewset
     */
    async eventsNotificationsUpdateRaw(
        requestParameters: EventsNotificationsUpdateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Notification>> {
        const requestOptions = await this.eventsNotificationsUpdateRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * Notification Viewset
     */
    async eventsNotificationsUpdate(
        requestParameters: EventsNotificationsUpdateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Notification> {
        const response = await this.eventsNotificationsUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

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

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

    /**
     * Get a list of all objects that use this object
     */
    async eventsNotificationsUsedByListRaw(
        requestParameters: EventsNotificationsUsedByListRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Array<UsedBy>>> {
        const requestOptions =
            await this.eventsNotificationsUsedByListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * Get a list of all objects that use this object
     */
    async eventsNotificationsUsedByList(
        requestParameters: EventsNotificationsUsedByListRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Array<UsedBy>> {
        const response = await this.eventsNotificationsUsedByListRaw(
            requestParameters,
            initOverrides,
        );
        return await response.value();
    }

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

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters["Content-Type"] = "application/json";

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/events/rules/`;

        return {
            path: urlPath,
            method: "POST",
            headers: headerParameters,
            query: queryParameters,
            body: NotificationRuleRequestToJSON(requestParameters["notificationRuleRequest"]),
        };
    }

    /**
     * NotificationRule Viewset
     */
    async eventsRulesCreateRaw(
        requestParameters: EventsRulesCreateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<NotificationRule>> {
        const requestOptions = await this.eventsRulesCreateRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * NotificationRule Viewset
     */
    async eventsRulesCreate(
        requestParameters: EventsRulesCreateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<NotificationRule> {
        const response = await this.eventsRulesCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

        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 = `/events/rules/{pbm_uuid}/`;
        urlPath = urlPath.replace(
            `{${"pbm_uuid"}}`,
            encodeURIComponent(String(requestParameters["pbmUuid"])),
        );

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

    /**
     * NotificationRule Viewset
     */
    async eventsRulesDestroyRaw(
        requestParameters: EventsRulesDestroyRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<void>> {
        const requestOptions = await this.eventsRulesDestroyRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     * NotificationRule Viewset
     */
    async eventsRulesDestroy(
        requestParameters: EventsRulesDestroyRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<void> {
        await this.eventsRulesDestroyRaw(requestParameters, initOverrides);
    }

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

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

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

        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["search"] != null) {
            queryParameters["search"] = requestParameters["search"];
        }

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

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

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

    /**
     * NotificationRule Viewset
     */
    async eventsRulesListRaw(
        requestParameters: EventsRulesListRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<PaginatedNotificationRuleList>> {
        const requestOptions = await this.eventsRulesListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * NotificationRule Viewset
     */
    async eventsRulesList(
        requestParameters: EventsRulesListRequest = {},
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<PaginatedNotificationRuleList> {
        const response = await this.eventsRulesListRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters["Content-Type"] = "application/json";

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/events/rules/{pbm_uuid}/`;
        urlPath = urlPath.replace(
            `{${"pbm_uuid"}}`,
            encodeURIComponent(String(requestParameters["pbmUuid"])),
        );

        return {
            path: urlPath,
            method: "PATCH",
            headers: headerParameters,
            query: queryParameters,
            body: PatchedNotificationRuleRequestToJSON(
                requestParameters["patchedNotificationRuleRequest"],
            ),
        };
    }

    /**
     * NotificationRule Viewset
     */
    async eventsRulesPartialUpdateRaw(
        requestParameters: EventsRulesPartialUpdateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<NotificationRule>> {
        const requestOptions = await this.eventsRulesPartialUpdateRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * NotificationRule Viewset
     */
    async eventsRulesPartialUpdate(
        requestParameters: EventsRulesPartialUpdateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<NotificationRule> {
        const response = await this.eventsRulesPartialUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

        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 = `/events/rules/{pbm_uuid}/`;
        urlPath = urlPath.replace(
            `{${"pbm_uuid"}}`,
            encodeURIComponent(String(requestParameters["pbmUuid"])),
        );

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

    /**
     * NotificationRule Viewset
     */
    async eventsRulesRetrieveRaw(
        requestParameters: EventsRulesRetrieveRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<NotificationRule>> {
        const requestOptions = await this.eventsRulesRetrieveRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * NotificationRule Viewset
     */
    async eventsRulesRetrieve(
        requestParameters: EventsRulesRetrieveRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<NotificationRule> {
        const response = await this.eventsRulesRetrieveRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

        if (requestParameters["notificationRuleRequest"] == null) {
            throw new runtime.RequiredError(
                "notificationRuleRequest",
                'Required parameter "notificationRuleRequest" was null or undefined when calling eventsRulesUpdate().',
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters["Content-Type"] = "application/json";

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/events/rules/{pbm_uuid}/`;
        urlPath = urlPath.replace(
            `{${"pbm_uuid"}}`,
            encodeURIComponent(String(requestParameters["pbmUuid"])),
        );

        return {
            path: urlPath,
            method: "PUT",
            headers: headerParameters,
            query: queryParameters,
            body: NotificationRuleRequestToJSON(requestParameters["notificationRuleRequest"]),
        };
    }

    /**
     * NotificationRule Viewset
     */
    async eventsRulesUpdateRaw(
        requestParameters: EventsRulesUpdateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<NotificationRule>> {
        const requestOptions = await this.eventsRulesUpdateRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * NotificationRule Viewset
     */
    async eventsRulesUpdate(
        requestParameters: EventsRulesUpdateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<NotificationRule> {
        const response = await this.eventsRulesUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

        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 = `/events/rules/{pbm_uuid}/used_by/`;
        urlPath = urlPath.replace(
            `{${"pbm_uuid"}}`,
            encodeURIComponent(String(requestParameters["pbmUuid"])),
        );

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

    /**
     * Get a list of all objects that use this object
     */
    async eventsRulesUsedByListRaw(
        requestParameters: EventsRulesUsedByListRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Array<UsedBy>>> {
        const requestOptions = await this.eventsRulesUsedByListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * Get a list of all objects that use this object
     */
    async eventsRulesUsedByList(
        requestParameters: EventsRulesUsedByListRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Array<UsedBy>> {
        const response = await this.eventsRulesUsedByListRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters["Content-Type"] = "application/json";

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/events/transports/`;

        return {
            path: urlPath,
            method: "POST",
            headers: headerParameters,
            query: queryParameters,
            body: NotificationTransportRequestToJSON(
                requestParameters["notificationTransportRequest"],
            ),
        };
    }

    /**
     * NotificationTransport Viewset
     */
    async eventsTransportsCreateRaw(
        requestParameters: EventsTransportsCreateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<NotificationTransport>> {
        const requestOptions = await this.eventsTransportsCreateRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * NotificationTransport Viewset
     */
    async eventsTransportsCreate(
        requestParameters: EventsTransportsCreateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<NotificationTransport> {
        const response = await this.eventsTransportsCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

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

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

    /**
     * NotificationTransport Viewset
     */
    async eventsTransportsDestroyRaw(
        requestParameters: EventsTransportsDestroyRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<void>> {
        const requestOptions = await this.eventsTransportsDestroyRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     * NotificationTransport Viewset
     */
    async eventsTransportsDestroy(
        requestParameters: EventsTransportsDestroyRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<void> {
        await this.eventsTransportsDestroyRaw(requestParameters, initOverrides);
    }

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

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

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

        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["search"] != null) {
            queryParameters["search"] = requestParameters["search"];
        }

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

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

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

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

    /**
     * NotificationTransport Viewset
     */
    async eventsTransportsListRaw(
        requestParameters: EventsTransportsListRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<PaginatedNotificationTransportList>> {
        const requestOptions = await this.eventsTransportsListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * NotificationTransport Viewset
     */
    async eventsTransportsList(
        requestParameters: EventsTransportsListRequest = {},
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<PaginatedNotificationTransportList> {
        const response = await this.eventsTransportsListRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters["Content-Type"] = "application/json";

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/events/transports/{uuid}/`;
        urlPath = urlPath.replace(
            `{${"uuid"}}`,
            encodeURIComponent(String(requestParameters["uuid"])),
        );

        return {
            path: urlPath,
            method: "PATCH",
            headers: headerParameters,
            query: queryParameters,
            body: PatchedNotificationTransportRequestToJSON(
                requestParameters["patchedNotificationTransportRequest"],
            ),
        };
    }

    /**
     * NotificationTransport Viewset
     */
    async eventsTransportsPartialUpdateRaw(
        requestParameters: EventsTransportsPartialUpdateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<NotificationTransport>> {
        const requestOptions =
            await this.eventsTransportsPartialUpdateRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * NotificationTransport Viewset
     */
    async eventsTransportsPartialUpdate(
        requestParameters: EventsTransportsPartialUpdateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<NotificationTransport> {
        const response = await this.eventsTransportsPartialUpdateRaw(
            requestParameters,
            initOverrides,
        );
        return await response.value();
    }

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

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

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

    /**
     * NotificationTransport Viewset
     */
    async eventsTransportsRetrieveRaw(
        requestParameters: EventsTransportsRetrieveRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<NotificationTransport>> {
        const requestOptions = await this.eventsTransportsRetrieveRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * NotificationTransport Viewset
     */
    async eventsTransportsRetrieve(
        requestParameters: EventsTransportsRetrieveRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<NotificationTransport> {
        const response = await this.eventsTransportsRetrieveRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

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

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

    /**
     * Send example notification using selected transport. Requires Modify permissions.
     */
    async eventsTransportsTestCreateRaw(
        requestParameters: EventsTransportsTestCreateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<NotificationTransportTest>> {
        const requestOptions = await this.eventsTransportsTestCreateRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * Send example notification using selected transport. Requires Modify permissions.
     */
    async eventsTransportsTestCreate(
        requestParameters: EventsTransportsTestCreateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<NotificationTransportTest> {
        const response = await this.eventsTransportsTestCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

        if (requestParameters["notificationTransportRequest"] == null) {
            throw new runtime.RequiredError(
                "notificationTransportRequest",
                'Required parameter "notificationTransportRequest" was null or undefined when calling eventsTransportsUpdate().',
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters["Content-Type"] = "application/json";

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/events/transports/{uuid}/`;
        urlPath = urlPath.replace(
            `{${"uuid"}}`,
            encodeURIComponent(String(requestParameters["uuid"])),
        );

        return {
            path: urlPath,
            method: "PUT",
            headers: headerParameters,
            query: queryParameters,
            body: NotificationTransportRequestToJSON(
                requestParameters["notificationTransportRequest"],
            ),
        };
    }

    /**
     * NotificationTransport Viewset
     */
    async eventsTransportsUpdateRaw(
        requestParameters: EventsTransportsUpdateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<NotificationTransport>> {
        const requestOptions = await this.eventsTransportsUpdateRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * NotificationTransport Viewset
     */
    async eventsTransportsUpdate(
        requestParameters: EventsTransportsUpdateRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<NotificationTransport> {
        const response = await this.eventsTransportsUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

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

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

    /**
     * Get a list of all objects that use this object
     */
    async eventsTransportsUsedByListRaw(
        requestParameters: EventsTransportsUsedByListRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<Array<UsedBy>>> {
        const requestOptions = await this.eventsTransportsUsedByListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     * Get a list of all objects that use this object
     */
    async eventsTransportsUsedByList(
        requestParameters: EventsTransportsUsedByListRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<Array<UsedBy>> {
        const response = await this.eventsTransportsUsedByListRaw(requestParameters, initOverrides);
        return await response.value();
    }
}
