wingetsvc

package module
v0.0.0-...-e914723 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: MIT Imports: 18 Imported by: 0

README

wingetsvc

Simple service that offers a REST API to query winget

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeHTTPHandler

func MakeHTTPHandler(endpoints Endpoints, logger *slog.Logger) http.Handler

Types

type Config

type Config struct {
	LogLevel  slog.Level `json:"log_level,omitempty"`
	LogFormat string     `json:"log_format,omitempty"`
	HTTPAddr  string     `json:"http_addr,omitempty"`
}

func LoadConfig

func LoadConfig(args []string) *Config

type Endpoints

type Endpoints struct {
	Search   endpoint.Endpoint
	Versions endpoint.Endpoint
}

func MakeEndpoints

func MakeEndpoints(svc Service) Endpoints

type Query

type Query struct {
	Term string `json:"term,omitempty"`
}

type Service

type Service interface {
	Search(ctx context.Context, query Query) ([]ServiceInfo, error)
	Versions(ctx context.Context, packageId string) ([]string, error)
}

func NewService

func NewService(controller WingetController) Service

type ServiceInfo

type ServiceInfo struct {
	Id      string `json:"id,omitempty"`
	Name    string `json:"name,omitempty"`
	Version string `json:"version,omitempty"`
}

type WingetController

type WingetController interface {
	Search(ctx context.Context, term string) ([]ServiceInfo, error)
	Versions(ctx context.Context, packageId string) ([]string, error)
}

func NewWingetController

func NewWingetController(logger *slog.Logger) WingetController

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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