Package africa.sendbyte
Class SendByteClient
java.lang.Object
africa.sendbyte.SendByteClient
- All Implemented Interfaces:
AutoCloseable
The entry point to the SendByte API.
Create one client for the lifetime of your application and reuse it; it is thread-safe. Resources are reached through accessor methods:
SendByteClient client = new SendByteClient(System.getenv("SENDBYTE_API_KEY"));
Email email = client.emails().send(
SendEmailRequest.builder()
.from("PayLink <receipts@paylink.ng>")
.to("amaka@halo.ng")
.subject("Receipt for ₦45,000")
.html("<p>Payment received.</p>")
.build());
System.out.println(email.getId());
Use a sk_test_ key while developing and a sk_live_ key in
production. Call close() on shutdown to release the HTTP connection pool.
-
Constructor Summary
ConstructorsConstructorDescriptionSendByteClient(HttpTransport transport) Create a client over a customHttpTransport.SendByteClient(SendByteClientOptions options) Create a client from a full options object.SendByteClient(String apiKey) Create a client with the given API key and default configuration. -
Method Summary
Modifier and TypeMethodDescriptionapiKeys()Access the API Keys resource: create, list, and revoke scoped keys.voidclose()domains()Access the Domains resource: register, retrieve, list, and verify sending domains.emails()Access the Emails resource: send, retrieve, and list transactional emails.Access the Templates resource: manage and preview reusable email templates.webhooks()Access the Webhooks resource: manage endpoints, inspect deliveries, and replay them.
-
Constructor Details
-
SendByteClient
Create a client with the given API key and default configuration. -
SendByteClient
Create a client from a full options object. -
SendByteClient
Create a client over a customHttpTransport. Primarily used by tests to inject a stub transport, but also allows swapping the HTTP layer entirely.
-
-
Method Details
-
emails
Access the Emails resource: send, retrieve, and list transactional emails. -
domains
Access the Domains resource: register, retrieve, list, and verify sending domains. -
templates
Access the Templates resource: manage and preview reusable email templates. -
webhooks
Access the Webhooks resource: manage endpoints, inspect deliveries, and replay them. -
apiKeys
Access the API Keys resource: create, list, and revoke scoped keys. -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-