Documentation
¶
Index ¶
- type APITokenCreate
- type APITokenCreateRequest
- type APITokenCreateResponse
- type APITokenList
- type APITokenListItem
- type APITokenListResponse
- type APITokenRevoke
- type ArticleGet
- type ArticleRatingSet
- type ArticleReadSet
- type ArticlesList
- type ArticlesListMetadata
- type ArticlesListResponse
- type RSS
- type RecommendedArticlesList
- type SemanticSearch
- type SimilarArticlesList
- type UserArticlesList
- type UserArticlesLister
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APITokenCreate ¶
type APITokenCreate struct {
CreateCmd *command.CreateAPIToken
}
APITokenCreate handles POST /v1/tokens to create a new API token.
func (APITokenCreate) ServeHTTP ¶
func (c APITokenCreate) ServeHTTP(w http.ResponseWriter, r *http.Request)
type APITokenCreateRequest ¶
type APITokenCreateRequest struct {
Name string `json:"name,omitempty"`
}
APITokenCreateRequest is the JSON request body for creating a token.
type APITokenCreateResponse ¶
type APITokenCreateResponse struct {
ID string `json:"id"`
Token string `json:"token"`
Prefix string `json:"prefix"`
}
APITokenCreateResponse is the JSON response for a created token.
type APITokenList ¶
type APITokenList struct {
TokenLister datasources.UserAPITokenLister
}
APITokenList handles GET /v1/tokens to list user's API tokens.
func (APITokenList) ServeHTTP ¶
func (c APITokenList) ServeHTTP(w http.ResponseWriter, r *http.Request)
type APITokenListItem ¶
type APITokenListItem struct {
ID string `json:"id"`
Prefix string `json:"prefix"`
Name *string `json:"name,omitempty"`
CreatedAt time.Time `json:"created_at"`
LastUsedAt *time.Time `json:"last_used_at,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
Revoked bool `json:"revoked"`
}
APITokenListItem represents a token in the list response.
type APITokenListResponse ¶
type APITokenListResponse struct {
Data []APITokenListItem `json:"data"`
}
APITokenListResponse is the JSON response for listing tokens.
type APITokenRevoke ¶
type APITokenRevoke struct {
TokenRevoker datasources.APITokenRevoker
}
APITokenRevoke handles DELETE /v1/tokens/{token_id} to revoke a token.
func (APITokenRevoke) ServeHTTP ¶
func (c APITokenRevoke) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ArticleGet ¶
type ArticleGet struct {
Fetcher datasources.ArticleFetcher
CacheMaxAge time.Duration
}
func (ArticleGet) ServeHTTP ¶
func (c ArticleGet) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ArticleRatingSet ¶
type ArticleRatingSet struct {
Fetcher datasources.ArticleFetcher
SetRatingCmd command.Command[command.SetArticleRatingRequest, command.Empty]
RatingType domain.UserRatingType
}
func (ArticleRatingSet) ServeHTTP ¶
func (c ArticleRatingSet) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ArticleReadSet ¶
type ArticleReadSet struct {
Fetcher datasources.ArticleFetcher
ReadSetter datasources.ArticleReadSetter
}
func (ArticleReadSet) ServeHTTP ¶
func (c ArticleReadSet) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ArticlesList ¶
type ArticlesList struct {
Lister interface {
datasources.LatestArticleLister
datasources.ArticleFetcher
}
CacheMaxAge time.Duration
}
func (ArticlesList) ServeHTTP ¶
func (c ArticlesList) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ArticlesListMetadata ¶
type ArticlesListMetadata struct{}
type ArticlesListResponse ¶
type ArticlesListResponse struct {
Data []domain.Article `json:"data"`
Metadata ArticlesListMetadata `json:"metadata"`
}
type RSS ¶
type RSS struct {
FeedHostname string
FeedPath string
FeedAuthorName string
FeedAuthorEmail string
Dataset interface {
datasources.LatestArticleLister
datasources.ArticleFetcher
}
CacheMaxAge time.Duration
}
type RecommendedArticlesList ¶
type RecommendedArticlesList struct {
Command command.Command[command.RecommendArticlesRequest, []domain.Article]
}
func (RecommendedArticlesList) ServeHTTP ¶
func (c RecommendedArticlesList) ServeHTTP(w http.ResponseWriter, r *http.Request)
type SemanticSearch ¶ added in v0.1.1
type SemanticSearch struct {
Embedder datasources.Embedder
Similarity datasources.SimilarArticlesByVectorLister
Fetcher datasources.ArticleFetcher
}
func (SemanticSearch) ServeHTTP ¶ added in v0.1.1
func (c SemanticSearch) ServeHTTP(w http.ResponseWriter, r *http.Request)
type SimilarArticlesList ¶
type SimilarArticlesList struct {
Fetcher datasources.ArticleFetcher
Similarity datasources.SimilarArticleLister
CacheMaxAge time.Duration
}
func (SimilarArticlesList) ServeHTTP ¶
func (c SimilarArticlesList) ServeHTTP(w http.ResponseWriter, r *http.Request)
type UserArticlesList ¶
type UserArticlesList struct {
Fetcher datasources.ArticleFetcher
ListFunc UserArticlesLister
ListEntity string // For error messages, e.g., "unreviewed", "liked", "disliked"
}
UserArticlesList is a generic controller for user-specific article lists.
func (UserArticlesList) ServeHTTP ¶
func (c UserArticlesList) ServeHTTP(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.