mediaserver

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DocumentClient

type DocumentClient interface {
	LookupShelfByName(context.Context, string) (uuid.UUID, bool, error)
	UploadDocument(_ context.Context, shelfID uuid.UUID, _ io.Reader, uniqueName, name, disk, path string) (document.Document, error)
	ReplaceDocument(_ context.Context, shelfID, documentID uuid.UUID, _ io.Reader) (document.Document, error)
	FetchShelf(context.Context, uuid.UUID) (document.JSONShelf, error)
}

Use github.com/modernice/nice-cms/media/mediarpc.NewClient to get a gRPC DocumentClient.

type GalleryClient

type GalleryClient interface {
	LookupGalleryByName(context.Context, string) (uuid.UUID, bool, error)
	LookupGalleryStackByName(_ context.Context, galleryID uuid.UUID, name string) (uuid.UUID, bool, error)
	UploadImage(_ context.Context, galleryID uuid.UUID, _ io.Reader, name, disk, path string) (gallery.Stack, error)
	ReplaceImage(_ context.Context, galleryID, stackID uuid.UUID, _ io.Reader) (gallery.Stack, error)
	FetchGallery(context.Context, uuid.UUID) (gallery.JSONGallery, error)
}

Use github.com/modernice/nice-cms/media/mediarpc.NewClient to get a gRPC GalleryClient.

type Option

type Option func(*Server)

Option is server option.

func WithDocuments

func WithDocuments(client DocumentClient, routePrefix string, opts ...routes.Option) Option

WithDocuments returns an Option that adds document routes to the media server.

func WithGalleries

func WithGalleries(client GalleryClient, opts ...routes.Option) Option

WithGalleries returns an Option that adds gallery routes to the media server.

type Server

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

Server is the media server.

func New

func New(commands command.Bus, opts ...Option) *Server

New returns the media server. Use the WithXXX Options to add routes to the media server:

var commands command.Bus
client := mediarpc.NewClient(...)
srv := New(commands, WithDocuments(client, "/shelfs"), WithGalleries(client, "/galleries"))

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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