models

package
v0.0.0-...-8b8482c Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 16 Imported by: 3

README

Listendev Models

Models for the Listendev's API to guarantee interoperability across projects.

Generation of models

go install golang.org/x/tools/cmd/stringer@latest
go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@master # Use master branch
go generate -x ./...

Documentation

Overview

Package models provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.16.2 DO NOT EDIT.

Index

Constants

View Source
const (
	NPMPackageNameMetadataKey    = "npm_package_name"
	NPMPackageVersionMetadataKey = "npm_package_version"
)

Variables

View Source
var (
	CompactMetadata = true
)

Functions

This section is empty.

Types

type FilterParsingError

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

func (*FilterParsingError) Error

func (e *FilterParsingError) Error() string

type Problem

type Problem struct {
	Detail string `json:"detail"`
	Title  string `json:"title"`
	Type   string `json:"type"`
}

Problem defines model for Problem.

type Verdict

type Verdict struct {
	Categories  []externalRef1.Category `` /* 130-byte string literal not displayed */
	Code        externalRef3.Code       `` /* 135-byte string literal not displayed */
	CreatedAt   *time.Time              `ch:"created_at" human:"the moment the verdict was created" json:"created_at,omitempty" validate:"mandatory"`
	Digest      string                  `ch:"digest" human:"the package digest" json:"digest" validate:"mandatory"`
	Ecosystem   externalRef0.Ecosystem  `ch:"ecosystem" human:"the ecosystem the target package belongs to" json:"ecosystem" validate:"is_ecosystem"`
	ExpiresAt   *time.Time              `ch:"expires_at" json:"expires_at"`
	File        string                  `ch:"file" human:"the result file identifying the analysis type" json:"file" validate:"mandatory,is_resultsfile"`
	Fingerprint string                  `ch:"fingerprint" human:"a string uniquely identifying this verdict instance" json:"fingerprint,omitempty"`
	Message     string                  `ch:"message" human:"the verdict message" json:"message,omitempty" validate:"omitempty,gt=1"`
	Metadata    map[string]interface{}  `ch:"metadata" json:"metadata,omitempty"`
	Org         string                  `ch:"org" human:"the organization name" json:"org,omitempty" validate:"omitempty"`
	Pkg         string                  `ch:"pkg" human:"the package name" json:"pkg" validate:"mandatory"`
	Severity    externalRef2.Severity   `ch:"severity" human:"the verdict severity" json:"severity,omitempty" validate:"required_with=Message,isdefault|is_severity"`
	Version     string                  `ch:"version" human:"the package version" json:"version" validate:"mandatory,semver"`
}

Verdict defines model for Verdict.

func NewEmptyVerdict

func NewEmptyVerdict(eco ecosystem.Ecosystem, org, pkg, version, digest, file string) (*Verdict, error)

func (*Verdict) ExpiresIn

func (o *Verdict) ExpiresIn(duration time.Duration)

func (*Verdict) HasExpired

func (o *Verdict) HasExpired() bool

func (Verdict) Key

func (o Verdict) Key() (string, error)

func (Verdict) MarshalJSON

func (o Verdict) MarshalJSON() ([]byte, error)

func (*Verdict) UnmarshalJSON

func (o *Verdict) UnmarshalJSON(data []byte) error

func (*Verdict) Validate

func (o *Verdict) Validate() error

type Verdicts

type Verdicts []Verdict

func FromBuffer

func FromBuffer(stream io.Reader) (Verdicts, error)

func (*Verdicts) Buffer

func (v *Verdicts) Buffer() (io.Reader, error)

func (*Verdicts) Filter

func (v *Verdicts) Filter(c context.Context, jsonpath string) (interface{}, Verdicts, error)

Filter applies a JSONPath expression to the receiving Verdicts and returns the result.

See the JSONPath expressions documentation for more information about the syntax: https://goessner.net/articles/JsonPath/index.html#e2.

The result is returned as raw (interface{} or interface{} slice) and as a Verdicts instance. Notice that, depending on the JSONPath input, the result may have a different structure than the Verdicts one: in this case this function returns the raw result, a nil Verdicts, and an error due to the conversion failure.

Directories

Path Synopsis
Package category provides primitives to interact with the openapi HTTP API.
Package category provides primitives to interact with the openapi HTTP API.
Package severity provides primitives to interact with the openapi HTTP API.
Package severity provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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