api

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryParamLimit       = "limit"
	QueryParamOffset      = "offset"
	QueryParamReleaseTime = "release_time"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Router *mux.Router
	// contains filtered or unexported fields
}

API provides a struct to wrap the api around

func Setup

func Setup(_ context.Context, isPublishing bool, r *mux.Router, dataStore DataStore, identityHandler func(http.Handler) http.Handler) *API

Setup function sets up the api and returns an API

func (*API) CreateOrUpdateCacheTime

func (api *API) CreateOrUpdateCacheTime(w http.ResponseWriter, req *http.Request)

CreateOrUpdateCacheTime handles the creation or update of a cache time

func (*API) GetCacheTime

func (api *API) GetCacheTime(w http.ResponseWriter, req *http.Request)

GetCacheTime retrieves a cache time for a given ID and writes it to the HTTP response.

func (*API) GetCacheTimes added in v1.7.0

func (api *API) GetCacheTimes(w http.ResponseWriter, req *http.Request)

GetCacheTimes retrieves a list of cache times with optional filtering and pagination.

type DataStore

type DataStore interface {
	Checker(ctx context.Context, state *healthcheck.CheckState) error
	Close(ctx context.Context) error
	IsConnected(ctx context.Context) bool
	GetCacheTime(ctx context.Context, id string) (*models.CacheTime, error)
	GetCacheTimes(ctx context.Context, offset int, limit int, releaseTime time.Time) ([]*models.CacheTime, int, error)
	UpsertCacheTime(ctx context.Context, cacheTime *models.CacheTime) error
}

DataStore defines the behaviour of a DataStore

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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