Go
Helpers and constants
What else the package defines besides the client’s methods.
Functions
| Function | What it is |
|---|---|
| nextmail.New() | A client. It reads the environment for anything you leave out, and client.Err() reports a configuration it refused. |
| nextmail.NewTempMail() | A client for disposable inboxes that carries no API key. |
| nextmail.VerifyWebhookSignature() | Checks the signature of a delivery in constant time, with a five minute window that nextmail.WithTolerance changes, and returns the event. |
| nextmail.IsAPIKey(), nextmail.IsAccessToken() | Whether a value has the shape of an API key or of an access token. |
| nextmail.IsSealed() | Whether a message is end to end encrypted, so its body cannot be read by the API. |
| nextmail.ResolveLanguage(), nextmail.LanguageByCode(), nextmail.IsRTLLanguage() | Look a language up by code, English name or own name, in the table nextmail.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 |
|---|---|
| nextmail.Body | A request body, a map[string]any with the field names of the API. |
| nextmail.Object | A decoded response, with the readers ID, String, Int, Float, Bool, Time, Object, Objects, Strings and Has. |
| nextmail.Page | One page of a list: Items, HasMore and NextCursor. |
| nextmail.Iterator | A walk over every page: Next, Item, Err and All. |
| nextmail.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, nextmail.Body{ "url": "https://example.com/webhooks/nextmail", "events": []string{constants.WebhookEventsEmailReceived, constants.WebhookEventsEmailBounced},})if err != nil { return err} fmt.Println(webhook.ID(), len(constants.WebhookEventsValues()))
Google Workspace