migagoapi

package module
v0.0.0-...-80b82fc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2024 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const BaseEndpoint = "https://api.migadu.com/v1/"

Variables

This section is empty.

Functions

This section is empty.

Types

type Addresser

type Addresser interface {
	GetAddress() string
}

type Client

type Client struct {
	User       string
	Token      string
	Endpoint   string
	Domain     string
	HttpClient *http.Client
}

func NewClient

func NewClient(user, token, endpoint, domain *string, timeout *time.Duration) (*Client, error)

Timeout will be used as the client's timeout duration and will overrule any context timeout duration (if longer). When the timeout of the client making the request is reached, it is treated as if the context of the request has ended.

func (*Client) CreateIdentity

func (c *Client) CreateIdentity(ctx context.Context, local_part string, new_identity *Identity) (*Identity, error)

func (*Client) CreateIdentityNoAuth

func (c *Client) CreateIdentityNoAuth(ctx context.Context, local_part, name, id string) (*Identity, error)

Convience function to create an identity that will not be used for authentication (i.e. login)

func (*Client) CreateIdentityWithPassword

func (c *Client) CreateIdentityWithPassword(ctx context.Context, local_part, name, id, password string) (*Identity, error)

Convience function to create an identity with a password. The password can be a custom password as passed, or left as an empty string to use the mailbox password

func (*Client) CreateMailbox

func (c *Client) CreateMailbox(ctx context.Context, new_mailbox *Mailbox) (*Mailbox, error)

Create mailbox using Mailbox object

func (*Client) CreateMailboxWithInvite

func (c *Client) CreateMailboxWithInvite(
	ctx context.Context, name, local_part, password_recovery_email string,
	is_internal bool) (*Mailbox, error)

Convience function to create a mailbox that sets the password via invitation link

func (*Client) CreateMailboxWithPassword

func (c *Client) CreateMailboxWithPassword(
	ctx context.Context, name, local_part, password string, is_internal bool) (*Mailbox, error)

Convience function to create a mailbox with a password set

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, path string) ([]byte, error)

func (*Client) DeleteIdentity

func (c *Client) DeleteIdentity(ctx context.Context, local_part, id string) error

func (*Client) DeleteMailbox

func (c *Client) DeleteMailbox(ctx context.Context, local_part string) error

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string) ([]byte, error)

func (*Client) GetIdentities

func (c *Client) GetIdentities(ctx context.Context, local_part string) (*[]Identity, error)

func (*Client) GetIdentity

func (c *Client) GetIdentity(ctx context.Context, local_part, id string) (*Identity, error)

func (*Client) GetMailbox

func (c *Client) GetMailbox(ctx context.Context, local_part string) (*Mailbox, error)

Get mailbox local_part at domain associated with the client

func (*Client) GetMailboxes

func (c *Client) GetMailboxes(ctx context.Context) (*[]Mailbox, error)

Get all mailboxes on the domain associated with the client

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, json_body []byte) ([]byte, error)

func (*Client) Put

func (c *Client) Put(ctx context.Context, path string, json_body []byte) ([]byte, error)

func (*Client) UpdateIdentity

func (c *Client) UpdateIdentity(ctx context.Context, local_part, id string, identity_params *Identity) (*Identity, error)

func (*Client) UpdateMailbox

func (c *Client) UpdateMailbox(ctx context.Context, local_part string, mailbox_params *Mailbox) (*Mailbox, error)

Updates the mailbox local_part using the parametres in the provided Mailbox Returns the updated Mailbox as a pointer and any errors

type CustomTime

type CustomTime time.Time

func (*CustomTime) MarshalJSON

func (t *CustomTime) MarshalJSON() ([]byte, error)

func (*CustomTime) UnmarshalJSON

func (t *CustomTime) UnmarshalJSON(b []byte) (err error)

type ErrorRequestStatus

type ErrorRequestStatus struct {
	StatusBody []byte
	StatusCode int
}

func (ErrorRequestStatus) Error

func (e ErrorRequestStatus) Error() string

type Identity

type Identity struct {
	LocalPart            string `json:"local_part,omitempty"`
	Domain               string `json:"domain,omitempty"`
	Address              string `json:"address,omitempty"`
	Name                 string `json:"name,omitempty"`
	MaySend              bool   `json:"may_send,omitempty"`
	MayReceive           bool   `json:"may_receive,omitempty"`
	MayAccessImap        bool   `json:"may_access_imap,omitempty"`
	MayAccessPop3        bool   `json:"may_access_pop3,omitempty"`
	MayAccessManagesieve bool   `json:"may_access_managesieve,omitempty"`
	Password             string `json:"password,mayomitempty"`
	PasswordUse          string `json:"password_use,omitempty"` // leaked info on new documentation (!!!) from https://github.com/metio/migadu-client.go/pull/9
	FooterActive         bool   `json:"footer_active,omitempty"`
	FooterPlainBody      string `json:"footer_plain_body,omitempty"`
	FooterHtmlBody       string `json:"footer_html_body,omitempty"`
}

func (Identity) GetAddress

func (i Identity) GetAddress() string

type Mailbox

type Mailbox struct {
	LocalPart             string     `json:"local_part,omitempty"`
	Domain                string     `json:"domain,omitempty"`
	Address               string     `json:"address,omitempty"`
	Name                  string     `json:"name,omitempty"`
	IsInternal            bool       `json:"is_internal,omitempty"`
	MaySend               bool       `json:"may_send,omitempty"`
	MayReceive            bool       `json:"may_receive,omitempty"`
	MayAccessImap         bool       `json:"may_access_imap,omitempty"`
	MayAccessPop3         bool       `json:"may_access_pop3,omitempty"`
	MayAccessManagesieve  bool       `json:"may_access_managesieve,omitempty"`
	PasswordMethod        string     `json:"password_method,omitempty"`
	Password              string     `json:"password,omitempty"`
	PasswordRecoveryEmail string     `json:"password_recovery_email,omitempty"`
	SpamAction            string     `json:"spam_action,omitempty"`
	SpamAggressiveness    string     `json:"spam_aggressiveness"`
	SenderDenylist        []string   `json:"sender_denylist,omitempty"`
	SenderAllowlist       []string   `json:"sender_allowlist,omitempty"`
	RecipientDenylist     []string   `json:"recipient_denylist,omitempty"`
	AutorespondActive     bool       `json:"autorespond_active,omitempty"`
	AutorespondSubject    string     `json:"autorespond_subject,omitempty"`
	AutorespondBody       string     `json:"autorespond_body,omitempty"`
	AutorespondExpiresOn  time.Time  `json:"autorespond_expires_on,omitempty"`
	FooterActive          bool       `json:"footer_active,omitempty"`
	FooterPlainBody       string     `json:"footer_plain_body,omitempty"`
	FooterHTMLBody        string     `json:"footer_html_body,omitempty"`
	Identities            []Identity `json:"identities,omitempty"`
}

func (Mailbox) GetAddress

func (m Mailbox) GetAddress() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL