Documentation
¶
Index ¶
- Constants
- Variables
- func BytesToIntArray(a []byte) []int
- type ApiKey
- type ApiKeysSvc
- type ApiKeysSvcImpl
- func (s *ApiKeysSvcImpl) Create(params *CreateApiKeyRequest) (CreateApiKeyResponse, error)
- func (s *ApiKeysSvcImpl) CreateWithContext(ctx context.Context, params *CreateApiKeyRequest) (CreateApiKeyResponse, error)
- func (s *ApiKeysSvcImpl) List() (ListApiKeysResponse, error)
- func (s *ApiKeysSvcImpl) ListWithContext(ctx context.Context) (ListApiKeysResponse, error)
- func (s *ApiKeysSvcImpl) ListWithOptions(ctx context.Context, options *ListOptions) (ListApiKeysResponse, error)
- func (s *ApiKeysSvcImpl) Remove(apiKeyId string) (bool, error)
- func (s *ApiKeysSvcImpl) RemoveWithContext(ctx context.Context, apiKeyId string) (bool, error)
- type Attachment
- type Audience
- type AudiencesSvc
- type AudiencesSvcImpl
- func (s *AudiencesSvcImpl) Create(params *CreateAudienceRequest) (CreateAudienceResponse, error)
- func (s *AudiencesSvcImpl) CreateWithContext(ctx context.Context, params *CreateAudienceRequest) (CreateAudienceResponse, error)
- func (s *AudiencesSvcImpl) Get(audienceId string) (Audience, error)
- func (s *AudiencesSvcImpl) GetWithContext(ctx context.Context, audienceId string) (Audience, error)
- func (s *AudiencesSvcImpl) List() (ListAudiencesResponse, error)
- func (s *AudiencesSvcImpl) ListWithContext(ctx context.Context) (ListAudiencesResponse, error)
- func (s *AudiencesSvcImpl) ListWithOptions(ctx context.Context, options *ListOptions) (ListAudiencesResponse, error)
- func (s *AudiencesSvcImpl) Remove(audienceId string) (RemoveAudienceResponse, error)
- func (s *AudiencesSvcImpl) RemoveWithContext(ctx context.Context, audienceId string) (RemoveAudienceResponse, error)
- type BatchEmailResponse
- type BatchError
- type BatchSendEmailOptions
- type BatchSvc
- type BatchSvcImpl
- func (s *BatchSvcImpl) Send(params []*SendEmailRequest) (*BatchEmailResponse, error)
- func (s *BatchSvcImpl) SendWithContext(ctx context.Context, params []*SendEmailRequest) (*BatchEmailResponse, error)
- func (s *BatchSvcImpl) SendWithOptions(ctx context.Context, params []*SendEmailRequest, ...) (*BatchEmailResponse, error)
- type BatchValidationMode
- type Broadcast
- type BroadcastsSvc
- type BroadcastsSvcImpl
- func (s *BroadcastsSvcImpl) Create(params *CreateBroadcastRequest) (CreateBroadcastResponse, error)
- func (s *BroadcastsSvcImpl) CreateWithContext(ctx context.Context, params *CreateBroadcastRequest) (CreateBroadcastResponse, error)
- func (s *BroadcastsSvcImpl) Get(broadcastId string) (Broadcast, error)
- func (s *BroadcastsSvcImpl) GetWithContext(ctx context.Context, broadcastId string) (Broadcast, error)
- func (s *BroadcastsSvcImpl) List() (ListBroadcastsResponse, error)
- func (s *BroadcastsSvcImpl) ListWithContext(ctx context.Context) (ListBroadcastsResponse, error)
- func (s *BroadcastsSvcImpl) ListWithOptions(ctx context.Context, options *ListOptions) (ListBroadcastsResponse, error)
- func (s *BroadcastsSvcImpl) Remove(broadcastId string) (RemoveBroadcastResponse, error)
- func (s *BroadcastsSvcImpl) RemoveWithContext(ctx context.Context, broadcastId string) (RemoveBroadcastResponse, error)
- func (s *BroadcastsSvcImpl) Send(params *SendBroadcastRequest) (SendBroadcastResponse, error)
- func (s *BroadcastsSvcImpl) SendWithContext(ctx context.Context, params *SendBroadcastRequest) (SendBroadcastResponse, error)
- func (s *BroadcastsSvcImpl) Update(params *UpdateBroadcastRequest) (UpdateBroadcastResponse, error)
- func (s *BroadcastsSvcImpl) UpdateWithContext(ctx context.Context, params *UpdateBroadcastRequest) (UpdateBroadcastResponse, error)
- type CancelScheduledEmailResponse
- type Client
- func (c *Client) NewRequest(ctx context.Context, method, path string, params interface{}) (*http.Request, error)
- func (c *Client) NewRequestWithOptions(ctx context.Context, method, path string, params interface{}, options Options) (*http.Request, error)
- func (c *Client) Perform(req *http.Request, ret interface{}) (*http.Response, error)
- type Contact
- type ContactsSvc
- type ContactsSvcImpl
- func (s *ContactsSvcImpl) Create(params *CreateContactRequest) (CreateContactResponse, error)
- func (s *ContactsSvcImpl) CreateWithContext(ctx context.Context, params *CreateContactRequest) (CreateContactResponse, error)
- func (s *ContactsSvcImpl) Get(audienceId, id string) (Contact, error)
- func (s *ContactsSvcImpl) GetWithContext(ctx context.Context, audienceId, id string) (Contact, error)
- func (s *ContactsSvcImpl) List(audienceId string) (ListContactsResponse, error)
- func (s *ContactsSvcImpl) ListWithContext(ctx context.Context, audienceId string) (ListContactsResponse, error)
- func (s *ContactsSvcImpl) ListWithOptions(ctx context.Context, audienceId string, options *ListOptions) (ListContactsResponse, error)
- func (s *ContactsSvcImpl) Remove(audienceId, id string) (RemoveContactResponse, error)
- func (s *ContactsSvcImpl) RemoveWithContext(ctx context.Context, audienceId, id string) (RemoveContactResponse, error)
- func (s *ContactsSvcImpl) Update(params *UpdateContactRequest) (UpdateContactResponse, error)
- func (s *ContactsSvcImpl) UpdateWithContext(ctx context.Context, params *UpdateContactRequest) (UpdateContactResponse, error)
- type CreateApiKeyRequest
- type CreateApiKeyResponse
- type CreateAudienceRequest
- type CreateAudienceResponse
- type CreateBroadcastRequest
- type CreateBroadcastResponse
- type CreateContactRequest
- type CreateContactResponse
- type CreateDomainRequest
- type CreateDomainResponse
- type CreateWebhookRequest
- type CreateWebhookResponse
- type DefaultError
- type DeleteWebhookResponse
- type Domain
- type DomainsSvc
- type DomainsSvcImpl
- func (s *DomainsSvcImpl) Create(params *CreateDomainRequest) (CreateDomainResponse, error)
- func (s *DomainsSvcImpl) CreateWithContext(ctx context.Context, params *CreateDomainRequest) (CreateDomainResponse, error)
- func (s *DomainsSvcImpl) Get(domainId string) (Domain, error)
- func (s *DomainsSvcImpl) GetWithContext(ctx context.Context, domainId string) (Domain, error)
- func (s *DomainsSvcImpl) List() (ListDomainsResponse, error)
- func (s *DomainsSvcImpl) ListWithContext(ctx context.Context) (ListDomainsResponse, error)
- func (s *DomainsSvcImpl) ListWithOptions(ctx context.Context, options *ListOptions) (ListDomainsResponse, error)
- func (s *DomainsSvcImpl) Remove(domainId string) (bool, error)
- func (s *DomainsSvcImpl) RemoveWithContext(ctx context.Context, domainId string) (bool, error)
- func (s *DomainsSvcImpl) Update(domainId string, params *UpdateDomainRequest) (Domain, error)
- func (s *DomainsSvcImpl) UpdateWithContext(ctx context.Context, domainId string, params *UpdateDomainRequest) (Domain, error)
- func (s *DomainsSvcImpl) Verify(domainId string) (bool, error)
- func (s *DomainsSvcImpl) VerifyWithContext(ctx context.Context, domainId string) (bool, error)
- type Email
- type EmailsSvc
- type EmailsSvcImpl
- func (s *EmailsSvcImpl) Cancel(emailID string) (*CancelScheduledEmailResponse, error)
- func (s *EmailsSvcImpl) CancelWithContext(ctx context.Context, emailID string) (*CancelScheduledEmailResponse, error)
- func (s *EmailsSvcImpl) Get(emailID string) (*Email, error)
- func (s *EmailsSvcImpl) GetWithContext(ctx context.Context, emailID string) (*Email, error)
- func (s *EmailsSvcImpl) List() (ListEmailsResponse, error)
- func (s *EmailsSvcImpl) ListWithContext(ctx context.Context) (ListEmailsResponse, error)
- func (s *EmailsSvcImpl) ListWithOptions(ctx context.Context, options *ListOptions) (ListEmailsResponse, error)
- func (s *EmailsSvcImpl) Send(params *SendEmailRequest) (*SendEmailResponse, error)
- func (s *EmailsSvcImpl) SendWithContext(ctx context.Context, params *SendEmailRequest) (*SendEmailResponse, error)
- func (s *EmailsSvcImpl) SendWithOptions(ctx context.Context, params *SendEmailRequest, options *SendEmailOptions) (*SendEmailResponse, error)
- func (s *EmailsSvcImpl) Update(params *UpdateEmailRequest) (*UpdateEmailResponse, error)
- func (s *EmailsSvcImpl) UpdateWithContext(ctx context.Context, params *UpdateEmailRequest) (*UpdateEmailResponse, error)
- type InvalidRequestError
- type ListApiKeysResponse
- type ListAudiencesResponse
- type ListBroadcastsResponse
- type ListContactsResponse
- type ListDomainsResponse
- type ListEmailsResponse
- type ListOptions
- type ListWebhooksResponse
- type MissingRequiredFieldsError
- type Options
- type RateLimitError
- type Record
- type RemoveAudienceResponse
- type RemoveBroadcastResponse
- type RemoveContactResponse
- type SendBroadcastRequest
- type SendBroadcastResponse
- type SendEmailOptions
- type SendEmailRequest
- type SendEmailResponse
- type Tag
- type TlsOption
- type UpdateBroadcastRequest
- type UpdateBroadcastResponse
- type UpdateContactRequest
- type UpdateContactResponse
- type UpdateDomainRequest
- type UpdateEmailRequest
- type UpdateEmailResponse
- type UpdateWebhookRequest
- type UpdateWebhookResponse
- type VerifyWebhookOptions
- type Webhook
- type WebhookHeaders
- type WebhookInList
- type WebhooksSvc
- type WebhooksSvcImpl
- func (s *WebhooksSvcImpl) Create(params *CreateWebhookRequest) (*CreateWebhookResponse, error)
- func (s *WebhooksSvcImpl) CreateWithContext(ctx context.Context, params *CreateWebhookRequest) (*CreateWebhookResponse, error)
- func (s *WebhooksSvcImpl) Get(webhookId string) (*Webhook, error)
- func (s *WebhooksSvcImpl) GetWithContext(ctx context.Context, webhookId string) (*Webhook, error)
- func (s *WebhooksSvcImpl) List() (*ListWebhooksResponse, error)
- func (s *WebhooksSvcImpl) ListWithContext(ctx context.Context) (*ListWebhooksResponse, error)
- func (s *WebhooksSvcImpl) ListWithOptions(ctx context.Context, options *ListOptions) (*ListWebhooksResponse, error)
- func (s *WebhooksSvcImpl) Remove(webhookId string) (*DeleteWebhookResponse, error)
- func (s *WebhooksSvcImpl) RemoveWithContext(ctx context.Context, webhookId string) (*DeleteWebhookResponse, error)
- func (s *WebhooksSvcImpl) Update(webhookId string, params *UpdateWebhookRequest) (*UpdateWebhookResponse, error)
- func (s *WebhooksSvcImpl) UpdateWithContext(ctx context.Context, webhookId string, params *UpdateWebhookRequest) (*UpdateWebhookResponse, error)
- func (s *WebhooksSvcImpl) Verify(options *VerifyWebhookOptions) error
Constants ¶
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" // Contact events EventContactCreated = "contact.created" EventContactUpdated = "contact.updated" EventContactDeleted = "contact.deleted" // Domain events EventDomainCreated = "domain.created" EventDomainUpdated = "domain.updated" EventDomainDeleted = "domain.deleted" )
const DefaultWebhookToleranceSeconds = 300
Default tolerance for timestamp validation (5 minutes)
Variables ¶
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") )
BroadcastsSvc errors
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") )
ApiKeySvc errors
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") )
EmailsSvc errors
var ErrRateLimit = errors.New("rate limit exceeded")
ErrRateLimit is a sentinel error for rate limit detection with errors.Is
Functions ¶
func BytesToIntArray ¶
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 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)
}
type ApiKeysSvcImpl ¶
type ApiKeysSvcImpl struct {
// contains filtered or unexported fields
}
func (*ApiKeysSvcImpl) Create ¶
func (s *ApiKeysSvcImpl) Create(params *CreateApiKeyRequest) (CreateApiKeyResponse, error)
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 ¶
func (s *ApiKeysSvcImpl) List() (ListApiKeysResponse, error)
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 ¶ added in v2.25.0
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 ¶
RemoveWithContext deletes a given api key by id https://resend.com/docs/api-reference/api-keys/delete-api-key
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 AudiencesSvc ¶ added in v2.4.0
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)
}
type AudiencesSvcImpl ¶ added in v2.4.0
type AudiencesSvcImpl struct {
// contains filtered or unexported fields
}
func (*AudiencesSvcImpl) Create ¶ added in v2.4.0
func (s *AudiencesSvcImpl) Create(params *CreateAudienceRequest) (CreateAudienceResponse, error)
Create creates a new Audience entry based on the given params https://resend.com/docs/api-reference/audiences/create-audience
func (*AudiencesSvcImpl) CreateWithContext ¶ added in v2.4.0
func (s *AudiencesSvcImpl) CreateWithContext(ctx context.Context, params *CreateAudienceRequest) (CreateAudienceResponse, error)
CreateWithContext creates a new Audience entry based on the given params https://resend.com/docs/api-reference/audiences/create-audience
func (*AudiencesSvcImpl) Get ¶ added in v2.4.0
func (s *AudiencesSvcImpl) Get(audienceId string) (Audience, error)
Get Retrieve a single audience. https://resend.com/docs/api-reference/audiences/get-audience
func (*AudiencesSvcImpl) GetWithContext ¶ added in v2.4.0
GetWithContext Retrieve a single audience. https://resend.com/docs/api-reference/audiences/get-audience
func (*AudiencesSvcImpl) List ¶ added in v2.4.0
func (s *AudiencesSvcImpl) List() (ListAudiencesResponse, error)
List returns the list of all audiences https://resend.com/docs/api-reference/audiences/list-audiences
func (*AudiencesSvcImpl) ListWithContext ¶ added in v2.4.0
func (s *AudiencesSvcImpl) ListWithContext(ctx context.Context) (ListAudiencesResponse, error)
ListWithContext returns the list of all audiences https://resend.com/docs/api-reference/audiences/list-audiences
func (*AudiencesSvcImpl) ListWithOptions ¶ added in v2.25.0
func (s *AudiencesSvcImpl) ListWithOptions(ctx context.Context, options *ListOptions) (ListAudiencesResponse, error)
ListWithOptions returns the list of all audiences with pagination options https://resend.com/docs/api-reference/audiences/list-audiences
func (*AudiencesSvcImpl) Remove ¶ added in v2.4.0
func (s *AudiencesSvcImpl) Remove(audienceId string) (RemoveAudienceResponse, error)
Remove removes a given audience entry by id https://resend.com/docs/api-reference/audiences/delete-audience
func (*AudiencesSvcImpl) RemoveWithContext ¶ added in v2.4.0
func (s *AudiencesSvcImpl) RemoveWithContext(ctx context.Context, audienceId string) (RemoveAudienceResponse, error)
RemoveWithContext removes a given audience by id https://resend.com/docs/api-reference/audiences/delete-audience
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 ¶ added in v2.24.0
BatchError represents an error for a specific email in a batch request when using permissive validation mode.
type BatchSendEmailOptions ¶ added in v2.20.0
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 ¶ added in v2.24.0
func (o BatchSendEmailOptions) GetBatchValidation() string
GetBatchValidation returns the batch validation mode for the batch send email request.
func (BatchSendEmailOptions) GetIdempotencyKey ¶ added in v2.20.0
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 ¶ added in v2.20.0
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 ¶ added in v2.24.0
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 ¶ added in v2.24.0
func (b BatchValidationMode) IsValid() bool
IsValid checks if the BatchValidationMode has a valid value
func (BatchValidationMode) String ¶ added in v2.24.0
func (b BatchValidationMode) String() string
String returns the string representation of the BatchValidationMode
type Broadcast ¶ added in v2.14.0
type Broadcast struct {
Object string `json:"object"`
Id string `json:"id"`
Name string `json:"name"`
AudienceId string `json:"audience_id"`
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"`
}
type BroadcastsSvc ¶ added in v2.14.0
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)
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)
RemoveWithContext(ctx context.Context, broadcastId string) (RemoveBroadcastResponse, error)
Remove(broadcastId string) (RemoveBroadcastResponse, error)
}
type BroadcastsSvcImpl ¶ added in v2.14.0
type BroadcastsSvcImpl struct {
// contains filtered or unexported fields
}
func (*BroadcastsSvcImpl) Create ¶ added in v2.14.0
func (s *BroadcastsSvcImpl) Create(params *CreateBroadcastRequest) (CreateBroadcastResponse, error)
Create creates a new Broadcast based on the given params
func (*BroadcastsSvcImpl) CreateWithContext ¶ added in v2.14.0
func (s *BroadcastsSvcImpl) CreateWithContext(ctx context.Context, params *CreateBroadcastRequest) (CreateBroadcastResponse, error)
CreateWithContext creates a new Broadcast based on the given params https://resend.com/docs/api-reference/broadcasts/create-broadcast
func (*BroadcastsSvcImpl) Get ¶ added in v2.14.0
func (s *BroadcastsSvcImpl) Get(broadcastId string) (Broadcast, error)
Get retrieves a single broadcast.
func (*BroadcastsSvcImpl) GetWithContext ¶ added in v2.14.0
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 ¶ added in v2.14.0
func (s *BroadcastsSvcImpl) List() (ListBroadcastsResponse, error)
List returns the list of all broadcasts
func (*BroadcastsSvcImpl) ListWithContext ¶ added in v2.14.0
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 ¶ added in v2.25.0
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) Remove ¶ added in v2.14.0
func (s *BroadcastsSvcImpl) Remove(broadcastId string) (RemoveBroadcastResponse, error)
Remove removes a given broadcast entry by id
func (*BroadcastsSvcImpl) RemoveWithContext ¶ added in v2.14.0
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 ¶ added in v2.14.0
func (s *BroadcastsSvcImpl) Send(params *SendBroadcastRequest) (SendBroadcastResponse, error)
Send sends broadcasts to your audience.
func (*BroadcastsSvcImpl) SendWithContext ¶ added in v2.14.0
func (s *BroadcastsSvcImpl) SendWithContext(ctx context.Context, params *SendBroadcastRequest) (SendBroadcastResponse, error)
SendWithContext Sends broadcasts to your audience. https://resend.com/docs/api-reference/broadcasts/send-broadcast
func (*BroadcastsSvcImpl) Update ¶ added in v2.17.0
func (s *BroadcastsSvcImpl) Update(params *UpdateBroadcastRequest) (UpdateBroadcastResponse, error)
func (*BroadcastsSvcImpl) UpdateWithContext ¶ added in v2.17.0
func (s *BroadcastsSvcImpl) UpdateWithContext(ctx context.Context, params *UpdateBroadcastRequest) (UpdateBroadcastResponse, error)
UpdateWithContext updates a given broadcast entry https://resend.com/docs/api-reference/broadcasts/update-broadcast
type CancelScheduledEmailResponse ¶ added in v2.11.0
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 EmailsSvc
Batch BatchSvc
ApiKeys ApiKeysSvc
Domains DomainsSvc
Audiences AudiencesSvc
Contacts ContactsSvc
Broadcasts BroadcastsSvc
Webhooks WebhooksSvc
// contains filtered or unexported fields
}
Client handles communication with Resend API.
func NewCustomClient ¶
NewCustomClient builds a new Resend API client, using a provided Http client.
func (*Client) NewRequest ¶
func (c *Client) NewRequest(ctx context.Context, method, path string, params interface{}) (*http.Request, error)
NewRequest builds and returns a new HTTP request object based on the given arguments
func (*Client) NewRequestWithOptions ¶ added in v2.18.0
func (c *Client) NewRequestWithOptions(ctx context.Context, method, path string, params interface{}, 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
type ContactsSvc ¶ added in v2.4.0
type ContactsSvc interface {
CreateWithContext(ctx context.Context, params *CreateContactRequest) (CreateContactResponse, error)
Create(params *CreateContactRequest) (CreateContactResponse, error)
ListWithOptions(ctx context.Context, audienceId string, options *ListOptions) (ListContactsResponse, error)
ListWithContext(ctx context.Context, audienceId string) (ListContactsResponse, error)
List(audienceId string) (ListContactsResponse, error)
GetWithContext(ctx context.Context, audienceId, id string) (Contact, error)
Get(audienceId, id string) (Contact, error)
RemoveWithContext(ctx context.Context, audienceId, id string) (RemoveContactResponse, error)
Remove(audienceId, id string) (RemoveContactResponse, error)
UpdateWithContext(ctx context.Context, params *UpdateContactRequest) (UpdateContactResponse, error)
Update(params *UpdateContactRequest) (UpdateContactResponse, error)
}
type ContactsSvcImpl ¶ added in v2.4.0
type ContactsSvcImpl struct {
// contains filtered or unexported fields
}
func (*ContactsSvcImpl) Create ¶ added in v2.4.0
func (s *ContactsSvcImpl) Create(params *CreateContactRequest) (CreateContactResponse, error)
Create creates a new Contact entry based on the given params https://resend.com/docs/api-reference/contacts/create-contact
func (*ContactsSvcImpl) CreateWithContext ¶ added in v2.4.0
func (s *ContactsSvcImpl) CreateWithContext(ctx context.Context, params *CreateContactRequest) (CreateContactResponse, error)
CreateWithContext creates a new Contact based on the given params https://resend.com/docs/api-reference/contacts/create-contact
func (*ContactsSvcImpl) Get ¶ added in v2.4.0
func (s *ContactsSvcImpl) Get(audienceId, id string) (Contact, error)
Get Retrieve a single contact. This method can be used to retrieve a contact by either its ID or email address.
@param [id] - can be either a contact id or email https://resend.com/docs/api-reference/contacts/get-contact
func (*ContactsSvcImpl) GetWithContext ¶ added in v2.4.0
func (s *ContactsSvcImpl) GetWithContext(ctx context.Context, audienceId, id string) (Contact, error)
GetWithContext Retrieve a single contact. This method can be used to retrieve a contact by either its ID or email address.
@param [id] - can be either a contact id or email
func (*ContactsSvcImpl) List ¶ added in v2.4.0
func (s *ContactsSvcImpl) List(audienceId string) (ListContactsResponse, error)
List returns the list of all contacts in an audience https://resend.com/docs/api-reference/contacts/list-contacts
func (*ContactsSvcImpl) ListWithContext ¶ added in v2.4.0
func (s *ContactsSvcImpl) ListWithContext(ctx context.Context, audienceId string) (ListContactsResponse, error)
ListWithContext returns the list of all contacts in an audience https://resend.com/docs/api-reference/contacts/list-contacts
func (*ContactsSvcImpl) ListWithOptions ¶ added in v2.25.0
func (s *ContactsSvcImpl) ListWithOptions(ctx context.Context, audienceId string, options *ListOptions) (ListContactsResponse, error)
ListWithOptions returns the list of all contacts in an audience with pagination options https://resend.com/docs/api-reference/contacts/list-contacts
func (*ContactsSvcImpl) Remove ¶ added in v2.4.0
func (s *ContactsSvcImpl) Remove(audienceId, id string) (RemoveContactResponse, error)
Remove removes a given contact entry by id or email
@param [id] - can be either a contact id or email
https://resend.com/docs/api-reference/contacts/delete-contact
func (*ContactsSvcImpl) RemoveWithContext ¶ added in v2.4.0
func (s *ContactsSvcImpl) RemoveWithContext(ctx context.Context, audienceId, id string) (RemoveContactResponse, error)
RemoveWithContext same as Remove but with context https://resend.com/docs/api-reference/contacts/delete-contact
func (*ContactsSvcImpl) Update ¶ added in v2.4.0
func (s *ContactsSvcImpl) Update(params *UpdateContactRequest) (UpdateContactResponse, error)
UpdateWithContext updates an existing Contact based on the given params https://resend.com/docs/api-reference/contacts/update-contact
func (*ContactsSvcImpl) UpdateWithContext ¶ added in v2.4.0
func (s *ContactsSvcImpl) UpdateWithContext(ctx context.Context, params *UpdateContactRequest) (UpdateContactResponse, error)
UpdateWithContext updates an existing Contact based on the given params https://resend.com/docs/api-reference/contacts/update-contact
type CreateApiKeyRequest ¶
type CreateApiKeyResponse ¶
type CreateAudienceRequest ¶ added in v2.4.0
type CreateAudienceRequest struct {
Name string `json:"name"`
}
type CreateAudienceResponse ¶ added in v2.4.0
type CreateBroadcastRequest ¶ added in v2.14.0
type CreateBroadcastRequest struct {
AudienceId string `json:"audience_id,omitempty"`
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""`
}
type CreateBroadcastResponse ¶ added in v2.14.0
type CreateBroadcastResponse struct {
Id string `json:"id"`
}
type CreateContactRequest ¶ added in v2.4.0
type CreateContactResponse ¶ added in v2.4.0
type CreateDomainRequest ¶
type CreateDomainResponse ¶
type CreateWebhookRequest ¶ added in v2.28.0
type CreateWebhookRequest struct {
Endpoint string `json:"endpoint"`
Events []string `json:"events"`
}
CreateWebhookRequest represents the parameters for creating a webhook
type CreateWebhookResponse ¶ added in v2.28.0
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 DeleteWebhookResponse ¶ added in v2.28.0
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"`
}
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 ¶
func (s *DomainsSvcImpl) Create(params *CreateDomainRequest) (CreateDomainResponse, error)
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 ¶
GetWithContext retrieves a domain object https://resend.com/docs/api-reference/domains/get-domain
func (*DomainsSvcImpl) List ¶
func (s *DomainsSvcImpl) List() (ListDomainsResponse, error)
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 ¶ added in v2.25.0
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 ¶
RemoveWithContext removes a given domain entry by id https://resend.com/docs/api-reference/domains/delete-domain
func (*DomainsSvcImpl) Update ¶ added in v2.6.0
func (s *DomainsSvcImpl) Update(domainId string, params *UpdateDomainRequest) (Domain, error)
Update is a wrapper around UpdateWithContext
func (*DomainsSvcImpl) UpdateWithContext ¶ added in v2.6.0
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 ¶
VerifyWithContext verifies a given domain Id https://resend.com/docs/api-reference/domains/verify-domain
type Email ¶
type Email struct {
Id string `json:"id"`
Object string `json:"object"`
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 EmailsSvc ¶
type EmailsSvc interface {
CancelWithContext(ctx context.Context, emailID string) (*CancelScheduledEmailResponse, error)
Cancel(emailID string) (*CancelScheduledEmailResponse, 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)
}
type EmailsSvcImpl ¶
type EmailsSvcImpl struct {
// contains filtered or unexported fields
}
func (*EmailsSvcImpl) Cancel ¶ added in v2.11.0
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 ¶ added in v2.11.0
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) GetWithContext ¶
GetWithContext retrieves an email with the given emailID https://resend.com/docs/api-reference/emails/retrieve-email
func (*EmailsSvcImpl) List ¶ added in v2.26.0
func (s *EmailsSvcImpl) List() (ListEmailsResponse, error)
List retrieves a list of emails https://resend.com/docs/api-reference/emails/list-emails
func (*EmailsSvcImpl) ListWithContext ¶ added in v2.26.0
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 ¶ added in v2.26.0
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) Send ¶
func (s *EmailsSvcImpl) Send(params *SendEmailRequest) (*SendEmailResponse, error)
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 ¶ added in v2.18.0
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) Update ¶ added in v2.11.0
func (s *EmailsSvcImpl) Update(params *UpdateEmailRequest) (*UpdateEmailResponse, error)
Update updates an email with the given params https://resend.com/docs/api-reference/emails/update-email
func (*EmailsSvcImpl) UpdateWithContext ¶ added in v2.11.0
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 InvalidRequestError ¶
type ListApiKeysResponse ¶
type ListAudiencesResponse ¶ added in v2.4.0
type ListBroadcastsResponse ¶ added in v2.14.0
type ListContactsResponse ¶ added in v2.4.0
type ListDomainsResponse ¶
type ListEmailsResponse ¶ added in v2.26.0
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 ListOptions ¶ added in v2.25.0
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 ListWebhooksResponse ¶ added in v2.28.0
type ListWebhooksResponse struct {
Object string `json:"object"`
HasMore bool `json:"has_more"`
Data []WebhookInList `json:"data"`
}
ListWebhooksResponse represents the response from listing webhooks
type MissingRequiredFieldsError ¶ added in v2.15.0
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 ¶ added in v2.15.0
func (e *MissingRequiredFieldsError) Error() string
type Options ¶ added in v2.18.0
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 RateLimitError ¶ added in v2.27.0
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 ¶ added in v2.27.0
func (e *RateLimitError) Error() string
Error implements the error interface
func (*RateLimitError) Is ¶ added in v2.27.0
func (e *RateLimitError) Is(target error) bool
Is implements errors.Is support for detecting rate limit errors
type RemoveAudienceResponse ¶ added in v2.4.0
type RemoveBroadcastResponse ¶ added in v2.14.0
type RemoveContactResponse ¶ added in v2.4.0
type SendBroadcastRequest ¶ added in v2.14.0
type SendBroadcastResponse ¶ added in v2.14.0
type SendBroadcastResponse struct {
Id string `json:"id"`
}
type SendEmailOptions ¶ added in v2.18.0
type SendEmailOptions struct {
IdempotencyKey string `json:"idempotency_key,omitempty"`
}
func (SendEmailOptions) GetIdempotencyKey ¶ added in v2.18.0
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"`
}
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 UpdateBroadcastRequest ¶ added in v2.17.0
type UpdateBroadcastRequest struct {
BroadcastId string `json:"broadcast_id,omitempty"`
AudienceId string `json:"audience_id,omitempty"`
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"`
}
type UpdateBroadcastResponse ¶ added in v2.17.0
type UpdateBroadcastResponse struct {
Id string `json:"id"`
}
type UpdateContactRequest ¶ added in v2.4.0
type UpdateContactRequest struct {
Id string `json:"id"`
Email string `json:"email,omitempty"`
AudienceId string `json:"audience_id"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Unsubscribed bool `json:"unsubscribed,omitempty"`
// contains filtered or unexported fields
}
func (UpdateContactRequest) MarshalJSON ¶ added in v2.21.0
func (r UpdateContactRequest) MarshalJSON() ([]byte, error)
Patches the JSON representation of the UpdateContactRequest in order to properly omit the `unsubscribed` field if it is not set This is marked to be fixed properly in v3, since the actual fix would require a breaking change
func (*UpdateContactRequest) SetUnsubscribed ¶ added in v2.21.0
func (r *UpdateContactRequest) SetUnsubscribed(val bool)
Temporary setter for the `unsubscribed` field. This is here as a backwards compatible way to set the unsubscribed field as false, since the default zero value for a bool is false with omitempty, and setting as false would omit the field from the JSON representation. Proper fix for this is coming in v3.
type UpdateContactResponse ¶ added in v2.4.0
type UpdateContactResponse struct {
Data Contact `json:"data"`
Error struct{} `json:"error"` // Fix this
}
type UpdateDomainRequest ¶ added in v2.6.0
type UpdateEmailRequest ¶ added in v2.11.0
UpdateEmailRequest is the request object for the Update call.
type UpdateEmailResponse ¶ added in v2.11.0
UpdateEmailResponse is the type that represents the response from the Update call.
type UpdateWebhookRequest ¶ added in v2.28.0
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 ¶ added in v2.28.0
UpdateWebhookResponse represents the response from updating a webhook
type VerifyWebhookOptions ¶ added in v2.28.0
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 ¶ added in v2.28.0
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 WebhookHeaders ¶ added in v2.28.0
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 ¶ added in v2.28.0
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 ¶ added in v2.28.0
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)
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 ¶ added in v2.28.0
type WebhooksSvcImpl struct {
// contains filtered or unexported fields
}
WebhooksSvcImpl implements the WebhooksSvc interface
func (*WebhooksSvcImpl) Create ¶ added in v2.28.0
func (s *WebhooksSvcImpl) Create(params *CreateWebhookRequest) (*CreateWebhookResponse, error)
Create creates a new webhook
func (*WebhooksSvcImpl) CreateWithContext ¶ added in v2.28.0
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 ¶ added in v2.28.0
func (s *WebhooksSvcImpl) Get(webhookId string) (*Webhook, error)
Get retrieves a webhook by ID
func (*WebhooksSvcImpl) GetWithContext ¶ added in v2.28.0
GetWithContext retrieves a webhook by ID with the given context https://resend.com/docs/api-reference/webhooks/get-webhook
func (*WebhooksSvcImpl) List ¶ added in v2.28.0
func (s *WebhooksSvcImpl) List() (*ListWebhooksResponse, error)
List lists all webhooks
func (*WebhooksSvcImpl) ListWithContext ¶ added in v2.28.0
func (s *WebhooksSvcImpl) ListWithContext(ctx context.Context) (*ListWebhooksResponse, error)
ListWithContext lists all webhooks with the given context
func (*WebhooksSvcImpl) ListWithOptions ¶ added in v2.28.0
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 ¶ added in v2.28.0
func (s *WebhooksSvcImpl) Remove(webhookId string) (*DeleteWebhookResponse, error)
Remove deletes a webhook by ID
func (*WebhooksSvcImpl) RemoveWithContext ¶ added in v2.28.0
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) Update ¶ added in v2.28.0
func (s *WebhooksSvcImpl) Update(webhookId string, params *UpdateWebhookRequest) (*UpdateWebhookResponse, error)
Update updates a webhook
func (*WebhooksSvcImpl) UpdateWithContext ¶ added in v2.28.0
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 ¶ added in v2.28.0
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