Go
Helpers and constants
What else the package defines besides the client’s methods.
Functions
| Function | What 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
| Type | What it is |
|---|---|
| openemail.Body | A request body, a map[string]any with the field names of the API. |
| openemail.Object | A decoded response, with the readers ID, String, Int, Float, Bool, Time, Object, Objects, Strings and Has. |
| openemail.Page | One page of a list: Items, HasMore and NextCursor. |
| openemail.Iterator | A walk over every page: Next, Item, Err and All. |
| openemail.Error | Every 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.
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()))