resend

package module
v4.12.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 17 Imported by: 6

README

Resend Go SDK

Build Release Go Reference

Installation

To install the Go SDK, simply execute the following command on a terminal:

go get github.com/resend/resend-go/v4

Setup

First, you need to get an API key, which is available in the Resend Dashboard.

Example

package main

import (
    "fmt"
    "github.com/resend/resend-go/v4"
)

func main() {
    apiKey := "re_123"

    client := resend.NewClient(apiKey)

    params := &resend.SendEmailRequest{
        To:      []string{"to@example.com", "you@example.com"},
        From:    "me@example.com",
        Text:    "hello world",
        Subject: "Hello from Golang",
        Cc:      []string{"cc@example.com"},
        Bcc:     []string{"bcc@example.com"},
        ReplyTo: "replyto@example.com",
    }

    sent, err := client.Emails.Send(params)
    if err != nil {
        panic(err)
    }
    fmt.Println(sent.Id)
}

Replace the placeholder API key and email addresses before sending. Use a verified domain for the From address.

You can view all the examples in the examples folder

Error handling

Use errors.As from the standard library's errors package to inspect typed API errors. HTTP 429 responses return *resend.RateLimitError; other HTTP error responses return *resend.ResendError. Handle other failures, such as network errors or canceled requests, separately:

_, err := client.Emails.Get("email-id")
if err != nil {
    var rateLimit *resend.RateLimitError
    var apiError *resend.ResendError

    switch {
    case errors.As(err, &rateLimit):
        fmt.Printf("Rate limited: %s (Retry-After: %s)\n",
            rateLimit.Message, rateLimit.RetryAfter)
    case errors.As(err, &apiError):
        fmt.Printf("Status: %d, name: %s, message: %s\n",
            apiError.StatusCode, apiError.Name, apiError.Message)
    default:
        fmt.Printf("Request failed: %v\n", err)
    }
}

ResendError.StatusCode comes from the HTTP response. If the error body cannot be read as JSON, Name is empty and Message falls back to the HTTP status. RateLimitError includes rate-limit metadata such as RetryAfter when the corresponding response headers are present. You can also detect rate limits with errors.Is(err, resend.ErrRateLimit).

The SDK does not automatically retry requests. The application decides whether and when to retry.

Documentation

Index

Constants

View Source
const (
	// Email events
	EventEmailSent            = "email.sent"
	EventEmailDelivered       = "email.delivered"
	EventEmailDeliveryDelayed = "email.delivery_delayed"
	EventEmailComplained      = "email.complained"
	EventEmailBounced         = "email.bounced"
	EventEmailOpened          = "email.opened"
	EventEmailClicked         = "email.clicked"
	EventEmailReceived        = "email.received"
	EventEmailFailed          = "email.failed"
	EventEmailScheduled       = "email.scheduled"
	EventEmailSuppressed      = "email.suppressed"

	// Contact events
	EventContactCreated       = "contact.created"
	EventContactUpdated       = "contact.updated"
	EventContactDeleted       = "contact.deleted"
	EventContactTopicsUpdated = "contact.topics.updated"

	// Domain events
	EventDomainCreated = "domain.created"
	EventDomainUpdated = "domain.updated"
	EventDomainDeleted = "domain.deleted"

	// Suppression events
	EventSuppressionAdded   = "suppression.added"
	EventSuppressionRemoved = "suppression.removed"

	// Topic events
	EventTopicCreated = "topic.created"
	EventTopicUpdated = "topic.updated"
	EventTopicDeleted = "topic.deleted"

	// Inbox events
	EventInboxCreated             = "inbox.created"
	EventInboxUpdated             = "inbox.updated"
	EventInboxDeleted             = "inbox.deleted"
	EventInboxThreadCreated       = "inbox.thread.created"
	EventInboxEmailReceived       = "inbox.email.received"
	EventInboxEmailSent           = "inbox.email.sent"
	EventInboxThreadFolderUpdated = "inbox.thread.folder.updated"
	EventInboxThreadAssigned      = "inbox.thread.assigned"
	EventInboxThreadUnassigned    = "inbox.thread.unassigned"
	EventInboxThreadLabelsUpdated = "inbox.thread.labels.updated"
	EventInboxDraftCreated        = "inbox.draft.created"
	EventInboxDraftUpdated        = "inbox.draft.updated"
	EventInboxDraftSent           = "inbox.draft.sent"
	EventInboxDraftDeleted        = "inbox.draft.deleted"
)
View Source
const DefaultWebhookToleranceSeconds = 300

Default tolerance for timestamp validation (5 minutes)

Variables

View Source
var (
	ErrFailedToCreateBroadcastUpdateRequest     = errors.New("[ERROR]: Failed to create Broadcasts.Update request")
	ErrFailedToCreateBroadcastSendRequest       = errors.New("[ERROR]: Failed to create Broadcasts.Send request")
	ErrFailedToCreateBroadcastCreateRequest     = errors.New("[ERROR]: Failed to create Broadcasts.Create request")
	ErrFailedToCreateBroadcastCancelRequest     = errors.New("[ERROR]: Failed to create Broadcasts.Cancel request")
	ErrFailedToCreateBroadcastDuplicateRequest  = errors.New("[ERROR]: Failed to create Broadcasts.Duplicate request")
	ErrFailedToCreateBroadcastRecipientsRequest = errors.New("[ERROR]: Failed to create Broadcasts.Recipients request")
)

BroadcastsSvc errors

View Source
var (
	ErrFailedToCreateApiKeysCreateRequest = errors.New("[ERROR]: Failed to create ApiKeys.Create request")
	ErrFailedToCreateApiKeysListRequest   = errors.New("[ERROR]: Failed to create ApiKeys.List request")
	ErrFailedToCreateApiKeysRemoveRequest = errors.New("[ERROR]: Failed to create ApiKeys.Remove request")
	ErrFailedToCreateApiKeysUpdateRequest = errors.New("[ERROR]: Failed to create ApiKeys.Update request")
)

ApiKeySvc errors

View Source
var (
	ErrFailedToCreateUpdateEmailRequest           = errors.New("[ERROR]: Failed to create UpdateEmail request")
	ErrFailedToCreateEmailsSendRequest            = errors.New("[ERROR]: Failed to create SendEmail request")
	ErrFailedToCreateEmailsGetRequest             = errors.New("[ERROR]: Failed to create GetEmail request")
	ErrFailedToCreateEmailsListRequest            = errors.New("[ERROR]: Failed to create ListEmails request")
	ErrFailedToCreateEmailsGetAttachmentRequest   = errors.New("[ERROR]: Failed to create Emails.GetAttachment request")
	ErrFailedToCreateEmailsListAttachmentsRequest = errors.New("[ERROR]: Failed to create Emails.ListAttachments request")
	ErrFailedToCreateEmailsShareRequest           = errors.New("[ERROR]: Failed to create Emails.Share request")
	ErrFailedToCreateEmailsMetricsRequest         = errors.New("[ERROR]: Failed to create Emails.Metrics request")
)

EmailsSvc errors

View Source
var (
	ErrFailedToCreateTemplateCreateRequest    = errors.New("[ERROR]: Failed to create Templates.Create request")
	ErrFailedToCreateTemplateGetRequest       = errors.New("[ERROR]: Failed to create Templates.Get request")
	ErrFailedToCreateTemplateListRequest      = errors.New("[ERROR]: Failed to create Templates.List request")
	ErrFailedToCreateTemplateUpdateRequest    = errors.New("[ERROR]: Failed to create Templates.Update request")
	ErrFailedToCreateTemplatePublishRequest   = errors.New("[ERROR]: Failed to create Templates.Publish request")
	ErrFailedToCreateTemplateDuplicateRequest = errors.New("[ERROR]: Failed to create Templates.Duplicate request")
	ErrFailedToCreateTemplateRemoveRequest    = errors.New("[ERROR]: Failed to create Templates.Remove request")
)

TemplatesSvc errors

View Source
var (
	ErrFailedToCreateReceivingGetRequest             = errors.New("[ERROR]: Failed to create Receiving.Get request")
	ErrFailedToCreateReceivingListRequest            = errors.New("[ERROR]: Failed to create Receiving.List request")
	ErrFailedToCreateReceivingGetAttachmentRequest   = errors.New("[ERROR]: Failed to create Receiving.GetAttachment request")
	ErrFailedToCreateReceivingListAttachmentsRequest = errors.New("[ERROR]: Failed to create Receiving.ListAttachments request")
)

ReceivingSvc errors

View Source
var (
	ErrFailedToCreateTopicCreateRequest = errors.New("[ERROR]: Failed to create Topics.Create request")
	ErrFailedToCreateTopicGetRequest    = errors.New("[ERROR]: Failed to create Topics.Get request")
	ErrFailedToCreateTopicListRequest   = errors.New("[ERROR]: Failed to create Topics.List request")
	ErrFailedToCreateTopicUpdateRequest = errors.New("[ERROR]: Failed to create Topics.Update request")
	ErrFailedToCreateTopicRemoveRequest = errors.New("[ERROR]: Failed to create Topics.Remove request")
)

TopicsSvc errors

View Source
var (
	ErrFailedToCreateLogsGetRequest  = errors.New("[ERROR]: Failed to create Logs.Get request")
	ErrFailedToCreateLogsListRequest = errors.New("[ERROR]: Failed to create Logs.List request")
)

LogsSvc errors

View Source
var (
	ErrFailedToCreateAutomationCreateRequest    = errors.New("[ERROR]: Failed to create Automations.Create request")
	ErrFailedToCreateAutomationGetRequest       = errors.New("[ERROR]: Failed to create Automations.Get request")
	ErrFailedToCreateAutomationListRequest      = errors.New("[ERROR]: Failed to create Automations.List request")
	ErrFailedToCreateAutomationUpdateRequest    = errors.New("[ERROR]: Failed to create Automations.Update request")
	ErrFailedToCreateAutomationRemoveRequest    = errors.New("[ERROR]: Failed to create Automations.Remove request")
	ErrFailedToCreateAutomationDuplicateRequest = errors.New("[ERROR]: Failed to create Automations.Duplicate request")
	ErrFailedToCreateAutomationStopRequest      = errors.New("[ERROR]: Failed to create Automations.Stop request")
	ErrFailedToCreateAutomationListRunsRequest  = errors.New("[ERROR]: Failed to create Automations.ListRuns request")
	ErrFailedToCreateAutomationGetRunRequest    = errors.New("[ERROR]: Failed to create Automations.GetRun request")
)

AutomationsSvc errors

View Source
var (
	ErrFailedToCreateEventCreateRequest = errors.New("[ERROR]: Failed to create Events.Create request")
	ErrFailedToCreateEventGetRequest    = errors.New("[ERROR]: Failed to create Events.Get request")
	ErrFailedToCreateEventListRequest   = errors.New("[ERROR]: Failed to create Events.List request")
	ErrFailedToCreateEventUpdateRequest = errors.New("[ERROR]: Failed to create Events.Update request")
	ErrFailedToCreateEventRemoveRequest = errors.New("[ERROR]: Failed to create Events.Remove request")
	ErrFailedToCreateEventSendRequest   = errors.New("[ERROR]: Failed to create Events.Send request")
)

EventsSvc errors

View Source
var (
	ErrFailedToCreateOAuthGrantsListRequest   = errors.New("[ERROR]: Failed to create OAuthGrants.List request")
	ErrFailedToCreateOAuthGrantsRevokeRequest = errors.New("[ERROR]: Failed to create OAuthGrants.Revoke request")
)

OAuthGrantsSvc errors

View Source
var (
	ErrFailedToCreateInboxesCreateRequest              = errors.New("[ERROR]: Failed to create Inboxes.Create request")
	ErrFailedToCreateInboxesListRequest                = errors.New("[ERROR]: Failed to create Inboxes.List request")
	ErrFailedToCreateInboxesGetRequest                 = errors.New("[ERROR]: Failed to create Inboxes.Get request")
	ErrFailedToCreateInboxesUpdateRequest              = errors.New("[ERROR]: Failed to create Inboxes.Update request")
	ErrFailedToCreateInboxesRemoveRequest              = errors.New("[ERROR]: Failed to create Inboxes.Remove request")
	ErrFailedToCreateInboxesAgentGetRequest            = errors.New("[ERROR]: Failed to create Inboxes.Agent.Get request")
	ErrFailedToCreateInboxesAgentUpdateRequest         = errors.New("[ERROR]: Failed to create Inboxes.Agent.Update request")
	ErrFailedToCreateInboxesLabelsListRequest          = errors.New("[ERROR]: Failed to create Inboxes.Labels.List request")
	ErrFailedToCreateInboxesLabelsCreateRequest        = errors.New("[ERROR]: Failed to create Inboxes.Labels.Create request")
	ErrFailedToCreateInboxesLabelsUpdateRequest        = errors.New("[ERROR]: Failed to create Inboxes.Labels.Update request")
	ErrFailedToCreateInboxesLabelsRemoveRequest        = errors.New("[ERROR]: Failed to create Inboxes.Labels.Remove request")
	ErrFailedToCreateInboxesThreadsListRequest         = errors.New("[ERROR]: Failed to create Inboxes.Threads.List request")
	ErrFailedToCreateInboxesThreadsSearchRequest       = errors.New("[ERROR]: Failed to create Inboxes.Threads.Search request")
	ErrFailedToCreateInboxesThreadsGetRequest          = errors.New("[ERROR]: Failed to create Inboxes.Threads.Get request")
	ErrFailedToCreateInboxesThreadsUpdateRequest       = errors.New("[ERROR]: Failed to create Inboxes.Threads.Update request")
	ErrFailedToCreateInboxesThreadsRemoveRequest       = errors.New("[ERROR]: Failed to create Inboxes.Threads.Remove request")
	ErrFailedToCreateInboxesThreadLabelsAddRequest     = errors.New("[ERROR]: Failed to create Inboxes.Threads.Labels.Add request")
	ErrFailedToCreateInboxesThreadLabelsSetRequest     = errors.New("[ERROR]: Failed to create Inboxes.Threads.Labels.Set request")
	ErrFailedToCreateInboxesThreadLabelsRemoveRequest  = errors.New("[ERROR]: Failed to create Inboxes.Threads.Labels.Remove request")
	ErrFailedToCreateInboxesThreadEmailsListRequest    = errors.New("[ERROR]: Failed to create Inboxes.Threads.Emails.List request")
	ErrFailedToCreateInboxesThreadEmailsGetRequest     = errors.New("[ERROR]: Failed to create Inboxes.Threads.Emails.Get request")
	ErrFailedToCreateInboxesThreadEmailsReplyRequest   = errors.New("[ERROR]: Failed to create Inboxes.Threads.Emails.Reply request")
	ErrFailedToCreateInboxesThreadEmailsForwardRequest = errors.New("[ERROR]: Failed to create Inboxes.Threads.Emails.Forward request")
	ErrFailedToCreateInboxesDraftsListRequest          = errors.New("[ERROR]: Failed to create Inboxes.Drafts.List request")
	ErrFailedToCreateInboxesDraftsCreateRequest        = errors.New("[ERROR]: Failed to create Inboxes.Drafts.Create request")
	ErrFailedToCreateInboxesDraftsGetRequest           = errors.New("[ERROR]: Failed to create Inboxes.Drafts.Get request")
	ErrFailedToCreateInboxesDraftsUpdateRequest        = errors.New("[ERROR]: Failed to create Inboxes.Drafts.Update request")
	ErrFailedToCreateInboxesDraftsRemoveRequest        = errors.New("[ERROR]: Failed to create Inboxes.Drafts.Remove request")
	ErrFailedToCreateInboxesDraftsSendRequest          = errors.New("[ERROR]: Failed to create Inboxes.Drafts.Send request")
)

InboxesSvc errors

View Source
var (
	ErrFailedToCreateUsageGetRequest = errors.New("[ERROR]: Failed to create Usage.Get request")
)

UsageSvc errors

View Source
var ErrRateLimit = errors.New("rate limit exceeded")

ErrRateLimit is a sentinel error for rate limit detection with errors.Is

Functions

func Bool

func Bool(v bool) *bool

Bool returns a pointer to the given bool value. Use this to set *bool fields on request structs.

func BytesToIntArray

func BytesToIntArray(a []byte) []int

BytesToIntArray converts a byte array to rune array ie: []byte(`hello`) becomes []int{104,101,108,108,111} which will then be properly marshalled into JSON in the way Resend supports

Types

type AddContactSegmentRequest

type AddContactSegmentRequest struct {
	SegmentId string `json:"segment_id"`
	ContactId string `json:"contact_id,omitempty"`
	Email     string `json:"email,omitempty"`
}

type AddContactSegmentResponse

type AddContactSegmentResponse struct {
	Id     string `json:"id"`
	Object string `json:"object"`
}

type AddInboxThreadLabelsRequest added in v4.9.0

type AddInboxThreadLabelsRequest struct {
	// Labels are the IDs of the labels to apply to the thread. Between 1 and 10 IDs, each a label
	// of the inbox. Labels already on the thread stay on it.
	Labels []string `json:"labels"`
}

AddInboxThreadLabelsRequest contains params for adding labels to a thread.

type AddSuppressionRequest

type AddSuppressionRequest struct {
	Email string `json:"email"`
}

AddSuppressionRequest contains params for suppressing an email address.

type AddSuppressionResponse

type AddSuppressionResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
}

type ApiKey

type ApiKey struct {
	Id         string  `json:"id"`
	Name       string  `json:"name"`
	CreatedAt  string  `json:"created_at"`
	LastUsedAt *string `json:"last_used_at"`
}

type ApiKeysSvc

type ApiKeysSvc interface {
	CreateWithContext(ctx context.Context, params *CreateApiKeyRequest) (CreateApiKeyResponse, error)
	Create(params *CreateApiKeyRequest) (CreateApiKeyResponse, error)
	ListWithOptions(ctx context.Context, options *ListOptions) (ListApiKeysResponse, error)
	ListWithContext(ctx context.Context) (ListApiKeysResponse, error)
	List() (ListApiKeysResponse, error)
	RemoveWithContext(ctx context.Context, apiKeyId string) (bool, error)
	Remove(apiKeyId string) (bool, error)
	UpdateWithContext(ctx context.Context, apiKeyId string, params *UpdateApiKeyRequest) (UpdateApiKeyResponse, error)
	Update(apiKeyId string, params *UpdateApiKeyRequest) (UpdateApiKeyResponse, error)
}

type ApiKeysSvcImpl

type ApiKeysSvcImpl struct {
	// contains filtered or unexported fields
}

func (*ApiKeysSvcImpl) Create

Create creates a new API Key based on the given params

func (*ApiKeysSvcImpl) CreateWithContext

func (s *ApiKeysSvcImpl) CreateWithContext(ctx context.Context, params *CreateApiKeyRequest) (CreateApiKeyResponse, error)

CreateWithContext creates a new API Key based on the given params https://resend.com/docs/api-reference/api-keys/create-api-key

func (*ApiKeysSvcImpl) List

List all API Keys in the project

func (*ApiKeysSvcImpl) ListWithContext

func (s *ApiKeysSvcImpl) ListWithContext(ctx context.Context) (ListApiKeysResponse, error)

ListWithContext list all API Keys in the project https://resend.com/docs/api-reference/api-keys/list-api-keys

func (*ApiKeysSvcImpl) ListWithOptions

func (s *ApiKeysSvcImpl) ListWithOptions(ctx context.Context, options *ListOptions) (ListApiKeysResponse, error)

ListWithOptions list all API Keys in the project with pagination options https://resend.com/docs/api-reference/api-keys/list-api-keys

func (*ApiKeysSvcImpl) Remove

func (s *ApiKeysSvcImpl) Remove(apiKeyId string) (bool, error)

Remove deletes a given api key by id

func (*ApiKeysSvcImpl) RemoveWithContext

func (s *ApiKeysSvcImpl) RemoveWithContext(ctx context.Context, apiKeyId string) (bool, error)

RemoveWithContext deletes a given api key by id https://resend.com/docs/api-reference/api-keys/delete-api-key

func (*ApiKeysSvcImpl) Update

func (s *ApiKeysSvcImpl) Update(apiKeyId string, params *UpdateApiKeyRequest) (UpdateApiKeyResponse, error)

type Attachment

type Attachment struct {
	// Content is the binary content of the attachment to use when a Path
	// is not available.
	Content []byte

	// Filename that will appear in the email.
	// Make sure you pick the correct extension otherwise preview
	// may not work as expected
	Filename string

	// Path where the attachment file is hosted instead of providing the
	// content directly.
	Path string

	// Content type for the attachment, if not set will be derived from
	// the filename property
	ContentType string

	// Optional content ID for the attachment, to be used as a reference in the HTML content.
	// If set, this attachment will be sent as an inline attachment and you can reference it
	// in the HTML content using the `cid:` prefix.
	ContentId string

	// Deprecated: Use ContentId instead. Kept for backwards compatibility.
	// Optional content ID for the attachment, to be used as a reference in the HTML content.
	// If set, this attachment will be sent as an inline attachment and you can reference it
	// in the HTML content using the `cid:` prefix.
	InlineContentId string
}

Attachment is the public struct used for adding attachments to emails

func (*Attachment) MarshalJSON

func (a *Attachment) MarshalJSON() ([]byte, error)

MarshalJSON overrides the regular JSON Marshaller to ensure that the attachment content is provided in the way Resend expects.

type Audience deprecated

type Audience = Segment

Deprecated: Use Segment instead

type AudiencesSvc deprecated

type AudiencesSvc interface {
	CreateWithContext(ctx context.Context, params *CreateAudienceRequest) (CreateAudienceResponse, error)
	Create(params *CreateAudienceRequest) (CreateAudienceResponse, error)
	ListWithOptions(ctx context.Context, options *ListOptions) (ListAudiencesResponse, error)
	ListWithContext(ctx context.Context) (ListAudiencesResponse, error)
	List() (ListAudiencesResponse, error)
	GetWithContext(ctx context.Context, audienceId string) (Audience, error)
	Get(audienceId string) (Audience, error)
	RemoveWithContext(ctx context.Context, audienceId string) (RemoveAudienceResponse, error)
	Remove(audienceId string) (RemoveAudienceResponse, error)
}

Deprecated: Use SegmentsSvc instead. Audiences have been renamed to Segments. The audiences API is maintained for backward compatibility and calls the segments API internally.

type AudiencesSvcImpl

type AudiencesSvcImpl struct {
	// contains filtered or unexported fields
}

AudiencesSvcImpl wraps SegmentsSvcImpl to provide backward compatibility Deprecated: Use SegmentsSvcImpl instead

func (*AudiencesSvcImpl) Create

Create creates a new Audience entry based on the given params Deprecated: Use Segments.Create instead https://resend.com/docs/api-reference/segments/create-segment

func (*AudiencesSvcImpl) CreateWithContext

func (s *AudiencesSvcImpl) CreateWithContext(ctx context.Context, params *CreateAudienceRequest) (CreateAudienceResponse, error)

CreateWithContext creates a new Audience entry based on the given params Deprecated: Use Segments.CreateWithContext instead https://resend.com/docs/api-reference/segments/create-segment

func (*AudiencesSvcImpl) Get

func (s *AudiencesSvcImpl) Get(audienceId string) (Audience, error)

Get Retrieve a single audience. Deprecated: Use Segments.Get instead https://resend.com/docs/api-reference/segments/get-segment

func (*AudiencesSvcImpl) GetWithContext

func (s *AudiencesSvcImpl) GetWithContext(ctx context.Context, audienceId string) (Audience, error)

GetWithContext Retrieve a single audience. Deprecated: Use Segments.GetWithContext instead https://resend.com/docs/api-reference/segments/get-segment

func (*AudiencesSvcImpl) List

List returns the list of all audiences Deprecated: Use Segments.List instead https://resend.com/docs/api-reference/segments/list-segments

func (*AudiencesSvcImpl) ListWithContext

func (s *AudiencesSvcImpl) ListWithContext(ctx context.Context) (ListAudiencesResponse, error)

ListWithContext returns the list of all audiences Deprecated: Use Segments.ListWithContext instead https://resend.com/docs/api-reference/segments/list-segments

func (*AudiencesSvcImpl) ListWithOptions

func (s *AudiencesSvcImpl) ListWithOptions(ctx context.Context, options *ListOptions) (ListAudiencesResponse, error)

ListWithOptions returns the list of all audiences with pagination options Deprecated: Use Segments.ListWithOptions instead https://resend.com/docs/api-reference/segments/list-segments

func (*AudiencesSvcImpl) Remove

func (s *AudiencesSvcImpl) Remove(audienceId string) (RemoveAudienceResponse, error)

Remove removes a given audience entry by id Deprecated: Use Segments.Remove instead https://resend.com/docs/api-reference/segments/delete-segment

func (*AudiencesSvcImpl) RemoveWithContext

func (s *AudiencesSvcImpl) RemoveWithContext(ctx context.Context, audienceId string) (RemoveAudienceResponse, error)

RemoveWithContext removes a given audience by id Deprecated: Use Segments.RemoveWithContext instead https://resend.com/docs/api-reference/segments/delete-segment

type Automation

type Automation struct {
	Object      string                   `json:"object"`
	Id          string                   `json:"id"`
	Name        string                   `json:"name"`
	Status      AutomationStatus         `json:"status"`
	CreatedAt   string                   `json:"created_at"`
	UpdatedAt   string                   `json:"updated_at"`
	Steps       []AutomationStepResponse `json:"steps"`
	Connections []AutomationConnection   `json:"connections"`
}

type AutomationConnection

type AutomationConnection struct {
	From string                   `json:"from"`
	To   string                   `json:"to"`
	Type AutomationConnectionType `json:"type,omitempty"`
}

type AutomationConnectionType

type AutomationConnectionType = string
const (
	AutomationConnectionTypeDefault         AutomationConnectionType = "default"
	AutomationConnectionTypeConditionMet    AutomationConnectionType = "condition_met"
	AutomationConnectionTypeConditionNotMet AutomationConnectionType = "condition_not_met"
	AutomationConnectionTypeTimeout         AutomationConnectionType = "timeout"
	AutomationConnectionTypeEventReceived   AutomationConnectionType = "event_received"
)

type AutomationListItem

type AutomationListItem struct {
	Id        string           `json:"id"`
	Name      string           `json:"name"`
	Status    AutomationStatus `json:"status"`
	CreatedAt string           `json:"created_at"`
	UpdatedAt string           `json:"updated_at"`
}

type AutomationRun

type AutomationRun struct {
	Object      string              `json:"object"`
	Id          string              `json:"id"`
	Status      AutomationRunStatus `json:"status"`
	StartedAt   *string             `json:"started_at"`
	CompletedAt *string             `json:"completed_at"`
	CreatedAt   string              `json:"created_at"`
	Steps       []AutomationRunStep `json:"steps"`
}

type AutomationRunListItem

type AutomationRunListItem struct {
	Id          string              `json:"id"`
	Status      AutomationRunStatus `json:"status"`
	StartedAt   *string             `json:"started_at"`
	CompletedAt *string             `json:"completed_at"`
	CreatedAt   string              `json:"created_at"`
}

type AutomationRunStatus

type AutomationRunStatus = string
const (
	AutomationRunStatusRunning   AutomationRunStatus = "running"
	AutomationRunStatusCompleted AutomationRunStatus = "completed"
	AutomationRunStatusFailed    AutomationRunStatus = "failed"
	AutomationRunStatusCancelled AutomationRunStatus = "cancelled"
)

type AutomationRunStep

type AutomationRunStep struct {
	Key         string             `json:"key"`
	Type        AutomationStepType `json:"type"`
	Status      string             `json:"status"`
	StartedAt   *string            `json:"started_at"`
	CompletedAt *string            `json:"completed_at"`
	Output      any                `json:"output"`
	Error       any                `json:"error"`
	CreatedAt   string             `json:"created_at"`
}

type AutomationStatus

type AutomationStatus = string
const (
	AutomationStatusEnabled  AutomationStatus = "enabled"
	AutomationStatusDisabled AutomationStatus = "disabled"
)

type AutomationStep

type AutomationStep struct {
	Key    string             `json:"key"`
	Type   AutomationStepType `json:"type"`
	Config map[string]any     `json:"config"`
}

type AutomationStepResponse

type AutomationStepResponse struct {
	Key    string             `json:"key"`
	Type   AutomationStepType `json:"type"`
	Config map[string]any     `json:"config"`
}

type AutomationStepType

type AutomationStepType = string
const (
	AutomationStepTypeTrigger       AutomationStepType = "trigger"
	AutomationStepTypeSendEmail     AutomationStepType = "send_email"
	AutomationStepTypeDelay         AutomationStepType = "delay"
	AutomationStepTypeWaitForEvent  AutomationStepType = "wait_for_event"
	AutomationStepTypeCondition     AutomationStepType = "condition"
	AutomationStepTypeContactUpdate AutomationStepType = "contact_update"
	AutomationStepTypeContactDelete AutomationStepType = "contact_delete"
	AutomationStepTypeAddToSegment  AutomationStepType = "add_to_segment"
)

type AutomationsSvc

type AutomationsSvc interface {
	CreateWithContext(ctx context.Context, params *CreateAutomationRequest) (CreateAutomationResponse, error)
	Create(params *CreateAutomationRequest) (CreateAutomationResponse, error)
	GetWithContext(ctx context.Context, automationId string) (Automation, error)
	Get(automationId string) (Automation, error)
	ListWithContext(ctx context.Context) (ListAutomationsResponse, error)
	List() (ListAutomationsResponse, error)
	ListWithOptions(ctx context.Context, options *ListAutomationsOptions) (ListAutomationsResponse, error)
	UpdateWithContext(ctx context.Context, automationId string, params *UpdateAutomationRequest) (UpdateAutomationResponse, error)
	Update(automationId string, params *UpdateAutomationRequest) (UpdateAutomationResponse, error)
	RemoveWithContext(ctx context.Context, automationId string) (DeleteAutomationResponse, error)
	Remove(automationId string) (DeleteAutomationResponse, error)
	DuplicateWithContext(ctx context.Context, automationId string) (DuplicateAutomationResponse, error)
	Duplicate(automationId string) (DuplicateAutomationResponse, error)
	StopWithContext(ctx context.Context, automationId string) (StopAutomationResponse, error)
	Stop(automationId string) (StopAutomationResponse, error)
	ListRunsWithContext(ctx context.Context, automationId string, options *ListAutomationRunsOptions) (ListAutomationRunsResponse, error)
	ListRuns(automationId string) (ListAutomationRunsResponse, error)
	GetRunWithContext(ctx context.Context, automationId string, runId string) (AutomationRun, error)
	GetRun(automationId string, runId string) (AutomationRun, error)
}

type AutomationsSvcImpl

type AutomationsSvcImpl struct {
	// contains filtered or unexported fields
}

func (*AutomationsSvcImpl) Create

Create creates a new Automation

func (*AutomationsSvcImpl) CreateWithContext

CreateWithContext creates a new Automation https://resend.com/docs/api-reference/automations/create-automation

func (*AutomationsSvcImpl) Duplicate

func (s *AutomationsSvcImpl) Duplicate(automationId string) (DuplicateAutomationResponse, error)

Duplicate duplicates an Automation by ID

func (*AutomationsSvcImpl) DuplicateWithContext

func (s *AutomationsSvcImpl) DuplicateWithContext(ctx context.Context, automationId string) (DuplicateAutomationResponse, error)

DuplicateWithContext duplicates an Automation by ID https://resend.com/docs/api-reference/automations/duplicate-automation

func (*AutomationsSvcImpl) Get

func (s *AutomationsSvcImpl) Get(automationId string) (Automation, error)

Get retrieves a single Automation by ID

func (*AutomationsSvcImpl) GetRun

func (s *AutomationsSvcImpl) GetRun(automationId string, runId string) (AutomationRun, error)

GetRun retrieves a single run for an Automation

func (*AutomationsSvcImpl) GetRunWithContext

func (s *AutomationsSvcImpl) GetRunWithContext(ctx context.Context, automationId string, runId string) (AutomationRun, error)

GetRunWithContext retrieves a single run for an Automation https://resend.com/docs/api-reference/automations/get-automation-run

func (*AutomationsSvcImpl) GetWithContext

func (s *AutomationsSvcImpl) GetWithContext(ctx context.Context, automationId string) (Automation, error)

GetWithContext retrieves a single Automation by ID https://resend.com/docs/api-reference/automations/get-automation

func (*AutomationsSvcImpl) List

List retrieves a list of Automations

func (*AutomationsSvcImpl) ListRuns

func (s *AutomationsSvcImpl) ListRuns(automationId string) (ListAutomationRunsResponse, error)

ListRuns retrieves a list of runs for an Automation

func (*AutomationsSvcImpl) ListRunsWithContext

func (s *AutomationsSvcImpl) ListRunsWithContext(ctx context.Context, automationId string, options *ListAutomationRunsOptions) (ListAutomationRunsResponse, error)

ListRunsWithContext retrieves a list of runs for an Automation https://resend.com/docs/api-reference/automations/list-automation-runs

func (*AutomationsSvcImpl) ListWithContext

func (s *AutomationsSvcImpl) ListWithContext(ctx context.Context) (ListAutomationsResponse, error)

ListWithContext retrieves a list of Automations https://resend.com/docs/api-reference/automations/list-automations

func (*AutomationsSvcImpl) ListWithOptions

ListWithOptions retrieves a list of Automations with pagination and filter options https://resend.com/docs/api-reference/automations/list-automations

func (*AutomationsSvcImpl) Remove

func (s *AutomationsSvcImpl) Remove(automationId string) (DeleteAutomationResponse, error)

Remove deletes an Automation by ID

func (*AutomationsSvcImpl) RemoveWithContext

func (s *AutomationsSvcImpl) RemoveWithContext(ctx context.Context, automationId string) (DeleteAutomationResponse, error)

RemoveWithContext deletes an Automation by ID https://resend.com/docs/api-reference/automations/delete-automation

func (*AutomationsSvcImpl) Stop

func (s *AutomationsSvcImpl) Stop(automationId string) (StopAutomationResponse, error)

Stop stops a running Automation by ID

func (*AutomationsSvcImpl) StopWithContext

func (s *AutomationsSvcImpl) StopWithContext(ctx context.Context, automationId string) (StopAutomationResponse, error)

StopWithContext stops a running Automation by ID https://resend.com/docs/api-reference/automations/stop-automation

func (*AutomationsSvcImpl) Update

Update updates an existing Automation

func (*AutomationsSvcImpl) UpdateWithContext

func (s *AutomationsSvcImpl) UpdateWithContext(ctx context.Context, automationId string, params *UpdateAutomationRequest) (UpdateAutomationResponse, error)

UpdateWithContext updates an existing Automation https://resend.com/docs/api-reference/automations/update-automation

type BatchAddSuppressionsRequest

type BatchAddSuppressionsRequest struct {
	Emails []string `json:"emails"`
}

BatchAddSuppressionsRequest contains params for suppressing up to 100 email addresses at once.

type BatchAddSuppressionsResponse

type BatchAddSuppressionsResponse struct {
	Data []AddSuppressionResponse `json:"data"`
}

type BatchEmailResponse

type BatchEmailResponse struct {
	Data   []SendEmailResponse `json:"data"`
	Errors []BatchError        `json:"errors,omitempty"`
}

BatchEmailResponse is the response from the BatchSendEmail call. see https://resend.com/docs/api-reference/emails/send-batch-emails

type BatchError

type BatchError struct {
	Index   int    `json:"index"`
	Message string `json:"message"`
}

BatchError represents an error for a specific email in a batch request when using permissive validation mode.

type BatchRemoveSuppressionsRequest

type BatchRemoveSuppressionsRequest struct {
	Emails []string `json:"emails,omitempty"`
	Ids    []string `json:"ids,omitempty"`
}

BatchRemoveSuppressionsRequest contains params for removing up to 100 suppressions at once. Provide either Emails or Ids, but not both. Ids must be suppression IDs in UUID form. The unset field is omitted from the request body; the API rejects it being sent as null.

type BatchRemoveSuppressionsResponse

type BatchRemoveSuppressionsResponse struct {
	Data []RemoveSuppressionResponse `json:"data"`
}

type BatchSendEmailOptions

type BatchSendEmailOptions struct {
	IdempotencyKey string `json:"idempotency_key,omitempty"`
	// BatchValidation controls the validation behavior for batch emails.
	// Can be BatchValidationStrict (default) or BatchValidationPermissive.
	// - BatchValidationStrict: Only sends the batch if all emails are valid
	// - BatchValidationPermissive: Processes all emails, allowing partial success
	BatchValidation BatchValidationMode `json:"-"`
}

BatchSendEmailOptions is the additional options struct for the Batch.SendEmail call.

func (BatchSendEmailOptions) GetBatchValidation

func (o BatchSendEmailOptions) GetBatchValidation() string

GetBatchValidation returns the batch validation mode for the batch send email request.

func (BatchSendEmailOptions) GetIdempotencyKey

func (o BatchSendEmailOptions) GetIdempotencyKey() string

GetIdempotencyKey returns the idempotency key for the batch send email request.

type BatchSvc

type BatchSvc interface {
	Send([]*SendEmailRequest) (*BatchEmailResponse, error)
	SendWithContext(ctx context.Context, params []*SendEmailRequest) (*BatchEmailResponse, error)
	SendWithOptions(ctx context.Context, params []*SendEmailRequest, options *BatchSendEmailOptions) (*BatchEmailResponse, error)
}

type BatchSvcImpl

type BatchSvcImpl struct {
	// contains filtered or unexported fields
}

func (*BatchSvcImpl) Send

func (s *BatchSvcImpl) Send(params []*SendEmailRequest) (*BatchEmailResponse, error)

Send send a batch of emails https://resend.com/docs/api-reference/emails/send-batch-emails

func (*BatchSvcImpl) SendWithContext

func (s *BatchSvcImpl) SendWithContext(ctx context.Context, params []*SendEmailRequest) (*BatchEmailResponse, error)

SendWithContext is the same as Send but accepts a ctx as argument

func (*BatchSvcImpl) SendWithOptions

func (s *BatchSvcImpl) SendWithOptions(ctx context.Context, params []*SendEmailRequest, options *BatchSendEmailOptions) (*BatchEmailResponse, error)

SendWithOptions is the same as Send but accepts a ctx and options as arguments

type BatchValidationMode

type BatchValidationMode string

BatchValidationMode represents the validation mode for batch emails

const (
	// BatchValidationStrict only sends the batch if all emails are valid
	BatchValidationStrict BatchValidationMode = "strict"
	// BatchValidationPermissive processes all emails, allowing partial success
	BatchValidationPermissive BatchValidationMode = "permissive"
)

func (BatchValidationMode) IsValid

func (b BatchValidationMode) IsValid() bool

IsValid checks if the BatchValidationMode has a valid value

func (BatchValidationMode) String

func (b BatchValidationMode) String() string

String returns the string representation of the BatchValidationMode

type Broadcast

type Broadcast struct {
	Object      string   `json:"object"`
	Id          string   `json:"id"`
	Name        string   `json:"name"`
	SegmentId   string   `json:"segment_id"`
	AudienceId  string   `json:"audience_id"` // Deprecated: Use SegmentId instead
	From        string   `json:"from"`
	Subject     string   `json:"subject"`
	ReplyTo     []string `json:"reply_to"`
	PreviewText string   `json:"preview_text"`
	Status      string   `json:"status"`
	CreatedAt   string   `json:"created_at"`
	ScheduledAt string   `json:"scheduled_at"`
	SentAt      string   `json:"sent_at"`
	Html        string   `json:"html"`
	Text        string   `json:"text"`
	TopicId     *string  `json:"topic_id"` // nil when the broadcast is not scoped to a topic
}
type BroadcastClickedLink struct {
	// Id is an opaque cursor for this row, used only for pagination. It does
	// not identify any entity in Resend.
	Id           string `json:"id"`
	Url          string `json:"url"`
	Clicks       int    `json:"clicks"`
	UniqueClicks int    `json:"unique_clicks"`
}

type BroadcastRecipient

type BroadcastRecipient struct {
	// Id is an opaque cursor identifying this row, used for pagination. It is not a real entity id.
	Id        string  `json:"id"`
	ContactId *string `json:"contact_id"`
	Email     string  `json:"email"`

	// Count is the number of times this recipient triggered the event. Only present when Type is
	// BroadcastRecipientEventTypeOpened or BroadcastRecipientEventTypeClicked.
	Count int `json:"count,omitempty"`

	// BounceType is only present when Type is BroadcastRecipientEventTypeBounced.
	BounceType BroadcastRecipientBounceType `json:"bounce_type,omitempty"`

	// ClickedLinks is only present when Type is BroadcastRecipientEventTypeClicked.
	ClickedLinks []BroadcastRecipientClickedLink `json:"clicked_links,omitempty"`
}

BroadcastRecipient is a single recipient row for the requested event type. Count, BounceType and ClickedLinks are only populated depending on ListBroadcastRecipientsOptions.Type.

type BroadcastRecipientBounceType

type BroadcastRecipientBounceType = string

BroadcastRecipientBounceType is the bounce type to filter by. Only meaningful when ListBroadcastRecipientsOptions.Type is BroadcastRecipientEventTypeBounced.

const (
	BroadcastRecipientBounceTypePermanent    BroadcastRecipientBounceType = "permanent"
	BroadcastRecipientBounceTypeTransient    BroadcastRecipientBounceType = "transient"
	BroadcastRecipientBounceTypeUndetermined BroadcastRecipientBounceType = "undetermined"
)
type BroadcastRecipientClickedLink struct {
	Url    string `json:"url"`
	Clicks int    `json:"clicks"`
}

BroadcastRecipientClickedLink is a link clicked by a recipient. Only present when Type is BroadcastRecipientEventTypeClicked.

type BroadcastRecipientEventType

type BroadcastRecipientEventType = string

BroadcastRecipientEventType is the recipient event type to filter by when listing a broadcast's recipients.

const (
	BroadcastRecipientEventTypeSent         BroadcastRecipientEventType = "sent"
	BroadcastRecipientEventTypeDelivered    BroadcastRecipientEventType = "delivered"
	BroadcastRecipientEventTypeOpened       BroadcastRecipientEventType = "opened"
	BroadcastRecipientEventTypeClicked      BroadcastRecipientEventType = "clicked"
	BroadcastRecipientEventTypeBounced      BroadcastRecipientEventType = "bounced"
	BroadcastRecipientEventTypeComplained   BroadcastRecipientEventType = "complained"
	BroadcastRecipientEventTypeUnsubscribed BroadcastRecipientEventType = "unsubscribed"
	BroadcastRecipientEventTypeSuppressed   BroadcastRecipientEventType = "suppressed"
)

type BroadcastsSvc

type BroadcastsSvc interface {
	CreateWithContext(ctx context.Context, params *CreateBroadcastRequest) (CreateBroadcastResponse, error)
	Create(params *CreateBroadcastRequest) (CreateBroadcastResponse, error)

	UpdateWithContext(ctx context.Context, params *UpdateBroadcastRequest) (UpdateBroadcastResponse, error)
	Update(params *UpdateBroadcastRequest) (UpdateBroadcastResponse, error)

	ListWithOptions(ctx context.Context, options *ListOptions) (ListBroadcastsResponse, error)
	ListWithContext(ctx context.Context) (ListBroadcastsResponse, error)
	List() (ListBroadcastsResponse, error)

	ClickedLinksWithOptions(ctx context.Context, broadcastId string, options *ListOptions) (ListBroadcastClickedLinksResponse, error)
	ClickedLinksWithContext(ctx context.Context, broadcastId string) (ListBroadcastClickedLinksResponse, error)
	ClickedLinks(broadcastId string) (ListBroadcastClickedLinksResponse, error)

	GetWithContext(ctx context.Context, broadcastId string) (Broadcast, error)
	Get(broadcastId string) (Broadcast, error)

	SendWithContext(ctx context.Context, params *SendBroadcastRequest) (SendBroadcastResponse, error)
	Send(params *SendBroadcastRequest) (SendBroadcastResponse, error)

	CancelWithContext(ctx context.Context, broadcastId string) (CancelBroadcastResponse, error)
	Cancel(broadcastId string) (CancelBroadcastResponse, error)

	DuplicateWithContext(ctx context.Context, broadcastId string) (DuplicateBroadcastResponse, error)
	Duplicate(broadcastId string) (DuplicateBroadcastResponse, error)

	RemoveWithContext(ctx context.Context, broadcastId string) (RemoveBroadcastResponse, error)
	Remove(broadcastId string) (RemoveBroadcastResponse, error)

	RecipientsWithContext(ctx context.Context, broadcastId string, options *ListBroadcastRecipientsOptions) (ListBroadcastRecipientsResponse, error)
	Recipients(broadcastId string, options *ListBroadcastRecipientsOptions) (ListBroadcastRecipientsResponse, error)
}

type BroadcastsSvcImpl

type BroadcastsSvcImpl struct {
	// contains filtered or unexported fields
}

func (*BroadcastsSvcImpl) Cancel

func (s *BroadcastsSvcImpl) Cancel(broadcastId string) (CancelBroadcastResponse, error)

func (*BroadcastsSvcImpl) CancelWithContext

func (s *BroadcastsSvcImpl) CancelWithContext(ctx context.Context, broadcastId string) (CancelBroadcastResponse, error)
func (s *BroadcastsSvcImpl) ClickedLinks(broadcastId string) (ListBroadcastClickedLinksResponse, error)

ClickedLinks returns the clicked links for a broadcast

func (*BroadcastsSvcImpl) ClickedLinksWithContext

func (s *BroadcastsSvcImpl) ClickedLinksWithContext(ctx context.Context, broadcastId string) (ListBroadcastClickedLinksResponse, error)

ClickedLinksWithContext returns the clicked links for a broadcast https://resend.com/docs/api-reference/broadcasts/list-broadcast-clicked-links

func (*BroadcastsSvcImpl) ClickedLinksWithOptions

func (s *BroadcastsSvcImpl) ClickedLinksWithOptions(ctx context.Context, broadcastId string, options *ListOptions) (ListBroadcastClickedLinksResponse, error)

ClickedLinksWithOptions returns the clicked links for a broadcast with pagination options https://resend.com/docs/api-reference/broadcasts/list-broadcast-clicked-links

func (*BroadcastsSvcImpl) Create

Create creates a new Broadcast based on the given params

func (*BroadcastsSvcImpl) CreateWithContext

CreateWithContext creates a new Broadcast based on the given params https://resend.com/docs/api-reference/broadcasts/create-broadcast

func (*BroadcastsSvcImpl) Duplicate added in v4.5.0

func (s *BroadcastsSvcImpl) Duplicate(broadcastId string) (DuplicateBroadcastResponse, error)

Duplicate duplicates a broadcast by id

func (*BroadcastsSvcImpl) DuplicateWithContext added in v4.5.0

func (s *BroadcastsSvcImpl) DuplicateWithContext(ctx context.Context, broadcastId string) (DuplicateBroadcastResponse, error)

DuplicateWithContext duplicates a broadcast by id, creating a new draft named after the source with " (copy)" appended https://resend.com/docs/api-reference/broadcasts/duplicate-broadcast

func (*BroadcastsSvcImpl) Get

func (s *BroadcastsSvcImpl) Get(broadcastId string) (Broadcast, error)

Get retrieves a single broadcast.

func (*BroadcastsSvcImpl) GetWithContext

func (s *BroadcastsSvcImpl) GetWithContext(ctx context.Context, broadcastId string) (Broadcast, error)

GetWithContext Retrieve a single broadcast. https://resend.com/docs/api-reference/broadcasts/get-broadcast

func (*BroadcastsSvcImpl) List

List returns the list of all broadcasts

func (*BroadcastsSvcImpl) ListWithContext

func (s *BroadcastsSvcImpl) ListWithContext(ctx context.Context) (ListBroadcastsResponse, error)

ListWithContext returns the list of all broadcasts https://resend.com/docs/api-reference/broadcasts/list-broadcasts

func (*BroadcastsSvcImpl) ListWithOptions

func (s *BroadcastsSvcImpl) ListWithOptions(ctx context.Context, options *ListOptions) (ListBroadcastsResponse, error)

ListWithOptions returns the list of all broadcasts with pagination options https://resend.com/docs/api-reference/broadcasts/list-broadcasts

func (*BroadcastsSvcImpl) Recipients

Recipients returns a broadcast's recipients for a given event type, such as who opened, clicked, or bounced.

func (*BroadcastsSvcImpl) RecipientsWithContext

func (s *BroadcastsSvcImpl) RecipientsWithContext(ctx context.Context, broadcastId string, options *ListBroadcastRecipientsOptions) (ListBroadcastRecipientsResponse, error)

RecipientsWithContext returns a broadcast's recipients for a given event type, such as who opened, clicked, or bounced. https://resend.com/docs/api-reference/broadcasts/list-broadcast-recipients

func (*BroadcastsSvcImpl) Remove

func (s *BroadcastsSvcImpl) Remove(broadcastId string) (RemoveBroadcastResponse, error)

Remove removes a given broadcast entry by id

func (*BroadcastsSvcImpl) RemoveWithContext

func (s *BroadcastsSvcImpl) RemoveWithContext(ctx context.Context, broadcastId string) (RemoveBroadcastResponse, error)

RemoveWithContext removes a given broadcast by id https://resend.com/docs/api-reference/broadcasts/delete-broadcast

func (*BroadcastsSvcImpl) Send

Send sends broadcasts to your audience.

func (*BroadcastsSvcImpl) SendWithContext

SendWithContext Sends broadcasts to your audience. https://resend.com/docs/api-reference/broadcasts/send-broadcast

func (*BroadcastsSvcImpl) Update

func (*BroadcastsSvcImpl) UpdateWithContext

UpdateWithContext updates a given broadcast entry https://resend.com/docs/api-reference/broadcasts/update-broadcast

type CancelBroadcastResponse

type CancelBroadcastResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
}

type CancelScheduledEmailResponse

type CancelScheduledEmailResponse struct {
	Id     string `json:"id"`
	Object string `json:"object"`
}

CancelScheduledEmailResponse is the response from the Cancel call.

type Client

type Client struct {

	// Api Key
	ApiKey string

	// Base URL
	BaseURL *url.URL

	// User agent for client
	UserAgent string

	// Services
	Emails       *EmailsSvcImpl
	Batch        BatchSvc
	ApiKeys      ApiKeysSvc
	Domains      DomainsSvc
	DomainClaims DomainClaimsSvc
	Segments     SegmentsSvc
	// Deprecated: Use Segments instead. Audiences have been renamed to Segments.
	Audiences         AudiencesSvc
	Contacts          *ContactsSvcImpl
	ContactProperties ContactPropertiesSvc
	Broadcasts        BroadcastsSvc
	Templates         TemplatesSvc
	Topics            TopicsSvc
	Webhooks          WebhooksSvc
	Logs              LogsSvc
	Automations       AutomationsSvc
	Events            EventsSvc
	OAuthGrants       OAuthGrantsSvc
	Suppressions      *SuppressionsSvcImpl
	Usage             UsageSvc
	Inboxes           *InboxesSvcImpl
	// contains filtered or unexported fields
}

Client handles communication with Resend API.

func NewClient

func NewClient(apiKey string) *Client

NewClient is the default client constructor

func NewCustomClient

func NewCustomClient(httpClient *http.Client, apiKey string) *Client

NewCustomClient builds a new Resend API client, using a provided Http client.

func (*Client) NewMultipartRequest

func (c *Client) NewMultipartRequest(ctx context.Context, path string, fileBytes []byte, filename string, fields map[string]string) (*http.Request, error)

NewMultipartRequest builds an HTTP multipart/form-data request for file uploads.

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, method, path string, params any) (*http.Request, error)

NewRequest builds and returns a new HTTP request object based on the given arguments

func (*Client) NewRequestWithOptions

func (c *Client) NewRequestWithOptions(ctx context.Context, method, path string, params any, options Options) (*http.Request, error)

NewRequestWithOptions builds and returns a new HTTP request object based on the given arguments and options It is used to set additional options like idempotency key

func (*Client) Perform

func (c *Client) Perform(req *http.Request, ret any) (*http.Response, error)

Perform sends the request to the Resend API

type Contact

type Contact struct {
	Id           string                          `json:"id"`
	Email        string                          `json:"email"`
	Object       string                          `json:"object"`
	FirstName    *string                         `json:"first_name"`
	LastName     *string                         `json:"last_name"`
	CreatedAt    string                          `json:"created_at"`
	Unsubscribed bool                            `json:"unsubscribed"`
	Properties   map[string]ContactPropertyValue `json:"properties,omitempty"` // Custom properties for global contacts, returned as {value, type} objects
}

type ContactImport

type ContactImport struct {
	Object    string               `json:"object"`
	Id        string               `json:"id"`
	Status    ContactImportStatus  `json:"status"`
	CreatedAt string               `json:"created_at"`
	Counts    *ContactImportCounts `json:"counts,omitempty"`
}

type ContactImportCounts

type ContactImportCounts struct {
	Total   int `json:"total"`
	Created int `json:"created"`
	Updated int `json:"updated"`
	Skipped int `json:"skipped"`
	Failed  int `json:"failed"`
}

type ContactImportSegment

type ContactImportSegment struct {
	Id string `json:"id"`
}

ContactImportSegment represents a segment reference for a contact import.

type ContactImportStatus

type ContactImportStatus string
const (
	ContactImportStatusQueued     ContactImportStatus = "queued"
	ContactImportStatusInProgress ContactImportStatus = "in_progress"
	ContactImportStatusCompleted  ContactImportStatus = "completed"
	ContactImportStatusFailed     ContactImportStatus = "failed"
)

type ContactImportsSvcImpl

type ContactImportsSvcImpl struct {
	// contains filtered or unexported fields
}

func (*ContactImportsSvcImpl) Create

Create creates a new contact import from a CSV file. https://resend.com/docs/api-reference/contacts/create-contact-import

func (*ContactImportsSvcImpl) CreateWithContext

CreateWithContext creates a new contact import from a CSV file with context. https://resend.com/docs/api-reference/contacts/create-contact-import

func (*ContactImportsSvcImpl) Get

Get retrieves a single contact import by ID. https://resend.com/docs/api-reference/contacts/get-contact-import

func (*ContactImportsSvcImpl) GetWithContext

func (s *ContactImportsSvcImpl) GetWithContext(ctx context.Context, id string) (ContactImport, error)

GetWithContext retrieves a single contact import by ID with context. https://resend.com/docs/api-reference/contacts/get-contact-import

func (*ContactImportsSvcImpl) List

List retrieves a list of contact imports. https://resend.com/docs/api-reference/contacts/list-contact-imports

func (*ContactImportsSvcImpl) ListWithContext

ListWithContext retrieves a list of contact imports with context. https://resend.com/docs/api-reference/contacts/list-contact-imports

type ContactPropertiesSvcImpl

type ContactPropertiesSvcImpl struct {
	// contains filtered or unexported fields
}

func (*ContactPropertiesSvcImpl) Create

Create creates a new contact property based on the given params https://resend.com/docs/api-reference/contact-properties/create-contact-property

func (*ContactPropertiesSvcImpl) CreateWithContext

CreateWithContext creates a new contact property based on the given params https://resend.com/docs/api-reference/contact-properties/create-contact-property

func (*ContactPropertiesSvcImpl) Get

Get retrieves a single contact property by ID https://resend.com/docs/api-reference/contact-properties/get-contact-property

func (*ContactPropertiesSvcImpl) GetWithContext

func (s *ContactPropertiesSvcImpl) GetWithContext(ctx context.Context, id string) (ContactProperty, error)

GetWithContext retrieves a single contact property by ID https://resend.com/docs/api-reference/contact-properties/get-contact-property

func (*ContactPropertiesSvcImpl) List

List returns the list of all contact properties https://resend.com/docs/api-reference/contact-properties/list-contact-properties

func (*ContactPropertiesSvcImpl) ListWithContext

ListWithContext returns the list of all contact properties https://resend.com/docs/api-reference/contact-properties/list-contact-properties

func (*ContactPropertiesSvcImpl) ListWithOptions

ListWithOptions returns the list of all contact properties with pagination options https://resend.com/docs/api-reference/contact-properties/list-contact-properties

func (*ContactPropertiesSvcImpl) Remove

Remove removes a contact property by ID https://resend.com/docs/api-reference/contact-properties/delete-contact-property

func (*ContactPropertiesSvcImpl) RemoveWithContext

RemoveWithContext removes a contact property by ID https://resend.com/docs/api-reference/contact-properties/delete-contact-property

func (*ContactPropertiesSvcImpl) Update

Update updates an existing contact property based on the given params https://resend.com/docs/api-reference/contact-properties/update-contact-property

func (*ContactPropertiesSvcImpl) UpdateWithContext

UpdateWithContext updates an existing contact property based on the given params https://resend.com/docs/api-reference/contact-properties/update-contact-property

type ContactProperty

type ContactProperty struct {
	Id            string `json:"id"`
	Key           string `json:"key"`
	Object        string `json:"object"`
	CreatedAt     string `json:"created_at"`
	Type          string `json:"type"`
	FallbackValue any    `json:"fallback_value"`
}

type ContactPropertyValue

type ContactPropertyValue struct {
	Value any    `json:"value"` // string, number, or boolean, depending on Type
	Type  string `json:"type"`
}

type ContactSegmentRef

type ContactSegmentRef struct {
	Id string `json:"id"`
}

ContactSegmentRef is a minimal reference to a segment for embedding in CreateContactRequest

type ContactSegmentsSvcImpl

type ContactSegmentsSvcImpl struct {
	// contains filtered or unexported fields
}

func (*ContactSegmentsSvcImpl) AddWithContext

AddWithContext adds a contact to a segment https://resend.com/docs/api-reference/contacts/add-contact-to-segment

func (*ContactSegmentsSvcImpl) List

List returns the list of all segments for a contact https://resend.com/docs/api-reference/contacts/list-contact-segments

func (*ContactSegmentsSvcImpl) ListWithContext

ListWithContext returns the list of all segments for a contact https://resend.com/docs/api-reference/contacts/list-contact-segments

func (*ContactSegmentsSvcImpl) ListWithOptions

ListWithOptions returns the list of all segments for a contact with pagination options https://resend.com/docs/api-reference/contacts/list-contact-segments

func (*ContactSegmentsSvcImpl) RemoveWithContext

RemoveWithContext removes a contact from a segment https://resend.com/docs/api-reference/contacts/remove-contact-from-segment

type ContactTopic

type ContactTopic struct {
	Id           string `json:"id"`
	Name         string `json:"name"`
	Description  string `json:"description"`
	Subscription string `json:"subscription"`
}

ContactTopic represents a topic subscription for a contact

type ContactTopicsSvc

type ContactTopicsSvc interface {
	ListWithOptions(ctx context.Context, id string, options *ListOptions) (ListContactTopicsResponse, error)
	ListWithContext(ctx context.Context, id string) (ListContactTopicsResponse, error)
	List(id string) (ListContactTopicsResponse, error)
	UpdateWithContext(ctx context.Context, params *UpdateContactTopicsRequest) (UpdateContactTopicsResponse, error)
	Update(params *UpdateContactTopicsRequest) (UpdateContactTopicsResponse, error)
}

ContactTopicsSvc handles operations for contact topics

type ContactTopicsSvcImpl

type ContactTopicsSvcImpl struct {
	// contains filtered or unexported fields
}

ContactTopicsSvcImpl is the implementation of ContactTopicsSvc

func (*ContactTopicsSvcImpl) List

List retrieves a list of topics subscriptions for a contact. The id parameter can be either a contact ID or email address. https://resend.com/docs/api-reference/contacts/get-contact-topics

func (*ContactTopicsSvcImpl) ListWithContext

ListWithContext retrieves a list of topics subscriptions for a contact. The id parameter can be either a contact ID or email address. https://resend.com/docs/api-reference/contacts/get-contact-topics

func (*ContactTopicsSvcImpl) ListWithOptions

func (s *ContactTopicsSvcImpl) ListWithOptions(ctx context.Context, id string, options *ListOptions) (ListContactTopicsResponse, error)

ListWithOptions retrieves a list of topics subscriptions for a contact with pagination options. The id parameter can be either a contact ID or email address. https://resend.com/docs/api-reference/contacts/get-contact-topics

func (*ContactTopicsSvcImpl) Update

Update updates topic subscriptions for a contact. Either Id or Email must be provided in the params. https://resend.com/docs/api-reference/contacts/update-contact-topics

func (*ContactTopicsSvcImpl) UpdateWithContext

UpdateWithContext updates topic subscriptions for a contact. Either Id or Email must be provided in the params. https://resend.com/docs/api-reference/contacts/update-contact-topics

type ContactsSvc

type ContactsSvc interface {
	Create(params *CreateContactRequest) (CreateContactResponse, error)
	CreateWithContext(ctx context.Context, params *CreateContactRequest) (CreateContactResponse, error)
	Get(options *GetContactOptions) (Contact, error)
	GetWithContext(ctx context.Context, options *GetContactOptions) (Contact, error)
	List(options *ListContactsOptions) (ListContactsResponse, error)
	ListWithContext(ctx context.Context, options *ListContactsOptions) (ListContactsResponse, error)
	Update(params *UpdateContactRequest) (UpdateContactResponse, error)
	UpdateWithContext(ctx context.Context, params *UpdateContactRequest) (UpdateContactResponse, error)
	Remove(options *RemoveContactOptions) (RemoveContactResponse, error)
	RemoveWithContext(ctx context.Context, options *RemoveContactOptions) (RemoveContactResponse, error)
}

type ContactsSvcImpl

type ContactsSvcImpl struct {
	Topics     ContactTopicsSvc
	Segments   ContactSegmentsSvc
	Properties ContactPropertiesSvc
	Imports    ContactImportsSvc
	// contains filtered or unexported fields
}

func (*ContactsSvcImpl) Create

Create creates a new Contact based on the given params Supports both global contacts (without audience_id) and audience-specific contacts. Global contacts support custom properties while audience-specific contacts do not. https://resend.com/docs/api-reference/contacts/create-contact

func (*ContactsSvcImpl) CreateWithContext

func (s *ContactsSvcImpl) CreateWithContext(ctx context.Context, params *CreateContactRequest) (CreateContactResponse, error)

CreateWithContext creates a new Contact based on the given params with context Supports both global contacts (without audience_id) and audience-specific contacts. Global contacts support custom properties while audience-specific contacts do not. https://resend.com/docs/api-reference/contacts/create-contact

func (*ContactsSvcImpl) Get

func (s *ContactsSvcImpl) Get(options *GetContactOptions) (Contact, error)

Get retrieves a single contact. This method can be used to retrieve a contact by either its ID or email address. If options.AudienceId is empty, retrieves a global contact. Otherwise retrieves an audience-specific contact. https://resend.com/docs/api-reference/contacts/get-contact

func (*ContactsSvcImpl) GetWithContext

func (s *ContactsSvcImpl) GetWithContext(ctx context.Context, options *GetContactOptions) (Contact, error)

GetWithContext retrieves a single contact with context. This method can be used to retrieve a contact by either its ID or email address. If options.AudienceId is empty, retrieves a global contact. Otherwise retrieves an audience-specific contact. https://resend.com/docs/api-reference/contacts/get-contact

func (*ContactsSvcImpl) List

List returns the list of all contacts If options.SegmentId is set, lists contacts in that segment. If options.AudienceId is set (legacy), lists contacts in that audience. Otherwise lists global contacts. https://resend.com/docs/api-reference/contacts/list-contacts

func (*ContactsSvcImpl) ListWithContext

func (s *ContactsSvcImpl) ListWithContext(ctx context.Context, options *ListContactsOptions) (ListContactsResponse, error)

ListWithContext returns the list of all contacts with context If options.SegmentId is set, lists contacts in that segment. If options.AudienceId is set (legacy), lists contacts in that audience. Otherwise lists global contacts. https://resend.com/docs/api-reference/contacts/list-contacts

func (*ContactsSvcImpl) Remove

Remove removes a contact If options.AudienceId is empty, removes a global contact. Otherwise removes an audience-specific contact. The options.Id field can be either a contact ID or email address. https://resend.com/docs/api-reference/contacts/delete-contact

func (*ContactsSvcImpl) RemoveWithContext

func (s *ContactsSvcImpl) RemoveWithContext(ctx context.Context, options *RemoveContactOptions) (RemoveContactResponse, error)

RemoveWithContext removes a contact with context If options.AudienceId is empty, removes a global contact. Otherwise removes an audience-specific contact. The options.Id field can be either a contact ID or email address. https://resend.com/docs/api-reference/contacts/delete-contact

func (*ContactsSvcImpl) Update

Update updates an existing Contact based on the given params Supports both global contacts (without audience_id) and audience-specific contacts. https://resend.com/docs/api-reference/contacts/update-contact

func (*ContactsSvcImpl) UpdateWithContext

func (s *ContactsSvcImpl) UpdateWithContext(ctx context.Context, params *UpdateContactRequest) (UpdateContactResponse, error)

UpdateWithContext updates an existing Contact based on the given params with context Supports both global contacts (without audience_id) and audience-specific contacts. https://resend.com/docs/api-reference/contacts/update-contact

type CreateApiKeyRequest

type CreateApiKeyRequest struct {
	Name       string `json:"name"`
	Permission string `json:"permission,omitempty"` // TODO: update permission to type
	DomainId   string `json:"domain_id,omitempty"`
}

type CreateApiKeyResponse

type CreateApiKeyResponse struct {
	Id    string `json:"id"`
	Token string `json:"token"`
}

type CreateAudienceRequest

type CreateAudienceRequest = CreateSegmentRequest

Type aliases for backward compatibility Deprecated: Use CreateSegmentRequest instead

type CreateAudienceResponse deprecated

type CreateAudienceResponse = CreateSegmentResponse

Deprecated: Use CreateSegmentResponse instead

type CreateAutomationRequest

type CreateAutomationRequest struct {
	Name        string                 `json:"name"`
	Status      AutomationStatus       `json:"status,omitempty"`
	Steps       []AutomationStep       `json:"steps"`
	Connections []AutomationConnection `json:"connections"`
}

type CreateAutomationResponse

type CreateAutomationResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
}

type CreateBroadcastRequest

type CreateBroadcastRequest struct {
	SegmentId  string   `json:"segment_id,omitempty"`
	AudienceId string   `json:"audience_id,omitempty"` // Deprecated: Use SegmentId instead
	From       string   `json:"from,omitempty"`
	Subject    string   `json:"subject,omitempty"`
	ReplyTo    []string `json:"reply_to,omitempty"`
	Html       string   `json:"html,omitempty"`
	Text       string   `json:"text,omitempty"`
	Name       string   `json:"name,omitempty"`

	// Preview text shown in the recipient's inbox, usually next to or below the subject line.
	PreviewText string `json:"preview_text,omitempty"`

	// The ID of the topic the broadcast is scoped to. When omitted, the broadcast is sent to
	// every subscribed contact in the segment, without checking topic preferences.
	TopicId string `json:"topic_id,omitempty"`

	// Send the broadcast immediately upon creation instead of creating a draft.
	Send bool `json:"send,omitempty"`

	// Schedule email to be sent later. The date should be in natural language (e.g.: in 1 min)
	// or ISO 8601 format (e.g: 2024-08-05T11:52:01.858Z).
	// Only valid when Send is true.
	ScheduledAt string `json:"scheduled_at,omitempty"`
}

type CreateBroadcastResponse

type CreateBroadcastResponse struct {
	Id string `json:"id"`
}

type CreateContactImportRequest

type CreateContactImportRequest struct {
	// CSV file content (required). Maximum size is 50MB.
	File []byte
	// Filename to use in the multipart upload. Defaults to "import.csv".
	Filename string
	// ColumnMap maps contact fields to CSV column names.
	// Will be JSON-encoded before sending.
	// Example: map[string]any{"email": "Email", "first_name": "First Name"}
	ColumnMap map[string]any
	// OnConflict strategy: "upsert" or "skip" (default "skip").
	OnConflict string
	// Segments is a list of segment objects to add imported contacts to.
	// Example: []ContactImportSegment{{Id: "60a2ac5e-0774-456e-817d-ebf40f6dba31"}}
	Segments []ContactImportSegment
	// Topics is a list of topic subscriptions to apply to imported contacts.
	// Will be JSON-encoded as [{"id": "...", "subscription": "opt_in|opt_out"}] before sending.
	Topics []TopicSubscriptionUpdate
}

CreateContactImportRequest contains params for creating a contact import. File is required; all other fields are optional.

type CreateContactImportResponse

type CreateContactImportResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
}

type CreateContactPropertyRequest

type CreateContactPropertyRequest struct {
	Key           string `json:"key"`
	Type          string `json:"type"`
	FallbackValue any    `json:"fallback_value"`
}

type CreateContactPropertyResponse

type CreateContactPropertyResponse struct {
	Id     string `json:"id"`
	Object string `json:"object"`
}

type CreateContactRequest

type CreateContactRequest struct {
	Email        string `json:"email"`
	AudienceId   string `json:"audience_id,omitempty"` // Deprecated: Optional, use Segments API for contact organization
	Unsubscribed bool   `json:"unsubscribed,omitempty"`
	FirstName    string `json:"first_name,omitempty"`
	LastName     string `json:"last_name,omitempty"`
	// Properties are custom key-value pairs for global contacts (when audience_id is omitted).
	// NOTE: Currently, the Resend API only accepts string values for properties.
	// Non-string values (numbers, booleans, etc.) will be rejected by the API with a validation error.
	// Example: Properties: map[string]any{"tier": "premium", "age": "30", "active": "true"}
	Properties map[string]any `json:"properties,omitempty"`
	// Segments is an array of segment IDs to add the contact to (when audience_id is omitted).
	// This field is only used when AudienceId is not set.
	Segments []ContactSegmentRef `json:"segments,omitempty"`
	// Topics is an array of topic subscriptions for the contact (when audience_id is omitted).
	// This field is only used when AudienceId is not set.
	Topics []TopicSubscriptionUpdate `json:"topics,omitempty"`
}

type CreateContactResponse

type CreateContactResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
}

type CreateDomainClaimRequest

type CreateDomainClaimRequest struct {
	Name              string `json:"name"`
	Region            string `json:"region,omitempty"`
	CustomReturnPath  string `json:"custom_return_path,omitempty"`
	TrackingSubdomain string `json:"tracking_subdomain,omitempty"`
	OpenTracking      *bool  `json:"open_tracking,omitempty"`
	ClickTracking     *bool  `json:"click_tracking,omitempty"`
}

CreateDomainClaimRequest contains params for starting a domain claim. Uses the same fields as CreateDomainRequest.

type CreateDomainRequest

type CreateDomainRequest struct {
	Name              string              `json:"name"`
	Region            string              `json:"region,omitempty"`
	CustomReturnPath  string              `json:"custom_return_path,omitempty"`
	TrackingSubdomain string              `json:"tracking_subdomain,omitempty"`
	OpenTracking      *bool               `json:"open_tracking,omitempty"`
	ClickTracking     *bool               `json:"click_tracking,omitempty"`
	Capabilities      *DomainCapabilities `json:"capabilities,omitempty"`
}

type CreateDomainResponse

type CreateDomainResponse struct {
	Id                string              `json:"id"`
	Name              string              `json:"name"`
	CreatedAt         string              `json:"created_at"`
	Status            string              `json:"status"`
	Records           []Record            `json:"records"`
	Region            string              `json:"region"`
	DnsProvider       string              `json:"dnsProvider"`
	OpenTracking      bool                `json:"open_tracking,omitempty"`
	ClickTracking     bool                `json:"click_tracking,omitempty"`
	TrackingSubdomain string              `json:"tracking_subdomain,omitempty"`
	Capabilities      *DomainCapabilities `json:"capabilities,omitempty"`
}

type CreateEventRequest

type CreateEventRequest struct {
	Name   string            `json:"name"`
	Schema map[string]string `json:"schema,omitempty"`
}

type CreateEventResponse

type CreateEventResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
}

type CreateInboxDraftOptions added in v4.9.0

type CreateInboxDraftOptions struct {
	// IdempotencyKey is a unique key for the request, so the draft is created only once. 1 to 256
	// characters. A retry with the same key within 24 hours returns the first successful (2xx)
	// response, with the `idempotent-replayed: true` header. A failed request is not stored, so it
	// can be retried with the same key. Reusing the key with a different body, or while the first
	// request is still running, returns a 409.
	// https://resend.com/docs/dashboard/emails/idempotency-keys
	IdempotencyKey string `json:"idempotency_key,omitempty"`
}

CreateInboxDraftOptions is the additional options struct for the Inboxes.Drafts.Create call.

func (CreateInboxDraftOptions) GetIdempotencyKey added in v4.9.0

func (o CreateInboxDraftOptions) GetIdempotencyKey() string

GetIdempotencyKey returns the idempotency key for the Inboxes.Drafts.Create request.

type CreateInboxDraftRequest added in v4.9.0

type CreateInboxDraftRequest struct {
	// To holds the recipients. Each value can include a friendly name, for example
	// `Ada Lovelace <ada@example.org>`. A nil slice is omitted, so a reply draft is addressed to
	// the sender of the email it replies to, or to its Reply-To when set. For an email the inbox
	// sent, it defaults to that email's `to` recipients. An empty, non-nil slice leaves it empty.
	To  []string
	Cc  []string
	Bcc []string
	// Subject is max 2000 characters. A string that is only whitespace, or that contains a line
	// break, is rejected.
	Subject string
	Html    string
	Text    string
	// Attachments are files to store on the draft. Each one needs a Filename and either Content
	// with a ContentType, or a Path URL that is downloaded when the request is made. The files on a
	// draft, downloaded ones included, can total at most 25 MB. An empty file, a blocked file type,
	// or a Path that cannot be downloaded returns a 422.
	Attachments []*InboxDraftAttachmentInput
	// ThreadId is the thread ID to reply in. It must be sent with ReplyToEmailId.
	ThreadId string
	// ReplyToEmailId is the email ID to reply to, as returned in Data[].Id by
	// Threads.Emails.List. It must be sent with ThreadId.
	ReplyToEmailId string
}

CreateInboxDraftRequest contains params for creating a draft. At least one of To, Cc, Bcc, Subject, Text, Html or Attachments must be non-empty. The combined recipients of To, Cc and Bcc cannot exceed 50. ThreadId and ReplyToEmailId must be sent together or not at all.

func (CreateInboxDraftRequest) MarshalJSON added in v4.9.0

func (r CreateInboxDraftRequest) MarshalJSON() ([]byte, error)

type CreateInboxDraftResponse added in v4.9.0

type CreateInboxDraftResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
}

type CreateInboxLabelRequest added in v4.9.0

type CreateInboxLabelRequest struct {
	// Name of the label. Max 64 characters. The API trims it. It must not match another label on
	// the inbox, compared without case.
	Name string `json:"name"`
	// Color of the label, as a `#RRGGBB` hex color. It is stored in uppercase. When omitted, a
	// random color from the dashboard palette is used.
	Color string `json:"color,omitempty"`
}

CreateInboxLabelRequest contains params for creating a label on an inbox.

type CreateInboxLabelResponse added in v4.9.0

type CreateInboxLabelResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
}

type CreateInboxRequest added in v4.9.0

type CreateInboxRequest struct {
	// EmailAddress is the inbox address on one of your domains. The API trims and lowercases it.
	EmailAddress string `json:"email_address"`
	// Name is the internal name for the inbox. Recipients do not see it. Max 64 characters.
	// Defaults to EmailAddress.
	Name string `json:"name,omitempty"`
	// FromName is the name recipients see when mail is sent from this inbox. A plain name, not a
	// `Name <email>` address. Max 78 characters.
	FromName string `json:"from_name,omitempty"`
	// Forwarding makes Resend provision a receiving address, so you can receive mail without adding
	// an MX record. The address is returned in ReceivingAddress.
	Forwarding bool `json:"forwarding,omitempty"`
}

CreateInboxRequest contains params for creating an inbox.

type CreateInboxResponse added in v4.9.0

type CreateInboxResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
}

type CreateSegmentRequest

type CreateSegmentRequest struct {
	Name string `json:"name"`
}

type CreateSegmentResponse

type CreateSegmentResponse struct {
	Id     string `json:"id"`
	Name   string `json:"name"`
	Object string `json:"object"`
}

type CreateTemplateRequest

type CreateTemplateRequest struct {
	Name      string              `json:"name"`
	Alias     string              `json:"alias,omitempty"`
	From      string              `json:"from,omitempty"`
	Subject   string              `json:"subject,omitempty"`
	ReplyTo   any                 `json:"reply_to,omitempty"` // string or []string
	Html      string              `json:"html"`
	Text      string              `json:"text,omitempty"`
	Variables []*TemplateVariable `json:"variables,omitempty"`
}

CreateTemplateRequest is the request payload for creating a template Important: All variables referenced in Html (e.g., {{{NAME}}}) must be declared in the Variables array, or the API will return a validation error.

type CreateTemplateResponse

type CreateTemplateResponse struct {
	Id     string `json:"id"`
	Object string `json:"object"`
}

CreateTemplateResponse is the response from creating a template

type CreateTopicRequest

type CreateTopicRequest struct {
	Name                string              `json:"name"`
	DefaultSubscription DefaultSubscription `json:"default_subscription"`
	Description         string              `json:"description,omitempty"`
}

CreateTopicRequest is the request payload for creating a topic

type CreateTopicResponse

type CreateTopicResponse struct {
	Id string `json:"id"`
}

CreateTopicResponse is the response from creating a topic

type CreateWebhookRequest

type CreateWebhookRequest struct {
	Endpoint string   `json:"endpoint"`
	Events   []string `json:"events"`
}

CreateWebhookRequest represents the parameters for creating a webhook

type CreateWebhookResponse

type CreateWebhookResponse struct {
	Object        string `json:"object"`
	Id            string `json:"id"`
	SigningSecret string `json:"signing_secret"`
}

CreateWebhookResponse represents the response from creating a webhook

type DefaultError

type DefaultError struct {
	Message string `json:"message"`
}

type DefaultSubscription

type DefaultSubscription string

DefaultSubscription represents the default subscription preference for new contacts

const (
	DefaultSubscriptionOptIn  DefaultSubscription = "opt_in"
	DefaultSubscriptionOptOut DefaultSubscription = "opt_out"
)

type DeleteAutomationResponse

type DeleteAutomationResponse struct {
	Object  string `json:"object"`
	Id      string `json:"id"`
	Deleted bool   `json:"deleted"`
}

type DeleteEventResponse

type DeleteEventResponse struct {
	Object  string `json:"object"`
	Id      string `json:"id"`
	Deleted bool   `json:"deleted"`
}

type DeleteWebhookResponse

type DeleteWebhookResponse struct {
	Object  string `json:"object"`
	Id      string `json:"id"`
	Deleted bool   `json:"deleted"`
}

DeleteWebhookResponse represents the response from deleting a webhook

type Domain

type Domain struct {
	Id                string              `json:"id,omitempty"`
	Object            string              `json:"object,omitempty"`
	Name              string              `json:"name,omitempty"`
	CreatedAt         string              `json:"created_at,omitempty"`
	Status            string              `json:"status,omitempty"`
	Region            string              `json:"region,omitempty"`
	Records           []Record            `json:"records,omitempty"`
	OpenTracking      bool                `json:"open_tracking,omitempty"`
	ClickTracking     bool                `json:"click_tracking,omitempty"`
	TrackingSubdomain string              `json:"tracking_subdomain,omitempty"`
	Capabilities      *DomainCapabilities `json:"capabilities,omitempty"`
}

type DomainCapabilities

type DomainCapabilities struct {
	Sending   DomainCapabilityStatus `json:"sending,omitempty"`
	Receiving DomainCapabilityStatus `json:"receiving,omitempty"`
}

type DomainCapabilityStatus

type DomainCapabilityStatus = string
const (
	DomainCapabilityStatusEnabled  DomainCapabilityStatus = "enabled"
	DomainCapabilityStatusDisabled DomainCapabilityStatus = "disabled"
)

type DomainClaim

type DomainClaim struct {
	Object        string             `json:"object,omitempty"`
	Id            string             `json:"id,omitempty"`
	Name          string             `json:"name,omitempty"`
	Status        DomainClaimStatus  `json:"status,omitempty"`
	DomainId      string             `json:"domain_id,omitempty"`
	Region        string             `json:"region,omitempty"`
	Record        *DomainClaimRecord `json:"record,omitempty"`
	BlockedReason string             `json:"blocked_reason,omitempty"`
	FailureReason string             `json:"failure_reason,omitempty"`
	CreatedAt     string             `json:"created_at,omitempty"`
	ExpiresAt     string             `json:"expires_at,omitempty"`
}

type DomainClaimBlockedReason

type DomainClaimBlockedReason = string
const (
	DomainClaimBlockedReasonGracePeriod            DomainClaimBlockedReason = "grace_period"
	DomainClaimBlockedReasonRecentOwnerActivity    DomainClaimBlockedReason = "recent_owner_activity"
	DomainClaimBlockedReasonPendingScheduledEmails DomainClaimBlockedReason = "pending_scheduled_emails"
)

type DomainClaimRecord

type DomainClaimRecord struct {
	Type  string `json:"type,omitempty"`
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
	Ttl   string `json:"ttl,omitempty"`
}

DomainClaimRecord is the TXT record to add to your DNS to prove ownership of the claimed domain.

type DomainClaimStatus

type DomainClaimStatus = string
const (
	DomainClaimStatusPending    DomainClaimStatus = "pending"
	DomainClaimStatusVerified   DomainClaimStatus = "verified"
	DomainClaimStatusCompleted  DomainClaimStatus = "completed"
	DomainClaimStatusBlocked    DomainClaimStatus = "blocked"
	DomainClaimStatusExpired    DomainClaimStatus = "expired"
	DomainClaimStatusSuperseded DomainClaimStatus = "superseded"
	DomainClaimStatusCanceled   DomainClaimStatus = "canceled"
	DomainClaimStatusFailed     DomainClaimStatus = "failed"
)

type DomainClaimsSvc

type DomainClaimsSvc interface {
	Create(params *CreateDomainClaimRequest) (DomainClaim, error)
	CreateWithContext(ctx context.Context, params *CreateDomainClaimRequest) (DomainClaim, error)
	Get(domainId string) (DomainClaim, error)
	GetWithContext(ctx context.Context, domainId string) (DomainClaim, error)
	Verify(domainId string) (DomainClaim, error)
	VerifyWithContext(ctx context.Context, domainId string) (DomainClaim, error)
}

type DomainClaimsSvcImpl

type DomainClaimsSvcImpl struct {
	// contains filtered or unexported fields
}

func (*DomainClaimsSvcImpl) Create

Create starts a claim for a domain that another Resend account has already verified. https://resend.com/docs/api-reference/domains/claim-domain

func (*DomainClaimsSvcImpl) CreateWithContext

func (s *DomainClaimsSvcImpl) CreateWithContext(ctx context.Context, params *CreateDomainClaimRequest) (DomainClaim, error)

CreateWithContext starts a claim for a domain that another Resend account has already verified, using the given context. https://resend.com/docs/api-reference/domains/claim-domain

func (*DomainClaimsSvcImpl) Get

func (s *DomainClaimsSvcImpl) Get(domainId string) (DomainClaim, error)

Get retrieves the latest claim for the placeholder domain created by the claim. https://resend.com/docs/api-reference/domains/get-domain-claim

func (*DomainClaimsSvcImpl) GetWithContext

func (s *DomainClaimsSvcImpl) GetWithContext(ctx context.Context, domainId string) (DomainClaim, error)

GetWithContext retrieves the latest claim for the placeholder domain created by the claim, using the given context. https://resend.com/docs/api-reference/domains/get-domain-claim

func (*DomainClaimsSvcImpl) Verify

func (s *DomainClaimsSvcImpl) Verify(domainId string) (DomainClaim, error)

Verify triggers asynchronous DNS verification and ownership transfer for a domain claim. The claim stays "pending" while verification runs; poll Get for status. https://resend.com/docs/api-reference/domains/verify-domain-claim

func (*DomainClaimsSvcImpl) VerifyWithContext

func (s *DomainClaimsSvcImpl) VerifyWithContext(ctx context.Context, domainId string) (DomainClaim, error)

VerifyWithContext triggers asynchronous DNS verification and ownership transfer for a domain claim, using the given context. The claim stays "pending" while verification runs; poll GetWithContext for status. https://resend.com/docs/api-reference/domains/verify-domain-claim

type DomainRecordStatus

type DomainRecordStatus = string
const (
	DomainRecordStatusPending         DomainRecordStatus = "pending"
	DomainRecordStatusVerified        DomainRecordStatus = "verified"
	DomainRecordStatusFailed          DomainRecordStatus = "failed"
	DomainRecordStatusTemporaryFailed DomainRecordStatus = "temporary_failure"
	DomainRecordStatusNotStarted      DomainRecordStatus = "not_started"
)

type DomainStatus

type DomainStatus = string
const (
	DomainStatusPending           DomainStatus = "pending"
	DomainStatusVerified          DomainStatus = "verified"
	DomainStatusFailed            DomainStatus = "failed"
	DomainStatusNotStarted        DomainStatus = "not_started"
	DomainStatusPartiallyVerified DomainStatus = "partially_verified"
	DomainStatusPartiallyFailed   DomainStatus = "partially_failed"
)

type DomainsSvc

type DomainsSvc interface {
	CreateWithContext(ctx context.Context, params *CreateDomainRequest) (CreateDomainResponse, error)
	Create(params *CreateDomainRequest) (CreateDomainResponse, error)
	VerifyWithContext(ctx context.Context, domainId string) (bool, error)
	Verify(domainId string) (bool, error)
	ListWithOptions(ctx context.Context, options *ListOptions) (ListDomainsResponse, error)
	ListWithContext(ctx context.Context) (ListDomainsResponse, error)
	List() (ListDomainsResponse, error)
	GetWithContext(ctx context.Context, domainId string) (Domain, error)
	Get(domainId string) (Domain, error)
	RemoveWithContext(ctx context.Context, domainId string) (bool, error)
	Remove(domainId string) (bool, error)
	UpdateWithContext(ctx context.Context, domainId string, params *UpdateDomainRequest) (Domain, error)
	Update(domainId string, params *UpdateDomainRequest) (Domain, error)
}

type DomainsSvcImpl

type DomainsSvcImpl struct {
	// contains filtered or unexported fields
}

func (*DomainsSvcImpl) Create

Create creates a new Domain entry based on the given params https://resend.com/docs/api-reference/domains/create-domain

func (*DomainsSvcImpl) CreateWithContext

func (s *DomainsSvcImpl) CreateWithContext(ctx context.Context, params *CreateDomainRequest) (CreateDomainResponse, error)

CreateWithContext creates a new Domain entry based on the given params https://resend.com/docs/api-reference/domains/create-domain

func (*DomainsSvcImpl) Get

func (s *DomainsSvcImpl) Get(domainId string) (Domain, error)

Get retrieves a domain object https://resend.com/docs/api-reference/domains/get-domain

func (*DomainsSvcImpl) GetWithContext

func (s *DomainsSvcImpl) GetWithContext(ctx context.Context, domainId string) (Domain, error)

GetWithContext retrieves a domain object https://resend.com/docs/api-reference/domains/get-domain

func (*DomainsSvcImpl) List

List returns the list of all domains https://resend.com/docs/api-reference/domains/list-domains

func (*DomainsSvcImpl) ListWithContext

func (s *DomainsSvcImpl) ListWithContext(ctx context.Context) (ListDomainsResponse, error)

ListWithContext returns the list of all domains https://resend.com/docs/api-reference/domains/list-domains

func (*DomainsSvcImpl) ListWithOptions

func (s *DomainsSvcImpl) ListWithOptions(ctx context.Context, options *ListOptions) (ListDomainsResponse, error)

ListWithOptions returns the list of all domains with pagination options https://resend.com/docs/api-reference/domains/list-domains

func (*DomainsSvcImpl) Remove

func (s *DomainsSvcImpl) Remove(domainId string) (bool, error)

Remove removes a given domain entry by id https://resend.com/docs/api-reference/domains/delete-domain

func (*DomainsSvcImpl) RemoveWithContext

func (s *DomainsSvcImpl) RemoveWithContext(ctx context.Context, domainId string) (bool, error)

RemoveWithContext removes a given domain entry by id https://resend.com/docs/api-reference/domains/delete-domain

func (*DomainsSvcImpl) Update

func (s *DomainsSvcImpl) Update(domainId string, params *UpdateDomainRequest) (Domain, error)

Update is a wrapper around UpdateWithContext

func (*DomainsSvcImpl) UpdateWithContext

func (s *DomainsSvcImpl) UpdateWithContext(ctx context.Context, domainId string, params *UpdateDomainRequest) (Domain, error)

UpdateWithContext updates an existing Domain entry based on the given params https://resend.com/docs/api-reference/domains/update-domain

func (*DomainsSvcImpl) Verify

func (s *DomainsSvcImpl) Verify(domainId string) (bool, error)

Verify verifies a given domain Id https://resend.com/docs/api-reference/domains/verify-domain

func (*DomainsSvcImpl) VerifyWithContext

func (s *DomainsSvcImpl) VerifyWithContext(ctx context.Context, domainId string) (bool, error)

VerifyWithContext verifies a given domain Id https://resend.com/docs/api-reference/domains/verify-domain

type DuplicateAutomationResponse

type DuplicateAutomationResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
}

type DuplicateBroadcastResponse added in v4.5.0

type DuplicateBroadcastResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
}

type DuplicateTemplateResponse

type DuplicateTemplateResponse struct {
	Id     string `json:"id"`
	Object string `json:"object"`
}

DuplicateTemplateResponse is the response from duplicating a template

type Email

type Email struct {
	Id        string   `json:"id"`
	Object    string   `json:"object"`
	MessageId string   `json:"message_id"`
	To        []string `json:"to"`
	From      string   `json:"from"`
	CreatedAt string   `json:"created_at"`
	Subject   string   `json:"subject"`
	Html      string   `json:"html"`
	Text      string   `json:"text"`
	Bcc       []string `json:"bcc"`
	Cc        []string `json:"cc"`
	ReplyTo   []string `json:"reply_to"`
	LastEvent string   `json:"last_event"`
}

Email provides the structure for the response from the Get call.

type EmailAttachment

type EmailAttachment struct {
	Object             string `json:"object,omitempty"`
	Id                 string `json:"id"`
	Filename           string `json:"filename"`
	ContentType        string `json:"content_type"`
	ContentDisposition string `json:"content_disposition"`
	ContentId          string `json:"content_id"`
	DownloadUrl        string `json:"download_url"`
	ExpiresAt          string `json:"expires_at"`
}

EmailAttachment represents an attachment for both sent and received emails. When returned from GET /emails/:id/attachments/:attachmentId, it includes the Object field. When returned in a list (Data array), the Object field is omitted.

type EmailTemplate

type EmailTemplate struct {
	// Id is the template ID or alias to use for this email
	Id string `json:"id"`
	// Variables are the key-value pairs to populate the template placeholders
	Variables map[string]any `json:"variables,omitempty"`
}

EmailTemplate represents a template configuration for sending emails.

type EmailsSvc

type EmailsSvc interface {
	CancelWithContext(ctx context.Context, emailId string) (*CancelScheduledEmailResponse, error)
	Cancel(emailId string) (*CancelScheduledEmailResponse, error)
	ShareWithContext(ctx context.Context, emailId string, params *ShareEmailRequest) (*ShareEmailResponse, error)
	Share(emailId string, params *ShareEmailRequest) (*ShareEmailResponse, error)
	UpdateWithContext(ctx context.Context, params *UpdateEmailRequest) (*UpdateEmailResponse, error)
	Update(params *UpdateEmailRequest) (*UpdateEmailResponse, error)
	SendWithOptions(ctx context.Context, params *SendEmailRequest, options *SendEmailOptions) (*SendEmailResponse, error)
	SendWithContext(ctx context.Context, params *SendEmailRequest) (*SendEmailResponse, error)
	Send(params *SendEmailRequest) (*SendEmailResponse, error)
	GetWithContext(ctx context.Context, emailId string) (*Email, error)
	Get(emailId string) (*Email, error)

	// Both List and ListWithOptions do the same thing, but since these List methods
	// were introduced after some time, we kept both for overall consistency with
	// the rest of the packages.
	ListWithOptions(ctx context.Context, options *ListOptions) (ListEmailsResponse, error)
	ListWithContext(ctx context.Context) (ListEmailsResponse, error)
	List() (ListEmailsResponse, error)

	// Attachment methods for sent emails
	GetAttachmentWithContext(ctx context.Context, emailId string, attachmentId string) (*EmailAttachment, error)
	GetAttachment(emailId string, attachmentId string) (*EmailAttachment, error)
	ListAttachmentsWithOptions(ctx context.Context, emailId string, options *ListOptions) (ListEmailAttachmentsResponse, error)
	ListAttachmentsWithContext(ctx context.Context, emailId string) (ListEmailAttachmentsResponse, error)
	ListAttachments(emailId string) (ListEmailAttachmentsResponse, error)

	// Metrics methods
	MetricsWithOptions(ctx context.Context, options *MetricsOptions) (*MetricsResponse, error)
	MetricsWithContext(ctx context.Context) (*MetricsResponse, error)
	Metrics() (*MetricsResponse, error)
}

type EmailsSvcImpl

type EmailsSvcImpl struct {
	Receiving ReceivingSvc
	// contains filtered or unexported fields
}

func (*EmailsSvcImpl) Cancel

func (s *EmailsSvcImpl) Cancel(emailId string) (*CancelScheduledEmailResponse, error)

Cancel cancels an email by ID https://resend.com/docs/api-reference/emails/cancel-email

func (*EmailsSvcImpl) CancelWithContext

func (s *EmailsSvcImpl) CancelWithContext(ctx context.Context, emailId string) (*CancelScheduledEmailResponse, error)

CancelWithContext cancels an email by ID https://resend.com/docs/api-reference/emails/cancel-email

func (*EmailsSvcImpl) Get

func (s *EmailsSvcImpl) Get(emailId string) (*Email, error)

Get retrieves an email with the given emailId https://resend.com/docs/api-reference/emails/retrieve-email

func (*EmailsSvcImpl) GetAttachment

func (s *EmailsSvcImpl) GetAttachment(emailId string, attachmentId string) (*EmailAttachment, error)

GetAttachment retrieves a single attachment from a sent email with the given emailId and attachmentId https://resend.com/docs/api-reference/attachments/retrieve-sent-email-attachment

func (*EmailsSvcImpl) GetAttachmentWithContext

func (s *EmailsSvcImpl) GetAttachmentWithContext(ctx context.Context, emailId string, attachmentId string) (*EmailAttachment, error)

GetAttachmentWithContext retrieves a single attachment from a sent email with the given emailId and attachmentId https://resend.com/docs/api-reference/attachments/retrieve-sent-email-attachment

func (*EmailsSvcImpl) GetWithContext

func (s *EmailsSvcImpl) GetWithContext(ctx context.Context, emailId string) (*Email, error)

GetWithContext retrieves an email with the given emailId https://resend.com/docs/api-reference/emails/retrieve-email

func (*EmailsSvcImpl) List

func (s *EmailsSvcImpl) List() (ListEmailsResponse, error)

List retrieves a list of emails https://resend.com/docs/api-reference/emails/list-emails

func (*EmailsSvcImpl) ListAttachments

func (s *EmailsSvcImpl) ListAttachments(emailId string) (ListEmailAttachmentsResponse, error)

ListAttachments retrieves a list of attachments for a sent email https://resend.com/docs/api-reference/attachments/list-sent-email-attachments

func (*EmailsSvcImpl) ListAttachmentsWithContext

func (s *EmailsSvcImpl) ListAttachmentsWithContext(ctx context.Context, emailId string) (ListEmailAttachmentsResponse, error)

ListAttachmentsWithContext retrieves a list of attachments for a sent email https://resend.com/docs/api-reference/attachments/list-sent-email-attachments

func (*EmailsSvcImpl) ListAttachmentsWithOptions

func (s *EmailsSvcImpl) ListAttachmentsWithOptions(ctx context.Context, emailId string, options *ListOptions) (ListEmailAttachmentsResponse, error)

ListAttachmentsWithOptions retrieves a list of attachments for a sent email with pagination options https://resend.com/docs/api-reference/attachments/list-sent-email-attachments

func (*EmailsSvcImpl) ListWithContext

func (s *EmailsSvcImpl) ListWithContext(ctx context.Context) (ListEmailsResponse, error)

ListWithContext retrieves a list of emails https://resend.com/docs/api-reference/emails/list-emails

func (*EmailsSvcImpl) ListWithOptions

func (s *EmailsSvcImpl) ListWithOptions(ctx context.Context, options *ListOptions) (ListEmailsResponse, error)

ListWithOptions retrieves a list of emails with pagination options https://resend.com/docs/api-reference/emails/list-emails

func (*EmailsSvcImpl) Metrics

func (s *EmailsSvcImpl) Metrics() (*MetricsResponse, error)

Metrics retrieves email metrics. https://resend.com/docs/api-reference/emails/get-metrics

func (*EmailsSvcImpl) MetricsWithContext

func (s *EmailsSvcImpl) MetricsWithContext(ctx context.Context) (*MetricsResponse, error)

MetricsWithContext retrieves email metrics. https://resend.com/docs/api-reference/emails/get-metrics

func (*EmailsSvcImpl) MetricsWithOptions

func (s *EmailsSvcImpl) MetricsWithOptions(ctx context.Context, options *MetricsOptions) (*MetricsResponse, error)

MetricsWithOptions retrieves email metrics with the given options. https://resend.com/docs/api-reference/emails/get-metrics

func (*EmailsSvcImpl) Send

Send sends an email with the given params https://resend.com/docs/api-reference/emails/send-email

func (*EmailsSvcImpl) SendWithContext

func (s *EmailsSvcImpl) SendWithContext(ctx context.Context, params *SendEmailRequest) (*SendEmailResponse, error)

SendWithContext sends an email with the given params https://resend.com/docs/api-reference/emails/send-email

func (*EmailsSvcImpl) SendWithOptions

func (s *EmailsSvcImpl) SendWithOptions(ctx context.Context, params *SendEmailRequest, options *SendEmailOptions) (*SendEmailResponse, error)

SendWithOptions sends an email with the given params and additional options https://resend.com/docs/api-reference/emails/send-email

func (*EmailsSvcImpl) Share

func (s *EmailsSvcImpl) Share(emailId string, params *ShareEmailRequest) (*ShareEmailResponse, error)

Share creates a shareable link for a sent or received email by ID https://resend.com/docs/api-reference/emails/share-email

func (*EmailsSvcImpl) ShareWithContext

func (s *EmailsSvcImpl) ShareWithContext(ctx context.Context, emailId string, params *ShareEmailRequest) (*ShareEmailResponse, error)

ShareWithContext creates a shareable link for a sent or received email by ID https://resend.com/docs/api-reference/emails/share-email

func (*EmailsSvcImpl) Update

Update updates an email with the given params https://resend.com/docs/api-reference/emails/update-email

func (*EmailsSvcImpl) UpdateWithContext

func (s *EmailsSvcImpl) UpdateWithContext(ctx context.Context, params *UpdateEmailRequest) (*UpdateEmailResponse, error)

UpdateWithContext updates an email with the given params https://resend.com/docs/api-reference/emails/update-email

type Event

type Event struct {
	Object    string            `json:"object"`
	Id        string            `json:"id"`
	Name      string            `json:"name"`
	Schema    map[string]string `json:"schema"`
	CreatedAt string            `json:"created_at"`
	UpdatedAt *string           `json:"updated_at"`
}

type EventSchemaType

type EventSchemaType = string
const (
	EventSchemaTypeString  EventSchemaType = "string"
	EventSchemaTypeNumber  EventSchemaType = "number"
	EventSchemaTypeBoolean EventSchemaType = "boolean"
	EventSchemaTypeDate    EventSchemaType = "date"
)

type EventSummary

type EventSummary struct {
	Id        string            `json:"id"`
	Name      string            `json:"name"`
	Schema    map[string]string `json:"schema"`
	CreatedAt string            `json:"created_at"`
	UpdatedAt *string           `json:"updated_at"`
}

type EventsSvc

type EventsSvc interface {
	CreateWithContext(ctx context.Context, params *CreateEventRequest) (CreateEventResponse, error)
	Create(params *CreateEventRequest) (CreateEventResponse, error)
	GetWithContext(ctx context.Context, identifier string) (Event, error)
	Get(identifier string) (Event, error)
	ListWithContext(ctx context.Context) (ListEventsResponse, error)
	List() (ListEventsResponse, error)
	ListWithOptions(ctx context.Context, options *ListOptions) (ListEventsResponse, error)
	UpdateWithContext(ctx context.Context, identifier string, params *UpdateEventRequest) (UpdateEventResponse, error)
	Update(identifier string, params *UpdateEventRequest) (UpdateEventResponse, error)
	RemoveWithContext(ctx context.Context, identifier string) (DeleteEventResponse, error)
	Remove(identifier string) (DeleteEventResponse, error)
	SendWithContext(ctx context.Context, params *SendEventRequest) (SendEventResponse, error)
	Send(params *SendEventRequest) (SendEventResponse, error)
}

type EventsSvcImpl

type EventsSvcImpl struct {
	// contains filtered or unexported fields
}

func (*EventsSvcImpl) Create

Create creates a new Event definition

func (*EventsSvcImpl) CreateWithContext

func (s *EventsSvcImpl) CreateWithContext(ctx context.Context, params *CreateEventRequest) (CreateEventResponse, error)

CreateWithContext creates a new Event definition https://resend.com/docs/api-reference/events/create-event

func (*EventsSvcImpl) Get

func (s *EventsSvcImpl) Get(identifier string) (Event, error)

Get retrieves an Event by ID or name

func (*EventsSvcImpl) GetWithContext

func (s *EventsSvcImpl) GetWithContext(ctx context.Context, identifier string) (Event, error)

GetWithContext retrieves an Event by ID or name https://resend.com/docs/api-reference/events/get-event

func (*EventsSvcImpl) List

func (s *EventsSvcImpl) List() (ListEventsResponse, error)

List retrieves a list of Events

func (*EventsSvcImpl) ListWithContext

func (s *EventsSvcImpl) ListWithContext(ctx context.Context) (ListEventsResponse, error)

ListWithContext retrieves a list of Events https://resend.com/docs/api-reference/events/list-events

func (*EventsSvcImpl) ListWithOptions

func (s *EventsSvcImpl) ListWithOptions(ctx context.Context, options *ListOptions) (ListEventsResponse, error)

ListWithOptions retrieves a list of Events with pagination options https://resend.com/docs/api-reference/events/list-events

func (*EventsSvcImpl) Remove

func (s *EventsSvcImpl) Remove(identifier string) (DeleteEventResponse, error)

Remove deletes an Event by ID or name

func (*EventsSvcImpl) RemoveWithContext

func (s *EventsSvcImpl) RemoveWithContext(ctx context.Context, identifier string) (DeleteEventResponse, error)

RemoveWithContext deletes an Event by ID or name https://resend.com/docs/api-reference/events/delete-event

func (*EventsSvcImpl) Send

Send sends an Event to trigger automations

func (*EventsSvcImpl) SendWithContext

func (s *EventsSvcImpl) SendWithContext(ctx context.Context, params *SendEventRequest) (SendEventResponse, error)

SendWithContext sends an Event to trigger automations https://resend.com/docs/api-reference/events/send-event

func (*EventsSvcImpl) Update

func (s *EventsSvcImpl) Update(identifier string, params *UpdateEventRequest) (UpdateEventResponse, error)

Update updates an Event's schema by ID or name

func (*EventsSvcImpl) UpdateWithContext

func (s *EventsSvcImpl) UpdateWithContext(ctx context.Context, identifier string, params *UpdateEventRequest) (UpdateEventResponse, error)

UpdateWithContext updates an Event's schema by ID or name https://resend.com/docs/api-reference/events/update-event

type ForwardInboxThreadEmailOptions added in v4.9.0

type ForwardInboxThreadEmailOptions struct {
	// IdempotencyKey is a unique key for the request, so the forward is sent only once. 1 to 256
	// characters. A retry with the same key within 24 hours returns the first successful (2xx)
	// response, with the `idempotent-replayed: true` header. A failed request is not stored, so it
	// can be retried with the same key. Reusing the key with a different body, or while the first
	// request is still running, returns a 409.
	// https://resend.com/docs/dashboard/emails/idempotency-keys
	IdempotencyKey string `json:"idempotency_key,omitempty"`
}

ForwardInboxThreadEmailOptions is the additional options struct for the Inboxes.Threads.Emails.Forward call.

func (ForwardInboxThreadEmailOptions) GetIdempotencyKey added in v4.9.0

func (o ForwardInboxThreadEmailOptions) GetIdempotencyKey() string

GetIdempotencyKey returns the idempotency key for the Inboxes.Threads.Emails.Forward request.

type ForwardInboxThreadEmailRequest added in v4.9.0

type ForwardInboxThreadEmailRequest struct {
	// To holds the recipients. It must name at least one address. To, Cc and Bcc combined cannot
	// exceed 50 recipients.
	To []string `json:"to"`
	// Cc holds CC recipients. They count toward the 50-recipient limit.
	Cc []string `json:"cc,omitempty"`
	// Bcc holds BCC recipients. They count toward the 50-recipient limit.
	Bcc []string `json:"bcc,omitempty"`
	// Html is an HTML note sent above the quoted original.
	Html string `json:"html,omitempty"`
	// Text is a plain-text note sent above the quoted original.
	Text string `json:"text,omitempty"`
	// Subject of the forward. It cannot contain a line break. When omitted, the thread subject is
	// used, prefixed with `Fwd:` if it does not already start with it.
	Subject string `json:"subject,omitempty"`
	// Attachments are files to attach, as on Emails.Send. Each one needs Content or Path. They
	// share one limit with the attachments of the original message, which the forward also sends.
	// Together they can have at most 25 MB of Content. A Path file does not count toward the 25
	// MB, because it is fetched when the email is sent. An empty file, a
	// blocked file type, or a Path that is not an http or https URL or that points to localhost
	// returns a 422.
	Attachments []*Attachment `json:"attachments,omitempty"`
	// Headers are custom headers to add to the email. The In-Reply-To, References and Reply-To
	// headers are set by Resend and cannot be set here. Sending one of them, in any letter case,
	// returns a 422. Header names cannot be empty, and names and values cannot contain line breaks
	// or null characters, or the request returns a 422.
	Headers map[string]string `json:"headers,omitempty"`
}

ForwardInboxThreadEmailRequest contains params for forwarding a thread email.

type ForwardInboxThreadEmailResponse added in v4.9.0

type ForwardInboxThreadEmailResponse struct {
	// Id is the ID of the sent email. Use it with the emails methods.
	Id string `json:"id"`
}

type GetContactOptions

type GetContactOptions struct {
	AudienceId string // Optional - omit for global contacts
	Id         string // Required - can be contact ID or email address
}

GetContactOptions contains parameters for retrieving a contact

type GetReceivedEmailParams

type GetReceivedEmailParams struct {
	HtmlFormat *string
}

GetReceivedEmailParams contains optional query parameters for Receiving.GetWithOptions

type Inbox added in v4.9.0

type Inbox struct {
	Object string `json:"object"`
	Id     string `json:"id"`
	// Name is the internal name for the inbox. Recipients do not see it. Falls back to the inbox
	// email address.
	Name         string `json:"name"`
	EmailAddress string `json:"email_address"`
	DomainId     string `json:"domain_id"`
	// ReceivingAddress is the address to forward mail to when forwarding is enabled. nil otherwise.
	ReceivingAddress *string `json:"receiving_address"`
	// FromName is the name recipients see when mail is sent from this inbox. nil when not set.
	FromName *string `json:"from_name"`
	// Unread is the number of unread threads in the Inbox folder.
	Unread int `json:"unread"`
	// Drafts is the number of unsent drafts.
	Drafts int `json:"drafts"`
	// LastReceived is the timestamp of the newest received email in the Inbox folder. nil when the
	// folder has no received email.
	LastReceived *string `json:"last_received"`
	CreatedAt    string  `json:"created_at"`
	UpdatedAt    string  `json:"updated_at"`
}

Inbox is a single inbox as returned by Get.

type InboxAgent added in v4.9.0

type InboxAgent struct {
	Object string `json:"object"`
	// Instructions the agent follows when it handles the threads of the inbox. nil when no
	// instructions are set.
	Instructions *string `json:"instructions"`
	// Tone the agent writes in. nil when no tone is set.
	Tone *InboxAgentTone `json:"tone"`
	// Actions are the actions the agent can take. Empty when no actions are enabled.
	Actions []InboxAgentAction `json:"actions"`
}

InboxAgent holds the agent settings of an inbox.

type InboxAgentAction added in v4.9.0

type InboxAgentAction = string

InboxAgentAction is an action the inbox agent can take.

const (
	InboxAgentActionDraftReply    InboxAgentAction = "draft_reply"
	InboxAgentActionForwardThread InboxAgentAction = "forward_thread"
	InboxAgentActionAddLabels     InboxAgentAction = "add_labels"
	InboxAgentActionAssignThread  InboxAgentAction = "assign_thread"
	InboxAgentActionMarkAsSpam    InboxAgentAction = "mark_as_spam"
	InboxAgentActionArchive       InboxAgentAction = "archive"
	InboxAgentActionMoveToTrash   InboxAgentAction = "move_to_trash"
)

type InboxAgentSvc added in v4.9.0

type InboxAgentSvc interface {
	Get(inboxId string) (InboxAgent, error)
	GetWithContext(ctx context.Context, inboxId string) (InboxAgent, error)
	Update(inboxId string, params *UpdateInboxAgentRequest) (UpdateInboxAgentResponse, error)
	UpdateWithContext(ctx context.Context, inboxId string, params *UpdateInboxAgentRequest) (UpdateInboxAgentResponse, error)
}

type InboxAgentSvcImpl added in v4.9.0

type InboxAgentSvcImpl struct {
	// contains filtered or unexported fields
}

func (*InboxAgentSvcImpl) Get added in v4.9.0

func (s *InboxAgentSvcImpl) Get(inboxId string) (InboxAgent, error)

Get retrieves the agent settings of the inbox. An inbox without a configured agent returns empty settings: Instructions and Tone are nil and Actions is empty. https://resend.com/docs/api-reference/inboxes/get-agent

func (*InboxAgentSvcImpl) GetWithContext added in v4.9.0

func (s *InboxAgentSvcImpl) GetWithContext(ctx context.Context, inboxId string) (InboxAgent, error)

GetWithContext retrieves the agent settings of the inbox with context. https://resend.com/docs/api-reference/inboxes/get-agent

func (*InboxAgentSvcImpl) Update added in v4.9.0

Update updates the agent settings of the inbox. The agent is created when the inbox has none. Omitted fields keep their current value. https://resend.com/docs/api-reference/inboxes/update-agent

func (*InboxAgentSvcImpl) UpdateWithContext added in v4.9.0

func (s *InboxAgentSvcImpl) UpdateWithContext(ctx context.Context, inboxId string, params *UpdateInboxAgentRequest) (UpdateInboxAgentResponse, error)

UpdateWithContext updates the agent settings of the inbox with context. https://resend.com/docs/api-reference/inboxes/update-agent

type InboxAgentTone added in v4.9.0

type InboxAgentTone = string

InboxAgentTone is a tone preset the inbox agent writes in.

const (
	InboxAgentToneConciseProfessional  InboxAgentTone = "concise_professional"
	InboxAgentToneConciseCasual        InboxAgentTone = "concise_casual"
	InboxAgentToneExpandedProfessional InboxAgentTone = "expanded_professional"
	InboxAgentToneExpandedCasual       InboxAgentTone = "expanded_casual"
)

type InboxDraft added in v4.9.0

type InboxDraft struct {
	Object string `json:"object"`
	Id     string `json:"id"`
	// Type is reply when the draft replies to an email in an existing thread, and standalone when
	// the draft starts a new thread.
	Type InboxDraftType `json:"type"`
	// To holds the recipients. nil or empty when no recipients are set.
	To      []string `json:"to"`
	Cc      []string `json:"cc"`
	Bcc     []string `json:"bcc"`
	Subject *string  `json:"subject"`
	Html    *string  `json:"html"`
	// Text is the plain text body. A reply draft created without a body has an empty string.
	Text *string `json:"text"`
	// ThreadId is the thread ID when the draft is a reply. nil otherwise.
	ThreadId *string `json:"thread_id"`
	// ReplyToEmailId is the email ID the draft replies to. nil otherwise.
	ReplyToEmailId *string `json:"reply_to_email_id"`
	// EmailId is the ID of the outbound email queued when the draft was sent. nil until the draft
	// is sent.
	EmailId   *string `json:"email_id"`
	CreatedAt string  `json:"created_at"`
	UpdatedAt string  `json:"updated_at"`
	// Attachments holds the files stored on the draft.
	Attachments []InboxDraftAttachment `json:"attachments"`
}

InboxDraft is an inbox draft as returned by Get and Update.

type InboxDraftAttachment added in v4.9.0

type InboxDraftAttachment struct {
	Id          string `json:"id"`
	Filename    string `json:"filename"`
	ContentType string `json:"content_type"`
	// Size is the size of the attachment in bytes.
	Size int `json:"size"`
}

InboxDraftAttachment is a file stored on a draft.

type InboxDraftAttachmentInput added in v4.9.0

type InboxDraftAttachmentInput struct {
	// Content is the content of the file. It is sent encoded in base64 and cannot be empty.
	Content []byte `json:"content,omitempty"`
	// Path is a URL to download the file from, starting with http or https. A file that cannot be
	// downloaded returns a 422, and so does a request whose downloads take more than 20 seconds
	// together.
	Path string `json:"path,omitempty"`
	// Filename of the attachment. A blocked file type returns a 422.
	Filename string `json:"filename"`
	// ContentType is the MIME type of the attachment. It is required with Content. With Path, it
	// defaults to the content type of the downloaded file.
	ContentType string `json:"content_type,omitempty"`
}

InboxDraftAttachmentInput is a file to store on a draft. Set either Content or Path. Unlike Emails.Send attachments, a Path file is downloaded when the request is made, not when the draft is sent, and a draft attachment cannot use a content ID. When both are set, Path is ignored.

type InboxDraftListItem added in v4.9.0

type InboxDraftListItem struct {
	Id      string         `json:"id"`
	Type    InboxDraftType `json:"type"`
	To      []string       `json:"to"`
	Cc      []string       `json:"cc"`
	Bcc     []string       `json:"bcc"`
	Subject *string        `json:"subject"`
	// Snippet is a short preview of the body.
	Snippet        *string `json:"snippet"`
	ThreadId       *string `json:"thread_id"`
	ReplyToEmailId *string `json:"reply_to_email_id"`
	UpdatedAt      string  `json:"updated_at"`
	// Attachments holds the files stored on the draft.
	Attachments []InboxDraftAttachment `json:"attachments"`
}

InboxDraftListItem is an inbox draft as returned by List.

type InboxDraftType added in v4.9.0

type InboxDraftType = string

InboxDraftType tells whether a draft replies in an existing thread or starts a new one.

const (
	InboxDraftTypeStandalone InboxDraftType = "standalone"
	InboxDraftTypeReply      InboxDraftType = "reply"
)

type InboxDraftsSvc added in v4.9.0

type InboxDraftsSvc interface {
	List(inboxId string, options *ListOptions) (ListInboxDraftsResponse, error)
	ListWithContext(ctx context.Context, inboxId string, options *ListOptions) (ListInboxDraftsResponse, error)
	Create(inboxId string, params *CreateInboxDraftRequest) (CreateInboxDraftResponse, error)
	CreateWithContext(ctx context.Context, inboxId string, params *CreateInboxDraftRequest) (CreateInboxDraftResponse, error)
	CreateWithOptions(ctx context.Context, inboxId string, params *CreateInboxDraftRequest, options *CreateInboxDraftOptions) (CreateInboxDraftResponse, error)
	Get(inboxId, draftId string) (InboxDraft, error)
	GetWithContext(ctx context.Context, inboxId, draftId string) (InboxDraft, error)
	Update(inboxId, draftId string, params *UpdateInboxDraftRequest) (UpdateInboxDraftResponse, error)
	UpdateWithContext(ctx context.Context, inboxId, draftId string, params *UpdateInboxDraftRequest) (UpdateInboxDraftResponse, error)
	Remove(inboxId, draftId string) (RemoveInboxDraftResponse, error)
	RemoveWithContext(ctx context.Context, inboxId, draftId string) (RemoveInboxDraftResponse, error)
	Send(inboxId, draftId string, params *SendInboxDraftRequest) (SendInboxDraftResponse, error)
	SendWithContext(ctx context.Context, inboxId, draftId string, params *SendInboxDraftRequest) (SendInboxDraftResponse, error)
	SendWithOptions(ctx context.Context, inboxId, draftId string, params *SendInboxDraftRequest, options *SendInboxDraftOptions) (SendInboxDraftResponse, error)
}

type InboxDraftsSvcImpl added in v4.9.0

type InboxDraftsSvcImpl struct {
	// contains filtered or unexported fields
}

func (*InboxDraftsSvcImpl) Create added in v4.9.0

Create creates an unsent draft on the inbox. Omit ThreadId and ReplyToEmailId for a draft that starts a new thread. Pass both together for a reply draft in an existing thread. Only one unsent reply draft can target an email, so a reply draft request for an email that already has one returns the ID of the existing draft. That request ignores every other field, except Attachments, which replaces the attachments of the existing draft when sent. A reply draft created without Subject stores an empty subject and gets no `Re:` prefix, so set one before you send it. https://resend.com/docs/api-reference/inboxes/create-draft

func (*InboxDraftsSvcImpl) CreateWithContext added in v4.9.0

func (s *InboxDraftsSvcImpl) CreateWithContext(ctx context.Context, inboxId string, params *CreateInboxDraftRequest) (CreateInboxDraftResponse, error)

CreateWithContext creates an unsent draft on the inbox with context. https://resend.com/docs/api-reference/inboxes/create-draft

func (*InboxDraftsSvcImpl) CreateWithOptions added in v4.9.0

CreateWithOptions creates an unsent draft on the inbox with context and additional options, such as an idempotency key. https://resend.com/docs/api-reference/inboxes/create-draft

func (*InboxDraftsSvcImpl) Get added in v4.9.0

func (s *InboxDraftsSvcImpl) Get(inboxId, draftId string) (InboxDraft, error)

Get retrieves a single draft. https://resend.com/docs/api-reference/inboxes/get-draft

func (*InboxDraftsSvcImpl) GetWithContext added in v4.9.0

func (s *InboxDraftsSvcImpl) GetWithContext(ctx context.Context, inboxId, draftId string) (InboxDraft, error)

GetWithContext retrieves a single draft with context. https://resend.com/docs/api-reference/inboxes/get-draft

func (*InboxDraftsSvcImpl) List added in v4.9.0

func (s *InboxDraftsSvcImpl) List(inboxId string, options *ListOptions) (ListInboxDraftsResponse, error)

List returns the unsent drafts on the inbox, most recently updated first. The After and Before cursors take a draft ID from the current page. A cursor that is not an unsent draft on this inbox returns a 404. https://resend.com/docs/api-reference/inboxes/list-drafts

func (*InboxDraftsSvcImpl) ListWithContext added in v4.9.0

func (s *InboxDraftsSvcImpl) ListWithContext(ctx context.Context, inboxId string, options *ListOptions) (ListInboxDraftsResponse, error)

ListWithContext returns the unsent drafts on the inbox with context. https://resend.com/docs/api-reference/inboxes/list-drafts

func (*InboxDraftsSvcImpl) Remove added in v4.9.0

func (s *InboxDraftsSvcImpl) Remove(inboxId, draftId string) (RemoveInboxDraftResponse, error)

Remove discards an unsent draft. A draft that was already sent, or that changed during the request, returns a 409. https://resend.com/docs/api-reference/inboxes/delete-draft

func (*InboxDraftsSvcImpl) RemoveWithContext added in v4.9.0

func (s *InboxDraftsSvcImpl) RemoveWithContext(ctx context.Context, inboxId, draftId string) (RemoveInboxDraftResponse, error)

RemoveWithContext discards an unsent draft with context. https://resend.com/docs/api-reference/inboxes/delete-draft

func (*InboxDraftsSvcImpl) Send added in v4.9.0

func (s *InboxDraftsSvcImpl) Send(inboxId, draftId string, params *SendInboxDraftRequest) (SendInboxDraftResponse, error)

Send sends the draft from the inbox address. A reply draft is sent in its thread. A draft without a thread starts a new thread. The draft must have at least one `to` recipient, a non-empty subject, and html or text, or the request returns a 422. A draft that was already sent returns a 409. The params are optional and take only Headers. Nil params send no request body. https://resend.com/docs/api-reference/inboxes/send-draft

func (*InboxDraftsSvcImpl) SendWithContext added in v4.9.0

func (s *InboxDraftsSvcImpl) SendWithContext(ctx context.Context, inboxId, draftId string, params *SendInboxDraftRequest) (SendInboxDraftResponse, error)

SendWithContext sends the draft with context. https://resend.com/docs/api-reference/inboxes/send-draft

func (*InboxDraftsSvcImpl) SendWithOptions added in v4.9.0

func (s *InboxDraftsSvcImpl) SendWithOptions(ctx context.Context, inboxId, draftId string, params *SendInboxDraftRequest, options *SendInboxDraftOptions) (SendInboxDraftResponse, error)

SendWithOptions sends the draft with context and additional options, such as an idempotency key. https://resend.com/docs/api-reference/inboxes/send-draft

func (*InboxDraftsSvcImpl) Update added in v4.9.0

func (s *InboxDraftsSvcImpl) Update(inboxId, draftId string, params *UpdateInboxDraftRequest) (UpdateInboxDraftResponse, error)

Update updates the content of an unsent draft. Omitted fields are left unchanged. Sending Attachments replaces every attachment on the draft. A request that sets Text or Html replaces the whole body. The body part you omit from that request becomes null. A draft that was already sent, or that changed during the request, returns a 409. https://resend.com/docs/api-reference/inboxes/update-draft

func (*InboxDraftsSvcImpl) UpdateWithContext added in v4.9.0

func (s *InboxDraftsSvcImpl) UpdateWithContext(ctx context.Context, inboxId, draftId string, params *UpdateInboxDraftRequest) (UpdateInboxDraftResponse, error)

UpdateWithContext updates the content of an unsent draft with context. https://resend.com/docs/api-reference/inboxes/update-draft

type InboxFolder added in v4.9.0

type InboxFolder = string

InboxFolder is the folder an inbox thread is in.

const (
	InboxFolderInbox   InboxFolder = "inbox"
	InboxFolderArchive InboxFolder = "archive"
	InboxFolderSpam    InboxFolder = "spam"
	// InboxFolderSent is assigned automatically. A thread update cannot set it.
	InboxFolderSent  InboxFolder = "sent"
	InboxFolderTrash InboxFolder = "trash"
)

type InboxLabel added in v4.9.0

type InboxLabel struct {
	Id   string `json:"id"`
	Name string `json:"name"`
	// Color is a `#RRGGBB` hex color in uppercase.
	Color     string `json:"color"`
	CreatedAt string `json:"created_at"`
}

InboxLabel is a named, colored tag that belongs to one inbox.

type InboxLabelsSvc added in v4.9.0

type InboxLabelsSvc interface {
	List(inboxId string) (ListInboxLabelsResponse, error)
	ListWithContext(ctx context.Context, inboxId string) (ListInboxLabelsResponse, error)
	Create(inboxId string, params *CreateInboxLabelRequest) (CreateInboxLabelResponse, error)
	CreateWithContext(ctx context.Context, inboxId string, params *CreateInboxLabelRequest) (CreateInboxLabelResponse, error)
	Update(inboxId, labelId string, params *UpdateInboxLabelRequest) (UpdateInboxLabelResponse, error)
	UpdateWithContext(ctx context.Context, inboxId, labelId string, params *UpdateInboxLabelRequest) (UpdateInboxLabelResponse, error)
	Remove(inboxId, labelId string) (RemoveInboxLabelResponse, error)
	RemoveWithContext(ctx context.Context, inboxId, labelId string) (RemoveInboxLabelResponse, error)
}

type InboxLabelsSvcImpl added in v4.9.0

type InboxLabelsSvcImpl struct {
	// contains filtered or unexported fields
}

func (*InboxLabelsSvcImpl) Create added in v4.9.0

Create creates a label on the inbox. An inbox can have at most 100 labels. Label names are unique per inbox, compared without case. A duplicate name or a full inbox returns a 422 validation_error. https://resend.com/docs/api-reference/inboxes/create-label

func (*InboxLabelsSvcImpl) CreateWithContext added in v4.9.0

func (s *InboxLabelsSvcImpl) CreateWithContext(ctx context.Context, inboxId string, params *CreateInboxLabelRequest) (CreateInboxLabelResponse, error)

CreateWithContext creates a label on the inbox with context. https://resend.com/docs/api-reference/inboxes/create-label

func (*InboxLabelsSvcImpl) List added in v4.9.0

List returns every label on the inbox, oldest first. The list is not paginated. https://resend.com/docs/api-reference/inboxes/list-labels

func (*InboxLabelsSvcImpl) ListWithContext added in v4.9.0

func (s *InboxLabelsSvcImpl) ListWithContext(ctx context.Context, inboxId string) (ListInboxLabelsResponse, error)

ListWithContext returns every label on the inbox with context. https://resend.com/docs/api-reference/inboxes/list-labels

func (*InboxLabelsSvcImpl) Remove added in v4.9.0

func (s *InboxLabelsSvcImpl) Remove(inboxId, labelId string) (RemoveInboxLabelResponse, error)

Remove deletes the label and removes it from every thread that carries it. https://resend.com/docs/api-reference/inboxes/delete-label

func (*InboxLabelsSvcImpl) RemoveWithContext added in v4.9.0

func (s *InboxLabelsSvcImpl) RemoveWithContext(ctx context.Context, inboxId, labelId string) (RemoveInboxLabelResponse, error)

RemoveWithContext deletes the label with context. https://resend.com/docs/api-reference/inboxes/delete-label

func (*InboxLabelsSvcImpl) Update added in v4.9.0

func (s *InboxLabelsSvcImpl) Update(inboxId, labelId string, params *UpdateInboxLabelRequest) (UpdateInboxLabelResponse, error)

Update renames or recolors a label. Omitted fields keep their current value. A new name must not match another label on the inbox, compared without case, or the request returns a 422 validation_error. https://resend.com/docs/api-reference/inboxes/update-label

func (*InboxLabelsSvcImpl) UpdateWithContext added in v4.9.0

func (s *InboxLabelsSvcImpl) UpdateWithContext(ctx context.Context, inboxId, labelId string, params *UpdateInboxLabelRequest) (UpdateInboxLabelResponse, error)

UpdateWithContext renames or recolors a label with context. https://resend.com/docs/api-reference/inboxes/update-label

type InboxListItem added in v4.9.0

type InboxListItem struct {
	Id           string  `json:"id"`
	Name         *string `json:"name"`
	EmailAddress string  `json:"email_address"`
	FromName     *string `json:"from_name"`
	Unread       int     `json:"unread"`
	LastReceived *string `json:"last_received"`
	CreatedAt    string  `json:"created_at"`
	UpdatedAt    string  `json:"updated_at"`
}

InboxListItem is an inbox as returned by List. It carries fewer fields than Inbox.

type InboxMoveThreadFolder added in v4.9.0

type InboxMoveThreadFolder = string

InboxMoveThreadFolder is a folder a thread update can move a thread to. It has no `sent`, because `sent` is assigned automatically.

const (
	InboxMoveThreadFolderInbox   InboxMoveThreadFolder = "inbox"
	InboxMoveThreadFolderArchive InboxMoveThreadFolder = "archive"
	InboxMoveThreadFolderSpam    InboxMoveThreadFolder = "spam"
	InboxMoveThreadFolderTrash   InboxMoveThreadFolder = "trash"
)

type InboxThread added in v4.9.0

type InboxThread struct {
	Id      string  `json:"id"`
	Subject *string `json:"subject"`
	// From is the sender email address. It can include the display name.
	From *string `json:"from"`
	// To holds the recipients of the most recent email. For a received email, these are the
	// addresses it was delivered to, not the full `To` header.
	To []string `json:"to"`
	Cc []string `json:"cc"`
	// Bcc is always empty for a received email.
	Bcc    []string           `json:"bcc"`
	Labels []InboxThreadLabel `json:"labels"`
	// EmailCount is the number of emails in the thread.
	EmailCount int `json:"email_count"`
	// HasAttachment tells whether the most recent email in the thread has an attachment.
	HasAttachment bool `json:"has_attachment"`
	// HasDraft tells whether the thread has an unsent draft.
	HasDraft bool `json:"has_draft"`
	// Read is true only when every email in the thread is read.
	Read bool `json:"read"`
	// ReceivedAt is the timestamp when the thread was last active.
	ReceivedAt string `json:"received_at"`
	// Folder is the folder the thread is in. Every thread is in exactly one folder.
	Folder InboxFolder `json:"folder"`
}

InboxThread is a thread as it appears in the list of an inbox's threads.

type InboxThreadEmail added in v4.9.0

type InboxThreadEmail struct {
	Id string `json:"id"`
	// Direction is inbound when the inbox received the message and outbound when it sent it. A
	// message the inbox sent to itself is inbound, so a reply to it goes to its sender.
	Direction InboxThreadEmailDirection `json:"direction"`
	// From is the sender address. It includes the display name when the sender has one, in the
	// format "Name <sender@domain.com>".
	From string `json:"from"`
	// To holds the recipients. For a received message, these are the addresses it was delivered
	// to, not the full `To` header.
	To []string `json:"to"`
	Cc []string `json:"cc"`
	// Bcc is always empty for a received message.
	Bcc       []string `json:"bcc"`
	ReplyTo   []string `json:"reply_to"`
	Subject   *string  `json:"subject"`
	MessageId *string  `json:"message_id"`
	Html      *string  `json:"html"`
	Text      *string  `json:"text"`
	// Attachments holds the attachments of the message.
	Attachments []InboxThreadEmailAttachment `json:"attachments"`
	Read        bool                         `json:"read"`
	// ReceivedAt is the timestamp when the inbox received the message, or when the inbox sent it.
	ReceivedAt string `json:"received_at"`
}

InboxThreadEmail is a message in an inbox thread.

type InboxThreadEmailAttachment added in v4.9.0

type InboxThreadEmailAttachment struct {
	Id       string  `json:"id"`
	Filename *string `json:"filename"`
	// Size is the size of the attachment in bytes.
	Size *int `json:"size"`
}

type InboxThreadEmailDirection added in v4.9.0

type InboxThreadEmailDirection = string

InboxThreadEmailDirection tells whether the inbox received or sent a thread email.

const (
	InboxThreadEmailDirectionInbound  InboxThreadEmailDirection = "inbound"
	InboxThreadEmailDirectionOutbound InboxThreadEmailDirection = "outbound"
)

type InboxThreadEmailsSvc added in v4.9.0

type InboxThreadEmailsSvc interface {
	List(inboxId, threadId string, options *ListOptions) (ListInboxThreadEmailsResponse, error)
	ListWithContext(ctx context.Context, inboxId, threadId string, options *ListOptions) (ListInboxThreadEmailsResponse, error)
	Get(inboxId, threadId, emailId string) (InboxThreadEmail, error)
	GetWithContext(ctx context.Context, inboxId, threadId, emailId string) (InboxThreadEmail, error)
	Reply(inboxId, threadId, emailId string, params *ReplyInboxThreadEmailRequest) (ReplyInboxThreadEmailResponse, error)
	ReplyWithContext(ctx context.Context, inboxId, threadId, emailId string, params *ReplyInboxThreadEmailRequest) (ReplyInboxThreadEmailResponse, error)
	ReplyWithOptions(ctx context.Context, inboxId, threadId, emailId string, params *ReplyInboxThreadEmailRequest, options *ReplyInboxThreadEmailOptions) (ReplyInboxThreadEmailResponse, error)
	Forward(inboxId, threadId, emailId string, params *ForwardInboxThreadEmailRequest) (ForwardInboxThreadEmailResponse, error)
	ForwardWithContext(ctx context.Context, inboxId, threadId, emailId string, params *ForwardInboxThreadEmailRequest) (ForwardInboxThreadEmailResponse, error)
	ForwardWithOptions(ctx context.Context, inboxId, threadId, emailId string, params *ForwardInboxThreadEmailRequest, options *ForwardInboxThreadEmailOptions) (ForwardInboxThreadEmailResponse, error)
}

type InboxThreadEmailsSvcImpl added in v4.9.0

type InboxThreadEmailsSvcImpl struct {
	// contains filtered or unexported fields
}

func (*InboxThreadEmailsSvcImpl) Forward added in v4.9.0

func (s *InboxThreadEmailsSvcImpl) Forward(inboxId, threadId, emailId string, params *ForwardInboxThreadEmailRequest) (ForwardInboxThreadEmailResponse, error)

Forward forwards a message from the inbox address right away, with no stored draft. The original message is quoted under a forwarded-message banner, below the optional Html or Text note. The attachments of the original message are sent with the forward, together with any Attachments you add. The request fails when they exceed 25 MB of content in total. An original attachment that was sent from a URL (Path) cannot be forwarded, and the request returns a 422. https://resend.com/docs/api-reference/inboxes/forward-thread-email

func (*InboxThreadEmailsSvcImpl) ForwardWithContext added in v4.9.0

func (s *InboxThreadEmailsSvcImpl) ForwardWithContext(ctx context.Context, inboxId, threadId, emailId string, params *ForwardInboxThreadEmailRequest) (ForwardInboxThreadEmailResponse, error)

ForwardWithContext forwards a thread email with context. https://resend.com/docs/api-reference/inboxes/forward-thread-email

func (*InboxThreadEmailsSvcImpl) ForwardWithOptions added in v4.9.0

ForwardWithOptions forwards a thread email with context and additional options, such as an idempotency key. https://resend.com/docs/api-reference/inboxes/forward-thread-email

func (*InboxThreadEmailsSvcImpl) Get added in v4.9.0

func (s *InboxThreadEmailsSvcImpl) Get(inboxId, threadId, emailId string) (InboxThreadEmail, error)

Get retrieves a single message of a thread. The emailId param is the ID returned in Data[].Id by List. https://resend.com/docs/api-reference/inboxes/get-thread-email

func (*InboxThreadEmailsSvcImpl) GetWithContext added in v4.9.0

func (s *InboxThreadEmailsSvcImpl) GetWithContext(ctx context.Context, inboxId, threadId, emailId string) (InboxThreadEmail, error)

GetWithContext retrieves a single message of a thread with context. https://resend.com/docs/api-reference/inboxes/get-thread-email

func (*InboxThreadEmailsSvcImpl) List added in v4.9.0

func (s *InboxThreadEmailsSvcImpl) List(inboxId, threadId string, options *ListOptions) (ListInboxThreadEmailsResponse, error)

List returns the messages of a thread, oldest first. Pass the ID of the last message as After to get the next, newer page. Pass the ID of the first message as Before to get the previous, older page. You cannot combine After and Before. A cursor that is not a message of the thread returns a 404. https://resend.com/docs/api-reference/inboxes/list-thread-emails

func (*InboxThreadEmailsSvcImpl) ListWithContext added in v4.9.0

func (s *InboxThreadEmailsSvcImpl) ListWithContext(ctx context.Context, inboxId, threadId string, options *ListOptions) (ListInboxThreadEmailsResponse, error)

ListWithContext returns the messages of a thread with context. https://resend.com/docs/api-reference/inboxes/list-thread-emails

func (*InboxThreadEmailsSvcImpl) Reply added in v4.9.0

func (s *InboxThreadEmailsSvcImpl) Reply(inboxId, threadId, emailId string, params *ReplyInboxThreadEmailRequest) (ReplyInboxThreadEmailResponse, error)

Reply sends a reply from the inbox address right away, with no stored draft. The `to` recipients come from the message you reply to. For a message the inbox received, the reply goes to its Reply-To addresses, or to its sender when it has no Reply-To. For a message the inbox sent, the reply goes to that message's `to` recipients. Set ReplyAll to also copy the other recipients of the message. The reply threads under the message through the In-Reply-To and References headers. https://resend.com/docs/api-reference/inboxes/reply-thread-email

func (*InboxThreadEmailsSvcImpl) ReplyWithContext added in v4.9.0

func (s *InboxThreadEmailsSvcImpl) ReplyWithContext(ctx context.Context, inboxId, threadId, emailId string, params *ReplyInboxThreadEmailRequest) (ReplyInboxThreadEmailResponse, error)

ReplyWithContext sends a reply to a thread email with context. https://resend.com/docs/api-reference/inboxes/reply-thread-email

func (*InboxThreadEmailsSvcImpl) ReplyWithOptions added in v4.9.0

func (s *InboxThreadEmailsSvcImpl) ReplyWithOptions(ctx context.Context, inboxId, threadId, emailId string, params *ReplyInboxThreadEmailRequest, options *ReplyInboxThreadEmailOptions) (ReplyInboxThreadEmailResponse, error)

ReplyWithOptions sends a reply to a thread email with context and additional options, such as an idempotency key. https://resend.com/docs/api-reference/inboxes/reply-thread-email

type InboxThreadLabel added in v4.9.0

type InboxThreadLabel struct {
	Id   string `json:"id"`
	Name string `json:"name"`
	// Color is a `#RRGGBB` hex color in uppercase.
	Color string `json:"color"`
}

InboxThreadLabel is a label as attached to a thread.

type InboxThreadLabelsResponse added in v4.9.0

type InboxThreadLabelsResponse struct {
	Object string             `json:"object"`
	Data   []InboxThreadLabel `json:"data"`
}

InboxThreadLabelsResponse lists every label on the thread after the change.

type InboxThreadLabelsSvc added in v4.9.0

type InboxThreadLabelsSvc interface {
	Add(inboxId, threadId string, params *AddInboxThreadLabelsRequest) (InboxThreadLabelsResponse, error)
	AddWithContext(ctx context.Context, inboxId, threadId string, params *AddInboxThreadLabelsRequest) (InboxThreadLabelsResponse, error)
	Set(inboxId, threadId string, params *SetInboxThreadLabelsRequest) (InboxThreadLabelsResponse, error)
	SetWithContext(ctx context.Context, inboxId, threadId string, params *SetInboxThreadLabelsRequest) (InboxThreadLabelsResponse, error)
	Remove(inboxId, threadId, labelId string) (InboxThreadLabelsResponse, error)
	RemoveWithContext(ctx context.Context, inboxId, threadId, labelId string) (InboxThreadLabelsResponse, error)
}

type InboxThreadLabelsSvcImpl added in v4.9.0

type InboxThreadLabelsSvcImpl struct {
	// contains filtered or unexported fields
}

func (*InboxThreadLabelsSvcImpl) Add added in v4.9.0

Add applies one or more labels to the thread. Labels already on the thread stay on it. A label ID that is not a label of the inbox returns a 404, and nothing changes. To replace the labels of the thread, use Set. https://resend.com/docs/api-reference/inboxes/add-thread-labels

func (*InboxThreadLabelsSvcImpl) AddWithContext added in v4.9.0

func (s *InboxThreadLabelsSvcImpl) AddWithContext(ctx context.Context, inboxId, threadId string, params *AddInboxThreadLabelsRequest) (InboxThreadLabelsResponse, error)

AddWithContext applies one or more labels to the thread with context. https://resend.com/docs/api-reference/inboxes/add-thread-labels

func (*InboxThreadLabelsSvcImpl) Remove added in v4.9.0

func (s *InboxThreadLabelsSvcImpl) Remove(inboxId, threadId, labelId string) (InboxThreadLabelsResponse, error)

Remove takes one label off the thread. The label itself is kept, and stays on every other thread that carries it. A label that is not on the thread returns the current labels. To delete the label, use Inboxes.Labels.Remove. https://resend.com/docs/api-reference/inboxes/remove-thread-label

func (*InboxThreadLabelsSvcImpl) RemoveWithContext added in v4.9.0

func (s *InboxThreadLabelsSvcImpl) RemoveWithContext(ctx context.Context, inboxId, threadId, labelId string) (InboxThreadLabelsResponse, error)

RemoveWithContext takes one label off the thread with context. https://resend.com/docs/api-reference/inboxes/remove-thread-label

func (*InboxThreadLabelsSvcImpl) Set added in v4.9.0

Set replaces every label on the thread with the given labels, in one atomic change. The labels themselves are kept. A nil params or an empty Labels slice takes every label off the thread. A label ID that is not a label of the inbox returns a 404, and nothing changes. https://resend.com/docs/api-reference/inboxes/set-thread-labels

func (*InboxThreadLabelsSvcImpl) SetWithContext added in v4.9.0

func (s *InboxThreadLabelsSvcImpl) SetWithContext(ctx context.Context, inboxId, threadId string, params *SetInboxThreadLabelsRequest) (InboxThreadLabelsResponse, error)

SetWithContext replaces every label on the thread with context. https://resend.com/docs/api-reference/inboxes/set-thread-labels

type InboxThreadSearchResult added in v4.9.0

type InboxThreadSearchResult struct {
	InboxThread
	// MatchedEmailId is the ID of the email in the thread that matched the search. When the query
	// has words or phrases, it is the most relevant match. Otherwise, it is the newest. It is the
	// same ID that Threads.Emails.List returns, so use it with the get, reply and forward thread
	// email methods. nil when the search index returns no matched email for the thread.
	MatchedEmailId *string `json:"matched_email_id"`
}

InboxThreadSearchResult is a thread as returned by Search.

type InboxThreadSummary added in v4.9.0

type InboxThreadSummary struct {
	Object  string             `json:"object"`
	Id      string             `json:"id"`
	Subject *string            `json:"subject"`
	Folder  InboxFolder        `json:"folder"`
	Labels  []InboxThreadLabel `json:"labels"`
	// Read is true only when every email in the thread is read.
	Read bool `json:"read"`
}

InboxThreadSummary is the summary of a single thread, as returned by Get and Update.

type InboxThreadsSvc added in v4.9.0

type InboxThreadsSvc interface {
	List(inboxId string, options *ListInboxThreadsOptions) (ListInboxThreadsResponse, error)
	ListWithContext(ctx context.Context, inboxId string, options *ListInboxThreadsOptions) (ListInboxThreadsResponse, error)
	Search(inboxId string, options *SearchInboxThreadsOptions) (SearchInboxThreadsResponse, error)
	SearchWithContext(ctx context.Context, inboxId string, options *SearchInboxThreadsOptions) (SearchInboxThreadsResponse, error)
	Get(inboxId, threadId string) (InboxThreadSummary, error)
	GetWithContext(ctx context.Context, inboxId, threadId string) (InboxThreadSummary, error)
	Update(inboxId, threadId string, params *UpdateInboxThreadRequest) (InboxThreadSummary, error)
	UpdateWithContext(ctx context.Context, inboxId, threadId string, params *UpdateInboxThreadRequest) (InboxThreadSummary, error)
	Remove(inboxId, threadId string) (RemoveInboxThreadResponse, error)
	RemoveWithContext(ctx context.Context, inboxId, threadId string) (RemoveInboxThreadResponse, error)
}

type InboxThreadsSvcImpl added in v4.9.0

type InboxThreadsSvcImpl struct {
	Emails InboxThreadEmailsSvc
	Labels InboxThreadLabelsSvc
	// contains filtered or unexported fields
}

func (*InboxThreadsSvcImpl) Get added in v4.9.0

func (s *InboxThreadsSvcImpl) Get(inboxId, threadId string) (InboxThreadSummary, error)

Get retrieves the thread summary. The emails in the thread are listed with Threads.Emails.List. https://resend.com/docs/api-reference/inboxes/get-thread

func (*InboxThreadsSvcImpl) GetWithContext added in v4.9.0

func (s *InboxThreadsSvcImpl) GetWithContext(ctx context.Context, inboxId, threadId string) (InboxThreadSummary, error)

GetWithContext retrieves the thread summary with context. https://resend.com/docs/api-reference/inboxes/get-thread

func (*InboxThreadsSvcImpl) List added in v4.9.0

List returns the threads in an inbox, most recently active first. A thread is a conversation made up of one or more emails. To find threads by text, sender, recipient, attachment, or date, use Search. https://resend.com/docs/api-reference/inboxes/list-threads

func (*InboxThreadsSvcImpl) ListWithContext added in v4.9.0

func (s *InboxThreadsSvcImpl) ListWithContext(ctx context.Context, inboxId string, options *ListInboxThreadsOptions) (ListInboxThreadsResponse, error)

ListWithContext returns the threads in an inbox with context. https://resend.com/docs/api-reference/inboxes/list-threads

func (*InboxThreadsSvcImpl) Remove added in v4.9.0

func (s *InboxThreadsSvcImpl) Remove(inboxId, threadId string) (RemoveInboxThreadResponse, error)

Remove moves the thread to trash and schedules it for deletion in 30 days. This is reversible. To restore the thread, update its Folder to inbox, archive, or spam, which also clears the deletion deadline. https://resend.com/docs/api-reference/inboxes/delete-thread

func (*InboxThreadsSvcImpl) RemoveWithContext added in v4.9.0

func (s *InboxThreadsSvcImpl) RemoveWithContext(ctx context.Context, inboxId, threadId string) (RemoveInboxThreadResponse, error)

RemoveWithContext moves the thread to trash with context. https://resend.com/docs/api-reference/inboxes/delete-thread

func (*InboxThreadsSvcImpl) Search added in v4.9.0

Search finds threads by the text of their emails, who sent or received them, whether they have attachments, and their dates. Results are ordered by latest activity, newest first, and paginate like List. Search can be up to about a minute behind new emails. When more than 10,000 threads match, search covers the 10,000 with the newest matching email. https://resend.com/docs/api-reference/inboxes/search-threads

func (*InboxThreadsSvcImpl) SearchWithContext added in v4.9.0

SearchWithContext finds threads in an inbox with context. https://resend.com/docs/api-reference/inboxes/search-threads

func (*InboxThreadsSvcImpl) Update added in v4.9.0

func (s *InboxThreadsSvcImpl) Update(inboxId, threadId string, params *UpdateInboxThreadRequest) (InboxThreadSummary, error)

Update marks a thread read or unread, or moves it to a folder. At least one of Read or Folder is required. To change the labels of a thread, use Threads.Labels. Moving a thread out of trash restores it and clears its deletion deadline. The changes apply in this order: Read, then Folder. They are not atomic. https://resend.com/docs/api-reference/inboxes/update-thread

func (*InboxThreadsSvcImpl) UpdateWithContext added in v4.9.0

func (s *InboxThreadsSvcImpl) UpdateWithContext(ctx context.Context, inboxId, threadId string, params *UpdateInboxThreadRequest) (InboxThreadSummary, error)

UpdateWithContext updates a thread with context. https://resend.com/docs/api-reference/inboxes/update-thread

type InboxesSvc added in v4.9.0

type InboxesSvc interface {
	Create(params *CreateInboxRequest) (CreateInboxResponse, error)
	CreateWithContext(ctx context.Context, params *CreateInboxRequest) (CreateInboxResponse, error)
	List(options *ListOptions) (ListInboxesResponse, error)
	ListWithContext(ctx context.Context, options *ListOptions) (ListInboxesResponse, error)
	Get(idOrEmail string) (Inbox, error)
	GetWithContext(ctx context.Context, idOrEmail string) (Inbox, error)
	Update(idOrEmail string, params *UpdateInboxRequest) (UpdateInboxResponse, error)
	UpdateWithContext(ctx context.Context, idOrEmail string, params *UpdateInboxRequest) (UpdateInboxResponse, error)
	Remove(idOrEmail string) (RemoveInboxResponse, error)
	RemoveWithContext(ctx context.Context, idOrEmail string) (RemoveInboxResponse, error)
}

type InboxesSvcImpl added in v4.9.0

type InboxesSvcImpl struct {
	Agent   InboxAgentSvc
	Labels  InboxLabelsSvc
	Threads *InboxThreadsSvcImpl
	Drafts  InboxDraftsSvc
	// contains filtered or unexported fields
}

func (*InboxesSvcImpl) Create added in v4.9.0

Create creates an inbox that sends and receives email at an address on one of your domains. A team that has reached the inbox limit of its plan gets a 403 validation_error. A blocked account gets a 451. https://resend.com/docs/api-reference/inboxes/create-inbox

func (*InboxesSvcImpl) CreateWithContext added in v4.9.0

func (s *InboxesSvcImpl) CreateWithContext(ctx context.Context, params *CreateInboxRequest) (CreateInboxResponse, error)

CreateWithContext creates an inbox with context. https://resend.com/docs/api-reference/inboxes/create-inbox

func (*InboxesSvcImpl) Get added in v4.9.0

func (s *InboxesSvcImpl) Get(idOrEmail string) (Inbox, error)

Get retrieves a single inbox. The idOrEmail param can be the inbox ID or the inbox email address. The email match is case-insensitive. https://resend.com/docs/api-reference/inboxes/get-inbox

func (*InboxesSvcImpl) GetWithContext added in v4.9.0

func (s *InboxesSvcImpl) GetWithContext(ctx context.Context, idOrEmail string) (Inbox, error)

GetWithContext retrieves a single inbox with context. https://resend.com/docs/api-reference/inboxes/get-inbox

func (*InboxesSvcImpl) List added in v4.9.0

func (s *InboxesSvcImpl) List(options *ListOptions) (ListInboxesResponse, error)

List returns the inboxes of the team, newest first. The list items carry fewer fields than a single inbox. Retrieve an inbox to get all its fields. The After and Before cursors take an inbox ID. A value that is not a UUID returns a 422, and an unknown ID returns a 404. https://resend.com/docs/api-reference/inboxes/list-inboxes

func (*InboxesSvcImpl) ListWithContext added in v4.9.0

func (s *InboxesSvcImpl) ListWithContext(ctx context.Context, options *ListOptions) (ListInboxesResponse, error)

ListWithContext returns the inboxes of the team with context. https://resend.com/docs/api-reference/inboxes/list-inboxes

func (*InboxesSvcImpl) Remove added in v4.9.0

func (s *InboxesSvcImpl) Remove(idOrEmail string) (RemoveInboxResponse, error)

Remove removes the inbox. The idOrEmail param can be the inbox ID or the inbox email address. An inbox that does not exist or was already removed returns a 404 not_found. https://resend.com/docs/api-reference/inboxes/delete-inbox

func (*InboxesSvcImpl) RemoveWithContext added in v4.9.0

func (s *InboxesSvcImpl) RemoveWithContext(ctx context.Context, idOrEmail string) (RemoveInboxResponse, error)

RemoveWithContext removes the inbox with context. https://resend.com/docs/api-reference/inboxes/delete-inbox

func (*InboxesSvcImpl) Update added in v4.9.0

func (s *InboxesSvcImpl) Update(idOrEmail string, params *UpdateInboxRequest) (UpdateInboxResponse, error)

Update updates the internal name of the inbox or the name recipients see when mail is sent from it. At least one of Name or FromName is required. The idOrEmail param can be the inbox ID or the inbox email address. https://resend.com/docs/api-reference/inboxes/update-inbox

func (*InboxesSvcImpl) UpdateWithContext added in v4.9.0

func (s *InboxesSvcImpl) UpdateWithContext(ctx context.Context, idOrEmail string, params *UpdateInboxRequest) (UpdateInboxResponse, error)

UpdateWithContext updates an inbox with context. https://resend.com/docs/api-reference/inboxes/update-inbox

type InvalidRequestError deprecated

type InvalidRequestError struct {
	StatusCode int    `json:"statusCode"`
	Name       string `json:"name"`
	Message    string `json:"message"`
}

InvalidRequestError is no longer returned by the SDK.

Deprecated: Use ResendError instead.

type ListApiKeysResponse

type ListApiKeysResponse struct {
	Object  string   `json:"object"`
	Data    []ApiKey `json:"data"`
	HasMore bool     `json:"has_more"`
}

type ListAudiencesResponse deprecated

type ListAudiencesResponse = ListSegmentsResponse

Deprecated: Use ListSegmentsResponse instead

type ListAutomationRunsOptions

type ListAutomationRunsOptions struct {
	Status []AutomationRunStatus
	Limit  *int
	After  *string
	Before *string
}

ListAutomationRunsOptions contains pagination and filter parameters for listing automation runs

type ListAutomationRunsResponse

type ListAutomationRunsResponse struct {
	Object  string                  `json:"object"`
	HasMore bool                    `json:"has_more"`
	Data    []AutomationRunListItem `json:"data"`
}

type ListAutomationsOptions

type ListAutomationsOptions struct {
	Status *AutomationStatus
	Limit  *int
	After  *string
	Before *string
}

ListAutomationsOptions contains pagination and filter parameters for listing automations

type ListAutomationsResponse

type ListAutomationsResponse struct {
	Object  string               `json:"object"`
	HasMore bool                 `json:"has_more"`
	Data    []AutomationListItem `json:"data"`
}

type ListBroadcastClickedLinksResponse

type ListBroadcastClickedLinksResponse struct {
	Object  string                 `json:"object"`
	Data    []BroadcastClickedLink `json:"data"`
	HasMore bool                   `json:"has_more"`
}

type ListBroadcastRecipientsOptions

type ListBroadcastRecipientsOptions struct {
	// Type is the recipient event type to filter by. Required.
	Type BroadcastRecipientEventType

	// Email filters recipients whose email address contains this substring.
	Email string

	// BounceType filters bounced recipients by bounce type. Only meaningful when Type is
	// BroadcastRecipientEventTypeBounced.
	BounceType BroadcastRecipientBounceType

	Limit  *int
	After  *string
	Before *string
}

ListBroadcastRecipientsOptions contains the filter and pagination parameters for listing a broadcast's recipients.

type ListBroadcastRecipientsResponse

type ListBroadcastRecipientsResponse struct {
	Object  string               `json:"object"`
	HasMore bool                 `json:"has_more"`
	Data    []BroadcastRecipient `json:"data"`
}

type ListBroadcastsResponse

type ListBroadcastsResponse struct {
	Object  string      `json:"object"`
	Data    []Broadcast `json:"data"`
	HasMore bool        `json:"has_more"`
}

type ListContactImportsOptions

type ListContactImportsOptions struct {
	// Status filters imports by status: queued, in_progress, completed, failed.
	Status string
	Limit  *int
	After  *string
	Before *string
}

type ListContactImportsResponse

type ListContactImportsResponse struct {
	Object  string          `json:"object"`
	HasMore bool            `json:"has_more"`
	Data    []ContactImport `json:"data"`
}

type ListContactPropertiesResponse

type ListContactPropertiesResponse struct {
	Object  string            `json:"object"`
	Data    []ContactProperty `json:"data"`
	HasMore bool              `json:"has_more"`
}

type ListContactSegmentsRequest

type ListContactSegmentsRequest struct {
	ContactId string `json:"contact_id,omitempty"`
	Email     string `json:"email,omitempty"`
}

type ListContactSegmentsResponse

type ListContactSegmentsResponse struct {
	Object  string    `json:"object"`
	Data    []Segment `json:"data"`
	HasMore bool      `json:"has_more"`
}

type ListContactTopicsResponse

type ListContactTopicsResponse struct {
	Object  string         `json:"object"`
	HasMore bool           `json:"has_more"`
	Data    []ContactTopic `json:"data"`
}

ListContactTopicsResponse is the response from listing contact topics

type ListContactsOptions

type ListContactsOptions struct {
	AudienceId string  // Deprecated: Use SegmentId instead
	SegmentId  string  // Optional - filter contacts by segment ID
	Limit      *int    // Optional - number of results to return
	After      *string // Optional - cursor for pagination
	Before     *string // Optional - cursor for pagination
}

ListContactsOptions contains parameters for listing contacts

type ListContactsResponse

type ListContactsResponse struct {
	Object  string    `json:"object"`
	Data    []Contact `json:"data"`
	HasMore bool      `json:"has_more"`
}

type ListDomainsResponse

type ListDomainsResponse struct {
	Object  string   `json:"object"`
	Data    []Domain `json:"data"`
	HasMore bool     `json:"has_more"`
}

type ListEmailAttachmentsResponse

type ListEmailAttachmentsResponse struct {
	Object  string            `json:"object"`
	HasMore bool              `json:"has_more"`
	Data    []EmailAttachment `json:"data"`
}

ListEmailAttachmentsResponse is the response from the ListAttachments call.

type ListEmailsResponse

type ListEmailsResponse struct {
	Object  string  `json:"object"`
	HasMore bool    `json:"has_more"`
	Data    []Email `json:"data"`
}

ListEmailsResponse is the response from the List call.

type ListEventsResponse

type ListEventsResponse struct {
	Object  string         `json:"object"`
	HasMore bool           `json:"has_more"`
	Data    []EventSummary `json:"data"`
}

type ListInboxDraftsResponse added in v4.9.0

type ListInboxDraftsResponse struct {
	Object  string `json:"object"`
	HasMore bool   `json:"has_more"`
	// Data holds the unsent drafts on this page, most recently updated first.
	Data []InboxDraftListItem `json:"data"`
}

type ListInboxLabelsResponse added in v4.9.0

type ListInboxLabelsResponse struct {
	Object string `json:"object"`
	// Data holds the labels on the inbox, oldest first.
	Data []InboxLabel `json:"data"`
}

type ListInboxThreadEmailsResponse added in v4.9.0

type ListInboxThreadEmailsResponse struct {
	Object  string `json:"object"`
	HasMore bool   `json:"has_more"`
	// Data holds the messages of the thread on this page, oldest first.
	Data []InboxThreadEmail `json:"data"`
}

type ListInboxThreadsOptions added in v4.9.0

type ListInboxThreadsOptions struct {
	// Folders to list. A thread is returned when any of its emails is in one of the folders.
	// Defaults to inbox, or to inbox, archive and sent when Labels is set. Spam and trash are only
	// included when you name them.
	Folders []InboxFolder
	// Labels are label IDs. Returns threads with any of these labels. Up to 50 IDs. An ID that
	// does not exist in the inbox returns a 404.
	Labels []string
	// Read set to true returns threads where every email is read. False returns threads with at
	// least one unread email.
	Read  *bool
	Limit *int
	// After and Before take a thread ID. Only one of them can be passed. A cursor thread that is
	// not in the selected folders returns a 404.
	After  *string
	Before *string
}

ListInboxThreadsOptions contains the filters and pagination for listing threads.

type ListInboxThreadsResponse added in v4.9.0

type ListInboxThreadsResponse struct {
	Object  string `json:"object"`
	HasMore bool   `json:"has_more"`
	// Data holds the matching threads, most recently active first.
	Data []InboxThread `json:"data"`
}

type ListInboxesResponse added in v4.9.0

type ListInboxesResponse struct {
	Object  string          `json:"object"`
	HasMore bool            `json:"has_more"`
	Data    []InboxListItem `json:"data"`
}

type ListLogsResponse

type ListLogsResponse struct {
	Object  string `json:"object"`
	Data    []Log  `json:"data"`
	HasMore bool   `json:"has_more"`
}

type ListOAuthGrantsResponse

type ListOAuthGrantsResponse struct {
	Object  string       `json:"object"`
	Data    []OAuthGrant `json:"data"`
	HasMore bool         `json:"has_more"`
}

type ListOptions

type ListOptions struct {
	Limit  *int    `json:"limit,omitempty"`
	After  *string `json:"after,omitempty"`
	Before *string `json:"before,omitempty"`
}

ListOptions contains pagination parameters for list methods

type ListReceivedEmail

type ListReceivedEmail struct {
	Id          string               `json:"id"`
	To          []string             `json:"to"`
	From        string               `json:"from"`
	CreatedAt   string               `json:"created_at"`
	Subject     string               `json:"subject"`
	Bcc         []string             `json:"bcc"`
	Cc          []string             `json:"cc"`
	ReplyTo     []string             `json:"reply_to"`
	MessageId   string               `json:"message_id"`
	Attachments []ReceivedAttachment `json:"attachments"`
}

ListReceivedEmail provides the structure for items in the Receiving.List call. It omits html, text, and headers fields compared to ReceivedEmail.

type ListReceivedEmailsResponse

type ListReceivedEmailsResponse struct {
	Object  string              `json:"object"`
	HasMore bool                `json:"has_more"`
	Data    []ListReceivedEmail `json:"data"`
}

ListReceivedEmailsResponse is the response from the Receiving.List call.

type ListSegmentsResponse

type ListSegmentsResponse struct {
	Object  string    `json:"object"`
	Data    []Segment `json:"data"`
	HasMore bool      `json:"has_more"`
}

type ListSuppressionsOptions

type ListSuppressionsOptions struct {
	// Origin filters suppressions by origin: bounce, complaint, manual.
	Origin SuppressionOrigin
	Limit  *int
	After  *string
	Before *string
}

ListSuppressionsOptions contains parameters for listing suppressions.

type ListSuppressionsResponse

type ListSuppressionsResponse struct {
	Object  string                 `json:"object"`
	HasMore bool                   `json:"has_more"`
	Data    []SuppressionListEntry `json:"data"`
}

type ListTemplatesResponse

type ListTemplatesResponse struct {
	Object  string              `json:"object"`
	Data    []*TemplateListItem `json:"data"`
	HasMore bool                `json:"has_more"`
}

ListTemplatesResponse is the response from listing templates

type ListTopicsResponse

type ListTopicsResponse struct {
	Object  string   `json:"object"`
	HasMore bool     `json:"has_more"`
	Data    []*Topic `json:"data"`
}

ListTopicsResponse is the response from listing topics

type ListWebhookEventAttemptsOptions added in v4.2.0

type ListWebhookEventAttemptsOptions struct {
	Limit *int    `json:"limit,omitempty"`
	After *string `json:"after,omitempty"`
}

ListWebhookEventAttemptsOptions represents the pagination options for listing webhook event attempts.

type ListWebhookEventAttemptsResponse added in v4.2.0

type ListWebhookEventAttemptsResponse struct {
	Object  string                `json:"object"`
	HasMore bool                  `json:"has_more"`
	Data    []WebhookEventAttempt `json:"data"`
}

ListWebhookEventAttemptsResponse represents the response from listing webhook event attempts.

type ListWebhookEventsOptions added in v4.2.0

type ListWebhookEventsOptions struct {
	Limit *int    `json:"limit,omitempty"`
	After *string `json:"after,omitempty"`
}

ListWebhookEventsOptions represents the pagination options for listing webhook events.

type ListWebhookEventsResponse added in v4.2.0

type ListWebhookEventsResponse struct {
	Object  string            `json:"object"`
	HasMore bool              `json:"has_more"`
	Data    []WebhookEventLog `json:"data"`
}

ListWebhookEventsResponse represents the response from listing webhook events.

type ListWebhooksResponse

type ListWebhooksResponse struct {
	Object  string          `json:"object"`
	HasMore bool            `json:"has_more"`
	Data    []WebhookInList `json:"data"`
}

ListWebhooksResponse represents the response from listing webhooks

type Log

type Log struct {
	Object         string  `json:"object,omitempty"`
	Id             string  `json:"id"`
	CreatedAt      string  `json:"created_at"`
	Endpoint       string  `json:"endpoint"`
	Method         string  `json:"method"`
	ResponseStatus int     `json:"response_status"`
	UserAgent      *string `json:"user_agent"`
	RequestBody    any     `json:"request_body,omitempty"`
	ResponseBody   any     `json:"response_body,omitempty"`
}

type LogsSvc

type LogsSvc interface {
	GetWithContext(ctx context.Context, logId string) (Log, error)
	Get(logId string) (Log, error)
	ListWithOptions(ctx context.Context, options *ListOptions) (ListLogsResponse, error)
	ListWithContext(ctx context.Context) (ListLogsResponse, error)
	List() (ListLogsResponse, error)
}

type LogsSvcImpl

type LogsSvcImpl struct {
	// contains filtered or unexported fields
}

func (*LogsSvcImpl) Get

func (s *LogsSvcImpl) Get(logId string) (Log, error)

Get retrieves a single log entry by ID

func (*LogsSvcImpl) GetWithContext

func (s *LogsSvcImpl) GetWithContext(ctx context.Context, logId string) (Log, error)

GetWithContext retrieves a single log entry by ID https://resend.com/docs/api-reference/logs/retrieve-log

func (*LogsSvcImpl) List

func (s *LogsSvcImpl) List() (ListLogsResponse, error)

List lists all logs

func (*LogsSvcImpl) ListWithContext

func (s *LogsSvcImpl) ListWithContext(ctx context.Context) (ListLogsResponse, error)

ListWithContext lists all logs https://resend.com/docs/api-reference/logs/list-logs

func (*LogsSvcImpl) ListWithOptions

func (s *LogsSvcImpl) ListWithOptions(ctx context.Context, options *ListOptions) (ListLogsResponse, error)

ListWithOptions lists all logs with pagination options https://resend.com/docs/api-reference/logs/list-logs

type MetricName

type MetricName = string

MetricName identifies a metric that can be requested from the Metrics call.

const (
	MetricReceived            MetricName = "received"
	MetricDelivered           MetricName = "delivered"
	MetricComplained          MetricName = "complained"
	MetricSuppressed          MetricName = "suppressed"
	MetricBounced             MetricName = "bounced"
	MetricBouncedTransient    MetricName = "bounced_transient"
	MetricBouncedPermanent    MetricName = "bounced_permanent"
	MetricBouncedUndetermined MetricName = "bounced_undetermined"
	MetricOpened              MetricName = "opened"
	MetricClicked             MetricName = "clicked"
	MetricUnsubscribed        MetricName = "unsubscribed"
	MetricDeliveryDelayed     MetricName = "delivery_delayed"
	MetricFailed              MetricName = "failed"
	MetricSent                MetricName = "sent"
	MetricUniqueOpened        MetricName = "unique_opened"
	MetricUniqueClicked       MetricName = "unique_clicked"
	MetricDeliveryRate        MetricName = "delivery_rate"
	MetricOpenRate            MetricName = "open_rate"
	MetricClickRate           MetricName = "click_rate"
	MetricBounceRate          MetricName = "bounce_rate"
	MetricComplaintRate       MetricName = "complaint_rate"
	MetricUnsubscribeRate     MetricName = "unsubscribe_rate"
)

type MetricsDataPoint

type MetricsDataPoint struct {
	// Period is set when MetricsDimensionPeriod is requested.
	Period *string `json:"period,omitempty"`

	// DomainId and DomainName are set when MetricsDimensionDomain is requested.
	DomainId   *string `json:"domain_id,omitempty"`
	DomainName *string `json:"domain_name,omitempty"`

	// EmailId is set when MetricsDimensionEmail is requested.
	EmailId *string `json:"email_id,omitempty"`

	// BroadcastId and BroadcastName are set when MetricsDimensionBroadcast is requested.
	BroadcastId   *string `json:"broadcast_id,omitempty"`
	BroadcastName *string `json:"broadcast_name,omitempty"`

	Received            *int64   `json:"received,omitempty"`
	Delivered           *int64   `json:"delivered,omitempty"`
	Complained          *int64   `json:"complained,omitempty"`
	Suppressed          *int64   `json:"suppressed,omitempty"`
	Bounced             *int64   `json:"bounced,omitempty"`
	BouncedTransient    *int64   `json:"bounced_transient,omitempty"`
	BouncedPermanent    *int64   `json:"bounced_permanent,omitempty"`
	BouncedUndetermined *int64   `json:"bounced_undetermined,omitempty"`
	Opened              *int64   `json:"opened,omitempty"`
	Clicked             *int64   `json:"clicked,omitempty"`
	Unsubscribed        *int64   `json:"unsubscribed,omitempty"`
	DeliveryDelayed     *int64   `json:"delivery_delayed,omitempty"`
	Failed              *int64   `json:"failed,omitempty"`
	Sent                *int64   `json:"sent,omitempty"`
	UniqueOpened        *int64   `json:"unique_opened,omitempty"`
	UniqueClicked       *int64   `json:"unique_clicked,omitempty"`
	DeliveryRate        *float64 `json:"delivery_rate,omitempty"`
	OpenRate            *float64 `json:"open_rate,omitempty"`
	ClickRate           *float64 `json:"click_rate,omitempty"`
	BounceRate          *float64 `json:"bounce_rate,omitempty"`
	ComplaintRate       *float64 `json:"complaint_rate,omitempty"`
	UnsubscribeRate     *float64 `json:"unsubscribe_rate,omitempty"`
}

MetricsDataPoint is a single row in MetricsResponse.Data. Which fields are populated depends on the requested dimensions and metrics: dimension key fields are set only when that dimension was requested, and metric fields are set only when that metric was requested.

type MetricsDimension

type MetricsDimension = string

MetricsDimension identifies a dimension to group metrics by in the Metrics call.

const (
	MetricsDimensionPeriod    MetricsDimension = "period"
	MetricsDimensionDomain    MetricsDimension = "domain"
	MetricsDimensionEmail     MetricsDimension = "email"
	MetricsDimensionBroadcast MetricsDimension = "broadcast"
)

type MetricsGranularity

type MetricsGranularity = string

MetricsGranularity is the bucket size used for the `period` dimension.

const (
	MetricsGranularityHourly  MetricsGranularity = "hourly"
	MetricsGranularityDaily   MetricsGranularity = "daily"
	MetricsGranularityWeekly  MetricsGranularity = "weekly"
	MetricsGranularityMonthly MetricsGranularity = "monthly"
)

type MetricsOptions

type MetricsOptions struct {
	// StartDate filters metrics to on/after this ISO 8601 date or datetime.
	// Defaults server-side to 6 days before EndDate.
	StartDate *string

	// EndDate filters metrics to on/before this ISO 8601 date or datetime.
	// Defaults server-side to now.
	EndDate *string

	// Timezone is an IANA timezone identifier, e.g. "America/New_York".
	// Defaults server-side to "UTC".
	Timezone *string

	// Granularity is the bucket size used when the `period` dimension is
	// requested. Defaults server-side to MetricsGranularityDaily.
	Granularity *MetricsGranularity

	// Metrics selects which metrics to compute. Defaults server-side to all
	// metrics.
	Metrics []MetricName

	// Dimensions selects which dimensions to group results by. Defaults
	// server-side to none, in which case the response only contains Totals.
	Dimensions []MetricsDimension

	// DomainId restricts results to these sending domain IDs (max 100).
	DomainId []string

	// EmailId restricts results to these email IDs (max 100). Cannot be
	// combined with MetricsDimensionBroadcast or BroadcastId.
	EmailId []string

	// BroadcastId restricts results to these broadcast IDs (max 100). Cannot
	// be combined with MetricsDimensionEmail or EmailId.
	BroadcastId []string
}

MetricsOptions contains the optional query parameters for the Metrics call.

See also https://resend.com/docs/api-reference/emails/get-metrics

type MetricsResponse

type MetricsResponse struct {
	Object      string             `json:"object"`
	StartDate   string             `json:"start_date"`
	EndDate     string             `json:"end_date"`
	Metrics     []string           `json:"metrics"`
	Dimensions  []string           `json:"dimensions"`
	Granularity string             `json:"granularity"`
	Totals      map[string]float64 `json:"totals"`
	// Data is omitted from the response when no dimensions were requested.
	Data []MetricsDataPoint `json:"data,omitempty"`
}

MetricsResponse is the response from the Metrics call.

See also https://resend.com/docs/api-reference/emails/get-metrics

type MissingRequiredFieldsError

type MissingRequiredFieldsError struct {
	// contains filtered or unexported fields
}

MissingRequiredFieldsError is used when a required field is missing before making an API request

func (*MissingRequiredFieldsError) Error

type OAuthGrant

type OAuthGrant struct {
	Id            string           `json:"id"`
	ClientId      string           `json:"client_id"`
	Scopes        []string         `json:"scopes"`
	CreatedAt     string           `json:"created_at"`
	RevokedAt     *string          `json:"revoked_at"`
	RevokedReason *string          `json:"revoked_reason"`
	Client        OAuthGrantClient `json:"client"`
}

type OAuthGrantClient

type OAuthGrantClient struct {
	Name    string  `json:"name"`
	LogoUri *string `json:"logo_uri"`
}

type OAuthGrantsSvc

type OAuthGrantsSvc interface {
	ListWithOptions(ctx context.Context, options *ListOptions) (ListOAuthGrantsResponse, error)
	ListWithContext(ctx context.Context) (ListOAuthGrantsResponse, error)
	List() (ListOAuthGrantsResponse, error)
	RevokeWithContext(ctx context.Context, oauthGrantId string) (RevokeOAuthGrantResponse, error)
	Revoke(oauthGrantId string) (RevokeOAuthGrantResponse, error)
}

type OAuthGrantsSvcImpl

type OAuthGrantsSvcImpl struct {
	// contains filtered or unexported fields
}

func (*OAuthGrantsSvcImpl) List

func (*OAuthGrantsSvcImpl) ListWithContext

func (s *OAuthGrantsSvcImpl) ListWithContext(ctx context.Context) (ListOAuthGrantsResponse, error)

func (*OAuthGrantsSvcImpl) ListWithOptions

func (s *OAuthGrantsSvcImpl) ListWithOptions(ctx context.Context, options *ListOptions) (ListOAuthGrantsResponse, error)

func (*OAuthGrantsSvcImpl) Revoke

func (s *OAuthGrantsSvcImpl) Revoke(oauthGrantId string) (RevokeOAuthGrantResponse, error)

func (*OAuthGrantsSvcImpl) RevokeWithContext

func (s *OAuthGrantsSvcImpl) RevokeWithContext(ctx context.Context, oauthGrantId string) (RevokeOAuthGrantResponse, error)

type Options

type Options interface {
	// GetIdempotencyKey returns the idempotency key
	GetIdempotencyKey() string
}

Options interface is used to define additional options that can be passed to the API methods.

type PublishTemplateResponse

type PublishTemplateResponse struct {
	Id     string `json:"id"`
	Object string `json:"object"`
}

PublishTemplateResponse is the response from publishing a template

type RateLimitError

type RateLimitError struct {
	// Message is the error message from the API
	Message string

	// Limit is the maximum number of requests allowed in the current window (raw header value)
	Limit string

	// Remaining is the number of requests remaining in the current window (raw header value)
	Remaining string

	// Reset is the time when the rate limit will reset in seconds (raw header value)
	Reset string

	// RetryAfter is the recommended wait time before retrying in seconds (raw header value)
	RetryAfter string
}

RateLimitError represents a rate limit error with metadata from response headers

func (*RateLimitError) Error

func (e *RateLimitError) Error() string

Error implements the error interface

func (*RateLimitError) Is

func (e *RateLimitError) Is(target error) bool

Is implements errors.Is support for detecting rate limit errors

type RawEmail

type RawEmail struct {
	DownloadUrl string `json:"download_url"`
	ExpiresAt   string `json:"expires_at"`
}

type ReceivedAttachment

type ReceivedAttachment struct {
	Id                 string `json:"id"`
	Filename           string `json:"filename"`
	ContentType        string `json:"content_type"`
	ContentDisposition string `json:"content_disposition"`
	ContentId          string `json:"content_id"`
}

ReceivedAttachment represents an attachment in a received email (used in list responses without download URLs)

type ReceivedEmail

type ReceivedEmail struct {
	Id          string               `json:"id"`
	Object      string               `json:"object"` // Always "email" for received emails
	To          []string             `json:"to"`
	From        string               `json:"from"`
	CreatedAt   string               `json:"created_at"`
	Subject     string               `json:"subject"`
	Html        string               `json:"html"`
	Text        string               `json:"text"`
	Bcc         []string             `json:"bcc"`
	Cc          []string             `json:"cc"`
	ReplyTo     []string             `json:"reply_to"`
	ReceivedFor []string             `json:"received_for"`
	Headers     map[string]string    `json:"headers"`
	MessageId   string               `json:"message_id"`
	Attachments []ReceivedAttachment `json:"attachments"`
	Raw         RawEmail             `json:"raw"`
}

ReceivedEmail provides the structure for the response from the Receiving.Get call.

type ReceivingSvc

type ReceivingSvc interface {
	GetWithOptions(ctx context.Context, emailId string, params *GetReceivedEmailParams) (*ReceivedEmail, error)
	GetWithContext(ctx context.Context, emailId string) (*ReceivedEmail, error)
	Get(emailId string) (*ReceivedEmail, error)
	ListWithOptions(ctx context.Context, options *ListOptions) (ListReceivedEmailsResponse, error)
	ListWithContext(ctx context.Context) (ListReceivedEmailsResponse, error)
	List() (ListReceivedEmailsResponse, error)
	GetAttachmentWithContext(ctx context.Context, emailId string, attachmentId string) (*EmailAttachment, error)
	GetAttachment(emailId string, attachmentId string) (*EmailAttachment, error)
	ListAttachmentsWithOptions(ctx context.Context, emailId string, options *ListOptions) (ListEmailAttachmentsResponse, error)
	ListAttachmentsWithContext(ctx context.Context, emailId string) (ListEmailAttachmentsResponse, error)
	ListAttachments(emailId string) (ListEmailAttachmentsResponse, error)
}

ReceivingSvc handles operations for received/inbound emails

type ReceivingSvcImpl

type ReceivingSvcImpl struct {
	// contains filtered or unexported fields
}

ReceivingSvcImpl is the implementation of the ReceivingSvc interface

func (*ReceivingSvcImpl) Get

func (s *ReceivingSvcImpl) Get(emailId string) (*ReceivedEmail, error)

Get retrieves a received email with the given emailId https://resend.com/docs/api-reference/emails/retrieve-received-email

func (*ReceivingSvcImpl) GetAttachment

func (s *ReceivingSvcImpl) GetAttachment(emailId string, attachmentId string) (*EmailAttachment, error)

GetAttachment retrieves a single attachment from a received email with the given emailId and attachmentId https://resend.com/docs/api-reference/attachments/retrieve-received-email-attachment

func (*ReceivingSvcImpl) GetAttachmentWithContext

func (s *ReceivingSvcImpl) GetAttachmentWithContext(ctx context.Context, emailId string, attachmentId string) (*EmailAttachment, error)

GetAttachmentWithContext retrieves a single attachment from a received email with the given emailId and attachmentId https://resend.com/docs/api-reference/attachments/retrieve-received-email-attachment

func (*ReceivingSvcImpl) GetWithContext

func (s *ReceivingSvcImpl) GetWithContext(ctx context.Context, emailId string) (*ReceivedEmail, error)

GetWithContext retrieves a received email with the given emailId https://resend.com/docs/api-reference/emails/retrieve-received-email

func (*ReceivingSvcImpl) GetWithOptions

func (s *ReceivingSvcImpl) GetWithOptions(ctx context.Context, emailId string, params *GetReceivedEmailParams) (*ReceivedEmail, error)

GetWithOptions retrieves a received email with the given emailId and optional query parameters https://resend.com/docs/api-reference/emails/retrieve-received-email

func (*ReceivingSvcImpl) List

List retrieves a list of received emails https://resend.com/docs/api-reference/emails/list-received-emails

func (*ReceivingSvcImpl) ListAttachments

func (s *ReceivingSvcImpl) ListAttachments(emailId string) (ListEmailAttachmentsResponse, error)

ListAttachments retrieves a list of attachments for a received email https://resend.com/docs/api-reference/attachments/list-received-email-attachments

func (*ReceivingSvcImpl) ListAttachmentsWithContext

func (s *ReceivingSvcImpl) ListAttachmentsWithContext(ctx context.Context, emailId string) (ListEmailAttachmentsResponse, error)

ListAttachmentsWithContext retrieves a list of attachments for a received email https://resend.com/docs/api-reference/attachments/list-received-email-attachments

func (*ReceivingSvcImpl) ListAttachmentsWithOptions

func (s *ReceivingSvcImpl) ListAttachmentsWithOptions(ctx context.Context, emailId string, options *ListOptions) (ListEmailAttachmentsResponse, error)

ListAttachmentsWithOptions retrieves a list of attachments for a received email with pagination options https://resend.com/docs/api-reference/attachments/list-received-email-attachments

func (*ReceivingSvcImpl) ListWithContext

ListWithContext retrieves a list of received emails https://resend.com/docs/api-reference/emails/list-received-emails

func (*ReceivingSvcImpl) ListWithOptions

func (s *ReceivingSvcImpl) ListWithOptions(ctx context.Context, options *ListOptions) (ListReceivedEmailsResponse, error)

ListWithOptions retrieves a list of received emails with pagination options https://resend.com/docs/api-reference/emails/list-received-emails

type Record

type Record struct {
	Record   RecordType  `json:"record"`
	Name     string      `json:"name"`
	Type     string      `json:"type"`
	Ttl      string      `json:"ttl"`
	Status   string      `json:"status"`
	Value    string      `json:"value"`
	Priority json.Number `json:"priority,omitempty"`
}

type RecordType

type RecordType = string
const (
	RecordTypeSPF         RecordType = "SPF"
	RecordTypeDKIM        RecordType = "DKIM"
	RecordTypeTracking    RecordType = "Tracking"
	RecordTypeTrackingCAA RecordType = "TrackingCAA"
)

type RemoveAudienceResponse deprecated

type RemoveAudienceResponse = RemoveSegmentResponse

Deprecated: Use RemoveSegmentResponse instead

type RemoveBroadcastResponse

type RemoveBroadcastResponse struct {
	Object  string `json:"object"`
	Id      string `json:"id"`
	Deleted bool   `json:"deleted"`
}

type RemoveContactOptions

type RemoveContactOptions struct {
	AudienceId string // Optional - omit for global contacts
	Id         string // Required - can be contact ID or email address
}

RemoveContactOptions contains parameters for removing a contact

type RemoveContactPropertyResponse

type RemoveContactPropertyResponse struct {
	Id      string `json:"id"`
	Object  string `json:"object"`
	Deleted bool   `json:"deleted"`
}

type RemoveContactResponse

type RemoveContactResponse struct {
	Id      string `json:"id"`
	Object  string `json:"object"`
	Deleted bool   `json:"deleted"`
}

type RemoveContactSegmentRequest

type RemoveContactSegmentRequest struct {
	SegmentId string `json:"segment_id"`
	ContactId string `json:"contact_id,omitempty"`
	Email     string `json:"email,omitempty"`
}

type RemoveContactSegmentResponse

type RemoveContactSegmentResponse struct {
	Id      string `json:"id"`
	Object  string `json:"object"`
	Deleted bool   `json:"deleted"`
}

type RemoveInboxDraftResponse added in v4.9.0

type RemoveInboxDraftResponse struct {
	Object  string `json:"object"`
	Id      string `json:"id"`
	Deleted bool   `json:"deleted"`
}

type RemoveInboxLabelResponse added in v4.9.0

type RemoveInboxLabelResponse struct {
	Object  string `json:"object"`
	Id      string `json:"id"`
	Deleted bool   `json:"deleted"`
}

type RemoveInboxResponse added in v4.9.0

type RemoveInboxResponse struct {
	Object  string `json:"object"`
	Id      string `json:"id"`
	Deleted bool   `json:"deleted"`
}

type RemoveInboxThreadResponse added in v4.9.0

type RemoveInboxThreadResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
	// Deleted is true when this call moved the thread to trash. False when the thread was already
	// there.
	Deleted bool `json:"deleted"`
}

type RemoveSegmentResponse

type RemoveSegmentResponse struct {
	Id      string `json:"id"`
	Object  string `json:"object"`
	Deleted bool   `json:"deleted"`
}

type RemoveSuppressionResponse

type RemoveSuppressionResponse struct {
	Object  string `json:"object"`
	Id      string `json:"id"`
	Deleted bool   `json:"deleted"`
}

type RemoveTemplateResponse

type RemoveTemplateResponse struct {
	Object  string `json:"object"`
	Id      string `json:"id"`
	Deleted bool   `json:"deleted"`
}

RemoveTemplateResponse is the response from removing a template

type RemoveTopicResponse

type RemoveTopicResponse struct {
	Object  string `json:"object"`
	Id      string `json:"id"`
	Deleted bool   `json:"deleted"`
}

RemoveTopicResponse is the response from removing a topic

type ReplayWebhookEventResponse added in v4.3.0

type ReplayWebhookEventResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
}

ReplayWebhookEventResponse represents the response from replaying a webhook event.

type ReplyInboxThreadEmailOptions added in v4.9.0

type ReplyInboxThreadEmailOptions struct {
	// IdempotencyKey is a unique key for the request, so the reply is sent only once. 1 to 256
	// characters. A retry with the same key within 24 hours returns the first successful (2xx)
	// response, with the `idempotent-replayed: true` header. A failed request is not stored, so it
	// can be retried with the same key. Reusing the key with a different body, or while the first
	// request is still running, returns a 409.
	// https://resend.com/docs/dashboard/emails/idempotency-keys
	IdempotencyKey string `json:"idempotency_key,omitempty"`
}

ReplyInboxThreadEmailOptions is the additional options struct for the Inboxes.Threads.Emails.Reply call.

func (ReplyInboxThreadEmailOptions) GetIdempotencyKey added in v4.9.0

func (o ReplyInboxThreadEmailOptions) GetIdempotencyKey() string

GetIdempotencyKey returns the idempotency key for the Inboxes.Threads.Emails.Reply request.

type ReplyInboxThreadEmailRequest added in v4.9.0

type ReplyInboxThreadEmailRequest struct {
	// Cc holds CC recipients. Without ReplyAll, the reply copies only these addresses. With
	// ReplyAll, these addresses are merged with the copied recipients, without duplicates. Cc and
	// Bcc combined must be fewer than 50 addresses. After the `to` recipients are added, the reply
	// cannot exceed 50 recipients.
	Cc []string `json:"cc,omitempty"`
	// Bcc holds BCC recipients. BCC recipients of the original message are never copied.
	Bcc  []string `json:"bcc,omitempty"`
	Html string   `json:"html,omitempty"`
	Text string   `json:"text,omitempty"`
	// Subject of the reply. It cannot contain a line break. When omitted, the thread subject is
	// used, prefixed with `Re:` if it does not already start with it.
	Subject string `json:"subject,omitempty"`
	// ReplyAll replies to everyone on the original message. For a message the inbox received, the
	// reply goes to its Reply-To addresses, or to its sender when it has none, and copies the other
	// addresses of its `To` header and its `cc` recipients in `cc`. For a message the inbox sent,
	// the reply goes to that message's Reply-To addresses when they are not the inbox address,
	// otherwise to its `to` recipients, and copies its `cc` recipients. The inbox address is always
	// excluded, and duplicates are removed.
	ReplyAll bool `json:"reply_all,omitempty"`
	// Attachments are files to attach, as on Emails.Send. Each one needs Content or Path. The
	// Content of all files can total at most 25 MB. A Path file does not count toward the 25 MB,
	// because it is fetched when the email is sent. An empty file, a blocked file type, or a Path
	// that is not an http or https URL or that points to localhost returns a 422.
	Attachments []*Attachment `json:"attachments,omitempty"`
	// Headers are custom headers to add to the email. The In-Reply-To, References and Reply-To
	// headers are set by Resend and cannot be set here. Sending one of them, in any letter case,
	// returns a 422. Header names cannot be empty, and names and values cannot contain line breaks
	// or null characters, or the request returns a 422.
	Headers map[string]string `json:"headers,omitempty"`
}

ReplyInboxThreadEmailRequest contains params for replying to a thread email. At least one of Html or Text must contain more than whitespace.

type ReplyInboxThreadEmailResponse added in v4.9.0

type ReplyInboxThreadEmailResponse struct {
	// Id is the ID of the sent email. Use it with the emails methods.
	Id string `json:"id"`
}

type ResendError added in v4.11.0

type ResendError struct {
	// StatusCode is the HTTP response status, regardless of the response body.
	StatusCode int `json:"statusCode"`
	// Name is the API error name, when available.
	Name string `json:"name"`
	// Message is the API error message or a fallback for an unreadable body.
	Message string `json:"message"`
}

ResendError represents an API error other than a rate limit error. Use errors.As to inspect it. HTTP 429 responses return *RateLimitError instead.

func (*ResendError) Error added in v4.11.0

func (e *ResendError) Error() string

Error implements the error interface.

type RevokeOAuthGrantResponse

type RevokeOAuthGrantResponse struct {
	Object        string  `json:"object"`
	Id            string  `json:"id"`
	RevokedAt     *string `json:"revoked_at"`
	RevokedReason *string `json:"revoked_reason"`
}

type RotateWebhookSigningSecretResponse added in v4.4.0

type RotateWebhookSigningSecretResponse struct {
	Object        string `json:"object"`
	Id            string `json:"id"`
	SigningSecret string `json:"signing_secret"`
}

RotateWebhookSigningSecretResponse represents the response from rotating a webhook signing secret

type SearchInboxThreadsOptions added in v4.9.0

type SearchInboxThreadsOptions struct {
	// Query is free text to search for in the subject, body, sender, recipients, and attachment
	// names. Every word must match. Wrap words in double quotes to match an exact phrase. Start a
	// word or quoted phrase with `-` to exclude it. Max 256 characters and 32 words.
	Query string
	// From holds senders. Each value matches part of the sender's address or name, without case.
	// Returns threads that match any of them. Up to 20 values.
	From []string
	// To holds recipients, matched the same way as From. Up to 20 values.
	To []string
	// Cc holds CC recipients, matched the same way as From. Up to 20 values.
	Cc []string
	// Bcc holds BCC recipients, matched the same way as From. Up to 20 values.
	Bcc []string
	// HasAttachment set to true matches emails with an attachment. False matches emails without
	// one.
	HasAttachment *bool
	// StartDate matches emails sent on or after this date. Accepts a date like `2026-09-01` or an
	// ISO 8601 timestamp, in UTC unless the timestamp has an offset.
	StartDate string
	// EndDate matches emails sent on or before this date. Same formats as StartDate. A date covers
	// that whole day. A timestamp is used as given.
	EndDate string
	Folders []InboxFolder
	Labels  []string
	Read    *bool
	Limit   *int
	After   *string
	Before  *string
}

SearchInboxThreadsOptions contains the search terms, filters and pagination for searching threads. Different parameters combine, so a thread must match all of them. Folders, Labels and Read apply to the thread. Query, From, To, Cc, Bcc, HasAttachment, StartDate and EndDate must all match the same email in the thread. When any of these email filters is set, the matching email must itself be in one of Folders. For sent, that means an email the inbox sent.

type SearchInboxThreadsResponse added in v4.9.0

type SearchInboxThreadsResponse struct {
	Object  string `json:"object"`
	HasMore bool   `json:"has_more"`
	// Data holds the matching threads, most recently active first.
	Data []InboxThreadSearchResult `json:"data"`
}

type Segment

type Segment struct {
	Id        string `json:"id"`
	Name      string `json:"name"`
	Object    string `json:"object"`
	CreatedAt string `json:"created_at"`
}

type SegmentsSvc

type SegmentsSvc interface {
	CreateWithContext(ctx context.Context, params *CreateSegmentRequest) (CreateSegmentResponse, error)
	Create(params *CreateSegmentRequest) (CreateSegmentResponse, error)
	ListWithOptions(ctx context.Context, options *ListOptions) (ListSegmentsResponse, error)
	ListWithContext(ctx context.Context) (ListSegmentsResponse, error)
	List() (ListSegmentsResponse, error)
	GetWithContext(ctx context.Context, segmentId string) (Segment, error)
	Get(segmentId string) (Segment, error)
	UpdateWithContext(ctx context.Context, segmentId string, params *UpdateSegmentRequest) (UpdateSegmentResponse, error)
	Update(segmentId string, params *UpdateSegmentRequest) (UpdateSegmentResponse, error)
	RemoveWithContext(ctx context.Context, segmentId string) (RemoveSegmentResponse, error)
	Remove(segmentId string) (RemoveSegmentResponse, error)
}

type SegmentsSvcImpl

type SegmentsSvcImpl struct {
	// contains filtered or unexported fields
}

func (*SegmentsSvcImpl) Create

Create creates a new Segment entry based on the given params https://resend.com/docs/api-reference/segments/create-segment

func (*SegmentsSvcImpl) CreateWithContext

func (s *SegmentsSvcImpl) CreateWithContext(ctx context.Context, params *CreateSegmentRequest) (CreateSegmentResponse, error)

CreateWithContext creates a new Segment entry based on the given params https://resend.com/docs/api-reference/segments/create-segment

func (*SegmentsSvcImpl) Get

func (s *SegmentsSvcImpl) Get(segmentId string) (Segment, error)

Get Retrieve a single segment. https://resend.com/docs/api-reference/segments/get-segment

func (*SegmentsSvcImpl) GetWithContext

func (s *SegmentsSvcImpl) GetWithContext(ctx context.Context, segmentId string) (Segment, error)

GetWithContext Retrieve a single segment. https://resend.com/docs/api-reference/segments/get-segment

func (*SegmentsSvcImpl) List

List returns the list of all segments https://resend.com/docs/api-reference/segments/list-segments

func (*SegmentsSvcImpl) ListWithContext

func (s *SegmentsSvcImpl) ListWithContext(ctx context.Context) (ListSegmentsResponse, error)

ListWithContext returns the list of all segments https://resend.com/docs/api-reference/segments/list-segments

func (*SegmentsSvcImpl) ListWithOptions

func (s *SegmentsSvcImpl) ListWithOptions(ctx context.Context, options *ListOptions) (ListSegmentsResponse, error)

ListWithOptions returns the list of all segments with pagination options https://resend.com/docs/api-reference/segments/list-segments

func (*SegmentsSvcImpl) Remove

func (s *SegmentsSvcImpl) Remove(segmentId string) (RemoveSegmentResponse, error)

Remove removes a given segment entry by id https://resend.com/docs/api-reference/segments/delete-segment

func (*SegmentsSvcImpl) RemoveWithContext

func (s *SegmentsSvcImpl) RemoveWithContext(ctx context.Context, segmentId string) (RemoveSegmentResponse, error)

RemoveWithContext removes a given segment by id https://resend.com/docs/api-reference/segments/delete-segment

func (*SegmentsSvcImpl) Update added in v4.1.0

func (s *SegmentsSvcImpl) Update(segmentId string, params *UpdateSegmentRequest) (UpdateSegmentResponse, error)

Update updates a segment by id https://resend.com/docs/api-reference/segments/update-segment

func (*SegmentsSvcImpl) UpdateWithContext added in v4.1.0

func (s *SegmentsSvcImpl) UpdateWithContext(ctx context.Context, segmentId string, params *UpdateSegmentRequest) (UpdateSegmentResponse, error)

UpdateWithContext updates a segment by id https://resend.com/docs/api-reference/segments/update-segment

type SendBroadcastRequest

type SendBroadcastRequest struct {
	BroadcastId string `json:"broadcast_id"`

	//Schedule email to be sent later. The date should be in language natural (e.g.: in 1 min)
	// or ISO 8601 format (e.g: 2024-08-05T11:52:01.858Z).
	ScheduledAt string `json:"scheduled_at"`
}

type SendBroadcastResponse

type SendBroadcastResponse struct {
	Id string `json:"id"`
}

type SendEmailOptions

type SendEmailOptions struct {
	IdempotencyKey string `json:"idempotency_key,omitempty"`
}

func (SendEmailOptions) GetIdempotencyKey

func (o SendEmailOptions) GetIdempotencyKey() string

type SendEmailRequest

type SendEmailRequest struct {
	From        string            `json:"from"`
	To          []string          `json:"to"`
	Subject     string            `json:"subject"`
	Bcc         []string          `json:"bcc,omitempty"`
	Cc          []string          `json:"cc,omitempty"`
	ReplyTo     string            `json:"reply_to,omitempty"`
	Html        string            `json:"html,omitempty"`
	Text        string            `json:"text,omitempty"`
	Tags        []Tag             `json:"tags,omitempty"`
	Attachments []*Attachment     `json:"attachments,omitempty"`
	Headers     map[string]string `json:"headers,omitempty"`
	ScheduledAt string            `json:"scheduled_at,omitempty"`
	Template    *EmailTemplate    `json:"template,omitempty"`
	TopicId     string            `json:"topic_id,omitempty"`
}

SendEmailRequest is the request object for the Send call.

See also https://resend.com/docs/api-reference/emails/send-email

type SendEmailResponse

type SendEmailResponse struct {
	Id string `json:"id"`
}

SendEmailResponse is the response from the Send call.

type SendEventRequest

type SendEventRequest struct {
	Event     string         `json:"event"`
	ContactId string         `json:"contact_id,omitempty"`
	Email     string         `json:"email,omitempty"`
	Payload   map[string]any `json:"payload,omitempty"`
}

type SendEventResponse

type SendEventResponse struct {
	Object string `json:"object"`
	Event  string `json:"event"`
}

type SendInboxDraftOptions added in v4.9.0

type SendInboxDraftOptions struct {
	// IdempotencyKey is a unique key for the request, so the draft is sent only once. 1 to 256
	// characters. A retry with the same key within 24 hours returns the first successful (2xx)
	// response, with the `idempotent-replayed: true` header. A failed request is not stored, so it
	// can be retried with the same key. Reusing the key with a different body, or while the first
	// request is still running, returns a 409.
	// https://resend.com/docs/dashboard/emails/idempotency-keys
	IdempotencyKey string `json:"idempotency_key,omitempty"`
}

SendInboxDraftOptions is the additional options struct for the Inboxes.Drafts.Send call.

func (SendInboxDraftOptions) GetIdempotencyKey added in v4.9.0

func (o SendInboxDraftOptions) GetIdempotencyKey() string

GetIdempotencyKey returns the idempotency key for the Inboxes.Drafts.Send request.

type SendInboxDraftRequest added in v4.9.0

type SendInboxDraftRequest struct {
	// Headers are custom headers to add to the email. The In-Reply-To, References and Reply-To
	// headers are set by Resend and cannot be set here. Sending one of them, in any letter case,
	// returns a 422. Header names cannot be empty, and names and values cannot contain line breaks
	// or null characters, or the request returns a 422.
	Headers map[string]string `json:"headers,omitempty"`
}

SendInboxDraftRequest contains the optional params for sending a draft. Its only field is Headers.

type SendInboxDraftResponse added in v4.9.0

type SendInboxDraftResponse struct {
	// Id is the ID of the sent email. Use it with the emails methods.
	Id string `json:"id"`
}

type SetInboxThreadLabelsRequest added in v4.9.0

type SetInboxThreadLabelsRequest struct {
	// Labels are the IDs of the labels the thread carries after the change. Up to 100 IDs, each a
	// label of the inbox. A nil or empty slice takes every label off the thread.
	Labels []string `json:"labels"`
}

SetInboxThreadLabelsRequest contains params for replacing the labels of a thread.

type ShareEmailRequest

type ShareEmailRequest struct {
	ExpiresIn string `json:"expires_in,omitempty"`
}

ShareEmailRequest is the request object for the Share call.

type ShareEmailResponse

type ShareEmailResponse struct {
	Id     string `json:"id"`
	Object string `json:"object"`
	Url    string `json:"url"`
}

ShareEmailResponse is the response from the Share call.

type StopAutomationResponse

type StopAutomationResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
	Status string `json:"status"`
}

type Suppression

type Suppression struct {
	Object string            `json:"object"`
	Id     string            `json:"id"`
	Email  string            `json:"email"`
	Origin SuppressionOrigin `json:"origin"`
	// SourceId identifies the event that caused the suppression, such as the email that
	// bounced or complained. It is null for manual suppressions.
	SourceId  *string `json:"source_id"`
	CreatedAt string  `json:"created_at"`
}

Suppression is a suppressed email address as returned by Get.

type SuppressionListEntry

type SuppressionListEntry struct {
	Id     string            `json:"id"`
	Email  string            `json:"email"`
	Origin SuppressionOrigin `json:"origin"`
	// SourceId identifies the event that caused the suppression, such as the email that
	// bounced or complained. It is null for manual suppressions.
	SourceId  *string `json:"source_id"`
	CreatedAt string  `json:"created_at"`
}

SuppressionListEntry is a suppressed email address as returned by List. It has no Object field because the list endpoint does not send one; only Get does.

type SuppressionOrigin

type SuppressionOrigin = string
const (
	SuppressionOriginBounce    SuppressionOrigin = "bounce"
	SuppressionOriginComplaint SuppressionOrigin = "complaint"
	SuppressionOriginManual    SuppressionOrigin = "manual"
)

type SuppressionsBatchSvcImpl

type SuppressionsBatchSvcImpl struct {
	// contains filtered or unexported fields
}

func (*SuppressionsBatchSvcImpl) Add

Add suppresses up to 100 email addresses at once. The API lowercases, trims and dedupes the addresses, and upserts them, so already-suppressed addresses succeed and return their existing IDs. The returned data can therefore be shorter than Emails. https://resend.com/docs/api-reference/suppressions/add-suppressions

func (*SuppressionsBatchSvcImpl) AddWithContext

AddWithContext suppresses up to 100 email addresses at once with context. The API lowercases, trims and dedupes the addresses, and upserts them, so already-suppressed addresses succeed and return their existing IDs. The returned data can therefore be shorter than Emails. https://resend.com/docs/api-reference/suppressions/add-suppressions

func (*SuppressionsBatchSvcImpl) Remove

Remove removes up to 100 suppressions at once, by email address or by ID. Unlike the single Remove, identifiers that are not suppressed are not an error: the returned data only covers the entries that were actually deleted. https://resend.com/docs/api-reference/suppressions/remove-suppressions

func (*SuppressionsBatchSvcImpl) RemoveWithContext

RemoveWithContext removes up to 100 suppressions at once with context, by email address or by ID. Unlike the single RemoveWithContext, identifiers that are not suppressed are not an error: the returned data only covers the entries that were actually deleted. https://resend.com/docs/api-reference/suppressions/remove-suppressions

type SuppressionsSvc

type SuppressionsSvc interface {
	Add(params *AddSuppressionRequest) (AddSuppressionResponse, error)
	AddWithContext(ctx context.Context, params *AddSuppressionRequest) (AddSuppressionResponse, error)
	List(options *ListSuppressionsOptions) (ListSuppressionsResponse, error)
	ListWithContext(ctx context.Context, options *ListSuppressionsOptions) (ListSuppressionsResponse, error)
	Get(idOrEmail string) (Suppression, error)
	GetWithContext(ctx context.Context, idOrEmail string) (Suppression, error)
	Remove(idOrEmail string) (RemoveSuppressionResponse, error)
	RemoveWithContext(ctx context.Context, idOrEmail string) (RemoveSuppressionResponse, error)
}

type SuppressionsSvcImpl

type SuppressionsSvcImpl struct {
	Batch SuppressionsBatchSvc
	// contains filtered or unexported fields
}

func (*SuppressionsSvcImpl) Add

Add suppresses an email address. The API lowercases and trims the address, and the call is an upsert: re-adding an already-suppressed address succeeds and returns the existing ID. https://resend.com/docs/api-reference/suppressions/add-suppression

func (*SuppressionsSvcImpl) AddWithContext

AddWithContext suppresses an email address with context. The API lowercases and trims the address, and the call is an upsert: re-adding an already-suppressed address succeeds and returns the existing ID. https://resend.com/docs/api-reference/suppressions/add-suppression

func (*SuppressionsSvcImpl) Get

func (s *SuppressionsSvcImpl) Get(idOrEmail string) (Suppression, error)

Get retrieves a single suppression. The idOrEmail param can be either a suppression ID or an email address. An unknown identifier returns a 404 "Suppression not found" error. https://resend.com/docs/api-reference/suppressions/get-suppression

func (*SuppressionsSvcImpl) GetWithContext

func (s *SuppressionsSvcImpl) GetWithContext(ctx context.Context, idOrEmail string) (Suppression, error)

GetWithContext retrieves a single suppression with context. The idOrEmail param can be either a suppression ID or an email address. An unknown identifier returns a 404 "Suppression not found" error. https://resend.com/docs/api-reference/suppressions/get-suppression

func (*SuppressionsSvcImpl) List

List retrieves a list of suppressions. https://resend.com/docs/api-reference/suppressions/list-suppressions

func (*SuppressionsSvcImpl) ListWithContext

ListWithContext retrieves a list of suppressions with context. https://resend.com/docs/api-reference/suppressions/list-suppressions

func (*SuppressionsSvcImpl) Remove

Remove removes a single suppression. The idOrEmail param can be either a suppression ID or an email address. An unknown identifier returns a 404 "Suppression not found" error. https://resend.com/docs/api-reference/suppressions/remove-suppression

func (*SuppressionsSvcImpl) RemoveWithContext

func (s *SuppressionsSvcImpl) RemoveWithContext(ctx context.Context, idOrEmail string) (RemoveSuppressionResponse, error)

RemoveWithContext removes a single suppression with context. The idOrEmail param can be either a suppression ID or an email address. An unknown identifier returns a 404 "Suppression not found" error. https://resend.com/docs/api-reference/suppressions/remove-suppression

type Tag

type Tag struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Tags are used to define custom metadata for emails

type Template

type Template struct {
	Object      string                      `json:"object"`
	Id          string                      `json:"id"`
	Alias       string                      `json:"alias"`
	Name        string                      `json:"name"`
	CreatedAt   string                      `json:"created_at"`
	UpdatedAt   string                      `json:"updated_at"`
	Status      string                      `json:"status"`
	PublishedAt string                      `json:"published_at"`
	From        string                      `json:"from"`
	Subject     string                      `json:"subject"`
	ReplyTo     any                         `json:"reply_to"` // string, []string, or null
	Html        string                      `json:"html"`
	Text        string                      `json:"text"`
	Variables   []*TemplateVariableResponse `json:"variables"`
}

Template represents a full template object returned by the Get endpoint

type TemplateListItem

type TemplateListItem struct {
	Id          string  `json:"id"`
	Name        string  `json:"name"`
	Status      string  `json:"status"`
	PublishedAt *string `json:"published_at"`
	CreatedAt   string  `json:"created_at"`
	UpdatedAt   string  `json:"updated_at"`
	Alias       string  `json:"alias"`
}

TemplateListItem represents a template in a list response

type TemplateVariable

type TemplateVariable struct {
	Key           string       `json:"key"`
	Type          VariableType `json:"type"`
	FallbackValue any          `json:"fallback_value,omitempty"`
}

TemplateVariable represents a variable in a template Important: - All variables used in the template HTML (e.g., {{{NAME}}}) must be declared in the Variables array

type TemplateVariableResponse

type TemplateVariableResponse struct {
	Id            string       `json:"id"`
	Key           string       `json:"key"`
	Type          VariableType `json:"type"`
	FallbackValue any          `json:"fallback_value"`
	CreatedAt     string       `json:"created_at"`
	UpdatedAt     string       `json:"updated_at"`
}

TemplateVariableResponse represents a variable in a template response (with additional fields)

type TemplatesSvc

type TemplatesSvc interface {
	CreateWithContext(ctx context.Context, params *CreateTemplateRequest) (*CreateTemplateResponse, error)
	Create(params *CreateTemplateRequest) (*CreateTemplateResponse, error)
	GetWithContext(ctx context.Context, identifier string) (*Template, error)
	Get(identifier string) (*Template, error)
	ListWithContext(ctx context.Context, options *ListOptions) (*ListTemplatesResponse, error)
	List(options *ListOptions) (*ListTemplatesResponse, error)
	UpdateWithContext(ctx context.Context, identifier string, params *UpdateTemplateRequest) (*UpdateTemplateResponse, error)
	Update(identifier string, params *UpdateTemplateRequest) (*UpdateTemplateResponse, error)
	PublishWithContext(ctx context.Context, identifier string) (*PublishTemplateResponse, error)
	Publish(identifier string) (*PublishTemplateResponse, error)
	DuplicateWithContext(ctx context.Context, identifier string) (*DuplicateTemplateResponse, error)
	Duplicate(identifier string) (*DuplicateTemplateResponse, error)
	RemoveWithContext(ctx context.Context, identifier string) (*RemoveTemplateResponse, error)
	Remove(identifier string) (*RemoveTemplateResponse, error)
}

TemplatesSvc handles operations for templates

type TemplatesSvcImpl

type TemplatesSvcImpl struct {
	// contains filtered or unexported fields
}

TemplatesSvcImpl is the implementation of the TemplatesSvc interface

func (*TemplatesSvcImpl) Create

Create creates a new template with the given parameters https://resend.com/docs/api-reference/templates/create-template

func (*TemplatesSvcImpl) CreateWithContext

func (s *TemplatesSvcImpl) CreateWithContext(ctx context.Context, params *CreateTemplateRequest) (*CreateTemplateResponse, error)

CreateWithContext creates a new template with the given parameters https://resend.com/docs/api-reference/templates/create-template

func (*TemplatesSvcImpl) Duplicate

func (s *TemplatesSvcImpl) Duplicate(identifier string) (*DuplicateTemplateResponse, error)

Duplicate duplicates a template by ID or alias https://resend.com/docs/api-reference/templates/duplicate-template

func (*TemplatesSvcImpl) DuplicateWithContext

func (s *TemplatesSvcImpl) DuplicateWithContext(ctx context.Context, identifier string) (*DuplicateTemplateResponse, error)

DuplicateWithContext duplicates a template by ID or alias https://resend.com/docs/api-reference/templates/duplicate-template

func (*TemplatesSvcImpl) Get

func (s *TemplatesSvcImpl) Get(identifier string) (*Template, error)

Get retrieves a template by ID or alias https://resend.com/docs/api-reference/templates/get-template

func (*TemplatesSvcImpl) GetWithContext

func (s *TemplatesSvcImpl) GetWithContext(ctx context.Context, identifier string) (*Template, error)

GetWithContext retrieves a template by ID or alias https://resend.com/docs/api-reference/templates/get-template

func (*TemplatesSvcImpl) List

List retrieves a list of templates with pagination options https://resend.com/docs/api-reference/templates/list-templates

func (*TemplatesSvcImpl) ListWithContext

func (s *TemplatesSvcImpl) ListWithContext(ctx context.Context, options *ListOptions) (*ListTemplatesResponse, error)

ListWithContext retrieves a list of templates with pagination options https://resend.com/docs/api-reference/templates/list-templates

func (*TemplatesSvcImpl) Publish

func (s *TemplatesSvcImpl) Publish(identifier string) (*PublishTemplateResponse, error)

Publish publishes a template by ID or alias https://resend.com/docs/api-reference/templates/publish-template

func (*TemplatesSvcImpl) PublishWithContext

func (s *TemplatesSvcImpl) PublishWithContext(ctx context.Context, identifier string) (*PublishTemplateResponse, error)

PublishWithContext publishes a template by ID or alias https://resend.com/docs/api-reference/templates/publish-template

func (*TemplatesSvcImpl) Remove

func (s *TemplatesSvcImpl) Remove(identifier string) (*RemoveTemplateResponse, error)

Remove removes a template by ID or alias https://resend.com/docs/api-reference/templates/delete-template

func (*TemplatesSvcImpl) RemoveWithContext

func (s *TemplatesSvcImpl) RemoveWithContext(ctx context.Context, identifier string) (*RemoveTemplateResponse, error)

RemoveWithContext removes a template by ID or alias https://resend.com/docs/api-reference/templates/delete-template

func (*TemplatesSvcImpl) Update

func (s *TemplatesSvcImpl) Update(identifier string, params *UpdateTemplateRequest) (*UpdateTemplateResponse, error)

Update updates a template by ID or alias https://resend.com/docs/api-reference/templates/update-template

func (*TemplatesSvcImpl) UpdateWithContext

func (s *TemplatesSvcImpl) UpdateWithContext(ctx context.Context, identifier string, params *UpdateTemplateRequest) (*UpdateTemplateResponse, error)

UpdateWithContext updates a template by ID or alias https://resend.com/docs/api-reference/templates/update-template

type TlsOption

type TlsOption = string
const (
	Enforced      TlsOption = "enforced"
	Opportunistic TlsOption = "opportunistic"
)

type Topic

type Topic struct {
	Id                  string              `json:"id"`
	Name                string              `json:"name"`
	Description         string              `json:"description"`
	DefaultSubscription DefaultSubscription `json:"default_subscription"`
	CreatedAt           string              `json:"created_at"`
}

Topic represents a full topic object

type TopicSubscriptionUpdate

type TopicSubscriptionUpdate struct {
	Id           string `json:"id"`
	Subscription string `json:"subscription"`
}

TopicSubscriptionUpdate represents a single topic subscription update

type TopicsSvc

type TopicsSvc interface {
	CreateWithContext(ctx context.Context, params *CreateTopicRequest) (*CreateTopicResponse, error)
	Create(params *CreateTopicRequest) (*CreateTopicResponse, error)
	GetWithContext(ctx context.Context, topicId string) (*Topic, error)
	Get(topicId string) (*Topic, error)
	ListWithContext(ctx context.Context, options *ListOptions) (*ListTopicsResponse, error)
	List(options *ListOptions) (*ListTopicsResponse, error)
	UpdateWithContext(ctx context.Context, topicId string, params *UpdateTopicRequest) (*UpdateTopicResponse, error)
	Update(topicId string, params *UpdateTopicRequest) (*UpdateTopicResponse, error)
	RemoveWithContext(ctx context.Context, topicId string) (*RemoveTopicResponse, error)
	Remove(topicId string) (*RemoveTopicResponse, error)
}

TopicsSvc handles operations for topics

type TopicsSvcImpl

type TopicsSvcImpl struct {
	// contains filtered or unexported fields
}

TopicsSvcImpl is the implementation of the TopicsSvc interface

func (*TopicsSvcImpl) Create

Create creates a new topic with the given parameters https://resend.com/docs/api-reference/topics/create-topic

func (*TopicsSvcImpl) CreateWithContext

func (s *TopicsSvcImpl) CreateWithContext(ctx context.Context, params *CreateTopicRequest) (*CreateTopicResponse, error)

CreateWithContext creates a new topic with the given parameters https://resend.com/docs/api-reference/topics/create-topic

func (*TopicsSvcImpl) Get

func (s *TopicsSvcImpl) Get(topicId string) (*Topic, error)

Get retrieves a topic by ID https://resend.com/docs/api-reference/topics/get-topic

func (*TopicsSvcImpl) GetWithContext

func (s *TopicsSvcImpl) GetWithContext(ctx context.Context, topicId string) (*Topic, error)

GetWithContext retrieves a topic by ID https://resend.com/docs/api-reference/topics/get-topic

func (*TopicsSvcImpl) List

func (s *TopicsSvcImpl) List(options *ListOptions) (*ListTopicsResponse, error)

List retrieves a list of topics with pagination options https://resend.com/docs/api-reference/topics/list-topics

func (*TopicsSvcImpl) ListWithContext

func (s *TopicsSvcImpl) ListWithContext(ctx context.Context, options *ListOptions) (*ListTopicsResponse, error)

ListWithContext retrieves a list of topics with pagination options https://resend.com/docs/api-reference/topics/list-topics

func (*TopicsSvcImpl) Remove

func (s *TopicsSvcImpl) Remove(topicId string) (*RemoveTopicResponse, error)

Remove removes a topic by ID https://resend.com/docs/api-reference/topics/delete-topic

func (*TopicsSvcImpl) RemoveWithContext

func (s *TopicsSvcImpl) RemoveWithContext(ctx context.Context, topicId string) (*RemoveTopicResponse, error)

RemoveWithContext removes a topic by ID https://resend.com/docs/api-reference/topics/delete-topic

func (*TopicsSvcImpl) Update

func (s *TopicsSvcImpl) Update(topicId string, params *UpdateTopicRequest) (*UpdateTopicResponse, error)

Update updates a topic by ID https://resend.com/docs/api-reference/topics/update-topic

func (*TopicsSvcImpl) UpdateWithContext

func (s *TopicsSvcImpl) UpdateWithContext(ctx context.Context, topicId string, params *UpdateTopicRequest) (*UpdateTopicResponse, error)

UpdateWithContext updates a topic by ID https://resend.com/docs/api-reference/topics/update-topic

type UpdateApiKeyRequest

type UpdateApiKeyRequest struct {
	Name string `json:"name"`
}

type UpdateApiKeyResponse

type UpdateApiKeyResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
}

type UpdateAutomationRequest

type UpdateAutomationRequest struct {
	Name        string                 `json:"name,omitempty"`
	Status      AutomationStatus       `json:"status,omitempty"`
	Steps       []AutomationStep       `json:"steps,omitempty"`
	Connections []AutomationConnection `json:"connections,omitempty"`
}

type UpdateAutomationResponse

type UpdateAutomationResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
}

type UpdateBroadcastRequest

type UpdateBroadcastRequest struct {
	BroadcastId string   `json:"broadcast_id,omitempty"`
	SegmentId   string   `json:"segment_id,omitempty"`
	AudienceId  string   `json:"audience_id,omitempty"` // Deprecated: Use SegmentId instead
	From        string   `json:"from,omitempty"`
	Subject     string   `json:"subject,omitempty"`
	ReplyTo     []string `json:"reply_to,omitempty"`
	Html        string   `json:"html,omitempty"`
	Text        string   `json:"text,omitempty"`
	Name        string   `json:"name,omitempty"`

	// Preview text shown in the recipient's inbox, usually next to or below the subject line.
	PreviewText string `json:"preview_text,omitempty"`

	// The ID of the topic the broadcast is scoped to.
	TopicId string `json:"topic_id,omitempty"`
}

type UpdateBroadcastResponse

type UpdateBroadcastResponse struct {
	Id string `json:"id"`
}

type UpdateContactPropertyRequest

type UpdateContactPropertyRequest struct {
	Id            string `json:"-"`
	FallbackValue any    `json:"fallback_value"`
}

type UpdateContactPropertyResponse

type UpdateContactPropertyResponse struct {
	Id     string `json:"id"`
	Object string `json:"object"`
}

type UpdateContactRequest

type UpdateContactRequest struct {
	Id           string `json:"id"`
	Email        string `json:"email,omitempty"`
	AudienceId   string `json:"audience_id,omitempty"` // Deprecated: Optional, use Segments API for contact organization
	FirstName    string `json:"first_name,omitempty"`
	LastName     string `json:"last_name,omitempty"`
	Unsubscribed bool   `json:"unsubscribed,omitempty"`
	// Properties are custom key-value pairs for global contacts (when audience_id is omitted).
	// NOTE: Currently, the Resend API only accepts string values for properties.
	// Non-string values (numbers, booleans, etc.) will be rejected by the API with a validation error.
	// Example: Properties: map[string]any{"tier": "premium", "age": "30", "active": "true"}
	Properties map[string]any `json:"properties,omitempty"`
	// contains filtered or unexported fields
}

func (UpdateContactRequest) MarshalJSON

func (r UpdateContactRequest) MarshalJSON() ([]byte, error)

Sends `unsubscribed` when it is true or was set via SetUnsubscribed, so a zero-value false doesn't resubscribe contacts on unrelated updates. This is marked to be fixed properly in the next major version, since the actual fix would require a breaking change

func (*UpdateContactRequest) SetUnsubscribed

func (r *UpdateContactRequest) SetUnsubscribed(val bool)

SetUnsubscribed is required to send `unsubscribed: false` (resubscribe). A plain bool can't distinguish an explicit false from an unset field, so a directly assigned false is omitted to avoid resubscribing contacts on unrelated updates. Assigning Unsubscribed = true directly also works. Proper fix (a *bool field) needs a breaking change, so it waits for the next major version.

type UpdateContactResponse

type UpdateContactResponse struct {
	Data  Contact  `json:"data"`
	Error struct{} `json:"error"` // Fix this
}

type UpdateContactTopicsRequest

type UpdateContactTopicsRequest struct {
	Id     string                    `json:"-"`
	Email  string                    `json:"-"`
	Topics []TopicSubscriptionUpdate `json:"topics"`
}

UpdateContactTopicsRequest is the request for updating contact topics

type UpdateContactTopicsResponse

type UpdateContactTopicsResponse struct {
	Id string `json:"id"`
}

UpdateContactTopicsResponse is the response from updating contact topics

type UpdateDomainRequest

type UpdateDomainRequest struct {
	OpenTracking      bool      `json:"open_tracking,omitempty"`
	ClickTracking     bool      `json:"click_tracking,omitempty"`
	Tls               TlsOption `json:"tls,omitempty"`
	TrackingSubdomain string    `json:"tracking_subdomain,omitempty"`
	// contains filtered or unexported fields
}

func (UpdateDomainRequest) MarshalJSON

func (r UpdateDomainRequest) MarshalJSON() ([]byte, error)

func (*UpdateDomainRequest) SetClickTracking

func (r *UpdateDomainRequest) SetClickTracking(val bool)

SetClickTracking explicitly sets the click_tracking field, allowing false to be sent. Setting ClickTracking directly on the struct does not send false due to omitempty.

func (*UpdateDomainRequest) SetOpenTracking

func (r *UpdateDomainRequest) SetOpenTracking(val bool)

SetOpenTracking explicitly sets the open_tracking field, allowing false to be sent. Setting OpenTracking directly on the struct does not send false due to omitempty.

type UpdateEmailRequest

type UpdateEmailRequest struct {
	Id          string `json:"id"`
	ScheduledAt string `json:"scheduled_at"`
}

UpdateEmailRequest is the request object for the Update call.

type UpdateEmailResponse

type UpdateEmailResponse struct {
	Id     string `json:"id"`
	Object string `json:"object"`
}

UpdateEmailResponse is the type that represents the response from the Update call.

type UpdateEventRequest

type UpdateEventRequest struct {
	Schema map[string]string `json:"schema,omitempty"`
}

type UpdateEventResponse

type UpdateEventResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
}

type UpdateInboxAgentRequest added in v4.9.0

type UpdateInboxAgentRequest struct {
	// Instructions the agent follows when it handles the threads of the inbox. Max 4000
	// characters. The API trims it, and the trimmed value must not be empty. Use
	// ClearInstructions to clear the instructions.
	Instructions *string
	// Tone the agent writes in. Use ClearTone to clear the tone.
	Tone *InboxAgentTone
	// Actions replaces the whole set of actions the agent can take. Duplicates are removed. A nil
	// slice is omitted. An empty, non-nil slice disables all actions.
	Actions []InboxAgentAction
	// contains filtered or unexported fields
}

UpdateInboxAgentRequest contains params for updating the agent settings of an inbox. Provide at least one field. Omitted fields keep their current value.

func (*UpdateInboxAgentRequest) ClearInstructions added in v4.9.0

func (r *UpdateInboxAgentRequest) ClearInstructions()

ClearInstructions sends `instructions: null`, which clears the instructions.

func (*UpdateInboxAgentRequest) ClearTone added in v4.9.0

func (r *UpdateInboxAgentRequest) ClearTone()

ClearTone sends `tone: null`, which clears the tone.

func (UpdateInboxAgentRequest) MarshalJSON added in v4.9.0

func (r UpdateInboxAgentRequest) MarshalJSON() ([]byte, error)

type UpdateInboxAgentResponse added in v4.9.0

type UpdateInboxAgentResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
}

type UpdateInboxDraftRequest added in v4.9.0

type UpdateInboxDraftRequest struct {
	// To holds the recipients. Each value can include a friendly name. A nil slice is omitted. An
	// empty, non-nil slice clears it.
	To []string
	// Cc holds the CC recipients. A nil slice is omitted. An empty, non-nil slice clears it.
	Cc []string
	// Bcc holds the BCC recipients. A nil slice is omitted. An empty, non-nil slice clears it.
	Bcc []string
	// Subject is max 2000 characters and must not contain a line break. Use ClearSubject to
	// clear it.
	Subject *string
	// Html is the HTML body. Use ClearHtml to clear it.
	Html *string
	// Text is the plain text body. Use ClearText to clear it.
	Text *string
	// Attachments replaces every attachment on the draft. Each one needs a Filename and either
	// Content with a ContentType, or a Path URL that is downloaded when the request is made. The
	// files on a draft, downloaded ones included, can total at most 25 MB. An empty file, a blocked
	// file type, or a Path that cannot be downloaded returns a 422. A nil slice is omitted and keeps the attachments. An empty, non-nil slice
	// removes them all.
	Attachments []*InboxDraftAttachmentInput
	// contains filtered or unexported fields
}

UpdateInboxDraftRequest contains params for updating a draft. Send at least one of To, Cc, Bcc, Subject, Text, Html or Attachments. Omitted fields are left unchanged. Setting Text or Html replaces the whole body, so the body part you omit becomes null. The merged draft must contain at least one non-empty field, and its combined recipients cannot exceed 50.

func (*UpdateInboxDraftRequest) ClearHtml added in v4.9.0

func (r *UpdateInboxDraftRequest) ClearHtml()

ClearHtml sends `html: null`, which clears the HTML body.

func (*UpdateInboxDraftRequest) ClearSubject added in v4.9.0

func (r *UpdateInboxDraftRequest) ClearSubject()

ClearSubject sends `subject: null`, which clears the subject.

func (*UpdateInboxDraftRequest) ClearText added in v4.9.0

func (r *UpdateInboxDraftRequest) ClearText()

ClearText sends `text: null`, which clears the plain text body.

func (UpdateInboxDraftRequest) MarshalJSON added in v4.9.0

func (r UpdateInboxDraftRequest) MarshalJSON() ([]byte, error)

type UpdateInboxDraftResponse added in v4.9.0

type UpdateInboxDraftResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
}

type UpdateInboxLabelRequest added in v4.9.0

type UpdateInboxLabelRequest struct {
	// Name is a new name for the label. Max 64 characters. The API trims it. It must not match
	// another label on the inbox, compared without case.
	Name string `json:"name,omitempty"`
	// Color is a new color for the label, as a `#RRGGBB` hex color. It is stored in uppercase.
	Color string `json:"color,omitempty"`
}

UpdateInboxLabelRequest contains params for renaming or recoloring a label. Omitted fields keep their current value.

type UpdateInboxLabelResponse added in v4.9.0

type UpdateInboxLabelResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
}

type UpdateInboxRequest added in v4.9.0

type UpdateInboxRequest struct {
	// Name is the new internal name for the inbox. Between 1 and 64 characters after trimming.
	Name string `json:"name,omitempty"`
	// FromName is the name recipients see when mail is sent from this inbox. Max 78 characters. A
	// pointer to an empty string removes it.
	FromName *string `json:"from_name,omitempty"`
}

UpdateInboxRequest contains params for updating an inbox. Provide at least one of Name or FromName.

type UpdateInboxResponse added in v4.9.0

type UpdateInboxResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
}

type UpdateInboxThreadRequest added in v4.9.0

type UpdateInboxThreadRequest struct {
	// Read marks every email in the thread read or unread.
	Read *bool `json:"read,omitempty"`
	// Folder moves the thread to this folder. `sent` is assigned automatically and cannot be set.
	// Moving a thread out of trash restores it and clears its deletion deadline.
	Folder InboxMoveThreadFolder `json:"folder,omitempty"`
}

UpdateInboxThreadRequest contains params for updating a thread. At least one field is required. To change the labels of a thread, use Threads.Labels.

type UpdateSegmentRequest added in v4.1.0

type UpdateSegmentRequest struct {
	Name string `json:"name"`
}

type UpdateSegmentResponse added in v4.1.0

type UpdateSegmentResponse struct {
	Id     string `json:"id"`
	Object string `json:"object"`
}

type UpdateTemplateRequest

type UpdateTemplateRequest struct {
	Name      string              `json:"name,omitempty"`
	Alias     string              `json:"alias,omitempty"`
	From      string              `json:"from,omitempty"`
	Subject   string              `json:"subject,omitempty"`
	ReplyTo   any                 `json:"reply_to,omitempty"` // string or []string
	Html      string              `json:"html,omitempty"`
	Text      string              `json:"text,omitempty"`
	Variables []*TemplateVariable `json:"variables,omitempty"`
}

UpdateTemplateRequest is the request payload for updating a template Important: All variables referenced in Html (e.g., {{{NAME}}}) must be declared in the Variables array, or the API will return a validation error.

type UpdateTemplateResponse

type UpdateTemplateResponse struct {
	Id     string `json:"id"`
	Object string `json:"object"`
}

UpdateTemplateResponse is the response from updating a template

type UpdateTopicRequest

type UpdateTopicRequest struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

UpdateTopicRequest is the request payload for updating a topic Note: default_subscription cannot be changed after creation

type UpdateTopicResponse

type UpdateTopicResponse struct {
	Id string `json:"id"`
}

UpdateTopicResponse is the response from updating a topic

type UpdateWebhookRequest

type UpdateWebhookRequest struct {
	Endpoint *string  `json:"endpoint,omitempty"`
	Events   []string `json:"events,omitempty"`
	Status   *string  `json:"status,omitempty"`
}

UpdateWebhookRequest represents the parameters for updating a webhook

type UpdateWebhookResponse

type UpdateWebhookResponse struct {
	Object string `json:"object"`
	Id     string `json:"id"`
}

UpdateWebhookResponse represents the response from updating a webhook

type Usage added in v4.7.0

type Usage struct {
	Object         string              `json:"object"`
	Emails         UsageEmails         `json:"emails"`
	Contacts       UsageContacts       `json:"contacts"`
	Segments       UsageSegments       `json:"segments"`
	Broadcasts     UsageBroadcasts     `json:"broadcasts"`
	AiCredits      UsageAiCredits      `json:"ai_credits"`
	AutomationRuns UsageAutomationRuns `json:"automation_runs"`
	Domains        UsageDomains        `json:"domains"`
	RateLimit      UsageRateLimit      `json:"rate_limit"`
}

Usage provides the structure for the response from the Get call.

type UsageAiCredits added in v4.7.0

type UsageAiCredits struct {
	Used           int     `json:"used"`
	Limit          *int    `json:"limit"`
	NextIncreaseAt *string `json:"next_increase_at"`
}

type UsageAutomationRuns added in v4.7.0

type UsageAutomationRuns struct {
	Used     int    `json:"used"`
	Limit    int    `json:"limit"`
	ResetsAt string `json:"resets_at"`
}

type UsageBroadcasts added in v4.7.0

type UsageBroadcasts struct {
	Used  int  `json:"used"`
	Limit *int `json:"limit"`
}

type UsageContacts added in v4.7.0

type UsageContacts struct {
	Used  int `json:"used"`
	Limit int `json:"limit"`
}

type UsageDomains added in v4.7.0

type UsageDomains struct {
	Used  int  `json:"used"`
	Limit *int `json:"limit"`
}

type UsageEmails added in v4.7.0

type UsageEmails struct {
	Daily   UsageEmailsPeriod `json:"daily"`
	Monthly UsageEmailsPeriod `json:"monthly"`
}

UsageEmails is the emails usage, broken down by period.

type UsageEmailsPeriod added in v4.7.0

type UsageEmailsPeriod struct {
	Used     int    `json:"used"`
	Limit    *int   `json:"limit"`
	Sent     int    `json:"sent"`
	Received int    `json:"received"`
	ResetsAt string `json:"resets_at"`
}

UsageEmailsPeriod is the usage for emails over a given period (daily or monthly).

type UsageRateLimit added in v4.7.0

type UsageRateLimit struct {
	Limit    int    `json:"limit"`
	Duration string `json:"duration"`
}

UsageRateLimit is the rate limit applied to the caller's API key.

type UsageSegments added in v4.7.0

type UsageSegments struct {
	Used  int  `json:"used"`
	Limit *int `json:"limit"`
}

type UsageSvc added in v4.7.0

type UsageSvc interface {
	GetWithContext(ctx context.Context) (Usage, error)
	Get() (Usage, error)
}

type UsageSvcImpl added in v4.7.0

type UsageSvcImpl struct {
	// contains filtered or unexported fields
}

func (*UsageSvcImpl) Get added in v4.7.0

func (s *UsageSvcImpl) Get() (Usage, error)

Get retrieves the caller's account-level usage and quota data. https://resend.com/docs/api-reference/usage/retrieve-usage

func (*UsageSvcImpl) GetWithContext added in v4.7.0

func (s *UsageSvcImpl) GetWithContext(ctx context.Context) (Usage, error)

GetWithContext retrieves the caller's account-level usage and quota data. https://resend.com/docs/api-reference/usage/retrieve-usage

type VariableType

type VariableType string

VariableType represents the type of a template variable

const (
	VariableTypeString VariableType = "string"
	VariableTypeNumber VariableType = "number"
)

type VerifyWebhookOptions

type VerifyWebhookOptions struct {
	Payload       string         // Raw webhook payload body
	Headers       WebhookHeaders // Webhook headers from the request
	WebhookSecret string         // Signing secret (from webhook creation response)
}

VerifyWebhookOptions represents the parameters for webhook verification

type Webhook

type Webhook struct {
	Object        string   `json:"object"`
	Id            string   `json:"id"`
	CreatedAt     string   `json:"created_at,omitempty"`
	Status        string   `json:"status,omitempty"`
	Endpoint      string   `json:"endpoint,omitempty"`
	Events        []string `json:"events,omitempty"`
	SigningSecret string   `json:"signing_secret,omitempty"`
}

Webhook represents a webhook object

type WebhookEvent added in v4.2.0

type WebhookEvent struct {
	Object        string             `json:"object"`
	Id            string             `json:"id"`
	Type          string             `json:"type"`
	CreatedAt     string             `json:"created_at"`
	Status        WebhookEventStatus `json:"status"`
	NextAttemptAt *string            `json:"next_attempt_at"`
	Payload       map[string]any     `json:"payload"`
}

WebhookEvent represents an event delivered to a webhook.

type WebhookEventAttempt added in v4.2.0

type WebhookEventAttempt struct {
	Id             string `json:"id"`
	HttpStatusCode int    `json:"http_status_code"`
	Response       string `json:"response"`
	SentAt         string `json:"sent_at"`
}

WebhookEventAttempt represents a delivery attempt for a webhook event.

type WebhookEventLog added in v4.2.0

type WebhookEventLog struct {
	Id        string             `json:"id"`
	Type      string             `json:"type"`
	CreatedAt string             `json:"created_at"`
	Status    WebhookEventStatus `json:"status"`
}

WebhookEventLog represents a webhook event in a list response.

type WebhookEventStatus added in v4.2.0

type WebhookEventStatus = string

WebhookEventStatus represents the delivery status of a webhook event.

const (
	// WebhookEventStatusPending indicates that the event is waiting for a delivery attempt.
	WebhookEventStatusPending WebhookEventStatus = "pending"
	// WebhookEventStatusAttempting indicates that the event is currently being delivered.
	WebhookEventStatusAttempting WebhookEventStatus = "attempting"
	// WebhookEventStatusSuccess indicates that the event was delivered successfully.
	WebhookEventStatusSuccess WebhookEventStatus = "success"
	// WebhookEventStatusFailed indicates that the event could not be delivered.
	WebhookEventStatusFailed WebhookEventStatus = "failed"
)

type WebhookHeaders

type WebhookHeaders struct {
	Id        string // svix-id header
	Timestamp string // svix-timestamp header
	Signature string // svix-signature header
}

WebhookHeaders represents the webhook verification headers

type WebhookInList

type WebhookInList struct {
	Id        string   `json:"id"`
	CreatedAt string   `json:"created_at"`
	Status    string   `json:"status"`
	Endpoint  string   `json:"endpoint"`
	Events    []string `json:"events"`
}

WebhookInList represents a webhook in the list response

type WebhooksSvc

type WebhooksSvc interface {
	CreateWithContext(ctx context.Context, params *CreateWebhookRequest) (*CreateWebhookResponse, error)
	Create(params *CreateWebhookRequest) (*CreateWebhookResponse, error)
	GetWithContext(ctx context.Context, webhookId string) (*Webhook, error)
	Get(webhookId string) (*Webhook, error)
	UpdateWithContext(ctx context.Context, webhookId string, params *UpdateWebhookRequest) (*UpdateWebhookResponse, error)
	Update(webhookId string, params *UpdateWebhookRequest) (*UpdateWebhookResponse, error)
	ListWithOptions(ctx context.Context, options *ListOptions) (*ListWebhooksResponse, error)
	ListWithContext(ctx context.Context) (*ListWebhooksResponse, error)
	List() (*ListWebhooksResponse, error)
	ListEventsWithOptions(ctx context.Context, webhookId string, options *ListWebhookEventsOptions) (*ListWebhookEventsResponse, error)
	ListEventsWithContext(ctx context.Context, webhookId string) (*ListWebhookEventsResponse, error)
	ListEvents(webhookId string) (*ListWebhookEventsResponse, error)
	GetEventWithContext(ctx context.Context, webhookId string, eventId string) (*WebhookEvent, error)
	GetEvent(webhookId string, eventId string) (*WebhookEvent, error)
	ReplayEventWithContext(ctx context.Context, webhookId string, eventId string) (*ReplayWebhookEventResponse, error)
	ReplayEvent(webhookId string, eventId string) (*ReplayWebhookEventResponse, error)
	ListEventAttemptsWithOptions(ctx context.Context, webhookId string, eventId string, options *ListWebhookEventAttemptsOptions) (*ListWebhookEventAttemptsResponse, error)
	ListEventAttemptsWithContext(ctx context.Context, webhookId string, eventId string) (*ListWebhookEventAttemptsResponse, error)
	ListEventAttempts(webhookId string, eventId string) (*ListWebhookEventAttemptsResponse, error)
	RotateSigningSecretWithContext(ctx context.Context, webhookId string) (*RotateWebhookSigningSecretResponse, error)
	RotateSigningSecret(webhookId string) (*RotateWebhookSigningSecretResponse, error)
	RemoveWithContext(ctx context.Context, webhookId string) (*DeleteWebhookResponse, error)
	Remove(webhookId string) (*DeleteWebhookResponse, error)
	Verify(options *VerifyWebhookOptions) error
}

WebhooksSvc defines the interface for webhook operations

type WebhooksSvcImpl

type WebhooksSvcImpl struct {
	// contains filtered or unexported fields
}

WebhooksSvcImpl implements the WebhooksSvc interface

func (*WebhooksSvcImpl) Create

Create creates a new webhook

func (*WebhooksSvcImpl) CreateWithContext

func (s *WebhooksSvcImpl) CreateWithContext(ctx context.Context, params *CreateWebhookRequest) (*CreateWebhookResponse, error)

CreateWithContext creates a new webhook with the given context https://resend.com/docs/api-reference/webhooks/create-webhook

func (*WebhooksSvcImpl) Get

func (s *WebhooksSvcImpl) Get(webhookId string) (*Webhook, error)

Get retrieves a webhook by ID

func (*WebhooksSvcImpl) GetEvent added in v4.2.0

func (s *WebhooksSvcImpl) GetEvent(webhookId string, eventId string) (*WebhookEvent, error)

GetEvent retrieves a webhook event by ID.

func (*WebhooksSvcImpl) GetEventWithContext added in v4.2.0

func (s *WebhooksSvcImpl) GetEventWithContext(ctx context.Context, webhookId string, eventId string) (*WebhookEvent, error)

GetEventWithContext retrieves a webhook event by ID with the given context. https://resend.com/docs/api-reference/webhooks/get-event

func (*WebhooksSvcImpl) GetWithContext

func (s *WebhooksSvcImpl) GetWithContext(ctx context.Context, webhookId string) (*Webhook, error)

GetWithContext retrieves a webhook by ID with the given context https://resend.com/docs/api-reference/webhooks/get-webhook

func (*WebhooksSvcImpl) List

List lists all webhooks

func (*WebhooksSvcImpl) ListEventAttempts added in v4.2.0

func (s *WebhooksSvcImpl) ListEventAttempts(webhookId string, eventId string) (*ListWebhookEventAttemptsResponse, error)

ListEventAttempts lists delivery attempts for a webhook event.

func (*WebhooksSvcImpl) ListEventAttemptsWithContext added in v4.2.0

func (s *WebhooksSvcImpl) ListEventAttemptsWithContext(ctx context.Context, webhookId string, eventId string) (*ListWebhookEventAttemptsResponse, error)

ListEventAttemptsWithContext lists delivery attempts for a webhook event with the given context.

func (*WebhooksSvcImpl) ListEventAttemptsWithOptions added in v4.2.0

func (s *WebhooksSvcImpl) ListEventAttemptsWithOptions(ctx context.Context, webhookId string, eventId string, options *ListWebhookEventAttemptsOptions) (*ListWebhookEventAttemptsResponse, error)

ListEventAttemptsWithOptions lists delivery attempts for a webhook event with pagination options. https://resend.com/docs/api-reference/webhooks/list-event-attempts

func (*WebhooksSvcImpl) ListEvents added in v4.2.0

func (s *WebhooksSvcImpl) ListEvents(webhookId string) (*ListWebhookEventsResponse, error)

ListEvents lists webhook events.

func (*WebhooksSvcImpl) ListEventsWithContext added in v4.2.0

func (s *WebhooksSvcImpl) ListEventsWithContext(ctx context.Context, webhookId string) (*ListWebhookEventsResponse, error)

ListEventsWithContext lists webhook events with the given context.

func (*WebhooksSvcImpl) ListEventsWithOptions added in v4.2.0

func (s *WebhooksSvcImpl) ListEventsWithOptions(ctx context.Context, webhookId string, options *ListWebhookEventsOptions) (*ListWebhookEventsResponse, error)

ListEventsWithOptions lists webhook events with pagination options. https://resend.com/docs/api-reference/webhooks/list-events

func (*WebhooksSvcImpl) ListWithContext

func (s *WebhooksSvcImpl) ListWithContext(ctx context.Context) (*ListWebhooksResponse, error)

ListWithContext lists all webhooks with the given context

func (*WebhooksSvcImpl) ListWithOptions

func (s *WebhooksSvcImpl) ListWithOptions(ctx context.Context, options *ListOptions) (*ListWebhooksResponse, error)

ListWithOptions lists all webhooks with pagination options https://resend.com/docs/api-reference/webhooks/list-webhooks

func (*WebhooksSvcImpl) Remove

func (s *WebhooksSvcImpl) Remove(webhookId string) (*DeleteWebhookResponse, error)

Remove deletes a webhook by ID

func (*WebhooksSvcImpl) RemoveWithContext

func (s *WebhooksSvcImpl) RemoveWithContext(ctx context.Context, webhookId string) (*DeleteWebhookResponse, error)

RemoveWithContext deletes a webhook by ID with the given context https://resend.com/docs/api-reference/webhooks/delete-webhook

func (*WebhooksSvcImpl) ReplayEvent added in v4.3.0

func (s *WebhooksSvcImpl) ReplayEvent(webhookId string, eventId string) (*ReplayWebhookEventResponse, error)

ReplayEvent queues one more delivery of a webhook event.

func (*WebhooksSvcImpl) ReplayEventWithContext added in v4.3.0

func (s *WebhooksSvcImpl) ReplayEventWithContext(ctx context.Context, webhookId string, eventId string) (*ReplayWebhookEventResponse, error)

ReplayEventWithContext queues one more delivery of a webhook event with the given context. https://resend.com/docs/api-reference/webhooks/replay-event

func (*WebhooksSvcImpl) RotateSigningSecret added in v4.4.0

func (s *WebhooksSvcImpl) RotateSigningSecret(webhookId string) (*RotateWebhookSigningSecretResponse, error)

RotateSigningSecret rotates the signing secret of a webhook.

func (*WebhooksSvcImpl) RotateSigningSecretWithContext added in v4.4.0

func (s *WebhooksSvcImpl) RotateSigningSecretWithContext(ctx context.Context, webhookId string) (*RotateWebhookSigningSecretResponse, error)

RotateSigningSecretWithContext rotates the signing secret of a webhook with the given context. https://resend.com/docs/api-reference/webhooks/rotate-signing-secret

func (*WebhooksSvcImpl) Update

func (s *WebhooksSvcImpl) Update(webhookId string, params *UpdateWebhookRequest) (*UpdateWebhookResponse, error)

Update updates a webhook

func (*WebhooksSvcImpl) UpdateWithContext

func (s *WebhooksSvcImpl) UpdateWithContext(ctx context.Context, webhookId string, params *UpdateWebhookRequest) (*UpdateWebhookResponse, error)

UpdateWithContext updates a webhook with the given context https://resend.com/docs/api-reference/webhooks/update-webhook

func (*WebhooksSvcImpl) Verify

func (s *WebhooksSvcImpl) Verify(options *VerifyWebhookOptions) error

Verify validates a webhook payload using HMAC-SHA256 signature verification This implements manual verification without external dependencies https://docs.svix.com/receiving/verifying-payloads/how-manual

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址