UNPKG

ts-mailcow-api

Version:
173 lines 6.96 kB
"use strict"; /** * @module MailcowClient */ Object.defineProperty(exports, "__esModule", { value: true }); const domain_endpoints_1 = require("./endpoints/domain-endpoints"); const antispam_endpoints_1 = require("./endpoints/antispam-endpoints"); const mailbox_endpoint_1 = require("./endpoints/mailbox-endpoint"); const request_factory_1 = require("./request-factory"); const alias_endpoints_1 = require("./endpoints/alias-endpoints"); const syncjob_endpoints_1 = require("./endpoints/syncjob-endpoints"); const forwarding_endpoints_1 = require("./endpoints/forwarding-endpoints"); const log_endpoints_1 = require("./endpoints/log-endpoints"); const address_rewriting_endpoint_1 = require("./endpoints/address-rewriting-endpoint"); const fail2ban_endpoints_1 = require("./endpoints/fail2ban-endpoints"); const status_endpoints_1 = require("./endpoints/status-endpoints"); const resource_endpoints_1 = require("./endpoints/resource-endpoints"); const queue_manager_endpoints_1 = require("./endpoints/queue-manager-endpoints"); const quarantine_endpoints_1 = require("./endpoints/quarantine-endpoints"); const ratelimit_endpoints_1 = require("./endpoints/ratelimit-endpoints"); const oauth2_endpoints_1 = require("./endpoints/oauth2-endpoints"); const app_password_endpoints_1 = require("./endpoints/app-password-endpoints"); const tls_policy_map_endpoints_1 = require("./endpoints/tls-policy-map-endpoints"); const dkim_endpoints_1 = require("./endpoints/dkim-endpoints"); const domain_admin_endpoints_1 = require("./endpoints/domain-admin-endpoints"); const routing_endpoints_1 = require("./endpoints/routing-endpoints"); /** * Class containing all the logic to interface with the Mailcow API in TypeScript. * @external */ class MailcowClient { /** * Creates a MailcowClient using the given URL and API key. * @param BASE_URL - The base URL of the Mailcow API. * @param API_KEY - The API key of the Mailcow API. * @param EXTRA_AXIOS_CONFIG - Allows for setting extra Axios request config such as keep alive. */ constructor(BASE_URL, API_KEY, EXTRA_AXIOS_CONFIG) { /** * Factory method pattern for creating HTTP requests. * @internal */ this.requestFactory = new request_factory_1.default(this); /** * All endpoints related to Aliases. * See {@link AliasEndpoints} */ this.aliases = (0, alias_endpoints_1.aliasEndpoints)(this); /** * All endpoints related to Domains. * See {@link DomainEndpoints} * @external */ this.domains = (0, domain_endpoints_1.domainEndpoints)(this); /** * All endpoints related to spam policies. * See {@link AntiSpamEndpoints} * @external */ this.spamPolicy = (0, antispam_endpoints_1.antiSpamEndpoints)(this); /** * All endpoints related to mailboxes. * See {@link MailboxEndpoints} * @external */ this.mailbox = (0, mailbox_endpoint_1.mailboxEndpoints)(this); /** * All endpoints related to sync jobs. * See {@link SyncjobEndpoints} * @external */ this.syncjobs = (0, syncjob_endpoints_1.syncjobEndpoints)(this); /** * All endpoints related to forwarding hosts. * See {@link ForwardingEndpoints} * @external */ this.forwardingHosts = (0, forwarding_endpoints_1.forwardingEndpoints)(this); /** * All endpoints related to address rewriting. * See {@link AdressRewritingEndpoints} * @external */ this.addressRewriting = (0, address_rewriting_endpoint_1.addressRewritingEndpoints)(this); /** * All endpoints related to logs. * See {@link LogEndpoints} * @external */ this.logs = (0, log_endpoints_1.logEndpoints)(this); /** * All endpoints related to fail2ban. * See {@link Fail2BanEndpoints} * @external */ this.fail2Ban = (0, fail2ban_endpoints_1.fail2BanEndpoints)(this); /** * All endpoints related to status. * See {@link StatusEndpoints} * @external */ this.status = (0, status_endpoints_1.statusEndpoints)(this); /** * All endpoints related to resources. * See {@link ResourceEndpoints} * @external */ this.resources = (0, resource_endpoints_1.resourceEndpoints)(this); /** * All endpoints related to the mail queue. * See {@link QueueManagerEndpoints} * @external */ this.queueManager = (0, queue_manager_endpoints_1.queueManagerEndpoints)(this); /** * All endpoints related to quarantine. * See {@link QuarantineEndpoints} * @external */ this.quarantine = (0, quarantine_endpoints_1.quarantineEndpoints)(this); /** * All endpoints related to rate limits. * See {@link RatelimitsEndpoints} * @external */ this.ratelimits = (0, ratelimit_endpoints_1.ratelimitsEndpoints)(this); /** * All endpoints related to OAuth2 clients. * See {@link OAuth2Endpoints} * @external */ this.oauth2 = (0, oauth2_endpoints_1.oauth2Endpoints)(this); /** * All endpoints related to app passwords. * See {@link AppPasswordEndpoints} * @external */ this.appPasswords = (0, app_password_endpoints_1.appPasswordEndpoints)(this); /** * All endpoints related to TLS Policy Maps. * See {@link TlsPolicyMapEndpoints} * @external */ this.tlsPolicyMaps = (0, tls_policy_map_endpoints_1.tlsPolicyMapEndpoints)(this); /** * All endpoints related to DKIM. * See {@link DkimEndpoints} * @external */ this.dkim = (0, dkim_endpoints_1.dkimEndpoints)(this); /** * All endpoints related to Domain Admins. * See {@link DomainAdminEndpoints} * @external */ this.domainAdmins = (0, domain_admin_endpoints_1.domainAdminEndpoints)(this); /** * All endpoints related to Routing. * See {@link RoutingEndpoints} * @external */ this.routing = (0, routing_endpoints_1.routingEndpoints)(this); this.BASE_URL = BASE_URL.charAt(BASE_URL.length - 1) === '/' ? BASE_URL : BASE_URL.concat('/'); this.API_KEY = API_KEY; // Set the correct Axios request config. this.AXIOS_CONFIG = Object.assign(Object.assign({}, EXTRA_AXIOS_CONFIG), { headers: { 'Content-Type': 'application/json', 'X-API-Key': this.API_KEY, } }); } } exports.default = MailcowClient; //# sourceMappingURL=client.js.map