endpoints

package
v0.0.0-...-1eb5c16 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	PostRegistry *search.PostRegistry
	UserCount    *usercount.UserCount

	Store *store.Store

	ClusterManager *clusters.ClusterManager

	LayoutServiceHost string

	Directory identity.Directory

	ThreadViewCacheTTL time.Duration
	ThreadViewCache    *lru.ARCCache[string, ThreadViewCacheEntry]
	LayoutCacheTTL     time.Duration
	LayoutCache        *lru.ARCCache[string, LayoutCacheEntry]
	StatsCacheTTL      time.Duration
	StatsCache         *StatsCacheEntry
	StatsCacheRWMux    *sync.RWMutex

	CheckoutLimiter *rate.Limiter
	MagicHeaderVal  string
}

func NewAPI

func NewAPI(
	postRegistry *search.PostRegistry,
	store *store.Store,
	userCount *usercount.UserCount,
	graphJSONUrl string,
	layoutServiceHost string,
	MagicHeaderVal string,
	threadViewCacheTTL time.Duration,
	layoutCacheTTL time.Duration,
	statsCacheTTL time.Duration,
) (*API, error)

func (*API) CancelCleanupJob

func (api *API) CancelCleanupJob(c *gin.Context)

func (*API) CleanupOldRecords

func (api *API) CleanupOldRecords(c *gin.Context)

func (*API) GetAuthorStats

func (api *API) GetAuthorStats(c *gin.Context)

func (*API) GetCleanupStats

func (api *API) GetCleanupStats(c *gin.Context)

func (*API) GetCleanupStatus

func (api *API) GetCleanupStatus(c *gin.Context)

func (*API) GetClusterForDID

func (api *API) GetClusterForDID(c *gin.Context)

func (*API) GetClusterForHandle

func (api *API) GetClusterForHandle(c *gin.Context)

func (*API) GetClusterList

func (api *API) GetClusterList(c *gin.Context)

func (*API) GetListMembers

func (api *API) GetListMembers(c *gin.Context)

func (*API) GetOptedOutAuthors

func (api *API) GetOptedOutAuthors(c *gin.Context)

func (*API) GetRepoAsJSON

func (api *API) GetRepoAsJSON(c *gin.Context)

func (*API) GetThreadView

func (api *API) GetThreadView(ctx context.Context, postID, authorID string) ([]search.PostView, error)

func (*API) GraphOptIn

func (api *API) GraphOptIn(c *gin.Context)

func (*API) GraphOptOut

func (api *API) GraphOptOut(c *gin.Context)

func (*API) LayoutThread

func (api *API) LayoutThread(ctx context.Context, rootPostID string, threadView []search.PostView) ([]layout.ThreadViewLayout, error)

func (*API) ProcessThreadRequest

func (api *API) ProcessThreadRequest(c *gin.Context)

func (*API) RedirectAtURI

func (api *API) RedirectAtURI(c *gin.Context)

func (*API) RefreshSiteStats

func (api *API) RefreshSiteStats(ctx context.Context) error

func (*API) RunCleanupDaemon

func (api *API) RunCleanupDaemon(ctx context.Context)

RunCleanupDaemon runs a daemon that periodically checks for cleanup jobs to run

func (*API) SearchActorTypeAhead

func (api *API) SearchActorTypeAhead(c *gin.Context)

type AuthorStatsResponse

type AuthorStatsResponse struct {
	TotalUsers          int                 `json:"total_users"`
	TotalAuthors        int64               `json:"total_authors"`
	TotalPosts          int64               `json:"total_posts"`
	MeanPostCount       float64             `json:"mean_post_count"`
	Percentiles         []search.Percentile `json:"percentiles"`
	FollowerPercentiles []StatPercentile    `json:"follower_percentiles"`
	Brackets            []search.Bracket    `json:"brackets"`
	UpdatedAt           time.Time           `json:"updated_at"`
	DailyData           []DailyDatapoint    `json:"daily_data"`
}

type CleanupOldRecordsRequest

type CleanupOldRecordsRequest struct {
	Identifier          string   `json:"identifier"`
	AppPassword         string   `json:"app_password"`
	CleanupTypes        []string `json:"cleanup_types"`
	DeleteUntilDaysAgo  int      `json:"delete_until_days_ago"`
	ActuallyDeleteStuff bool     `json:"actually_delete_stuff"`
}

type DailyDatapoint

type DailyDatapoint struct {
	Date                    string `json:"date"`
	LikesPerDay             int64  `json:"num_likes"`
	DailyActiveLikers       int64  `json:"num_likers"`
	DailyActivePosters      int64  `json:"num_posters"`
	PostsPerDay             int64  `json:"num_posts"`
	PostsWithImagesPerDay   int64  `json:"num_posts_with_images"`
	ImagesPerDay            int64  `json:"num_images"`
	ImagesWithAltTextPerDay int64  `json:"num_images_with_alt_text"`
	FirstTimePosters        int64  `json:"num_first_time_posters"`
	FollowsPerDay           int64  `json:"num_follows"`
	DailyActiveFollowers    int64  `json:"num_followers"`
	BlocksPerDay            int64  `json:"num_blocks"`
	DailyActiveBlockers     int64  `json:"num_blockers"`
}

type GraphOptRequest

type GraphOptRequest struct {
	Username    string `json:"username"`
	AppPassword string `json:"appPassword"`
}

type LayoutCacheEntry

type LayoutCacheEntry struct {
	Layout     []layout.ThreadViewLayout
	Expiration time.Time
}

type StatPercentile

type StatPercentile struct {
	Percentile float64 `json:"percentile"`
	Value      float64 `json:"value"`
}

type StatsCacheEntry

type StatsCacheEntry struct {
	Stats      AuthorStatsResponse
	Expiration time.Time
}

type ThreadViewCacheEntry

type ThreadViewCacheEntry struct {
	ThreadView []search.PostView
	Expiration time.Time
}

type TypeaheadMatch

type TypeaheadMatch struct {
	Handle string  `json:"handle"`
	DID    string  `json:"did"`
	Score  float64 `json:"score"`
}

Jump to

Keyboard shortcuts

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