improvmx

package module
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2022 License: MIT Imports: 3 Imported by: 2

README

go-improvmx

A Golang API client for ImprovMX, my email forwarding service of choice.

Usage

package main

import (
	"os"

	improvmx "github.com/issyl0/go-improvmx"
)

func main() {
	client := improvmx.NewClient(os.Getenv("IMPROVMX_API_TOKEN"))

	client.CreateDomain("example.com")
	client.CreateEmailForward("example.com", "hi", "person@realdomain.com")
	client.UpdateEmailForward("example.com", "hi", "person@realdomain.com,another@realdomain.com")
	client.DeleteEmailForward("example.com", "hi")
	client.DeleteDomain("example.com")
}

TODO

  • Tests.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL     string
	AccessToken string
	Http        *resty.Request
}

func NewClient

func NewClient(accessToken string) *Client

func (*Client) AccountDetails

func (client *Client) AccountDetails() Response

https://improvmx.com/api/#account handler

func (*Client) CreateDomain

func (client *Client) CreateDomain(domain, notificationEmail, whitelabel string) Response

https://improvmx.com/api/#domains-add

func (*Client) CreateEmailForward

func (client *Client) CreateEmailForward(domain, alias, forward string) Response

func (*Client) CreateSMTPCredential added in v0.15.0

func (client *Client) CreateSMTPCredential(domain, username, password string) Response

func (*Client) DeleteDomain

func (client *Client) DeleteDomain(domain string) Response

https://improvmx.com/api/#domain-delete

func (*Client) DeleteEmailForward

func (client *Client) DeleteEmailForward(domain, alias string) Response

https://improvmx.com/api/#alias-delete

func (*Client) DeleteSMTPCredential added in v0.15.0

func (client *Client) DeleteSMTPCredential(domain, username string) Response

func (*Client) GetDomain added in v0.7.0

func (client *Client) GetDomain(domain string) Response

func (*Client) GetDomainCheck added in v0.16.0

func (client *Client) GetDomainCheck(domain string) Response

func (*Client) GetEmailForward added in v0.5.0

func (client *Client) GetEmailForward(domain, alias string) Response

func (*Client) GetSMTPCredential added in v0.15.0

func (client *Client) GetSMTPCredential(domain string) Response

func (*Client) UpdateDomain added in v0.13.0

func (client *Client) UpdateDomain(domain, notificationEmail, whitelabel string) Response

func (*Client) UpdateEmailForward added in v0.12.0

func (client *Client) UpdateEmailForward(domain, alias, forward string) Response

func (*Client) UpdateSMTPCredential added in v0.15.0

func (client *Client) UpdateSMTPCredential(domain, username, password string) Response

type Response

type Response struct {
	Success bool `json:"success"`
	Total   int  `json:"total"`
	Code    int  `json:"code"`

	Errors struct {
		Domain  []string `json:"domain"`
		Alias   []string `json:"alias"`
		Account []string `json:"account"`
	} `json:"errors"`

	Error string `json:"error"`

	Records struct {
		Valid    bool   `json:"valid"`
		Provider string `json:"provider"`
		Advanced bool   `json:"advanced"`
		Mx       struct {
			Valid    bool     `json:"valid"`
			Expected []string `json:"expected"`
			Values   []string `json:"values"`
		} `json:"mx"`
		Spf struct {
			Valid    bool   `json:"valid"`
			Expected string `json:"expected"`
			Values   string `json:"values"`
		} `json:"spf"`
	}

	Account struct {
		Plan struct {
			Display string `json:"display"`
		} `json:"plan"`
	} `json:"account"`

	Alias struct {
		Forward string `json:"forward"`
		Alias   string `json:"alias"`
		Id      int64  `json:"id"`
	} `json:"alias"`

	Domain struct {
		Domain            string `json:"domain"`
		Whitelabel        string `json:"whitelabel"`
		NotificationEmail string `json:"notification_email"`
		Aliases           []struct {
			Id int64 `json:"id"`
		}
	} `json:"domain"`

	Credential struct {
		Created  int64  `json:"created"`
		Usage    int    `json:"usage"`
		Username string `json:"username"`
	} `json:"credential"`

	Credentials []struct {
		Created  int64  `json:"created"`
		Usage    int    `json:"usage"`
		Username string `json:"username"`
	} `json:"credentials"`
}

Jump to

Keyboard shortcuts

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