client

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrApiKeyIsEmpty          = errors.New("baton-sendgrid: api key is empty")
	ErrInvalidPaginationToken = errors.New("baton-sendgrid: invalid pagination token")
)
View Source
var (
	SendGridBaseUrl   = "https://api.sendgrid.com/"
	SendGridEUBaseUrl = "https://api.eu.sendgrid.com/"
	AuthHeaderName    = "Authorization"

	RetrieveAllTeammatesEndpoint     = "v3/teammates"
	InviteTeammateEndpoint           = "v3/teammates"
	DeleteTeammateEndpoint           = "v3/teammates"
	SpecificTeammateEndpoint         = "v3/teammates/%s"
	PendingTeammateEndpoint          = "v3/teammates/pending"
	TeammateSubuserAccessEndpoint    = "v3/teammates/%s/subuser_access"
	TeammateUpdatePermissionEndpoint = "/v3/teammates/%s"

	SubusersEndpoint              = "v3/subusers"
	SpecificSubusersEndpoint      = "v3/subusers/%s"
	SubusersWebsiteAccessEndpoint = "v3/subusers/%s/website_access"
)

Functions

This section is empty.

Types

type CustomErr

type CustomErr struct {
	Errors []CustomErrField `json:"errors"`
}

func (CustomErr) Error

func (c CustomErr) Error() error

type CustomErrField

type CustomErrField struct {
	Message string `json:"message"`
	Field   string `json:"field"`
}

func (CustomErrField) Error

func (c CustomErrField) Error() string

type SendGridClient

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

SendGridClient is a client for the SendGrid API.

func NewClient

func NewClient(ctx context.Context, baseUrl, apiKey string) (*SendGridClient, error)

func (*SendGridClient) CreateSubuser

func (h *SendGridClient) CreateSubuser(ctx context.Context, subuser models.SubuserCreate) error

CreateSubuser Create a Subuser. https://www.twilio.com/docs/sendgrid/api-reference/subusers-api/create-subuser

func (*SendGridClient) DeletePendingTeammate added in v0.0.2

func (h *SendGridClient) DeletePendingTeammate(ctx context.Context, token string) error

DeletePendingTeammate Delete a pending teammate invitation. https://www.twilio.com/docs/sendgrid/api-reference/teammates/delete-pending-teammate

func (*SendGridClient) DeleteSubuser

func (h *SendGridClient) DeleteSubuser(ctx context.Context, username string) error

DeleteSubuser Delete a Subuser. https://www.twilio.com/docs/sendgrid/api-reference/subusers-api/delete-a-subuser

func (*SendGridClient) GetPendingTeammates

func (h *SendGridClient) GetPendingTeammates(ctx context.Context, pToken *pagination.Token) ([]*models.TeammateInvitation, string, error)

GetPendingTeammates List All Pending Teammates. https://www.twilio.com/docs/sendgrid/api-reference/teammates/retrieve-all-pending-teammates

func (*SendGridClient) GetSpecificTeammate

func (h *SendGridClient) GetSpecificTeammate(ctx context.Context, username string) (*models.TeammateScope, error)

GetSpecificTeammate Retrieve a specific teammate with scopes.

func (*SendGridClient) GetSubusers

func (h *SendGridClient) GetSubusers(ctx context.Context, pToken *pagination.Token) ([]models.Subuser, string, error)

GetSubusers List All Subusers. https://www.twilio.com/docs/sendgrid/api-reference/subusers-api/list-all-subusers

func (*SendGridClient) GetTeammates

func (h *SendGridClient) GetTeammates(ctx context.Context, pToken *pagination.Token) ([]models.Teammate, string, error)

GetTeammates List All Teammates. https://www.twilio.com/docs/sendgrid/api-reference/teammates/retrieve-all-teammates

func (*SendGridClient) GetTeammatesSubAccess

func (h *SendGridClient) GetTeammatesSubAccess(ctx context.Context, username string, pToken *pagination.Token) ([]models.TeammateSubuser, string, error)

func (*SendGridClient) InviteTeammate

func (h *SendGridClient) InviteTeammate(ctx context.Context, email string, scopes []string, isAdmin bool) (*models.TeammateInvitation, error)

InviteTeammate Invite a teammate. https://www.twilio.com/docs/sendgrid/api-reference/teammates/invite-teammate

func (*SendGridClient) SetSubuserDisabled

func (h *SendGridClient) SetSubuserDisabled(ctx context.Context, username string, disabled bool) error

SetSubuserDisabled SetSubuserAccess Set Subuser Access. https://www.twilio.com/docs/sendgrid/api-reference/subusers-api/enabledisable-website-access-to-a-subuser

func (*SendGridClient) SetTeammateScopes

func (h *SendGridClient) SetTeammateScopes(ctx context.Context, username string, scopes []string, isAdmin bool) error

SetTeammateScopes https://www.twilio.com/docs/sendgrid/api-reference/teammates/update-teammates-permissions

Jump to

Keyboard shortcuts

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