presenters

package
v1.167.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthPresenter

type AuthPresenter interface {
	PresentAuthentication(w http.ResponseWriter, response *auth.AuthenticateUserResponse)
	PresentGitHubAuthentication(w http.ResponseWriter, response *auth.GitHubAuthenticateResponse)
	PresentValidation(w http.ResponseWriter, response *auth.ValidateAPIKeyResponse)
	PresentLogout(w http.ResponseWriter)
	PresentError(w http.ResponseWriter, message string, statusCode int)
}

AuthPresenter defines the interface for presenting authentication data

type AuthenticationResponse

type AuthenticationResponse struct {
	User        *UserResponse `json:"user"`
	APIKey      string        `json:"api_key"`
	Permissions []string      `json:"permissions"`
	ExpiresAt   *string       `json:"expires_at,omitempty"`
}

AuthenticationResponse represents the response for user authentication

type CreateSubscriptionResponse

type CreateSubscriptionResponse struct {
	Subscription *SubscriptionResponse `json:"subscription"`
}

CreateSubscriptionResponse represents the response for creating a subscription

type DeleteSubscriptionResponse

type DeleteSubscriptionResponse struct {
	Success bool `json:"success"`
}

DeleteSubscriptionResponse represents the response for deleting a subscription

type GitHubAuthenticationResponse

type GitHubAuthenticationResponse struct {
	User        *UserResponse       `json:"user"`
	APIKey      string              `json:"api_key"`
	Permissions []string            `json:"permissions"`
	GitHubInfo  *GitHubInfoResponse `json:"github_info"`
	ExpiresAt   *string             `json:"expires_at,omitempty"`
}

GitHubAuthenticationResponse represents the response for GitHub authentication

type GitHubInfoResponse

type GitHubInfoResponse struct {
	ID        int64                           `json:"id"`
	Login     string                          `json:"login"`
	Name      *string                         `json:"name,omitempty"`
	Email     *string                         `json:"email,omitempty"`
	AvatarURL string                          `json:"avatar_url"`
	Company   *string                         `json:"company,omitempty"`
	Location  *string                         `json:"location,omitempty"`
	Teams     []*GitHubTeamMembershipResponse `json:"teams,omitempty"`
}

GitHubInfoResponse represents GitHub user information in HTTP responses

type GitHubTeamMembershipResponse

type GitHubTeamMembershipResponse struct {
	TeamID   int    `json:"team_id"`
	TeamName string `json:"team_name"`
	OrgName  string `json:"org_name"`
	Role     string `json:"role"`
}

GitHubTeamMembershipResponse represents GitHub team membership in HTTP responses

type HTTPAuthPresenter

type HTTPAuthPresenter struct{}

HTTPAuthPresenter implements AuthPresenter for HTTP responses

func NewHTTPAuthPresenter

func NewHTTPAuthPresenter() *HTTPAuthPresenter

NewHTTPAuthPresenter creates a new HTTPAuthPresenter

func (*HTTPAuthPresenter) PresentAuthentication

func (p *HTTPAuthPresenter) PresentAuthentication(w http.ResponseWriter, response *auth.AuthenticateUserResponse)

PresentAuthentication presents an authentication response

func (*HTTPAuthPresenter) PresentError

func (p *HTTPAuthPresenter) PresentError(w http.ResponseWriter, message string, statusCode int)

PresentError presents an error response

func (*HTTPAuthPresenter) PresentGitHubAuthentication

func (p *HTTPAuthPresenter) PresentGitHubAuthentication(w http.ResponseWriter, response *auth.GitHubAuthenticateResponse)

PresentGitHubAuthentication presents a GitHub authentication response

func (*HTTPAuthPresenter) PresentLogout

func (p *HTTPAuthPresenter) PresentLogout(w http.ResponseWriter)

PresentLogout presents a logout response

func (*HTTPAuthPresenter) PresentValidation

func (p *HTTPAuthPresenter) PresentValidation(w http.ResponseWriter, response *auth.ValidateAPIKeyResponse)

PresentValidation presents an API key validation response

type HTTPNotificationPresenter

type HTTPNotificationPresenter struct{}

HTTPNotificationPresenter implements NotificationPresenter for HTTP responses

func NewHTTPNotificationPresenter

func NewHTTPNotificationPresenter() *HTTPNotificationPresenter

NewHTTPNotificationPresenter creates a new HTTPNotificationPresenter

func (*HTTPNotificationPresenter) PresentCreateSubscription

func (p *HTTPNotificationPresenter) PresentCreateSubscription(w http.ResponseWriter, response *notification.CreateSubscriptionResponse)

PresentCreateSubscription presents a create subscription response

func (*HTTPNotificationPresenter) PresentDeleteSubscription

func (p *HTTPNotificationPresenter) PresentDeleteSubscription(w http.ResponseWriter, response *notification.DeleteSubscriptionResponse)

PresentDeleteSubscription presents a delete subscription response

func (*HTTPNotificationPresenter) PresentError

func (p *HTTPNotificationPresenter) PresentError(w http.ResponseWriter, message string, statusCode int)

PresentError presents an error response

func (*HTTPNotificationPresenter) PresentSendNotification

func (p *HTTPNotificationPresenter) PresentSendNotification(w http.ResponseWriter, response *notification.SendNotificationResponse)

PresentSendNotification presents a send notification response

type LogoutResponse

type LogoutResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

LogoutResponse represents the response for logout

type NotificationPresenter

type NotificationPresenter interface {
	PresentSendNotification(w http.ResponseWriter, response *notification.SendNotificationResponse)
	PresentCreateSubscription(w http.ResponseWriter, response *notification.CreateSubscriptionResponse)
	PresentDeleteSubscription(w http.ResponseWriter, response *notification.DeleteSubscriptionResponse)
	PresentError(w http.ResponseWriter, message string, statusCode int)
}

NotificationPresenter defines the interface for presenting notification data

type NotificationResponse

type NotificationResponse struct {
	ID        string            `json:"id"`
	UserID    string            `json:"user_id"`
	Title     string            `json:"title"`
	Body      string            `json:"body"`
	URL       *string           `json:"url,omitempty"`
	Tags      map[string]string `json:"tags,omitempty"`
	IconURL   *string           `json:"icon_url,omitempty"`
	CreatedAt string            `json:"created_at"`
	Status    string            `json:"status"`
}

NotificationResponse represents a notification in HTTP responses

type NotificationResultResponse

type NotificationResultResponse struct {
	SubscriptionID string  `json:"subscription_id"`
	Success        bool    `json:"success"`
	Error          *string `json:"error,omitempty"`
	DeliveredAt    *string `json:"delivered_at,omitempty"`
}

NotificationResultResponse represents a notification delivery result in HTTP responses

type SendNotificationResponse

type SendNotificationResponse struct {
	Notification *NotificationResponse         `json:"notification"`
	Results      []*NotificationResultResponse `json:"results"`
	SentCount    int                           `json:"sent_count"`
	FailedCount  int                           `json:"failed_count"`
}

SendNotificationResponse represents the response for sending a notification

type SubscriptionResponse

type SubscriptionResponse struct {
	ID        string `json:"id"`
	UserID    string `json:"user_id"`
	Type      string `json:"type"`
	Endpoint  string `json:"endpoint"`
	Active    bool   `json:"active"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

SubscriptionResponse represents a subscription in HTTP responses

type UserResponse

type UserResponse struct {
	ID          string   `json:"id"`
	Type        string   `json:"type"`
	Username    string   `json:"username"`
	Email       *string  `json:"email,omitempty"`
	DisplayName *string  `json:"display_name,omitempty"`
	AvatarURL   *string  `json:"avatar_url,omitempty"`
	Status      string   `json:"status"`
	Roles       []string `json:"roles"`
	Permissions []string `json:"permissions"`
	LastUsedAt  *string  `json:"last_used_at,omitempty"`
	CreatedAt   string   `json:"created_at"`
}

UserResponse represents user information in HTTP responses

type ValidationResponse

type ValidationResponse struct {
	Valid       bool          `json:"valid"`
	User        *UserResponse `json:"user,omitempty"`
	Permissions []string      `json:"permissions,omitempty"`
}

ValidationResponse represents the response for API key validation

Jump to

Keyboard shortcuts

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