Skip to the documentation
Go

Helpers and constants

What else the package defines besides the client’s methods.

Functions

FunctionWhat it is
openemail.New()A client. It reads the environment for anything you leave out, and client.Err() reports a configuration it refused.
openemail.NewTempMail()A client for disposable inboxes that carries no API key.
openemail.VerifyWebhookSignature()Checks the signature of a delivery in constant time, with a five minute window that openemail.WithTolerance changes, and returns the event.
openemail.IsAPIKey(), openemail.IsAccessToken()Whether a value has the shape of an API key or of an access token.
openemail.IsSealed()Whether a message is end to end encrypted, so its body cannot be read by the API.
openemail.ResolveLanguage(), openemail.LanguageByCode(), openemail.IsRTLLanguage()Look a language up by code, English name or own name, in the table openemail.Languages() returns.
client.Request()Calls a path no method wraps yet, with the credential and retry policy of the client.

Types

TypeWhat it is
openemail.BodyA request body, a map[string]any with the field names of the API.
openemail.ObjectA decoded response, with the readers ID, String, Int, Float, Bool, Time, Object, Objects, Strings and Has.
openemail.PageOne page of a list: Items, HasMore and NextCursor.
openemail.IteratorA walk over every page: Next, Item, Err and All.
openemail.ErrorEvery failure, with Status, Type, Code, Param, DocURL, RequestID, RetryAfter, Fields and Body.

Constants

The constants package holds every set of values the API uses, generated from the TypeScript SDK: webhook events, scopes, statuses and the rest. Each member is a constant named after its set, and each set of text values has a function that lists them.

constants.go
webhook, err := client.Webhooks.Create(ctx, openemail.Body{	"url":    "https://example.com/webhooks/openemail",	"events": []string{constants.WebhookEventsEmailReceived, constants.WebhookEventsEmailBounced},})if err != nil {	return err} fmt.Println(webhook.ID(), len(constants.WebhookEventsValues()))