mailcow

    Dark Mode
Search:
Group by:

API DOCS: https://mailcow.docs.apiary.io/

Types

Session = ref object
  url*: Uri
  apikey*: string
  client*: HttpClient

Procs

proc setInfo(domain: string; key: string): Session {...}{.raises: [KeyError],
    tags: [].}
Sets the URL and the API key
proc getDomains(self: Session; domain: string = "all"): JsonNode {...}{.raises: [
    ValueError, IOError, OSError, HttpRequestError, Exception, LibraryError,
    SslError, TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Return Domain settings, by default it returns all domains
proc createDomain(self: Session; domain: string; description: string = "";
                  aliases: int = 400; mailboxes: int = 10; defquota: int = 3072;
                  maxquota: int = 10240; quota: int = 10240; active: int = 1;
                  rl_value: int = 10; rl_frame: string = "s"; backupmx: int = 0;
                  relay_all_recipients: int = 0; restart_sogo: int = 0): JsonNode {...}{.raises: [
    ValueError, IOError, OSError, HttpRequestError, Exception, LibraryError,
    SslError, TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Creates a Domain. Defaults values are from Mailcow
proc updateDomain(self: Session; domain: string; description: string = "";
                  aliases: string = ""; mailboxes: string = "";
                  defquota: string = ""; maxquota: string = "";
                  quota: string = ""; active: string = "";
                  backupmx: string = ""; relay_all_recipients: string = "";
                  gal: string = ""; relayhost: string = ""): JsonNode {...}{.raises: [
    ValueError, IOError, OSError, HttpRequestError, Exception, LibraryError,
    SslError, TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Updates a Domain and only changes the called parameters
proc deleteDomain(self: Session; domain: string): JsonNode {...}{.raises: [
    ValueError, IOError, OSError, HttpRequestError, Exception, LibraryError,
    SslError, TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Deletes the provided domain
proc getDomainWhitelist(self: Session; domain: string): JsonNode {...}{.raises: [
    ValueError, IOError, OSError, HttpRequestError, Exception, LibraryError,
    SslError, TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Adds a Domain to a whitelist
proc getDomainBlacklist(self: Session; domain: string): JsonNode {...}{.raises: [
    ValueError, IOError, OSError, HttpRequestError, Exception, LibraryError,
    SslError, TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Adds a Domain to a blacklist
proc createDomainPolicy(self: Session; domain: string; wl_bl: string;
                        toblock: string): JsonNode {...}{.raises: [ValueError,
    IOError, OSError, HttpRequestError, Exception, LibraryError, SslError,
    TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Creates a Domain policy
proc deleteDomainPolicy(self: Session; domain: string): JsonNode {...}{.raises: [
    ValueError, IOError, OSError, HttpRequestError, Exception, LibraryError,
    SslError, TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Deletes a Domain policy
proc getMailboxes(self: Session; id: string): JsonNode {...}{.raises: [ValueError,
    IOError, OSError, HttpRequestError, Exception, LibraryError, SslError,
    TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Returns the Mailbox from the provided ID
proc createMailbox(self: Session; local_part: string; domain: string;
                   name: string; quota: string = "3072"; password: string;
                   active: bool = true; force_pw_update: bool = false;
                   tls_enforce_in: bool = false; tls_enforce_out: bool = false): JsonNode {...}{.raises: [
    ValueError, IOError, OSError, HttpRequestError, Exception, LibraryError,
    SslError, TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Creates a Mailbox and uses some of the Mailcow default Values
proc updateMailbox(self: Session; mailbox: string; name: string = "";
                   quota: string = ""; password: string = "";
                   active: string = ""; force_pw_update: string = "";
                   sogo: string = ""): JsonNode {...}{.raises: [ValueError, IOError,
    OSError, HttpRequestError, Exception, LibraryError, SslError, TimeoutError,
    ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Updates a Mailbox and only changes the called parameters
proc updateSpamScore(self: Session; mailbox: string; score: string): JsonNode {...}{.raises: [
    ValueError, IOError, OSError, HttpRequestError, Exception, LibraryError,
    SslError, TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Updates the Spamscore for the Mailbox has to be the full E-Mail address (example@example.com)
proc deleteMailbox(self: Session; mailbox: string): JsonNode {...}{.raises: [
    ValueError, IOError, OSError, HttpRequestError, Exception, LibraryError,
    SslError, TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Deletes the provided Mailbox
proc setQuarantineNoti(self: Session; mailbox: string; time: string): JsonNode {...}{.raises: [
    ValueError, IOError, OSError, HttpRequestError, Exception, LibraryError,
    SslError, TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Sets the Quarantine Notifications Settings. Valid time settings are: hourly, daily, weekly, never
proc getAliases(self: Session; id: string): JsonNode {...}{.raises: [ValueError,
    IOError, OSError, HttpRequestError, Exception, LibraryError, SslError,
    TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Return the Alias settings Valid id values are: all or the number
proc createAlias(self: Session; mailbox: string; goto: string; active: string): JsonNode {...}{.raises: [
    ValueError, IOError, OSError, HttpRequestError, Exception, LibraryError,
    SslError, TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Creates an alias
proc updateAlias(self: Session; id: string; address: string = "";
                 goto: string = ""; priv: string = ""; pub: string = "";
                 active: string = ""): JsonNode {...}{.raises: [ValueError, IOError,
    OSError, HttpRequestError, Exception, LibraryError, SslError, TimeoutError,
    ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Updates the alias settings
proc deleteAlias(self: Session; id: string): JsonNode {...}{.raises: [ValueError,
    IOError, OSError, HttpRequestError, Exception, LibraryError, SslError,
    TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Deletes an Alias
proc getLogs(self: Session; service: string; count: string): JsonNode {...}{.raises: [
    ValueError, IOError, OSError, HttpRequestError, Exception, LibraryError,
    SslError, TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Valid Services are: postfix, rspamd-history, dovecot, acme, sogo, watchdog, api, ratelimited, netfilter, autodiscover
proc getQueue(self: Session): JsonNode {...}{.raises: [ValueError, IOError, OSError,
    HttpRequestError, Exception, LibraryError, SslError, TimeoutError,
    ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Returns the current Queue as a JsonNode
proc flushQueue(self: Session): JsonNode {...}{.raises: [ValueError, IOError,
    OSError, HttpRequestError, Exception, LibraryError, SslError, TimeoutError,
    ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Flushes the Queue
proc deleteQueue(self: Session): JsonNode {...}{.raises: [ValueError, IOError,
    OSError, HttpRequestError, Exception, LibraryError, SslError, TimeoutError,
    ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Deletes the current Queue
proc getQuarantine(self: Session): JsonNode {...}{.raises: [ValueError, IOError,
    OSError, HttpRequestError, Exception, LibraryError, SslError, TimeoutError,
    ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Returns all Mails in the Quarantine as a JsonNode
proc deleteQuarantine(self: Session; id: string): JsonNode {...}{.raises: [
    ValueError, IOError, OSError, HttpRequestError, Exception, LibraryError,
    SslError, TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Deletes a Mail from the Quarantine
proc getFail2Ban(self: Session): JsonNode {...}{.raises: [ValueError, IOError,
    OSError, HttpRequestError, Exception, LibraryError, SslError, TimeoutError,
    ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Gets the current Fail2Ban settings
proc editFail2Ban(self: Session; ban_time: string = "";
                  max_attempts: string = ""; retry_window: string = "";
                  netban_ipv4: string = ""; netban_ipv6: string = "";
                  whitelist: string = ""; blacklist: string = ""): JsonNode {...}{.raises: [
    ValueError, IOError, OSError, HttpRequestError, Exception, LibraryError,
    SslError, TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Edits the Fail2Ban settings Only edits the called parameters
proc getDkim(self: Session; domain: string): JsonNode {...}{.raises: [ValueError,
    IOError, OSError, HttpRequestError, Exception, LibraryError, SslError,
    TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Gets the public DKIM key for the provided Domain
proc generateDkim(self: Session; domain: string; size: string = "2048"): JsonNode {...}{.raises: [
    ValueError, IOError, OSError, HttpRequestError, Exception, LibraryError,
    SslError, TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Generates a DKIM key for the provided domain Default size is 2048
proc duplicateDkim(self: Session; from_domain: string; to: string): JsonNode {...}{.raises: [
    ValueError, IOError, OSError, HttpRequestError, Exception, LibraryError,
    SslError, TimeoutError, ProtocolError, KeyError, JsonParsingError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, TimeEffect].}
Duplicates the DKIM key from one domain to another