transmitly

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Transmitly Go SDK

client := transmitly.New(os.Getenv("TRANSMITLY_KEY"))
accepted, err := client.SendEmail(ctx, transmitly.EmailInput{
    From: "Notify <notify@mail.acme.com>",
    To:   []string{"ada@example.net"},
    Subject: "Your workspace is ready",
    HTML: "<p>Welcome.</p>",
    ReplyTo: "support@acme.com",
})

BaseURL defaults to https://transmitly.io; set it for local testing. Non-2xx responses return *transmitly.APIError with Status, Code, Message and Details. Domain, webhook and inbound management require an API key with the admin scope.

The package lives at github.com/Transmitly-io/sdk-go.

Documentation

Overview

Package transmitly is a small Go client for the Transmitly email API.

Index

Constants

View Source
const DefaultBaseURL = "https://transmitly.io"

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Status  int            `json:"-"`
	Code    string         `json:"code"`
	Message string         `json:"message"`
	Details map[string]any `json:"details,omitempty"`
}

func (*APIError) Error

func (e *APIError) Error() string

type Client

type Client struct {
	APIKey  string
	BaseURL string
	HTTP    *http.Client
}

func New

func New(apiKey string) *Client

func (*Client) AddSuppression

func (c *Client) AddSuppression(ctx context.Context, in SuppressionInput) (map[string]any, error)

func (*Client) CreateDomain

func (c *Client) CreateDomain(ctx context.Context, domain string) (map[string]any, error)

func (*Client) CreateInboundRoute

func (c *Client) CreateInboundRoute(ctx context.Context, in InboundRouteInput) (map[string]any, error)

func (*Client) CreateWebhook

func (c *Client) CreateWebhook(ctx context.Context, in WebhookInput) (map[string]any, error)

func (*Client) GetEmail

func (c *Client) GetEmail(ctx context.Context, id string) (map[string]any, error)

func (*Client) Health

func (c *Client) Health(ctx context.Context) (map[string]any, error)

func (*Client) ListDomains

func (c *Client) ListDomains(ctx context.Context) (map[string]any, error)

func (*Client) ListInboundRoutes

func (c *Client) ListInboundRoutes(ctx context.Context) (map[string]any, error)

func (*Client) ListMessages

func (c *Client) ListMessages(ctx context.Context, params url.Values) (map[string]any, error)

func (*Client) ListSuppressions

func (c *Client) ListSuppressions(ctx context.Context, params url.Values) (map[string]any, error)

func (*Client) ListWebhooks

func (c *Client) ListWebhooks(ctx context.Context) (map[string]any, error)

func (*Client) SendEmail

func (c *Client) SendEmail(ctx context.Context, in EmailInput) (*EmailAccepted, error)

func (*Client) Usage

func (c *Client) Usage(ctx context.Context, params url.Values) (map[string]any, error)

func (*Client) VerifyDomain

func (c *Client) VerifyDomain(ctx context.Context, id string) (map[string]any, error)

type Delivery

type Delivery struct {
	ID           string `json:"id"`
	Recipient    string `json:"recipient"`
	Status       string `json:"status"`
	Attempts     int    `json:"attempts"`
	ProviderID   string `json:"provider_id"`
	MXHost       string `json:"mx_host"`
	SMTPCode     int    `json:"smtp_code"`
	EnhancedCode string `json:"enhanced_code"`
	LastError    string `json:"last_error"`
	DeliveredAt  string `json:"delivered_at"`
}

type Domain

type Domain struct {
	ID           string `json:"id"`
	Domain       string `json:"domain"`
	Status       string `json:"status"`
	DKIMSelector string `json:"dkim_selector"`
}

type EmailAccepted

type EmailAccepted struct {
	ID         string `json:"id"`
	Status     string `json:"status"`
	Recipients int    `json:"recipients"`
	Warning    string `json:"warning,omitempty"`
}

type EmailInput

type EmailInput struct {
	From    string            `json:"from"`
	To      any               `json:"to"` // string or []string
	ReplyTo string            `json:"reply_to,omitempty"`
	Subject string            `json:"subject"`
	HTML    string            `json:"html,omitempty"`
	Text    string            `json:"text,omitempty"`
	Stream  string            `json:"stream,omitempty"`
	Tags    map[string]string `json:"tags,omitempty"`
	Headers map[string]string `json:"headers,omitempty"`
}

type InboundRouteInput

type InboundRouteInput struct {
	Address     string `json:"address"`
	Action      string `json:"action"`
	Destination string `json:"destination,omitempty"`
	Note        string `json:"note,omitempty"`
}

type Message

type Message struct {
	ID         string `json:"id"`
	Stream     string `json:"stream"`
	From       string `json:"from"`
	Subject    string `json:"subject"`
	Status     string `json:"status"`
	Recipients int    `json:"recipient_count"`
	CreatedAt  string `json:"created_at"`
}

type SuppressionInput

type SuppressionInput struct {
	Email  string `json:"email"`
	Reason string `json:"reason,omitempty"`
	Stream string `json:"stream,omitempty"`
	Note   string `json:"note,omitempty"`
}

type WebhookInput

type WebhookInput struct {
	URL         string   `json:"url"`
	Events      []string `json:"events"`
	Description string   `json:"description,omitempty"`
	DomainIDs   []string `json:"domain_ids,omitempty"`
}

Jump to

Keyboard shortcuts

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