Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateUniqueID ¶
func GenerateUniqueID() string
GenerateUniqueID generates a unique ID for a new user
Types ¶
type AuthProvider ¶
type AuthProvider struct {
// contains filtered or unexported fields
}
AuthProvider handles API authentication
func NewAuthProvider ¶
func NewAuthProvider(tokens []string) *AuthProvider
NewAuthProvider creates a new authentication provider with the given tokens
func (*AuthProvider) AddToken ¶
func (a *AuthProvider) AddToken(token string)
AddToken adds a new token to the provider
func (*AuthProvider) Authenticate ¶
func (a *AuthProvider) Authenticate(token string) bool
Authenticate validates the provided token Returns true if the token is valid
func (*AuthProvider) HasTokens ¶
func (a *AuthProvider) HasTokens() bool
HasTokens returns true if there are tokens configured
func (*AuthProvider) RemoveToken ¶
func (a *AuthProvider) RemoveToken(token string)
RemoveToken removes a token from the provider
type BulkUploadRequest ¶
type BulkUploadRequest struct {
Emails []string `json:"emails,omitempty"`
}
BulkUploadRequest represents the JSON payload for bulk email upload
type BulkUploadResponse ¶
type BulkUploadResponse struct {
Total int `json:"total"`
Success int `json:"success"`
Failed int `json:"failed"`
Duplicate int `json:"duplicate"`
Failures []string `json:"failures,omitempty"`
}
BulkUploadResponse represents the JSON response for bulk upload
type EmailRequest ¶
type EmailRequest struct {
Email string `json:"email"`
}
EmailRequest represents the JSON payload for email submission
type EmailResponse ¶
type EmailResponse struct {
ID string `json:"id,omitempty"`
Status string `json:"status"`
Message string `json:"message,omitempty"`
}
EmailResponse represents the JSON response for email submission
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
Code int `json:"code"`
Details string `json:"details,omitempty"`
}
ErrorResponse represents the JSON response for errors
type ReportResponse ¶
type ReportResponse struct {
Type string `json:"type"`
From string `json:"from"`
To string `json:"to"`
Count int `json:"count"`
Users []*domain.User `json:"users,omitempty"`
Generated time.Time `json:"generated"`
}
ReportResponse represents the JSON response for report requests
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the REST API server
type ServiceInterface ¶
type ServiceInterface interface {
CheckEmailStatus(ctx any, userID int64, email string) (string, *domain.User, error)
RedeemCocktail(ctx any, userID int64, email string) (time.Time, error)
UpdateUser(ctx any, user *domain.User) error
AddUser(ctx any, user *domain.User) error
GenerateReport(ctx any, reportType string, fromDate, toDate time.Time) ([]*domain.User, error)
Close() error
}
ServiceInterface defines the required methods from the service layer