Documentation
¶
Index ¶
- Variables
- type CustomErr
- type CustomErrField
- type SendGridClient
- func (h *SendGridClient) CreateSubuser(ctx context.Context, subuser models.SubuserCreate) error
- func (h *SendGridClient) DeletePendingTeammate(ctx context.Context, token string) error
- func (h *SendGridClient) DeleteSubuser(ctx context.Context, username string) error
- func (h *SendGridClient) DeleteTeammate(ctx context.Context, username string) error
- func (h *SendGridClient) GetPendingTeammates(ctx context.Context, pToken *pagination.Token) ([]*models.TeammateInvitation, string, error)
- func (h *SendGridClient) GetSpecificTeammate(ctx context.Context, username string) (*models.TeammateScope, error)
- func (h *SendGridClient) GetSubusers(ctx context.Context, pToken *pagination.Token) ([]models.Subuser, string, error)
- func (h *SendGridClient) GetTeammates(ctx context.Context, pToken *pagination.Token) ([]models.Teammate, string, error)
- func (h *SendGridClient) GetTeammatesSubAccess(ctx context.Context, username string, pToken *pagination.Token) ([]models.TeammateSubuser, string, error)
- func (h *SendGridClient) InviteTeammate(ctx context.Context, email string, scopes []string, isAdmin bool) (*models.TeammateInvitation, error)
- func (h *SendGridClient) SetSubuserDisabled(ctx context.Context, username string, disabled bool) error
- func (h *SendGridClient) SetTeammateScopes(ctx context.Context, username string, scopes []string, isAdmin bool) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrApiKeyIsEmpty = errors.New("baton-sendgrid: api key is empty") ErrInvalidPaginationToken = errors.New("baton-sendgrid: invalid pagination token") )
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"`
}
type CustomErrField ¶
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) DeleteTeammate ¶
func (h *SendGridClient) DeleteTeammate(ctx context.Context, username string) error
https://www.twilio.com/docs/sendgrid/api-reference/teammates/delete-teammate
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