You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

github.com/shoopea/mailcow-go

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/shoopea/mailcow-go

v0.0.0-20230714175612-5975d0fbd02b
Source
Go
Version published
Created
Source

Go API client for mailcow

mailcow is complete e-mailing solution with advanced antispam, antivirus, nice UI and API.

In order to use this API you have to create a API key and add your IP address to the whitelist of allowed IPs this can be done by logging into the Mailcow UI using your admin account, then go to Configuration > Access > Edit administrator details > API. There you will find a collapsed API menu.

There are two types of API keys

  • The read only key can only be used for all get endpoints
  • The read write key can be used for all endpoints

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import mailcow "github.com/shoopea/mailcow-go"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), mailcow.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), mailcow.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), mailcow.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), mailcow.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to http://localhost

ClassMethodHTTP requestDescription
AddressRewritingApiCreateBCCMapPost /api/v1/add/bccCreate BCC Map
AddressRewritingApiCreateRecipientMapPost /api/v1/add/recipient_mapCreate Recipient Map
AddressRewritingApiDeleteBCCMapPost /api/v1/delete/bccDelete BCC Map
AddressRewritingApiDeleteRecipientMapPost /api/v1/delete/recipient_mapDelete Recipient Map
AddressRewritingApiGetBCCMapGet /api/v1/get/bcc/{id}Get BCC Map
AddressRewritingApiGetRecipientMapGet /api/v1/get/recipient_map/{id}Get Recipient Map
AliasesApiCreateAliasPost /api/v1/add/aliasCreate alias
AliasesApiCreateTimeLimitedAliasPost /api/v1/add/time_limited_aliasCreate time limited alias
AliasesApiDeleteAliasPost /api/v1/delete/aliasDelete alias
AliasesApiGetAliasesGet /api/v1/get/alias/{id}Get aliases
AliasesApiGetTimeLimitedAliasesGet /api/v1/get/time_limited_aliases/{mailbox}Get time limited aliases
AliasesApiUpdateAliasPost /api/v1/edit/aliasUpdate alias
AppPasswordsApiCreateAppPasswordPost /api/v1/add/app-passwdCreate App Password
AppPasswordsApiDeleteAppPasswordPost /api/v1/delete/app-passwdDelete App Password
AppPasswordsApiGetAppPasswordGet /api/v1/get/app-passwd/all/{mailbox}Get App Password
DKIMApiDeleteDKIMKeyPost /api/v1/delete/dkimDelete DKIM Key
DKIMApiDuplicateDKIMKeyPost /api/v1/add/dkim_duplicateDuplicate DKIM Key
DKIMApiGenerateDKIMKeyPost /api/v1/add/dkimGenerate DKIM Key
DKIMApiGetDKIMKeyGet /api/v1/get/dkim/{domain}Get DKIM Key
DomainAdminApiCreateDomainAdminUserPost /api/v1/add/domain-adminCreate Domain Admin user
DomainAdminApiDeleteDomainAdminPost /api/v1/delete/domain-adminDelete Domain Admin
DomainAdminApiEditDomainAdminACLPost /api/v1/edit/da-aclEdit Domain Admin ACL
DomainAdminApiEditDomainAdminUserPost /api/v1/edit/domain-adminEdit Domain Admin user
DomainAdminApiGetDomainAdminsGet /api/v1/get/domain-admin/allGet Domain Admins
DomainAntispamPoliciesApiCreateDomainPolicyPost /api/v1/add/domain-policyCreate domain policy
DomainAntispamPoliciesApiDeleteDomainPolicyPost /api/v1/delete/domain-policyDelete domain policy
DomainAntispamPoliciesApiListBlacklistDomainPolicyGet /api/v1/get/policy_bl_domain/{domain}List blacklist domain policy
DomainAntispamPoliciesApiListWhitelistDomainPolicyGet /api/v1/get/policy_wl_domain/{domain}List whitelist domain policy
DomainsApiCreateDomainPost /api/v1/add/domainCreate domain
DomainsApiDeleteDomainPost /api/v1/delete/domainDelete domain
DomainsApiDeleteDomainTagsPost /api/v1/delete/domain/tag/{domain}Delete domain tags
DomainsApiGetDomainsGet /api/v1/get/domain/{id}Get domains
DomainsApiUpdateDomainPost /api/v1/edit/domainUpdate domain
Fail2BanApiEditFail2BanPost /api/v1/edit/fail2banEdit Fail2Ban
Fail2BanApiGetFail2BanConfigGet /api/v1/get/fail2banGet Fail2Ban Config
FordwardingHostsApiAddForwardHostPost /api/v1/add/fwdhostAdd Forward Host
FordwardingHostsApiDeleteForwardHostPost /api/v1/delete/fwdhostDelete Forward Host
FordwardingHostsApiGetForwardingHostsGet /api/v1/get/fwdhost/allGet Forwarding Hosts
LogsApiGetACMELogsGet /api/v1/get/logs/acme/{count}Get ACME logs
LogsApiGetApiLogsGet /api/v1/get/logs/api/{count}Get Api logs
LogsApiGetAutodiscoverLogsGet /api/v1/get/logs/autodiscover/{count}Get Autodiscover logs
LogsApiGetDovecotLogsGet /api/v1/get/logs/dovecot/{count}Get Dovecot logs
LogsApiGetNetfilterLogsGet /api/v1/get/logs/netfilter/{count}Get Netfilter logs
LogsApiGetPostfixLogsGet /api/v1/get/logs/postfix/{count}Get Postfix logs
LogsApiGetRatelimitLogsGet /api/v1/get/logs/ratelimited/{count}Get Ratelimit logs
LogsApiGetRspamdLogsGet /api/v1/get/logs/rspamd-history/{count}Get Rspamd logs
LogsApiGetSOGoLogsGet /api/v1/get/logs/sogo/{count}Get SOGo logs
LogsApiGetWatchdogLogsGet /api/v1/get/logs/watchdog/{count}Get Watchdog logs
MailboxesApiCreateMailboxPost /api/v1/add/mailboxCreate mailbox
MailboxesApiDeleteMailboxPost /api/v1/delete/mailboxDelete mailbox
MailboxesApiDeleteMailboxTagsPost /api/v1/delete/mailbox/tag/{mailbox}Delete mailbox tags
MailboxesApiEditMailboxSpamFilterScorePost /api/v1/edit/spam-score/Edit mailbox spam filter score
MailboxesApiGetMailboxesGet /api/v1/get/mailbox/{id}Get mailboxes
MailboxesApiGetMailboxesOfADomainGet /api/v1/get/mailbox/all/{domain}Get mailboxes of a domain
MailboxesApiQuarantineNotificationsPost /api/v1/edit/quarantine_notificationQuarantine Notifications
MailboxesApiUpdateMailboxPost /api/v1/edit/mailboxUpdate mailbox
MailboxesApiUpdateMailboxACLPost /api/v1/edit/user-aclUpdate mailbox ACL
MailboxesApiUpdatePushoverSettingsPost /api/v1/edit/pushoverUpdate Pushover settings
OAuthClientsApiCreateOAuthClientPost /api/v1/add/oauth2-clientCreate oAuth Client
OAuthClientsApiDeleteOAuthClientPost /api/v1/delete/oauth2-clientDelete oAuth Client
OAuthClientsApiGetOAuthClientsGet /api/v1/get/oauth2-client/{id}Get oAuth Clients
OutgoingTLSPolicyMapOverridesApiCreateTLSPolicyMapPost /api/v1/add/tls-policy-mapCreate TLS Policy Map
OutgoingTLSPolicyMapOverridesApiDeleteTLSPolicyMapPost /api/v1/delete/tls-policy-mapDelete TLS Policy Map
OutgoingTLSPolicyMapOverridesApiGetTLSPolicyMapGet /api/v1/get/tls-policy-map/{id}Get TLS Policy Map
QuarantineApiDeleteMailsInQuarantinePost /api/v1/delete/qitemDelete mails in Quarantine
QuarantineApiGetMailsInQuarantineGet /api/v1/get/quarantine/allGet mails in Quarantine
QueueManagerApiDeleteQueuePost /api/v1/delete/mailqDelete Queue
QueueManagerApiFlushQueuePost /api/v1/edit/mailqFlush Queue
QueueManagerApiGetQueueGet /api/v1/get/mailq/allGet Queue
RatelimitsApiEditDomainRatelimitsPost /api/v1/edit/rl-domain/Edit domain ratelimits
RatelimitsApiEditMailboxRatelimitsPost /api/v1/edit/rl-mbox/Edit mailbox ratelimits
RatelimitsApiGetDomainRatelimitsGet /api/v1/get/rl-domain/{domain}Get domain ratelimits
RatelimitsApiGetMailboxRatelimitsGet /api/v1/get/rl-mbox/{mailbox}Get mailbox ratelimits
ResourcesApiCreateResourcesPost /api/v1/add/resourceCreate Resources
ResourcesApiDeleteResourcesPost /api/v1/delete/resourceDelete Resources
ResourcesApiGetResourcesGet /api/v1/get/resource/allGet Resources
RoutingApiCreateSenderDependentTransportsPost /api/v1/add/relayhostCreate Sender-Dependent Transports
RoutingApiCreateTransportMapsPost /api/v1/add/transportCreate Transport Maps
RoutingApiDeleteSenderDependentTransportsPost /api/v1/delete/relayhostDelete Sender-Dependent Transports
RoutingApiDeleteTransportMapsPost /api/v1/delete/transportDelete Transport Maps
RoutingApiGetSenderDependentTransportsGet /api/v1/get/relayhost/{id}Get Sender-Dependent Transports
RoutingApiGetTransportMapsGet /api/v1/get/transport/{id}Get Transport Maps
SingleSignOnApiIssueDomainAdminSSOTokenPost /api/v1/add/sso/domain-adminIssue Domain Admin SSO token
StatusApiGetContainerStatusGet /api/v1/get/status/containersGet container status
StatusApiGetSolrStatusGet /api/v1/get/status/solrGet solr status
StatusApiGetVersionStatusGet /api/v1/get/status/versionGet version status
StatusApiGetVmailStatusGet /api/v1/get/status/vmailGet vmail status
SyncJobsApiCreateSyncJobPost /api/v1/add/syncjobCreate sync job
SyncJobsApiDeleteSyncJobPost /api/v1/delete/syncjobDelete sync job
SyncJobsApiGetSyncJobsGet /api/v1/get/syncjobs/all/no_logGet sync jobs
SyncJobsApiUpdateSyncJobPost /api/v1/edit/syncjobUpdate sync job

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

ApiKeyAuth

  • Type: API key
  • API key parameter name: X-API-Key
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: X-API-Key and passed in as the auth context for each request.

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

FAQs

Package last updated on 14 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts