client

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package client provides a rest client to talk to the Trusty API.

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = Options{
	Workers: 2,
	BaseURL: defaultEndpoint,
}

DefaultOptions is the default Trusty client options set

Functions

This section is empty.

Types

type Options

type Options struct {
	HttpClient netClient
	// Workers is the number of parallel request the client makes to the API
	Workers int

	// BaseURL of the Trusty API
	BaseURL string
}

Options configures the Trusty API client

type Trusty

type Trusty struct {
	Options Options
}

Trusty is the main trusty client

func New

func New() *Trusty

New returns a new Trusty REST client

func NewWithOptions

func NewWithOptions(opts Options) *Trusty

NewWithOptions returns a new client with the dspecified options set

func (*Trusty) GroupReport added in v0.2.0

func (t *Trusty) GroupReport(_ context.Context, deps []*types.Dependency) ([]*types.Reply, error)

GroupReport queries the Trusty API in parallel for a group of dependencies.

func (*Trusty) PackageEndpoint added in v0.2.0

func (t *Trusty) PackageEndpoint(dep *types.Dependency) (string, error)

PackageEndpoint takes a dependency and returns the Trusty endpoint to query data about it.

func (*Trusty) PurlEndpoint added in v0.2.0

func (t *Trusty) PurlEndpoint(purl string) (string, error)

PurlEndpoint returns the API endpoint url to query for data about a purl

func (*Trusty) PurlToDependency added in v0.2.0

func (t *Trusty) PurlToDependency(purlString string) (*types.Dependency, error)

PurlToDependency takes a string with a package url

func (*Trusty) PurlToEcosystem added in v0.2.0

func (_ *Trusty) PurlToEcosystem(purl string) types.Ecosystem

PurlToEcosystem returns a trusty ecosystem constant from a Package URL's type

func (*Trusty) Report

func (t *Trusty) Report(_ context.Context, dep *types.Dependency) (*types.Reply, error)

Report returns a dependency report with all the data that Trust has available for a package

Jump to

Keyboard shortcuts

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