sendgrid

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBodyNotNil low error displayed when the prepared body for a POST call
	// to the API is nil.
	ErrBodyNotNil = errors.New("body must not be nil")

	// ErrNameRequired error displayed when an api key name wasn't specified.
	ErrNameRequired = errors.New("a name is required")

	// ErrAPIKeyIDRequired error displayed when an api key ID wasn't specified.
	ErrAPIKeyIDRequired = errors.New("an API Key ID is required")

	// ErrFailedCreatingAPIKey error displayed when the provider can not create an api key.
	ErrFailedCreatingAPIKey = errors.New("failed creating apiKey")

	// ErrFailedDeletingAPIKey error displayed when the provider can not delete an api key.
	ErrFailedDeletingAPIKey = errors.New("failed deleting apiKey")

	// ErrUsernameRequired error displayed when a subUser username wasn't specified.
	ErrUsernameRequired = errors.New("a username is required")

	// ErrEmailRequired error displayed when a subUser email wasn't specified.
	ErrEmailRequired = errors.New("an email is required")

	// ErrPasswordRequired error displayed when a subUser password wasn't specified.
	ErrPasswordRequired = errors.New("a password is required")

	// ErrIPRequired error displayed when at least one IP per subUser wasn't specified.
	ErrIPRequired = errors.New("at least one ip address is required")

	// ErrFailedCreatingSubUser error displayed when the provider can not create a subuser.
	ErrFailedCreatingSubUser = errors.New("failed creating subUser")

	// ErrFailedDeletingSubUser error displayed when the provider can not delete a subuser.
	ErrFailedDeletingSubUser = errors.New("failed deleting subUser")

	// ErrTemplateIDRequired error displayed when a template ID wasn't specified.
	ErrTemplateIDRequired = errors.New("a template ID is required")

	// ErrTemplateNameRequired error displayed when a template name wasn't specified.
	ErrTemplateNameRequired = errors.New("a template name is required")

	// ErrTemplateVersionIDRequired error displayed when a template version ID wasn't specified.
	ErrTemplateVersionIDRequired = errors.New("a template version ID is required")

	// ErrTemplateVersionNameRequired error displayed when a template version ID wasn't specified.
	ErrTemplateVersionNameRequired = errors.New("a template version name is required")

	// ErrTemplateVersionSubjectRequired error displayed when a template version subject wasn't specified.
	ErrTemplateVersionSubjectRequired = errors.New("a template version subject is required")

	ErrFailedCreatingUnsubscribeGroup = errors.New("failed to create unsubscribe list")

	ErrUnsubscribeGroupIDRequired = errors.New("unsubscribe list id is required")

	ErrFailedDeletingUnsubscribeGroup = errors.New("failed deleting unsubscribe list")

	ErrFailedCreatingParseWebhook = errors.New("failed to create parse webhook")

	ErrFailedDeletingParseWebhook = errors.New("failed deleting parse webhook")

	ErrHostnameRequired = errors.New("a hostname is required")

	ErrURLRequired = errors.New("a url is required")

	ErrFailedPatchingEventWebhook = errors.New("failed to patch event webhook")

	ErrFailedCreatingDomainAuthentication = errors.New("failed to create domain authentication")

	ErrDomainAuthenticationIDRequired = errors.New("id for domain authentication is required")

	ErrFailedDeletingDomainAuthentication = errors.New("failed deleting domain authentication")

	ErrLinkBrandingIDRequired = errors.New("link branding id is required")

	ErrFailedDeletingLinkBranding = errors.New("failed to delete link branding")

	ErrFailedCreatingLinkBranding = errors.New("failed to create link branding")

	// ErrSubUserPassword should be empty.
	ErrSubUserPassword = errors.New("new password must be non empty")

	// ErrSSOIntegrationMissingField error displayed when a required SSO integration field is not specified.
	ErrSSOIntegrationMissingField = errors.New("SSO integration field is missing")

	// ErrFailedCreatingSSOIntegration error displayed when an SSO integration creation request fails.
	ErrFailedCreatingSSOIntegration = errors.New("failed to create SSO integration")

	// ErrFailedUpdatingSSOIntegration error displayed when an SSO integration update request fails.
	ErrFailedUpdatingSSOIntegration = errors.New("failed to update SSO integration")

	// ErrSSOCertificateMissingField error displayed when a required SSO certificate field is not specified.
	ErrSSOCertificateMissingField = errors.New("SSO certificate field is missing")

	// ErrFailedCreatingSSOCertificate error displayed when an SSO certificate creation request fails.
	ErrFailedCreatingSSOCertificate = errors.New("failed to create SSO certificate")

	// ErrFailedUpdatingSSOCertificate error displayed when an SSO certificate update request fails.
	ErrFailedUpdatingSSOCertificate = errors.New("failed to update SSO certificate")
)

Functions

func ParseDomainAuthentication

func ParseDomainAuthentication(respBody string) (*DomainAuthentication, RequestError)

func RetryOnRateLimit

func RetryOnRateLimit(
	ctx context.Context, d *schema.ResourceData, f func() (interface{}, RequestError),
) (interface{}, error)

RetryOnRateLimit management of RequestErrors, and launch a retry if needed.

Types

type APIError added in v1.0.1

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

func (APIError) Detail added in v1.0.1

func (e APIError) Detail() string

func (APIError) Empty added in v1.0.1

func (e APIError) Empty() bool

Empty returns true if empty.

func (APIError) Error added in v1.0.1

func (e APIError) Error() string

func (*APIError) MarshalJSON added in v1.0.1

func (e *APIError) MarshalJSON() ([]byte, error)

func (*APIError) UnmarshalJSON added in v1.0.1

func (e *APIError) UnmarshalJSON(b []byte) error

type APIKey

type APIKey struct {
	ID     string   `json:"api_key_id,omitempty"` //nolint:tagliatelle
	APIKey string   `json:"api_key,omitempty"`    //nolint:tagliatelle
	Name   string   `json:"name,omitempty"`
	Scopes []string `json:"scopes,omitempty"`
}

APIKey is a Sendgrid API key.

type Client

type Client struct {
	BaseURL   *url.URL
	UserAgent string

	OnBehalfOf string
	// contains filtered or unexported fields
}

Client is a Sendgrid client.

func NewClient

func NewClient(apiKey, host, onBehalfOf string) *Client

NewClient creates a Sendgrid Client.

func (*Client) ActivateTemplateVersion added in v1.0.5

func (c *Client) ActivateTemplateVersion(ctx context.Context, t TemplateVersion) (*TemplateVersion, error)

ActivateTemplateVersion activates a version of a transactional template and returns it.

func (*Client) ConfigureEventWebhookSigning

func (c *Client) ConfigureEventWebhookSigning(ctx context.Context, enabled bool) (*EventWebhookSigning, RequestError)

func (*Client) CreateAPIKey

func (c *Client) CreateAPIKey(ctx context.Context, name string, scopes []string) (*APIKey, RequestError)

CreateAPIKey creates an APIKey and returns it.

func (*Client) CreateDomainAuthentication

func (c *Client) CreateDomainAuthentication(
	ctx context.Context,
	domain string,
	subdomain string,
	ips []string,
	customSpf bool,
	isDefault bool,
	automaticSecurity bool,
	customDKIMSelector string,
) (*DomainAuthentication, RequestError)

CreateDomainAuthentication creates an DomainAuthentication and returns it.

func (*Client) CreateLinkBranding

func (c *Client) CreateLinkBranding(ctx context.Context, domain string, subdomain string, isDefault bool) (*LinkBranding, RequestError)

CreateLinkBranding creates an LinkBranding and returns it.

func (*Client) CreateParseWebhook

func (c *Client) CreateParseWebhook(
	ctx context.Context,
	hostname string,
	url string,
	spamCheck bool,
	sendRaw bool,
) (*ParseWebhook, RequestError)

CreateParseWebhook creates an ParseWebhook and returns it.

func (Client) CreateSSOCertificate

func (c Client) CreateSSOCertificate(
	ctx context.Context,
	publicCertificate string,
	integrationID string,
) (*SSOCertificate, RequestError)

CreateSSOCertificate creates an SSO certificate and returns it.

func (Client) CreateSSOIntegration

func (c Client) CreateSSOIntegration(
	ctx context.Context,
	name string,
	enabled bool,
	signInURL string,
	signOutURL string,
	entityID string,
) (*SSOIntegration, RequestError)

CreateSSOIntegration creates an SSO integration and returns it.

func (*Client) CreateSSOUser added in v1.0.4

func (c *Client) CreateSSOUser(ctx context.Context, firstName, lastName, email string, scopes []string, isAdmin bool) (*User, error)

func (*Client) CreateSubuser

func (c *Client) CreateSubuser(ctx context.Context, username, email, password string, ips []string) (*SubUser, RequestError)

CreateSubuser creates a subuser and returns it.

func (*Client) CreateTemplate

func (c *Client) CreateTemplate(ctx context.Context, name, generation string) (*Template, error)

CreateTemplate creates a transactional template and returns it.

func (*Client) CreateTemplateVersion

func (c *Client) CreateTemplateVersion(ctx context.Context, t TemplateVersion) (*TemplateVersion, error)

CreateTemplateVersion creates a new version of a transactional template and returns it.

func (*Client) CreateUnsubscribeGroup

func (c *Client) CreateUnsubscribeGroup(
	ctx context.Context,
	name string,
	description string,
	isDefault bool,
) (*UnsubscribeGroup, RequestError)

CreateUnsubscribeGroup creates an UnsubscribeGroup and returns it.

func (*Client) CreateUser added in v1.0.1

func (c *Client) CreateUser(ctx context.Context, email string, scopes []string, isAdmin bool) (*User, error)

func (*Client) DeleteAPIKey

func (c *Client) DeleteAPIKey(ctx context.Context, id string) (bool, RequestError)

DeleteAPIKey deletes an APIKey.

func (*Client) DeleteDomainAuthentication

func (c *Client) DeleteDomainAuthentication(ctx context.Context, id string) (bool, RequestError)

DeleteDomainAuthentication deletes an DomainAuthentication.

func (*Client) DeleteLinkBranding

func (c *Client) DeleteLinkBranding(ctx context.Context, id string) (bool, RequestError)

DeleteLinkBranding deletes an LinkBranding.

func (*Client) DeleteParseWebhook

func (c *Client) DeleteParseWebhook(ctx context.Context, hostname string) (bool, RequestError)

DeleteParseWebhook deletes an ParseWebhook.

func (Client) DeleteSSOCertificate

func (c Client) DeleteSSOCertificate(ctx context.Context, id string) (bool, RequestError)

DeleteSSOCertificate deletes an SSO certificate by ID.

func (Client) DeleteSSOIntegration

func (c Client) DeleteSSOIntegration(ctx context.Context, id string) (bool, RequestError)

DeleteSSOIntegration deletes an SSO integration by ID.

func (*Client) DeleteSubuser

func (c *Client) DeleteSubuser(ctx context.Context, username string) (bool, RequestError)

DeleteSubuser deletes a subuser.

func (*Client) DeleteTemplate

func (c *Client) DeleteTemplate(ctx context.Context, id string) (bool, error)

DeleteTemplate deletes a transactional template.

func (*Client) DeleteTemplateVersion

func (c *Client) DeleteTemplateVersion(ctx context.Context, templateID, id string) (bool, error)

DeleteTemplateVersion deletes a version of a transactional template.

func (*Client) DeleteUnsubscribeGroup

func (c *Client) DeleteUnsubscribeGroup(ctx context.Context, id string) (bool, RequestError)

DeleteUnsubscribeGroup deletes an UnsubscribeGroup.

func (*Client) DeleteUser added in v1.0.1

func (c *Client) DeleteUser(ctx context.Context, email string) (bool, error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, method rest.Method, endpoint string) (string, int, error)

Get gets a resource from Sendgrid.

func (*Client) GetPendingUserToken added in v1.0.1

func (c *Client) GetPendingUserToken(ctx context.Context, email string) (string, error)

func (*Client) GetUsernameByEmail added in v1.0.1

func (c *Client) GetUsernameByEmail(ctx context.Context, email string) (string, error)

func (Client) ListSSOCertificates

func (c Client) ListSSOCertificates(ctx context.Context) ([]*SSOCertificate, RequestError)

ListSSOCertificates retrieves all existing SSO certificates.

func (Client) ListSSOIntegrations

func (c Client) ListSSOIntegrations(ctx context.Context) ([]*SSOIntegration, RequestError)

ListSSOIntegrations returns a list of SSO integrations.

func (*Client) PatchEventWebhook

func (c *Client) PatchEventWebhook(ctx context.Context, enabled bool, url string, groupResubscribe bool, delivered bool, groupUnsubscribe bool, spamReport bool, bounce bool, deferred bool, unsubscribe bool, processed bool, open bool, click bool, dropped bool, oauthClientID string, oauthClientSecret string, oauthTokenURL string) (*EventWebhook, RequestError)

CreateEventWebhook creates an EventWebhook and returns it.

func (*Client) Post

func (c *Client) Post(ctx context.Context, method rest.Method, endpoint string, body interface{}) (string, int, error)

Post posts a resource to Sendgrid.

func (*Client) ReadAPIKey

func (c *Client) ReadAPIKey(ctx context.Context, id string) (*APIKey, RequestError)

ReadAPIKey retreives an APIKey and returns it.

func (*Client) ReadAPIKeys

func (c *Client) ReadAPIKeys(ctx context.Context) ([]APIKey, RequestError)

func (*Client) ReadDomainAuthentication

func (c *Client) ReadDomainAuthentication(ctx context.Context, id string) (*DomainAuthentication, RequestError)

ReadDomainAuthentication retrieves an DomainAuthentication and returns it.

func (*Client) ReadEventWebhook

func (c *Client) ReadEventWebhook(ctx context.Context) (*EventWebhook, RequestError)

ReadEventWebhook retrieves an EventWebhook and returns it.

func (*Client) ReadEventWebhookSigning

func (c *Client) ReadEventWebhookSigning(ctx context.Context) (*EventWebhookSigning, RequestError)

func (*Client) ReadLinkBranding

func (c *Client) ReadLinkBranding(ctx context.Context, id string) (*LinkBranding, RequestError)

ReadLinkBranding retrieves an LinkBranding and returns it.

func (*Client) ReadParseWebhook

func (c *Client) ReadParseWebhook(ctx context.Context, hostname string) (*ParseWebhook, RequestError)

ReadParseWebhook retreives an ParseWebhook and returns it.

func (Client) ReadSSOCertificate

func (c Client) ReadSSOCertificate(ctx context.Context, id string) (*SSOCertificate, RequestError)

ReadSSOCertificate retrieves an SSO certificate by ID.

func (Client) ReadSSOIntegration

func (c Client) ReadSSOIntegration(ctx context.Context, id string) (*SSOIntegration, RequestError)

ReadSSOIntegration retrieves an SSO integration by ID.

func (*Client) ReadSubUser

func (c *Client) ReadSubUser(ctx context.Context, username string) ([]SubUser, RequestError)

ReadSubUser retreives a subuser and returns it.

func (*Client) ReadTemplate

func (c *Client) ReadTemplate(ctx context.Context, id string) (*Template, error)

ReadTemplate retreives a transactional template and returns it.

func (*Client) ReadTemplateVersion

func (c *Client) ReadTemplateVersion(ctx context.Context, templateID, id string) (*TemplateVersion, error)

ReadTemplateVersion retreives a version of a transactional template and returns it.

func (*Client) ReadTemplates

func (c *Client) ReadTemplates(ctx context.Context, generation string) ([]Template, error)

func (*Client) ReadUnsubscribeGroup

func (c *Client) ReadUnsubscribeGroup(ctx context.Context, id string) (*UnsubscribeGroup, RequestError)

ReadUnsubscribeGroup retreives an UnsubscribeGroup and returns it.

func (*Client) ReadUnsubscribeGroups

func (c *Client) ReadUnsubscribeGroups(ctx context.Context) ([]UnsubscribeGroup, RequestError)

ReadUnsubscribeGroups retrieves all UnsubscribeGroup and returns them.

func (*Client) ReadUser added in v1.0.1

func (c *Client) ReadUser(ctx context.Context, email string) (*User, error)

func (*Client) UpdateAPIKey

func (c *Client) UpdateAPIKey(ctx context.Context, id, name string, scopes []string) (*APIKey, RequestError)

UpdateAPIKey edits an APIKey and returns it.

func (*Client) UpdateDomainAuthentication

func (c *Client) UpdateDomainAuthentication(
	ctx context.Context,
	id string,
	isDefault bool,
	customSPF bool,
) (*DomainAuthentication, RequestError)

UpdateDomainAuthentication edits an DomainAuthentication and returns it.

func (*Client) UpdateLinkBranding

func (c *Client) UpdateLinkBranding(ctx context.Context, id string, isDefault bool) (*LinkBranding, RequestError)

UpdateLinkBranding edits an LinkBranding and returns it.

func (*Client) UpdateParseWebhook

func (c *Client) UpdateParseWebhook(ctx context.Context, hostname string, spamCheck bool, sendRaw bool) RequestError

UpdateParseWebhook edits an ParseWebhook and returns it.

func (Client) UpdateSSOCertificate

func (c Client) UpdateSSOCertificate(
	ctx context.Context,
	id string,
	publicCertificate string,
	integrationID string,
) (*SSOCertificate, RequestError)

UpdateSSOCertificate updates an existing SSO certificate by ID.

func (Client) UpdateSSOIntegration

func (c Client) UpdateSSOIntegration(
	ctx context.Context,
	id string,
	name string,
	enabled bool,
	signInURL string,
	signOutURL string,
	entityID string,
) (*SSOIntegration, RequestError)

UpdateSSOIntegration updates an existing SSO integration by ID.

func (*Client) UpdateSSOUser added in v1.0.4

func (c *Client) UpdateSSOUser(ctx context.Context, firstName, lastName, email string, scopes []string, isAdmin bool) (*User, error)

func (*Client) UpdateSubuser

func (c *Client) UpdateSubuser(ctx context.Context, username string, disabled bool) (bool, RequestError)

UpdateSubuser enables/disables a subuser.

func (*Client) UpdateSubuserIPs

func (c *Client) UpdateSubuserIPs(ctx context.Context, username string, ips []string) RequestError

func (*Client) UpdateSubuserPassword

func (c *Client) UpdateSubuserPassword(ctx context.Context, username string, oldPassword string, newPassword string) RequestError

func (*Client) UpdateTemplate

func (c *Client) UpdateTemplate(ctx context.Context, id, name string) (*Template, error)

UpdateTemplate edits a transactional template and returns it. We can't change the "generation" of a transactional template.

func (*Client) UpdateTemplateVersion

func (c *Client) UpdateTemplateVersion(ctx context.Context, t TemplateVersion) (*TemplateVersion, error)

UpdateTemplateVersion edits a version of a transactional template and returns it.

func (*Client) UpdateUnsubscribeGroup

func (c *Client) UpdateUnsubscribeGroup(
	ctx context.Context,
	id string,
	name string,
	description string,
	isDefault bool,
) (*UnsubscribeGroup, RequestError)

UpdateUnsubscribeGroup edits an UnsubscribeGroup and returns it.

func (*Client) UpdateUser added in v1.0.1

func (c *Client) UpdateUser(ctx context.Context, email string, scopes []string, isAdmin bool) (*User, error)

func (*Client) ValidateDomainAuthentication

func (c *Client) ValidateDomainAuthentication(ctx context.Context, id string) RequestError

func (*Client) ValidateLinkBranding

func (c *Client) ValidateLinkBranding(ctx context.Context, id string) RequestError

type DomainAuthentication

type DomainAuthentication struct {
	ID                 int32                   `json:"id,omitempty"`
	UserID             int32                   `json:"user_id,omitempty"` //nolint:tagliatelle
	Domain             string                  `json:"domain,omitempty"`
	Subdomain          string                  `json:"subdomain,omitempty"`
	Username           string                  `json:"username,omitempty"`
	IPs                []string                `json:"ips,omitempty"`
	CustomSPF          bool                    `json:"custom_spf"` //nolint:tagliatelle
	IsDefault          bool                    `json:"default"`
	AutomaticSecurity  bool                    `json:"automatic_security"`   //nolint:tagliatelle
	CustomDKIMSelector string                  `json:"custom_dkim_selector"` //nolint:tagliatelle
	Legacy             bool                    `json:"legacy,omitempty"`
	Valid              bool                    `json:"valid,omitempty"`
	DNS                DomainAuthenticationDNS `json:"dns,omitempty"`
}

DomainAuthentication is a Sendgrid domain authentication.

type DomainAuthenticationDNS

type DomainAuthenticationDNS struct {
	MailCNAME    DomainAuthenticationDNSValue `json:"mail_cname,omitempty"` //nolint:tagliatelle
	DKIM1        DomainAuthenticationDNSValue `json:"dkim1,omitempty"`
	DKIM2        DomainAuthenticationDNSValue `json:"dkim2,omitempty"`
	MailServer   DomainAuthenticationDNSValue `json:"mail_server,omitempty"`   //nolint:tagliatelle
	SubDomainSPF DomainAuthenticationDNSValue `json:"subdomain_spf,omitempty"` //nolint:tagliatelle
	DKIM         DomainAuthenticationDNSValue `json:"dkim,omitempty"`
}

type DomainAuthenticationDNSValue

type DomainAuthenticationDNSValue struct {
	Valid bool   `json:"valid,omitempty"`
	Type  string `json:"type,omitempty"`
	Host  string `json:"host,omitempty"`
	Data  string `json:"data,omitempty"`
}

type EventWebhook

type EventWebhook struct {
	Enabled           bool   `json:"enabled"`
	URL               string `json:"url,omitempty"`
	GroupResubscribe  bool   `json:"group_resubscribe"` //nolint:tagliatelle
	Delivered         bool   `json:"delivered"`
	GroupUnsubscribe  bool   `json:"group_unsubscribe"` //nolint:tagliatelle
	SpamReport        bool   `json:"spam_report"`       //nolint:tagliatelle
	Bounce            bool   `json:"bounce"`
	Deferred          bool   `json:"deferred"`
	Unsubscribe       bool   `json:"unsubscribe"`
	Processed         bool   `json:"processed"`
	Open              bool   `json:"open"`
	Click             bool   `json:"click"`
	Dropped           bool   `json:"dropped"`
	OAuthClientID     string `json:"oauth_client_id,omitempty"`     //nolint:tagliatelle
	OAuthClientSecret string `json:"oauth_client_secret,omitempty"` //nolint:tagliatelle
	OAuthTokenURL     string `json:"oauth_token_url,omitempty"`     //nolint:tagliatelle
}

EventWebhook is a Sendgrid event webhook settings.

type EventWebhookSigning

type EventWebhookSigning struct {
	Enabled   bool   `json:"enabled"`
	PublicKey string `json:"public_key"` //nolint:tagliatelle
}

type LinkBranding

type LinkBranding struct {
	ID        int32           `json:"id,omitempty"`
	UserID    int32           `json:"user_id,omitempty"` //nolint:tagliatelle
	Domain    string          `json:"domain,omitempty"`
	Subdomain string          `json:"subdomain,omitempty"`
	Username  string          `json:"username,omitempty"`
	IsDefault bool            `json:"default"`
	Legacy    bool            `json:"legacy,omitempty"`
	Valid     bool            `json:"valid,omitempty"`
	DNS       LinkBrandingDNS `json:"dns,omitempty"`
}

LinkBranding is a Sendgrid domain authentication.

type LinkBrandingDNS

type LinkBrandingDNS struct {
	DomainCNAME LinkBrandingDNSValue `json:"domain_cname,omitempty"` //nolint:tagliatelle
	OwnerCNAME  LinkBrandingDNSValue `json:"owner_cname,omitempty"`  //nolint:tagliatelle
}

type LinkBrandingDNSValue

type LinkBrandingDNSValue struct {
	Valid bool   `json:"valid,omitempty"`
	Type  string `json:"type,omitempty"`
	Host  string `json:"host,omitempty"`
	Data  string `json:"data,omitempty"`
}

type ParseWebhook

type ParseWebhook struct {
	Hostname  string `json:"hostname,omitempty"`
	URL       string `json:"url,omitempty"`
	SpamCheck bool   `json:"spam_check"` //nolint:tagliatelle
	SendRaw   bool   `json:"send_raw"`   //nolint:tagliatelle
}

ParseWebhook is a Sendgrid inbound parse settings.

type PendingUser added in v1.0.1

type PendingUser struct {
	Result []struct {
		Token          string   `json:"token,omitempty"`
		Email          string   `json:"email,omitempty"`
		IsAdmin        bool     `json:"is_admin,omitempty"`
		IsReadOnly     bool     `json:"is_read_only,omitempty"`
		ExpirationDate int      `json:"expiration_date,omitempty"`
		Scopes         []string `json:"scopes,omitempty"`
	} `json:"result"`
}

type Rate added in v1.0.1

type Rate struct {
	// The maximum number of requests allowed within the window.
	Limit int

	// The number of requests this caller has left on this endpoint within the current window
	Remaining int

	// The time when the next rate limit window begins and the count resets, measured in UTC seconds from epoch
	Reset time.Time
}

type RequestError

type RequestError struct {
	StatusCode int
	Err        error
}

RequestError struct permits to embed to return the statucode and the error to the parent function.

type Response added in v1.0.1

type Response struct {
	*http.Response

	// For APIs that support cursor pagination, the following field will be populated
	// to point to the next page if more results are available.
	// Set ListCursorParams.Cursor to this value when calling the endpoint again.
	Cursor string

	Rate Rate
}

type SSOCertificate

type SSOCertificate struct {
	PublicCertificate string `json:"public_certificate"` //nolint:tagliatelle
	IntegrationID     string `json:"integration_id"`     //nolint:tagliatelle
	ID                int32  `json:"id,omitempty"`
}

SSOCertificate maps a public certificate to an SSO integration, allowing the SSO integration to verify SAML requests from an IdP.

type SSOIntegration

type SSOIntegration struct {
	CompletedIntegration bool   `json:"completed_integration,omitempty"` //nolint:tagliatelle
	Enabled              bool   `json:"enabled"`
	Name                 string `json:"name"`
	SignInURL            string `json:"signin_url"`  //nolint:tagliatelle
	SignOutURL           string `json:"signout_url"` //nolint:tagliatelle
	EntityID             string `json:"entity_id"`   //nolint:tagliatelle
	ID                   string `json:"id,omitempty"`
	SingleSignOnURL      string `json:"single_signon_url,omitempty"` //nolint:tagliatelle
	AudienceURL          string `json:"audience_url,omitempty"`      //nolint:tagliatelle
}

SSOIntegration is a Sendgrid SSO configuration set.

type SubUser

type SubUser struct {
	ID                 int              `json:"id,omitempty"`
	UserID             int              `json:"user_id,omitempty"` //nolint:tagliatelle
	UserName           string           `json:"username,omitempty"`
	Password           string           `json:"password,omitempty"`
	ConfirmPassword    string           `json:"confirm_password,omitempty"` //nolint:tagliatelle
	Email              string           `json:"email,omitempty"`
	IPs                []string         `json:"ips,omitempty"`
	Disabled           bool             `json:"disabled,omitempty"`
	SignupSessionToken string           `json:"signup_session_token,omitempty"` //nolint:tagliatelle
	AuthorizationToken string           `json:"authorization_token,omitempty"`  //nolint:tagliatelle
	CreditAllocation   creditAllocation `json:"credit_allocation,omitempty"`    //nolint:tagliatelle
}

SubUser is a Sendgrid SubUser.

type Template

type Template struct {
	ID         string            `json:"id,omitempty"`
	Name       string            `json:"name,omitempty"`
	Generation string            `json:"generation,omitempty"`
	UpdatedAt  string            `json:"updated_at,omitempty"` //nolint:tagliatelle
	Versions   []TemplateVersion `json:"versions,omitempty"`
	Warnings   []string          `json:"warnings,omitempty"`
}

Template is a Sendgrid transactional template.

type TemplateVersion

type TemplateVersion struct {
	ID                   string   `json:"id,omitempty"`
	TemplateID           string   `json:"template_id,omitempty"`   //nolint:tagliatelle
	UpdatedAt            string   `json:"updated_at,omitempty"`    //nolint:tagliatelle
	ThumbnailURL         string   `json:"thumbnail_url,omitempty"` //nolint:tagliatelle
	Warnings             []string `json:"warnings,omitempty"`
	Active               int      `json:"active,omitempty"`
	Name                 string   `json:"name,omitempty"`
	HTMLContent          string   `json:"html_content,omitempty"`           //nolint:tagliatelle
	PlainContent         string   `json:"plain_content,omitempty"`          //nolint:tagliatelle
	GeneratePlainContent bool     `json:"generate_plain_content,omitempty"` //nolint:tagliatelle
	Subject              string   `json:"subject,omitempty"`
	Editor               string   `json:"editor,omitempty"`
	TestData             string   `json:"test_data,omitempty"` //nolint:tagliatelle
}

TemplateVersion is a Sendgrid transactional template version.

type Templates

type Templates struct {
	Result []Template `json:"result"`
}

type UnsubscribeGroup

type UnsubscribeGroup struct {
	ID           int32  `json:"id,omitempty"`
	Name         string `json:"name,omitempty"`
	Description  string `json:"description,omitempty"`
	IsDefault    bool   `json:"is_default"` //nolint:tagliatelle
	Unsubscribes int32  `json:"unsubscribes,omitempty"`
}

UnsubscribeGroup is a Sendgrid - Suppressions - Unsubscribe Group.

type UpdateSubUserPassword

type UpdateSubUserPassword struct {
	NewPassword string `json:"new_password"` //nolint:tagliatelle
	OldPassword string `json:"old_password"` //nolint:tagliatelle
}

type User added in v1.0.1

type User struct {
	Username  string   `json:"username,omitempty"`
	Email     string   `json:"email,omitempty"`
	FirstName string   `json:"first_name,omitempty"`
	LastName  string   `json:"last_name,omitempty"`
	Address   string   `json:"address,omitempty"`
	Address2  string   `json:"address2,omitempty"`
	City      string   `json:"city,omitempty"`
	State     string   `json:"state,omitempty"`
	Zip       string   `json:"zip,omitempty"`
	Country   string   `json:"country,omitempty"`
	Company   string   `json:"company,omitempty"`
	Website   string   `json:"website,omitempty"`
	Phone     string   `json:"phone,omitempty"`
	IsAdmin   bool     `json:"is_admin,omitempty"`
	IsSSO     bool     `json:"is_sso,omitempty"`
	UserType  string   `json:"user_type,omitempty"`
	Scopes    []string `json:"scopes,omitempty"`
}

type Users added in v1.0.1

type Users struct {
	Result []User `json:"result"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL