"use strict";
/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2026.2.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.
 */
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.CryptoCertificatekeypairsListKeyTypeEnum = exports.CryptoApi = void 0;
const runtime = __importStar(require("../runtime"));
const index_1 = require("../models/index");
/**
 *
 */
class CryptoApi extends runtime.BaseAPI {
    /**
     * CertificateKeyPair Viewset
     */
    async cryptoCertificatekeypairsCreateRaw(requestParameters, initOverrides) {
        if (requestParameters['certificateKeyPairRequest'] == null) {
            throw new runtime.RequiredError('certificateKeyPairRequest', 'Required parameter "certificateKeyPairRequest" was null or undefined when calling cryptoCertificatekeypairsCreate().');
        }
        const queryParameters = {};
        const headerParameters = {};
        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 = `/crypto/certificatekeypairs/`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: (0, index_1.CertificateKeyPairRequestToJSON)(requestParameters['certificateKeyPairRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.CertificateKeyPairFromJSON)(jsonValue));
    }
    /**
     * CertificateKeyPair Viewset
     */
    async cryptoCertificatekeypairsCreate(requestParameters, initOverrides) {
        const response = await this.cryptoCertificatekeypairsCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * CertificateKeyPair Viewset
     */
    async cryptoCertificatekeypairsDestroyRaw(requestParameters, initOverrides) {
        if (requestParameters['kpUuid'] == null) {
            throw new runtime.RequiredError('kpUuid', 'Required parameter "kpUuid" was null or undefined when calling cryptoCertificatekeypairsDestroy().');
        }
        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 = `/crypto/certificatekeypairs/{kp_uuid}/`;
        urlPath = urlPath.replace(`{${"kp_uuid"}}`, encodeURIComponent(String(requestParameters['kpUuid'])));
        const response = await this.request({
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     * CertificateKeyPair Viewset
     */
    async cryptoCertificatekeypairsDestroy(requestParameters, initOverrides) {
        await this.cryptoCertificatekeypairsDestroyRaw(requestParameters, initOverrides);
    }
    /**
     * Generate a new, self-signed certificate-key pair
     */
    async cryptoCertificatekeypairsGenerateCreateRaw(requestParameters, initOverrides) {
        if (requestParameters['certificateGenerationRequest'] == null) {
            throw new runtime.RequiredError('certificateGenerationRequest', 'Required parameter "certificateGenerationRequest" was null or undefined when calling cryptoCertificatekeypairsGenerateCreate().');
        }
        const queryParameters = {};
        const headerParameters = {};
        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 = `/crypto/certificatekeypairs/generate/`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: (0, index_1.CertificateGenerationRequestToJSON)(requestParameters['certificateGenerationRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.CertificateKeyPairFromJSON)(jsonValue));
    }
    /**
     * Generate a new, self-signed certificate-key pair
     */
    async cryptoCertificatekeypairsGenerateCreate(requestParameters, initOverrides) {
        const response = await this.cryptoCertificatekeypairsGenerateCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * CertificateKeyPair Viewset
     */
    async cryptoCertificatekeypairsListRaw(requestParameters, initOverrides) {
        const queryParameters = {};
        if (requestParameters['hasKey'] != null) {
            queryParameters['has_key'] = requestParameters['hasKey'];
        }
        if (requestParameters['keyType'] != null) {
            queryParameters['key_type'] = requestParameters['keyType'];
        }
        if (requestParameters['managed'] != null) {
            queryParameters['managed'] = requestParameters['managed'];
        }
        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'];
        }
        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 = `/crypto/certificatekeypairs/`;
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.PaginatedCertificateKeyPairListFromJSON)(jsonValue));
    }
    /**
     * CertificateKeyPair Viewset
     */
    async cryptoCertificatekeypairsList(requestParameters = {}, initOverrides) {
        const response = await this.cryptoCertificatekeypairsListRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * CertificateKeyPair Viewset
     */
    async cryptoCertificatekeypairsPartialUpdateRaw(requestParameters, initOverrides) {
        if (requestParameters['kpUuid'] == null) {
            throw new runtime.RequiredError('kpUuid', 'Required parameter "kpUuid" was null or undefined when calling cryptoCertificatekeypairsPartialUpdate().');
        }
        const queryParameters = {};
        const headerParameters = {};
        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 = `/crypto/certificatekeypairs/{kp_uuid}/`;
        urlPath = urlPath.replace(`{${"kp_uuid"}}`, encodeURIComponent(String(requestParameters['kpUuid'])));
        const response = await this.request({
            path: urlPath,
            method: 'PATCH',
            headers: headerParameters,
            query: queryParameters,
            body: (0, index_1.PatchedCertificateKeyPairRequestToJSON)(requestParameters['patchedCertificateKeyPairRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.CertificateKeyPairFromJSON)(jsonValue));
    }
    /**
     * CertificateKeyPair Viewset
     */
    async cryptoCertificatekeypairsPartialUpdate(requestParameters, initOverrides) {
        const response = await this.cryptoCertificatekeypairsPartialUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * CertificateKeyPair Viewset
     */
    async cryptoCertificatekeypairsRetrieveRaw(requestParameters, initOverrides) {
        if (requestParameters['kpUuid'] == null) {
            throw new runtime.RequiredError('kpUuid', 'Required parameter "kpUuid" was null or undefined when calling cryptoCertificatekeypairsRetrieve().');
        }
        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 = `/crypto/certificatekeypairs/{kp_uuid}/`;
        urlPath = urlPath.replace(`{${"kp_uuid"}}`, encodeURIComponent(String(requestParameters['kpUuid'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.CertificateKeyPairFromJSON)(jsonValue));
    }
    /**
     * CertificateKeyPair Viewset
     */
    async cryptoCertificatekeypairsRetrieve(requestParameters, initOverrides) {
        const response = await this.cryptoCertificatekeypairsRetrieveRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * CertificateKeyPair Viewset
     */
    async cryptoCertificatekeypairsUpdateRaw(requestParameters, initOverrides) {
        if (requestParameters['kpUuid'] == null) {
            throw new runtime.RequiredError('kpUuid', 'Required parameter "kpUuid" was null or undefined when calling cryptoCertificatekeypairsUpdate().');
        }
        if (requestParameters['certificateKeyPairRequest'] == null) {
            throw new runtime.RequiredError('certificateKeyPairRequest', 'Required parameter "certificateKeyPairRequest" was null or undefined when calling cryptoCertificatekeypairsUpdate().');
        }
        const queryParameters = {};
        const headerParameters = {};
        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 = `/crypto/certificatekeypairs/{kp_uuid}/`;
        urlPath = urlPath.replace(`{${"kp_uuid"}}`, encodeURIComponent(String(requestParameters['kpUuid'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: (0, index_1.CertificateKeyPairRequestToJSON)(requestParameters['certificateKeyPairRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.CertificateKeyPairFromJSON)(jsonValue));
    }
    /**
     * CertificateKeyPair Viewset
     */
    async cryptoCertificatekeypairsUpdate(requestParameters, initOverrides) {
        const response = await this.cryptoCertificatekeypairsUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Get a list of all objects that use this object
     */
    async cryptoCertificatekeypairsUsedByListRaw(requestParameters, initOverrides) {
        if (requestParameters['kpUuid'] == null) {
            throw new runtime.RequiredError('kpUuid', 'Required parameter "kpUuid" was null or undefined when calling cryptoCertificatekeypairsUsedByList().');
        }
        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 = `/crypto/certificatekeypairs/{kp_uuid}/used_by/`;
        urlPath = urlPath.replace(`{${"kp_uuid"}}`, encodeURIComponent(String(requestParameters['kpUuid'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(index_1.UsedByFromJSON));
    }
    /**
     * Get a list of all objects that use this object
     */
    async cryptoCertificatekeypairsUsedByList(requestParameters, initOverrides) {
        const response = await this.cryptoCertificatekeypairsUsedByListRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Return certificate-key pairs certificate and log access
     */
    async cryptoCertificatekeypairsViewCertificateRetrieveRaw(requestParameters, initOverrides) {
        if (requestParameters['kpUuid'] == null) {
            throw new runtime.RequiredError('kpUuid', 'Required parameter "kpUuid" was null or undefined when calling cryptoCertificatekeypairsViewCertificateRetrieve().');
        }
        const queryParameters = {};
        if (requestParameters['download'] != null) {
            queryParameters['download'] = requestParameters['download'];
        }
        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 = `/crypto/certificatekeypairs/{kp_uuid}/view_certificate/`;
        urlPath = urlPath.replace(`{${"kp_uuid"}}`, encodeURIComponent(String(requestParameters['kpUuid'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.CertificateDataFromJSON)(jsonValue));
    }
    /**
     * Return certificate-key pairs certificate and log access
     */
    async cryptoCertificatekeypairsViewCertificateRetrieve(requestParameters, initOverrides) {
        const response = await this.cryptoCertificatekeypairsViewCertificateRetrieveRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     * Return certificate-key pairs private key and log access
     */
    async cryptoCertificatekeypairsViewPrivateKeyRetrieveRaw(requestParameters, initOverrides) {
        if (requestParameters['kpUuid'] == null) {
            throw new runtime.RequiredError('kpUuid', 'Required parameter "kpUuid" was null or undefined when calling cryptoCertificatekeypairsViewPrivateKeyRetrieve().');
        }
        const queryParameters = {};
        if (requestParameters['download'] != null) {
            queryParameters['download'] = requestParameters['download'];
        }
        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 = `/crypto/certificatekeypairs/{kp_uuid}/view_private_key/`;
        urlPath = urlPath.replace(`{${"kp_uuid"}}`, encodeURIComponent(String(requestParameters['kpUuid'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.CertificateDataFromJSON)(jsonValue));
    }
    /**
     * Return certificate-key pairs private key and log access
     */
    async cryptoCertificatekeypairsViewPrivateKeyRetrieve(requestParameters, initOverrides) {
        const response = await this.cryptoCertificatekeypairsViewPrivateKeyRetrieveRaw(requestParameters, initOverrides);
        return await response.value();
    }
}
exports.CryptoApi = CryptoApi;
/**
 * @export
 */
exports.CryptoCertificatekeypairsListKeyTypeEnum = {
    Dsa: 'dsa',
    Ec: 'ec',
    Ed25519: 'ed25519',
    Ed448: 'ed448',
    Rsa: 'rsa',
    UnknownDefaultOpenApi: '11184809'
};
//# sourceMappingURL=CryptoApi.js.map