---
title: "Helpers and constants"
description: "What else the package defines besides the client’s methods."
url: "https://openemail.uk/docs/java/reference/helpers"
area: "Java"
category: "Reference"
---

# Helpers and constants

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

## Static methods

| Method | What it is |
| --- | --- |
| `new OpenEmail()`, `OpenEmail.builder()` | A client. Both read the environment for anything you leave out. |
| `OpenEmail.createTempMail()` | A disposable-inbox client that carries no API key. |
| `OpenEmail.verifyWebhookSignature()` | Checks the signature of a delivery in constant time, with a five minute window that a `Duration` changes, and returns the event. |
| `OpenEmail.toBase64()` | Base64 text for the bytes of an attachment. |
| `OpenEmail.isApiKey()` | Whether a value has the `oe_live_` or `oe_test_` shape. A shape check, not proof the key still works. |
| `OpenEmail.isAccessToken()` | Whether a value has the shape of an OAuth access token: 1 to 512 characters, not beginning `oe_`. |
| `OpenEmail.isSealed()` | Whether a message’s body is ciphertext. It is false for the two signed formats, whose bodies arrived in the clear. |
| `OpenEmail.resolveLanguage()`, `OpenEmail.languageByCode()`, `OpenEmail.isRtlLanguage()` | The lookups a language picker needs, over the bundled `Languages.ALL` table. |
| `client.raw().request()` | Calls a path no method wraps yet, with the credential and retry policy of the client. |

## Constants

Every value set the TypeScript SDK exports is a final class in `uk.openemail.constants`, with one constant per member under the same names, so `WebhookEvents.EMAIL_DELIVERED` is `email.delivered`. `values()` returns the whole set, which is also how to check a value that came from outside.

**Constants.java**

```
List<String> events = WebhookEvents.values();
List<String> scopes = List.of(ApiScopes.EMAILS_SEND, ApiScopes.THREADS_READ);
boolean known = events.contains("email.delivered");

System.out.println(events.size() + " " + String.join(",", scopes) + " " + PageLimits.MAX_LIMIT + " " + known);
```

| Constant | What it holds |
| --- | --- |
| `OpenEmail.VERSION` | The package version. |
| `ApiScopes` | The scope vocabulary, for a key-creation screen. |
| `WebhookEvents`, `WebhookSignatureHeaders` | The events an endpoint can subscribe to, and the names of the headers a delivery carries. |
| `ErrorTypes` | The error vocabulary that `ApiException.type()` returns. |
| `PageLimits` | The largest and the default `limit` on most paged lists, `MAX_LIMIT` and `DEFAULT_LIMIT`: 100 and 25. A few lists take more, and the reference of each method says so. |
| `RuleFields`, `RuleOperators`, `RuleActions` | The vocabulary a rule’s conditions and actions are built from. |
| `MessageEncryptionFormats` | The five envelopes ingest can name. Three of them are sealed. |
| `CredentialKinds`, `StepUpMethods`, `StepUpErrorCodes` | Which credential `me().get` and `me().ping` describe, how a verification code is checked, and the codes a verification can fail with. |
| `ThreadSorts`, `PeopleSorts`, `FileSorts` and the other `*Sorts` | The orders a list can be sorted in. |
| `FormStatuses`, `BroadcastStatuses`, `SuppressionReasons` and the other sets | The values a field of a resource can take. Each set is named after what it holds. |
| `Languages.ALL` | Every language a translated send or preview accepts, with its code, its names and its direction. |

## Objects

A response is the decoded JSON as a `Map<String, Object>`. The package builds a type of its own only where it shapes the answer. Each is an immutable record in `uk.openemail.result`, and a `for` loop walks its rows.

| Class | What it carries |
| --- | --- |
| `Page` | `items`, `hasMore` and `nextCursor`, from every paged `list`. |
| `PeoplePage` | The same plus `seen`, from `contacts().listPeople`. |
| `TempMessagesPage` | The same plus `expiresAt`, from `tempMail().listMessages`. |
| `AddressBookPage`, `AddressBook` | `unrestricted`, `addresses` and `domains`, from `addresses().list` (with `hasMore` and `nextCursor`) and `addresses().listAll`. |
| `BatchResult` | `items`, `sent` and `failed`, from `emails().sendBatch`. |
| `TemplateSends` | `items`, `total`, `page` and `pageSize`, from `templates().listSends`. |
| `PagedIterable` | A walk over every page, from every `iterate`: a `for` loop, `stream()` or `toList()`. |
| `Body`, `RequestOptions` | What a call takes: a request body that keeps its order and takes null values, and the options of one call. |

> Every exception the package throws is an `OpenEmailException`: `ApiException` and its subclasses, `NetworkException` and `WebhookSignatureException`. A mistake in the call itself throws `IllegalArgumentException` before anything is sent.

## What it deliberately does not do

- It validates no request body. The server’s schema is the only copy of the rules, and a second copy here would eventually refuse an address a newer server accepts, in a version somebody pinned two years ago.
- It reshapes a response in one way only: the `data` list of a collection is lifted out of its envelope into one of the types above. Every other response comes back as the API sent it, with the camelCase keys of the API.
- It has no asynchronous methods. A call blocks its thread until the answer arrives, which costs little on a virtual thread.
