rest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package rest implements the pageshot's REST API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler is an REST HTTP handler.

func NewHandler

func NewHandler(params HandlerParams) *Handler

NewHandler returns net http.Handler.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP satisfies the http.Handler interface.

type HandlerParams

type HandlerParams struct {
	Logger            *logrus.Logger
	ScreenshotService ScreenshotService
}

HandlerParams is an incoming params for the NewHandler function.

type ScreenshotService

type ScreenshotService interface {
	Screenshot(ctx context.Context, opts models.ScreenshotOptions) (io.Reader, string, error)
}

ScreenshotService is a screenshot interface that is required for the Handler.

type Server

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

Server is main HTTP server.

func NewServer

func NewServer(params ServerParams) *Server

NewServer creates new instance of the Server.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown gracefully shut downs the server.

func (*Server) Start

func (s *Server) Start() error

Start starts the server.

type ServerParams

type ServerParams struct {
	Config  config.ServerConfig
	Handler http.Handler
}

ServerParams is an incoming params for the NewServer function.

Jump to

Keyboard shortcuts

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