Documentation ¶
Index ¶
- Constants
- Variables
- type FollowerEvent
- type FollowerList
- type SlackConfig
- type Table
- func (t *Table) CreateFollowerEvent(ctx context.Context, e *FollowerEvent) error
- func (t *Table) CreateFollowerList(ctx context.Context, l *FollowerList) error
- func (t *Table) CreateUser(ctx context.Context, u *User) error
- func (t *Table) DeleteUser(ctx context.Context, userID string) error
- func (t *Table) GetLatestFollowerEvents(ctx context.Context, userID string, limit int64) ([]*FollowerEvent, error)
- func (t *Table) GetLatestFollowerLists(ctx context.Context, userID string, limit int64) ([]*FollowerList, error)
- func (t *Table) GetUser(ctx context.Context, userID string) (*User, error)
- func (t *Table) GetUserAndLatestFollowerLists(ctx context.Context, userID string, limit int64) (*User, []*FollowerList, error)
- func (t *Table) NewUserIter() UserIter
- func (t *Table) RegisterUser(ctx context.Context, u *User) error
- func (t *Table) UpdateUser(ctx context.Context, u *User) error
- type TableAPI
- type User
- type UserIter
- type UserSignupEvent
Constants ¶
View Source
const ( FollowerStateNew = "NEW" FollowerStateLost = "LOST" FollowerStateReasonFollowed = "FOLLOWED" FollowerStateReasonUnfollowed = "UNFOLLOWED" FollowerStateReasonDeleted = "DELETED" FollowerStateReasonSuspended = "SUSPENDED" )
Variables ¶
View Source
var ( ErrUserNotFound = errors.New("user not found") ErrFollowerListNotFound = errors.New("follower list not found") )
Functions ¶
This section is empty.
Types ¶
type FollowerEvent ¶
type FollowerEvent struct { ID string `json:"id" dynamo:"EventID"` UserID string `json:"userId" tstype:"-"` // FIXME: required by notify-user TotalFollowers int `json:"totalFollowers"` Follower *twitter.User `json:"follower" tstype:",required"` FollowerState string `json:"followerState" tstype:"'NEW' | 'LOST'"` FollowerStateReason string `json:"followerStateReason" tstype:"'FOLLOWED' | 'UNFOLLOWED' | 'DELETED' | 'SUSPENDED'"` CreatedAt time.Time `json:"createdAt"` ExpiresAt time.Time `json:"-"` }
func (*FollowerEvent) Validate ¶
func (e *FollowerEvent) Validate() error
type FollowerList ¶
type FollowerList struct { UserID string S3Bucket string S3Key string TotalFollowers int CreatedAt time.Time ExpiresAt time.Time }
func (*FollowerList) Validate ¶
func (l *FollowerList) Validate() error
type SlackConfig ¶
type SlackConfig struct { Enabled bool `json:"enabled"` WebhookURL string `json:"webhookUrl,omitempty" dynamo:",omitempty"` Channel string `json:"channel,omitempty" dynamo:",omitempty"` }
func (SlackConfig) Validate ¶
func (c SlackConfig) Validate() error
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table implements the Table Module pattern: https://www.martinfowler.com/eaaCatalog/tableModule.html
func NewConsistentTable ¶
func NewConsistentTable(p client.ConfigProvider, name string) *Table
func (*Table) CreateFollowerEvent ¶
func (t *Table) CreateFollowerEvent(ctx context.Context, e *FollowerEvent) error
func (*Table) CreateFollowerList ¶
func (t *Table) CreateFollowerList(ctx context.Context, l *FollowerList) error
func (*Table) GetLatestFollowerEvents ¶
func (*Table) GetLatestFollowerLists ¶
func (*Table) GetUserAndLatestFollowerLists ¶
func (*Table) NewUserIter ¶
func (*Table) RegisterUser ¶
RegisterUser creates or updates a user, e.g. after login via Auth0.
type TableAPI ¶
type TableAPI interface { CreateUser(ctx context.Context, u *User) error UpdateUser(ctx context.Context, u *User) error RegisterUser(ctx context.Context, u *User) error GetUser(ctx context.Context, userID string) (*User, error) DeleteUser(ctx context.Context, userID string) error NewUserIter() UserIter CreateFollowerList(ctx context.Context, l *FollowerList) error GetUserAndLatestFollowerLists(ctx context.Context, userID string, limit int64) (*User, []*FollowerList, error) GetLatestFollowerLists(ctx context.Context, userID string, limit int64) ([]*FollowerList, error) CreateFollowerEvent(ctx context.Context, e *FollowerEvent) error GetLatestFollowerEvents(ctx context.Context, userID string, limit int64) ([]*FollowerEvent, error) }
type User ¶
type User struct { ID string `json:"id" dynamo:"UserID"` Handle string `json:"handle"` Name string `json:"name"` Location string `json:"location,omitempty"` Bio string `json:"bio,omitempty"` ProfileImageURL string `json:"profileImageUrl"` AccessToken string `json:"-"` AccessSecret string `json:"-"` Slack SlackConfig `json:"slack"` IgnoreFollowers []string `json:"ignoreFollowers,omitempty" dynamo:",set,omitempty"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` LastLogin time.Time `json:"lastLogin"` LastIP string `json:"-"` LoginsCount int64 `json:"-"` IDP string `json:"-" dynamo:"IdP"` }
func (*User) IgnoresFollower ¶
type UserSignupEvent ¶
type UserSignupEvent struct {
UserID string `tstype:"-"`
}
Click to show internal directories.
Click to hide internal directories.