api

package
v0.27.2 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: AGPL-3.0 Imports: 77 Imported by: 0

Documentation

Overview

Package api provides the HTTP and Graphql API for the application.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotImplemented is an error which means the given functionality isn't implemented by the API.
	ErrNotImplemented = errors.New("not implemented")

	// ErrNotSupported is returned whenever there's a test, which can be used to guard against the error,
	// but the given parameters aren't supported by the system.
	ErrNotSupported = errors.New("not supported")

	// ErrInput signifies errors where the input isn't valid for some reason. And no more specific error exists.
	ErrInput = errors.New("input error")
)
View Source
var (
	BaseURLCtxKey = &contextKey{"BaseURL"}
)
View Source
var ErrInvalidPackageType = errors.New("invalid package type")
View Source
var ErrOverriddenConfig = errors.New("cannot set overridden value")
View Source
var ErrTimestamp = errors.New("cannot parse Timestamp")

Functions

func BaseURLMiddleware

func BaseURLMiddleware(next http.Handler) http.Handler

func MarshalBoolMap added in v0.24.0

func MarshalBoolMap(val map[string]bool) graphql.Marshaler

func MarshalPluginConfigMap added in v0.25.0

func MarshalPluginConfigMap(val map[string]map[string]interface{}) graphql.Marshaler

func MarshalTimestamp added in v0.22.0

func MarshalTimestamp(t time.Time) graphql.Marshaler

func SecurityHeadersMiddleware

func SecurityHeadersMiddleware(next http.Handler) http.Handler

func UnmarshalBoolMap added in v0.24.0

func UnmarshalBoolMap(v interface{}) (map[string]bool, error)

func UnmarshalPluginConfigMap added in v0.25.0

func UnmarshalPluginConfigMap(v interface{}) (map[string]map[string]interface{}, error)

func UnmarshalTimestamp added in v0.22.0

func UnmarshalTimestamp(v interface{}) (time.Time, error)

Types

type BaseFile added in v0.23.0

type BaseFile interface {
	IsBaseFile()
}

type CaptionFinder added in v0.17.0

type CaptionFinder interface {
	GetCaptions(ctx context.Context, fileID models.FileID) ([]*models.VideoCaption, error)
}

type GalleryFile added in v0.23.0

type GalleryFile struct {
	*models.BaseFile
}

func (*GalleryFile) Fingerprints added in v0.24.0

func (f *GalleryFile) Fingerprints() []models.Fingerprint

func (GalleryFile) IsBaseFile added in v0.24.0

func (GalleryFile) IsBaseFile()

func (GalleryFile) IsVisualFile added in v0.24.0

func (GalleryFile) IsVisualFile()

type GalleryFinder added in v0.27.0

type GalleryFinder interface {
	models.GalleryGetter
	FindByChecksum(ctx context.Context, checksum string) ([]*models.Gallery, error)
}

type GalleryImageFinder added in v0.27.0

type GalleryImageFinder interface {
	FindByGalleryIDIndex(ctx context.Context, galleryID int, index uint) (*models.Image, error)
	image.Queryer
	image.CoverQueryer
}

type GroupFinder added in v0.27.0

type GroupFinder interface {
	models.GroupGetter
	GetFrontImage(ctx context.Context, groupID int) ([]byte, error)
	GetBackImage(ctx context.Context, groupID int) ([]byte, error)
}

type ImageFile added in v0.24.0

type ImageFile struct {
	*models.ImageFile
}

func (*ImageFile) Fingerprints added in v0.24.0

func (f *ImageFile) Fingerprints() []models.Fingerprint

func (ImageFile) IsBaseFile added in v0.24.0

func (ImageFile) IsBaseFile()

func (ImageFile) IsVisualFile added in v0.24.0

func (ImageFile) IsVisualFile()

type ImageFinder added in v0.17.0

type ImageFinder interface {
	models.ImageGetter
	FindByChecksum(ctx context.Context, checksum string) ([]*models.Image, error)
}

type LatestRelease added in v0.19.0

type LatestRelease struct {
	Version   string
	Hash      string
	ShortHash string
	Date      string
	Url       string
}

func GetLatestRelease added in v0.19.0

func GetLatestRelease(ctx context.Context) (*LatestRelease, error)

GetLatestRelease gets latest release information from github API If running a build from the "master" branch, then the latest full release is used, otherwise it uses the release that is tagged with "latest_develop" which is the latest pre-release build.

type PerformerFinder added in v0.17.0

type PerformerFinder interface {
	models.PerformerGetter
	GetImage(ctx context.Context, performerID int) ([]byte, error)
}

type Resolver

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

func (*Resolver) ConfigResult added in v0.24.0

func (r *Resolver) ConfigResult() ConfigResultResolver

func (*Resolver) Gallery

func (r *Resolver) Gallery() GalleryResolver

func (*Resolver) GalleryChapter added in v0.20.0

func (r *Resolver) GalleryChapter() GalleryChapterResolver

func (*Resolver) GalleryFile added in v0.24.0

func (r *Resolver) GalleryFile() GalleryFileResolver

func (*Resolver) Group added in v0.27.0

func (r *Resolver) Group() GroupResolver

func (*Resolver) Image

func (r *Resolver) Image() ImageResolver

func (*Resolver) ImageFile added in v0.24.0

func (r *Resolver) ImageFile() ImageFileResolver

func (*Resolver) Movie

func (r *Resolver) Movie() MovieResolver

func (*Resolver) Mutation

func (r *Resolver) Mutation() MutationResolver

func (*Resolver) Performer

func (r *Resolver) Performer() PerformerResolver

func (*Resolver) Plugin added in v0.24.0

func (r *Resolver) Plugin() PluginResolver

func (*Resolver) Query

func (r *Resolver) Query() QueryResolver

func (*Resolver) SavedFilter added in v0.23.0

func (r *Resolver) SavedFilter() SavedFilterResolver

func (*Resolver) Scene

func (r *Resolver) Scene() SceneResolver

func (*Resolver) SceneMarker

func (r *Resolver) SceneMarker() SceneMarkerResolver

func (*Resolver) Studio

func (r *Resolver) Studio() StudioResolver

func (*Resolver) Subscription

func (r *Resolver) Subscription() SubscriptionResolver

func (*Resolver) Tag

func (r *Resolver) Tag() TagResolver

func (*Resolver) VideoFile added in v0.24.0

func (r *Resolver) VideoFile() VideoFileResolver

type SceneFinder added in v0.17.0

type SceneFinder interface {
	models.SceneGetter

	FindByChecksum(ctx context.Context, checksum string) ([]*models.Scene, error)
	FindByOSHash(ctx context.Context, oshash string) ([]*models.Scene, error)
	GetCover(ctx context.Context, sceneID int) ([]byte, error)
}

type SceneMarkerFinder added in v0.17.0

type SceneMarkerFinder interface {
	models.SceneMarkerGetter
	FindBySceneID(ctx context.Context, sceneID int) ([]*models.SceneMarker, error)
}

type SceneMarkerTagFinder added in v0.23.0

type SceneMarkerTagFinder interface {
	models.TagGetter
	FindBySceneMarkerID(ctx context.Context, sceneMarkerID int) ([]*models.Tag, error)
}

type Server added in v0.24.0

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

func Initialize added in v0.24.0

func Initialize() (*Server, error)

Initialize creates a new Server instance. It assumes that the manager.Manager instance has been initialised.

func (*Server) Shutdown added in v0.24.0

func (s *Server) Shutdown()

Shutdown gracefully shuts down the server without interrupting any active connections.

func (*Server) Start added in v0.24.0

func (s *Server) Start() error

Start starts the server. It listens on the configured address and port. It calls ListenAndServeTLS if TLS is configured, otherwise it calls ListenAndServe. Calls to Start are blocked until the server is shutdown.

type StudioFinder added in v0.17.0

type StudioFinder interface {
	models.StudioGetter
	GetImage(ctx context.Context, studioID int) ([]byte, error)
}

type TagFinder added in v0.17.0

type TagFinder interface {
	models.TagGetter
	GetImage(ctx context.Context, tagID int) ([]byte, error)
}

type VideoFile added in v0.24.0

type VideoFile struct {
	*models.VideoFile
}

func (*VideoFile) Fingerprints added in v0.24.0

func (f *VideoFile) Fingerprints() []models.Fingerprint

func (VideoFile) IsBaseFile added in v0.24.0

func (VideoFile) IsBaseFile()

func (VideoFile) IsVisualFile added in v0.24.0

func (VideoFile) IsVisualFile()

type VisualFile added in v0.24.0

type VisualFile interface {
	IsVisualFile()
}

Source Files

Directories

Path Synopsis
Package urlbuilders provides the builders used to build URLs to pass to clients.
Package urlbuilders provides the builders used to build URLs to pass to clients.

Jump to

Keyboard shortcuts

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