"use strict";
/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2026.2.0-rc5
 * 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.
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Oauth2Api = void 0;
const runtime = __importStar(require("../runtime"));
const index_1 = require("../models/index");
/**
 *
 */
class Oauth2Api extends runtime.BaseAPI {
    /**
     * Creates request options for oauth2AccessTokensDestroy without sending the request
     */
    async oauth2AccessTokensDestroyRequestOpts(requestParameters) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling oauth2AccessTokensDestroy().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/oauth2/access_tokens/{id}/`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        return {
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * AccessToken Viewset
     */
    async oauth2AccessTokensDestroyRaw(requestParameters, initOverrides) {
        const requestOptions = await this.oauth2AccessTokensDestroyRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * AccessToken Viewset
     */
    async oauth2AccessTokensDestroy(requestParameters, initOverrides) {
        await this.oauth2AccessTokensDestroyRaw(requestParameters, initOverrides);
    }
    /**
     * Creates request options for oauth2AccessTokensList without sending the request
     */
    async oauth2AccessTokensListRequestOpts(requestParameters) {
        const queryParameters = {};
        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'];
        }
        if (requestParameters['user'] != null) {
            queryParameters['user'] = requestParameters['user'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/oauth2/access_tokens/`;
        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * AccessToken Viewset
     */
    async oauth2AccessTokensListRaw(requestParameters, initOverrides) {
        const requestOptions = await this.oauth2AccessTokensListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.PaginatedTokenModelListFromJSON)(jsonValue));
    }
    /**
     * AccessToken Viewset
     */
    async oauth2AccessTokensList(requestParameters = {}, initOverrides) {
        const response = await this.oauth2AccessTokensListRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Creates request options for oauth2AccessTokensRetrieve without sending the request
     */
    async oauth2AccessTokensRetrieveRequestOpts(requestParameters) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling oauth2AccessTokensRetrieve().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/oauth2/access_tokens/{id}/`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * AccessToken Viewset
     */
    async oauth2AccessTokensRetrieveRaw(requestParameters, initOverrides) {
        const requestOptions = await this.oauth2AccessTokensRetrieveRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.TokenModelFromJSON)(jsonValue));
    }
    /**
     * AccessToken Viewset
     */
    async oauth2AccessTokensRetrieve(requestParameters, initOverrides) {
        const response = await this.oauth2AccessTokensRetrieveRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Creates request options for oauth2AccessTokensUsedByList without sending the request
     */
    async oauth2AccessTokensUsedByListRequestOpts(requestParameters) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling oauth2AccessTokensUsedByList().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/oauth2/access_tokens/{id}/used_by/`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * Get a list of all objects that use this object
     */
    async oauth2AccessTokensUsedByListRaw(requestParameters, initOverrides) {
        const requestOptions = await this.oauth2AccessTokensUsedByListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(index_1.UsedByFromJSON));
    }
    /**
     * Get a list of all objects that use this object
     */
    async oauth2AccessTokensUsedByList(requestParameters, initOverrides) {
        const response = await this.oauth2AccessTokensUsedByListRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Creates request options for oauth2AuthorizationCodesDestroy without sending the request
     */
    async oauth2AuthorizationCodesDestroyRequestOpts(requestParameters) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling oauth2AuthorizationCodesDestroy().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/oauth2/authorization_codes/{id}/`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        return {
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * AuthorizationCode Viewset
     */
    async oauth2AuthorizationCodesDestroyRaw(requestParameters, initOverrides) {
        const requestOptions = await this.oauth2AuthorizationCodesDestroyRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * AuthorizationCode Viewset
     */
    async oauth2AuthorizationCodesDestroy(requestParameters, initOverrides) {
        await this.oauth2AuthorizationCodesDestroyRaw(requestParameters, initOverrides);
    }
    /**
     * Creates request options for oauth2AuthorizationCodesList without sending the request
     */
    async oauth2AuthorizationCodesListRequestOpts(requestParameters) {
        const queryParameters = {};
        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'];
        }
        if (requestParameters['user'] != null) {
            queryParameters['user'] = requestParameters['user'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/oauth2/authorization_codes/`;
        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * AuthorizationCode Viewset
     */
    async oauth2AuthorizationCodesListRaw(requestParameters, initOverrides) {
        const requestOptions = await this.oauth2AuthorizationCodesListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.PaginatedExpiringBaseGrantModelListFromJSON)(jsonValue));
    }
    /**
     * AuthorizationCode Viewset
     */
    async oauth2AuthorizationCodesList(requestParameters = {}, initOverrides) {
        const response = await this.oauth2AuthorizationCodesListRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Creates request options for oauth2AuthorizationCodesRetrieve without sending the request
     */
    async oauth2AuthorizationCodesRetrieveRequestOpts(requestParameters) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling oauth2AuthorizationCodesRetrieve().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/oauth2/authorization_codes/{id}/`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * AuthorizationCode Viewset
     */
    async oauth2AuthorizationCodesRetrieveRaw(requestParameters, initOverrides) {
        const requestOptions = await this.oauth2AuthorizationCodesRetrieveRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ExpiringBaseGrantModelFromJSON)(jsonValue));
    }
    /**
     * AuthorizationCode Viewset
     */
    async oauth2AuthorizationCodesRetrieve(requestParameters, initOverrides) {
        const response = await this.oauth2AuthorizationCodesRetrieveRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Creates request options for oauth2AuthorizationCodesUsedByList without sending the request
     */
    async oauth2AuthorizationCodesUsedByListRequestOpts(requestParameters) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling oauth2AuthorizationCodesUsedByList().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/oauth2/authorization_codes/{id}/used_by/`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * Get a list of all objects that use this object
     */
    async oauth2AuthorizationCodesUsedByListRaw(requestParameters, initOverrides) {
        const requestOptions = await this.oauth2AuthorizationCodesUsedByListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(index_1.UsedByFromJSON));
    }
    /**
     * Get a list of all objects that use this object
     */
    async oauth2AuthorizationCodesUsedByList(requestParameters, initOverrides) {
        const response = await this.oauth2AuthorizationCodesUsedByListRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Creates request options for oauth2RefreshTokensDestroy without sending the request
     */
    async oauth2RefreshTokensDestroyRequestOpts(requestParameters) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling oauth2RefreshTokensDestroy().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/oauth2/refresh_tokens/{id}/`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        return {
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * RefreshToken Viewset
     */
    async oauth2RefreshTokensDestroyRaw(requestParameters, initOverrides) {
        const requestOptions = await this.oauth2RefreshTokensDestroyRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * RefreshToken Viewset
     */
    async oauth2RefreshTokensDestroy(requestParameters, initOverrides) {
        await this.oauth2RefreshTokensDestroyRaw(requestParameters, initOverrides);
    }
    /**
     * Creates request options for oauth2RefreshTokensList without sending the request
     */
    async oauth2RefreshTokensListRequestOpts(requestParameters) {
        const queryParameters = {};
        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'];
        }
        if (requestParameters['user'] != null) {
            queryParameters['user'] = requestParameters['user'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/oauth2/refresh_tokens/`;
        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * RefreshToken Viewset
     */
    async oauth2RefreshTokensListRaw(requestParameters, initOverrides) {
        const requestOptions = await this.oauth2RefreshTokensListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.PaginatedTokenModelListFromJSON)(jsonValue));
    }
    /**
     * RefreshToken Viewset
     */
    async oauth2RefreshTokensList(requestParameters = {}, initOverrides) {
        const response = await this.oauth2RefreshTokensListRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Creates request options for oauth2RefreshTokensRetrieve without sending the request
     */
    async oauth2RefreshTokensRetrieveRequestOpts(requestParameters) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling oauth2RefreshTokensRetrieve().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/oauth2/refresh_tokens/{id}/`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * RefreshToken Viewset
     */
    async oauth2RefreshTokensRetrieveRaw(requestParameters, initOverrides) {
        const requestOptions = await this.oauth2RefreshTokensRetrieveRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.TokenModelFromJSON)(jsonValue));
    }
    /**
     * RefreshToken Viewset
     */
    async oauth2RefreshTokensRetrieve(requestParameters, initOverrides) {
        const response = await this.oauth2RefreshTokensRetrieveRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Creates request options for oauth2RefreshTokensUsedByList without sending the request
     */
    async oauth2RefreshTokensUsedByListRequestOpts(requestParameters) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling oauth2RefreshTokensUsedByList().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("authentik", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/oauth2/refresh_tokens/{id}/used_by/`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }
    /**
     * Get a list of all objects that use this object
     */
    async oauth2RefreshTokensUsedByListRaw(requestParameters, initOverrides) {
        const requestOptions = await this.oauth2RefreshTokensUsedByListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(index_1.UsedByFromJSON));
    }
    /**
     * Get a list of all objects that use this object
     */
    async oauth2RefreshTokensUsedByList(requestParameters, initOverrides) {
        const response = await this.oauth2RefreshTokensUsedByListRaw(requestParameters, initOverrides);
        return await response.value();
    }
}
exports.Oauth2Api = Oauth2Api;
//# sourceMappingURL=Oauth2Api.js.map