Documentation
¶
Index ¶
- func ByteArrayToStringArray(a []byte) []string
- func PrepareAttachments(attachments []Attachment) []_attachment
- type ApiKey
- type ApiKeysSvc
- type ApiKeysSvcImpl
- type Attachment
- type Client
- type CreateApiKeyRequest
- type CreateApiKeyResponse
- type CreateDomainRequest
- type CreateDomainResponse
- type DefaultError
- type Domain
- type DomainsSvc
- type DomainsSvcImpl
- func (s *DomainsSvcImpl) Create(params *CreateDomainRequest) (CreateDomainResponse, error)
- func (s *DomainsSvcImpl) Get(domainId string) (Domain, error)
- func (s *DomainsSvcImpl) List() (ListDomainsResponse, error)
- func (s *DomainsSvcImpl) Remove(domainId string) (bool, error)
- func (s *DomainsSvcImpl) Verify(domainId string) (bool, error)
- type Email
- type EmailsSvc
- type EmailsSvcImpl
- type InvalidRequestError
- type ListApiKeysResponse
- type ListDomainsResponse
- type Record
- type SendEmailRequest
- type SendEmailResponse
- type Tag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByteArrayToStringArray ¶ added in v1.7.0
ByteArrayToStringArray converts a byte array to string array ie: []byte{44,45,46} becomes []string{44,45,46} which will then be properly marshalled into JSON in the way Resend supports
func PrepareAttachments ¶ added in v1.7.0
func PrepareAttachments(attachments []Attachment) []_attachment
PrepareAttachments converts a Attachment into _attachment
Types ¶
type ApiKeysSvc ¶ added in v1.6.0
type ApiKeysSvc interface {
Create(*CreateApiKeyRequest) (CreateApiKeyResponse, error)
List() (ListApiKeysResponse, error)
Remove(apiKeyId string) (bool, error)
}
type ApiKeysSvcImpl ¶ added in v1.6.0
type ApiKeysSvcImpl struct {
// contains filtered or unexported fields
}
func (*ApiKeysSvcImpl) Create ¶ added in v1.6.0
func (s *ApiKeysSvcImpl) Create(params *CreateApiKeyRequest) (CreateApiKeyResponse, error)
Create creates a new API Key based on the given params https://resend.com/docs/api-reference/api-keys/create-api-key
func (*ApiKeysSvcImpl) List ¶ added in v1.6.0
func (s *ApiKeysSvcImpl) List() (ListApiKeysResponse, error)
List list all API Keys in the project https://resend.com/docs/api-reference/api-keys/list-api-keys
func (*ApiKeysSvcImpl) Remove ¶ added in v1.6.0
func (s *ApiKeysSvcImpl) Remove(apiKeyId string) (bool, error)
Remove deletes a given api key by id https://resend.com/docs/api-reference/api-keys/delete-api-key
type Attachment ¶ added in v1.6.0
type Attachment struct {
// Content is a string here, but this will be converted back to
// an array of strings representing an array of bytes
Content string `json:"content,omitempty"`
// Filename that will appear in the email.
// Make sure you pick the correct extension otherwise preview
// may not work as expected
Filename string `json:"filename"`
// Path where the attachment file is hosted
Path string `json:"path,omitempty"`
}
Attachment is the public struct used for adding attachments to emails
type Client ¶ added in v1.6.0
type Client struct {
// Api Key
ApiKey string
// Base URL
BaseURL *url.URL
// User agent for client
UserAgent string
// Services
Emails EmailsSvc
ApiKeys ApiKeysSvc
Domains DomainsSvc
// contains filtered or unexported fields
}
Client handles communication with Resend API.
func NewCustomClient ¶ added in v1.6.0
NewCustomClient builds a new Resend API client, using a provided Http client.
func (*Client) NewRequest ¶ added in v1.6.0
NewRequest builds and returns a new HTTP request object based on the given arguments
type CreateApiKeyRequest ¶ added in v1.6.0
type CreateApiKeyResponse ¶ added in v1.6.0
type CreateDomainRequest ¶ added in v1.6.0
type CreateDomainResponse ¶ added in v1.6.0
type DefaultError ¶ added in v1.6.0
type DefaultError struct {
Message string `json:"message"`
}
type DomainsSvc ¶ added in v1.6.0
type DomainsSvc interface {
Create(*CreateDomainRequest) (CreateDomainResponse, error)
Verify(domainId string) (bool, error)
List() (ListDomainsResponse, error)
Get(domainId string) (Domain, error)
Remove(domainId string) (bool, error)
}
type DomainsSvcImpl ¶ added in v1.6.0
type DomainsSvcImpl struct {
// contains filtered or unexported fields
}
func (*DomainsSvcImpl) Create ¶ added in v1.6.0
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) Get ¶ added in v1.6.0
func (s *DomainsSvcImpl) Get(domainId string) (Domain, error)
Get retrieves a domain object https://resend.com/docs/api-reference/domains/get-domain
func (*DomainsSvcImpl) List ¶ added in v1.6.0
func (s *DomainsSvcImpl) List() (ListDomainsResponse, error)
List returns the list of all doamins https://resend.com/docs/api-reference/domains/list-domains
func (*DomainsSvcImpl) Remove ¶ added in v1.6.0
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) Verify ¶ added in v1.6.0
func (s *DomainsSvcImpl) Verify(domainId string) (bool, error)
Verify verifies a given domain Id https://resend.com/docs/api-reference/domains/verify-domain
type Email ¶ added in v1.6.0
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"`
}
type EmailsSvc ¶ added in v1.6.0
type EmailsSvc interface {
Send(*SendEmailRequest) (SendEmailResponse, error)
Get(emailId string) (Email, error)
}
type EmailsSvcImpl ¶ added in v1.6.0
type EmailsSvcImpl struct {
// contains filtered or unexported fields
}
func (*EmailsSvcImpl) Get ¶ added in v1.6.0
func (s *EmailsSvcImpl) Get(emailId string) (Email, error)
Get retrives an email with the given emailId https://resend.com/docs/api-reference/emails/retrieve-email
func (*EmailsSvcImpl) Send ¶ added in v1.6.0
func (s *EmailsSvcImpl) Send(params *SendEmailRequest) (SendEmailResponse, error)
Send sends an email with the given params
type InvalidRequestError ¶ added in v1.6.0
type ListApiKeysResponse ¶ added in v1.6.0
type ListApiKeysResponse struct {
Data []ApiKey `json:"data"`
}
type ListDomainsResponse ¶ added in v1.6.0
type ListDomainsResponse struct {
Data []Domain `json:"data"`
}
type SendEmailRequest ¶ added in v1.6.0
type SendEmailRequest struct {
From string `json:"from"`
To []string `json:"to"`
Subject string `json:"subject"`
Bcc []string `json:"bcc"`
Cc []string `json:"cc"`
ReplyTo string `json:"reply_to"`
Html string `json:"html"`
Text string `json:"text"`
Tags []Tag `json:"tags"`
Attachments []Attachment `json:"attachments"`
Headers map[string]string `json:"headers"`
}
type SendEmailResponse ¶ added in v1.6.0
type SendEmailResponse struct {
Id string `json:"id"`
}