gpm

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultServer = "https://gpm.jolheiser.com"
	TokenHeader   = "X-GPM-Token"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a gpm client

func New

func New(token string, opts ...ClientOption) *Client

New returns a new Client

func (*Client) Add

func (c *Client) Add(ctx context.Context, pkg Package) error

Add adds a new Package to a gpm server

func (*Client) Get

func (c *Client) Get(ctx context.Context, name string) (Package, error)

Get gets a Package from a server

func (*Client) Info

func (c *Client) Info(ctx context.Context) (Info, error)

Info gets Info from a gpm server

func (*Client) Remove

func (c *Client) Remove(ctx context.Context, pkg Package) error

Remove removes a Package from a gpm server

func (*Client) Update

func (c *Client) Update(ctx context.Context, pkg Package) error

Update updates a Package on a gpm server

type ClientOption

type ClientOption func(*Client)

ClientOption is an option for a Client

func WithHTTP

func WithHTTP(client *http.Client) ClientOption

WithHTTP sets the http.Client for a Client

func WithServer

func WithServer(server string) ClientOption

WithServer sets the gpm server for a Client

type Info

type Info struct {
	Version     string    `json:"version"`
	NumPackages int       `json:"num_packages"`
	Packages    []Package `json:"packages"`
}

Info is gpm information, such as version and list of packages

type Package

type Package struct {
	Name   string `json:"name"`
	Import string `json:"import"`
}

Package is a gpm package

Jump to

Keyboard shortcuts

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