admin

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 60 Imported by: 0

Documentation

Overview

Package admin provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT.

Index

Constants

View Source
const (
	BearerAuthScopes bearerAuthContextKey = "BearerAuth.Scopes"
)

Variables

This section is empty.

Functions

func Handler added in v0.20.0

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux added in v0.20.0

func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL added in v0.20.0

func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler

func HandlerWithOptions added in v0.20.0

func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

Types

type Article added in v0.20.0

type Article struct {
	AgentId      *string `json:"agent_id,omitempty"`
	Author       *string `json:"author,omitempty"`
	CanonicalUrl string  `json:"canonical_url"`

	// Content Article body in markdown. Returned only when ?include=content is set.
	Content     *string            `json:"content,omitempty"`
	CreatedAt   time.Time          `json:"created_at"`
	FilePath    string             `json:"file_path"`
	Id          string             `json:"id"`
	Metadata    *map[string]string `json:"metadata,omitempty"`
	PublishedAt *time.Time         `json:"published_at,omitempty"`
	ReadAt      *time.Time         `json:"read_at,omitempty"`
	SavedAt     time.Time          `json:"saved_at"`
	SourceType  SourceType         `json:"source_type"`
	Starred     bool               `json:"starred"`
	Status      ArticleStatus      `json:"status"`
	Summary     *string            `json:"summary,omitempty"`
	Tags        *[]string          `json:"tags,omitempty"`
	Title       string             `json:"title"`
	UpdatedAt   time.Time          `json:"updated_at"`
	Url         string             `json:"url"`
}

Article defines model for Article.

type ArticleList added in v0.20.0

type ArticleList struct {
	Items []Article `json:"items"`
}

ArticleList defines model for ArticleList.

type ArticleStatus added in v0.20.0

type ArticleStatus string

ArticleStatus defines model for ArticleStatus.

const (
	Archived ArticleStatus = "archived"
	Read     ArticleStatus = "read"
	Unread   ArticleStatus = "unread"
)

Defines values for ArticleStatus.

func (ArticleStatus) Valid added in v0.20.0

func (e ArticleStatus) Valid() bool

Valid indicates whether the value is a known member of the ArticleStatus enum.

type AuthInfo added in v0.9.0

type AuthInfo struct {
	UserID   int64  `json:"user_id"`
	Username string `json:"username"`
	Role     string `json:"role"`
	IsAdmin  bool   `json:"is_admin"`
}

AuthInfo carries authenticated user data through request context.

func UserFromContext added in v0.9.0

func UserFromContext(ctx context.Context) *AuthInfo

UserFromContext extracts the AuthInfo from a request context. Returns nil if the user is not authenticated.

type BadRequest added in v0.20.0

type BadRequest = Error

BadRequest defines model for BadRequest.

type CreateFeedJSONRequestBody added in v0.20.0

type CreateFeedJSONRequestBody = CreateFeedRequest

CreateFeedJSONRequestBody defines body for CreateFeed for application/json ContentType.

type CreateFeedRequest added in v0.20.0

type CreateFeedRequest struct {
	AgentId *string `json:"agent_id,omitempty"`

	// Title Optional override; server fetches feed metadata if omitted
	Title *string `json:"title,omitempty"`
	Url   string  `json:"url"`
}

CreateFeedRequest defines model for CreateFeedRequest.

type Digest added in v0.20.0

type Digest struct {
	ArchivedCount        int64      `json:"archived_count"`
	Date                 time.Time  `json:"date"`
	ReadCount            int64      `json:"read_count"`
	SavedYesterday       []Article  `json:"saved_yesterday"`
	SavedYesterdayCount  int        `json:"saved_yesterday_count"`
	StarredCount         int64      `json:"starred_count"`
	TopTags              []TagCount `json:"top_tags"`
	TotalArticles        int64      `json:"total_articles"`
	UnreadCount          int64      `json:"unread_count"`
	WorthRevisiting      []Article  `json:"worth_revisiting"`
	WorthRevisitingCount int        `json:"worth_revisiting_count"`
}

Digest defines model for Digest.

type Error added in v0.20.0

type Error struct {
	Error string `json:"error"`
}

Error defines model for Error.

type Feed added in v0.20.0

type Feed struct {
	AgentId       *string    `json:"agent_id,omitempty"`
	CheckInterval string     `json:"check_interval"`
	CreatedAt     time.Time  `json:"created_at"`
	Description   *string    `json:"description,omitempty"`
	Enabled       bool       `json:"enabled"`
	Id            string     `json:"id"`
	LastCheckedAt *time.Time `json:"last_checked_at,omitempty"`
	LastEtag      *string    `json:"last_etag,omitempty"`
	LastModified  *string    `json:"last_modified,omitempty"`
	Title         string     `json:"title"`
	UpdatedAt     time.Time  `json:"updated_at"`
	Url           string     `json:"url"`
}

Feed defines model for Feed.

type FeedEntry added in v0.20.0

type FeedEntry struct {
	ArticleId    *string         `json:"article_id,omitempty"`
	Attempts     int             `json:"attempts"`
	DiscoveredAt time.Time       `json:"discovered_at"`
	ErrorMsg     *string         `json:"error_msg,omitempty"`
	FeedId       string          `json:"feed_id"`
	Guid         string          `json:"guid"`
	Id           string          `json:"id"`
	ProcessedAt  *time.Time      `json:"processed_at,omitempty"`
	Status       FeedEntryStatus `json:"status"`
	Title        string          `json:"title"`
	Url          string          `json:"url"`
}

FeedEntry defines model for FeedEntry.

type FeedEntryList added in v0.20.0

type FeedEntryList struct {
	Items []FeedEntry `json:"items"`
}

FeedEntryList defines model for FeedEntryList.

type FeedEntryStatus added in v0.20.0

type FeedEntryStatus string

FeedEntryStatus defines model for FeedEntryStatus.

const (
	FeedEntryStatusError   FeedEntryStatus = "error"
	FeedEntryStatusPending FeedEntryStatus = "pending"
	FeedEntryStatusSaved   FeedEntryStatus = "saved"
	FeedEntryStatusSkipped FeedEntryStatus = "skipped"
)

Defines values for FeedEntryStatus.

func (FeedEntryStatus) Valid added in v0.20.0

func (e FeedEntryStatus) Valid() bool

Valid indicates whether the value is a known member of the FeedEntryStatus enum.

type FeedList added in v0.20.0

type FeedList struct {
	Items []Feed `json:"items"`
}

FeedList defines model for FeedList.

type FeedPollResult added in v0.20.0

type FeedPollResult struct {
	// Error Set if the upstream RSS fetch failed but the feed exists
	Error      *string     `json:"error,omitempty"`
	Feed       Feed        `json:"feed"`
	NewEntries []FeedEntry `json:"new_entries"`
}

FeedPollResult defines model for FeedPollResult.

type GetArticleParams added in v0.20.0

type GetArticleParams struct {
	// Include Comma-separated extras (only `content` supported)
	Include *string `form:"include,omitempty" json:"include,omitempty"`
}

GetArticleParams defines parameters for GetArticle.

type InvalidParamFormatError added in v0.20.0

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error added in v0.20.0

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap added in v0.20.0

func (e *InvalidParamFormatError) Unwrap() error

type ListArticlesParams added in v0.20.0

type ListArticlesParams struct {
	// Q Free-text search across title, summary, tags, author
	Q          *string        `form:"q,omitempty" json:"q,omitempty"`
	Status     *ArticleStatus `form:"status,omitempty" json:"status,omitempty"`
	SourceType *SourceType    `form:"source_type,omitempty" json:"source_type,omitempty"`
	Starred    *bool          `form:"starred,omitempty" json:"starred,omitempty"`

	// CanonicalUrl Lookup by exact canonical URL
	CanonicalUrl *string `form:"canonical_url,omitempty" json:"canonical_url,omitempty"`
	Limit        *int    `form:"limit,omitempty" json:"limit,omitempty"`
}

ListArticlesParams defines parameters for ListArticles.

type ListFeedEntriesParams added in v0.20.0

type ListFeedEntriesParams struct {
	// Status Filter by entry status. Currently only 'pending' is supported; other values return 400.
	Status *FeedEntryStatus `form:"status,omitempty" json:"status,omitempty"`
	Limit  *int             `form:"limit,omitempty" json:"limit,omitempty"`
}

ListFeedEntriesParams defines parameters for ListFeedEntries.

type ListFeedsParams added in v0.20.0

type ListFeedsParams struct {
	// Url Lookup by exact feed URL
	Url *string `form:"url,omitempty" json:"url,omitempty"`
}

ListFeedsParams defines parameters for ListFeeds.

type MiddlewareFunc added in v0.20.0

type MiddlewareFunc func(http.Handler) http.Handler

type NotFound added in v0.20.0

type NotFound = Error

NotFound defines model for NotFound.

type PollFeedParams added in v0.20.0

type PollFeedParams struct {
	Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
}

PollFeedParams defines parameters for PollFeed.

type RequiredHeaderError added in v0.20.0

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error added in v0.20.0

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap added in v0.20.0

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError added in v0.20.0

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error added in v0.20.0

func (e *RequiredParamError) Error() string

type SaveArticleJSONRequestBody added in v0.20.0

type SaveArticleJSONRequestBody = SaveArticleRequest

SaveArticleJSONRequestBody defines body for SaveArticle for application/json ContentType.

type SaveArticleRequest added in v0.20.0

type SaveArticleRequest struct {
	AgentId      *string `json:"agent_id,omitempty"`
	Author       *string `json:"author,omitempty"`
	CanonicalUrl *string `json:"canonical_url,omitempty"`

	// Content Markdown body. If empty and the article exists, only metadata is updated; if empty and the article is new, the request fails 400.
	Content     *string            `json:"content,omitempty"`
	Metadata    *map[string]string `json:"metadata,omitempty"`
	PublishedAt *time.Time         `json:"published_at,omitempty"`
	SourceType  *SourceType        `json:"source_type,omitempty"`
	Summary     *string            `json:"summary,omitempty"`
	Tags        *[]string          `json:"tags,omitempty"`
	Title       *string            `json:"title,omitempty"`
	Url         string             `json:"url"`
}

SaveArticleRequest defines model for SaveArticleRequest.

type ServeMux added in v0.20.0

type ServeMux interface {
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
	http.Handler
}

ServeMux is an abstraction of http.ServeMux.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server provides HTTP handlers for the admin API and templ-rendered pages.

func New

func New(store config.Store, authStore auth.AuthStore, engine *auth.PolicyEngine, mem memory.Provider, db *sql.DB, linkCodes *auth.LinkCodeStore, poolManager *agent.PoolManager, pluginHost *pluginhost.Host) *Server

New creates an admin server with all API routes mounted. The linkCodes store is shared with channel bots so codes generated in the admin panel can be consumed by channel handlers.

func (*Server) CredentialsService added in v0.15.0

func (s *Server) CredentialsService() *credentials.Service

CredentialsService returns the shared credentials service. Used by callers that need to wire in the runner invalidator or access the credentials tool from outside the admin package.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the HTTP handler with CORS, JSON, and auth middleware applied.

func (*Server) LinkCodes added in v0.9.0

func (s *Server) LinkCodes() *auth.LinkCodeStore

LinkCodes returns the link code store for use by channel handlers.

func (*Server) SetTokenService added in v0.20.0

func (s *Server) SetTokenService(svc *auth.TokenService)

SetTokenService wires bearer token authentication into the admin server.

func (*Server) SetVaultRecipient added in v0.15.0

func (s *Server) SetVaultRecipient(r *age.X25519Recipient)

SetVaultRecipient sets the master age recipient so that new users created via web registration receive an age keypair. Call before serving requests. If not set (nil), vault key generation is skipped for new users.

func (*Server) SetVaultService added in v0.15.0

func (s *Server) SetVaultService(svc *vault.Service)

SetVaultService wires the vault service into the admin server. Call before serving requests. If not set (nil), vault API endpoints return 503 Service Unavailable.

type ServerInterface added in v0.20.0

type ServerInterface interface {
	// List or search articles
	// (GET /api/recally/articles)
	ListArticles(w http.ResponseWriter, r *http.Request, params ListArticlesParams)
	// Save an article (upsert by canonical URL)
	// (POST /api/recally/articles)
	SaveArticle(w http.ResponseWriter, r *http.Request)
	// Delete an article (DB row + markdown file)
	// (DELETE /api/recally/articles/{id})
	DeleteArticle(w http.ResponseWriter, r *http.Request, id string)
	// Get an article
	// (GET /api/recally/articles/{id})
	GetArticle(w http.ResponseWriter, r *http.Request, id string, params GetArticleParams)
	// Update article fields (partial)
	// (PUT /api/recally/articles/{id})
	UpdateArticle(w http.ResponseWriter, r *http.Request, id string)
	// Get the current user's reading digest
	// (GET /api/recally/digest)
	GetDigest(w http.ResponseWriter, r *http.Request)
	// List subscribed feeds
	// (GET /api/recally/feeds)
	ListFeeds(w http.ResponseWriter, r *http.Request, params ListFeedsParams)
	// Subscribe to a new feed (server fetches metadata)
	// (POST /api/recally/feeds)
	CreateFeed(w http.ResponseWriter, r *http.Request)
	// List entries for a feed
	// (GET /api/recally/feeds/{feedId}/entries)
	ListFeedEntries(w http.ResponseWriter, r *http.Request, feedId string, params ListFeedEntriesParams)
	// Update an entry (status transition)
	// (PUT /api/recally/feeds/{feedId}/entries/{id})
	UpdateFeedEntry(w http.ResponseWriter, r *http.Request, feedId string, id string)
	// Unsubscribe from a feed (cascade deletes entries)
	// (DELETE /api/recally/feeds/{id})
	DeleteFeed(w http.ResponseWriter, r *http.Request, id string)
	// Get a feed
	// (GET /api/recally/feeds/{id})
	GetFeed(w http.ResponseWriter, r *http.Request, id string)
	// Update feed fields (partial)
	// (PUT /api/recally/feeds/{id})
	UpdateFeed(w http.ResponseWriter, r *http.Request, id string)
	// Poll a feed (server fetches RSS, creates pending entries)
	// (POST /api/recally/feeds/{id}/poll)
	PollFeed(w http.ResponseWriter, r *http.Request, id string, params PollFeedParams)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper added in v0.20.0

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) CreateFeed added in v0.20.0

func (siw *ServerInterfaceWrapper) CreateFeed(w http.ResponseWriter, r *http.Request)

CreateFeed operation middleware

func (*ServerInterfaceWrapper) DeleteArticle added in v0.20.0

func (siw *ServerInterfaceWrapper) DeleteArticle(w http.ResponseWriter, r *http.Request)

DeleteArticle operation middleware

func (*ServerInterfaceWrapper) DeleteFeed added in v0.20.0

func (siw *ServerInterfaceWrapper) DeleteFeed(w http.ResponseWriter, r *http.Request)

DeleteFeed operation middleware

func (*ServerInterfaceWrapper) GetArticle added in v0.20.0

func (siw *ServerInterfaceWrapper) GetArticle(w http.ResponseWriter, r *http.Request)

GetArticle operation middleware

func (*ServerInterfaceWrapper) GetDigest added in v0.20.0

func (siw *ServerInterfaceWrapper) GetDigest(w http.ResponseWriter, r *http.Request)

GetDigest operation middleware

func (*ServerInterfaceWrapper) GetFeed added in v0.20.0

GetFeed operation middleware

func (*ServerInterfaceWrapper) ListArticles added in v0.20.0

func (siw *ServerInterfaceWrapper) ListArticles(w http.ResponseWriter, r *http.Request)

ListArticles operation middleware

func (*ServerInterfaceWrapper) ListFeedEntries added in v0.20.0

func (siw *ServerInterfaceWrapper) ListFeedEntries(w http.ResponseWriter, r *http.Request)

ListFeedEntries operation middleware

func (*ServerInterfaceWrapper) ListFeeds added in v0.20.0

func (siw *ServerInterfaceWrapper) ListFeeds(w http.ResponseWriter, r *http.Request)

ListFeeds operation middleware

func (*ServerInterfaceWrapper) PollFeed added in v0.20.0

func (siw *ServerInterfaceWrapper) PollFeed(w http.ResponseWriter, r *http.Request)

PollFeed operation middleware

func (*ServerInterfaceWrapper) SaveArticle added in v0.20.0

func (siw *ServerInterfaceWrapper) SaveArticle(w http.ResponseWriter, r *http.Request)

SaveArticle operation middleware

func (*ServerInterfaceWrapper) UpdateArticle added in v0.20.0

func (siw *ServerInterfaceWrapper) UpdateArticle(w http.ResponseWriter, r *http.Request)

UpdateArticle operation middleware

func (*ServerInterfaceWrapper) UpdateFeed added in v0.20.0

func (siw *ServerInterfaceWrapper) UpdateFeed(w http.ResponseWriter, r *http.Request)

UpdateFeed operation middleware

func (*ServerInterfaceWrapper) UpdateFeedEntry added in v0.20.0

func (siw *ServerInterfaceWrapper) UpdateFeedEntry(w http.ResponseWriter, r *http.Request)

UpdateFeedEntry operation middleware

type SourceType added in v0.20.0

type SourceType string

SourceType defines model for SourceType.

const (
	Github  SourceType = "github"
	Pdf     SourceType = "pdf"
	Rss     SourceType = "rss"
	Twitter SourceType = "twitter"
	Web     SourceType = "web"
	Youtube SourceType = "youtube"
)

Defines values for SourceType.

func (SourceType) Valid added in v0.20.0

func (e SourceType) Valid() bool

Valid indicates whether the value is a known member of the SourceType enum.

type StdHTTPServerOptions added in v0.20.0

type StdHTTPServerOptions struct {
	BaseURL          string
	BaseRouter       ServeMux
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type TagCount added in v0.20.0

type TagCount struct {
	Count int64  `json:"count"`
	Tag   string `json:"tag"`
}

TagCount defines model for TagCount.

type TooManyValuesForParamError added in v0.20.0

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error added in v0.20.0

type Unauthorized added in v0.20.0

type Unauthorized = Error

Unauthorized defines model for Unauthorized.

type UnescapedCookieParamError added in v0.20.0

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error added in v0.20.0

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap added in v0.20.0

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshalingParamError added in v0.20.0

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error added in v0.20.0

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap added in v0.20.0

func (e *UnmarshalingParamError) Unwrap() error

type UpdateArticleJSONRequestBody added in v0.20.0

type UpdateArticleJSONRequestBody = UpdateArticleRequest

UpdateArticleJSONRequestBody defines body for UpdateArticle for application/json ContentType.

type UpdateArticleRequest added in v0.20.0

type UpdateArticleRequest struct {
	Author *string `json:"author,omitempty"`

	// Content If set, rewrites the markdown file body.
	Content     *string            `json:"content,omitempty"`
	FilePath    *string            `json:"file_path,omitempty"`
	Metadata    *map[string]string `json:"metadata,omitempty"`
	PublishedAt *time.Time         `json:"published_at,omitempty"`
	Starred     *bool              `json:"starred,omitempty"`
	Status      *ArticleStatus     `json:"status,omitempty"`
	Summary     *string            `json:"summary,omitempty"`
	Tags        *[]string          `json:"tags,omitempty"`
	Title       *string            `json:"title,omitempty"`
}

UpdateArticleRequest Only provided fields are updated.

type UpdateFeedEntryJSONRequestBody added in v0.20.0

type UpdateFeedEntryJSONRequestBody = UpdateFeedEntryRequest

UpdateFeedEntryJSONRequestBody defines body for UpdateFeedEntry for application/json ContentType.

type UpdateFeedEntryRequest added in v0.20.0

type UpdateFeedEntryRequest struct {
	ArticleId *string         `json:"article_id,omitempty"`
	ErrorMsg  *string         `json:"error_msg,omitempty"`
	Status    FeedEntryStatus `json:"status"`
}

UpdateFeedEntryRequest defines model for UpdateFeedEntryRequest.

type UpdateFeedJSONRequestBody added in v0.20.0

type UpdateFeedJSONRequestBody = UpdateFeedRequest

UpdateFeedJSONRequestBody defines body for UpdateFeed for application/json ContentType.

type UpdateFeedRequest added in v0.20.0

type UpdateFeedRequest struct {
	CheckInterval *string `json:"check_interval,omitempty"`
	Description   *string `json:"description,omitempty"`
	Enabled       *bool   `json:"enabled,omitempty"`
	Title         *string `json:"title,omitempty"`
}

UpdateFeedRequest defines model for UpdateFeedRequest.

Directories

Path Synopsis
ui
templ: version: v0.3.1001
templ: version: v0.3.1001
pages
templ: version: v0.3.1001
templ: version: v0.3.1001

Jump to

Keyboard shortcuts

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