listen

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: Apache-2.0

Copyright © 2023 The listen.dev team <engineering@garnet.ai>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright © 2023 The listen.dev team <engineering@garnet.ai>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright © 2023 The listen.dev team <engineering@garnet.ai>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright © 2023 The listen.dev team <engineering@garnet.ai>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright © 2023 The listen.dev team <engineering@garnet.ai>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright © 2023 The listen.dev team <engineering@garnet.ai>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithBaseURL

func WithBaseURL(input string) func(*options)

func WithContext

func WithContext(input context.Context) func(*options)

func WithEcosystem added in v0.12.0

func WithEcosystem(eco ecosystem.Ecosystem) func(*options)

func WithJSONOptions

func WithJSONOptions(input flags.JSONFlags) func(*options)

func WithUserAgent added in v0.10.0

func WithUserAgent(userAgent string) func(*options)

Types

type AnalysisRequest

type AnalysisRequest struct {
	Manifest listentype.AnalysisRequester `json:"manifest" name:"manifest" validate:"mandatory"`
	Context  *Context                     `json:"context,omitempty"`
}

AnalysisRequest represents the payload for the analysis listen.dev API endpoint.

func NewAnalysisRequest

func NewAnalysisRequest(lockfile listentype.AnalysisRequester, opts ...RequestOption) (*AnalysisRequest, error)

func (AnalysisRequest) IsRequest

func (req AnalysisRequest) IsRequest() bool

func (AnalysisRequest) MarshalJSON

func (req AnalysisRequest) MarshalJSON() ([]byte, error)

MarshalJSON is a custom marshaler that encodes the content of the package lock in the receiving AnalysisRequest.

func (*AnalysisRequest) Ok

func (req *AnalysisRequest) Ok() (bool, error)

type Context

type Context struct {
	ID      uuid.UUID         `json:"id"`
	Version version.Version   `json:"version"`
	Git     *git.Context      `json:"git,omitempty"`
	OS      *lstnos.Info      `json:"os,omitempty"`
	PMs     map[string]string `json:"packagemanagers,omitempty"`
}

func NewContext

func NewContext(funcs ...git.GetDirFunc) *Context

type Package

type Package struct {
	// Name name of the package
	Name string `json:"name"`

	// Problems A list of problems
	Problems []Problem `json:"problems,omitempty"`

	// Shasum shasum of the package
	Digest *string `json:"digest,omitempty"`

	// Verdicts A list of verdicts
	Verdicts []Verdict `json:"verdicts"`

	// Version version of the package
	Version *string `json:"version,omitempty"`
}

type Problem

type Problem = models.Problem

type Request

type Request interface {
	IsRequest() bool
	Ok() (bool, error)
}

type RequestOption added in v0.10.0

type RequestOption func(*AnalysisRequest)

func WithRequestContext added in v0.10.0

func WithRequestContext() RequestOption

type Response

type Response []Package

func BulkPackages added in v0.3.0

func BulkPackages(requests []*VerdictsRequest, opts ...func(*options)) (*Response, []byte, error)

func Packages

func Packages[T Request](r T, opts ...func(*options)) (*Response, []byte, error)

func (Response) Verdicts added in v0.11.0

func (r Response) Verdicts() models.Verdicts

type Verdict

type Verdict = models.Verdict

type VerdictsRequest

type VerdictsRequest struct {
	Name    string   `json:"name" name:"name" validate:"mandatory"`
	Version string   `json:"version,omitempty" validate:"omitempty,semver"`
	Digest  string   `json:"digest,omitempty" validate:"omitempty,digest"`
	Select  string   `json:"select,omitempty"`
	Context *Context `json:"context,omitempty"`
}

VerdictsRequest represents the payload for the verdicts listen.dev API endpoint.

func NewBulkVerdictsRequests added in v0.3.0

func NewBulkVerdictsRequests(names []string, versions semver.Collection, selection string) ([]*VerdictsRequest, error)

func NewBulkVerdictsRequestsFromMap added in v0.3.0

func NewBulkVerdictsRequestsFromMap(deps map[string]*semver.Version, selection string) ([]*VerdictsRequest, error)

func NewVerdictsRequest

func NewVerdictsRequest(args []string) (*VerdictsRequest, error)

func NewVerdictsRequestWithContext added in v0.3.0

func NewVerdictsRequestWithContext(args []string, c *Context) (*VerdictsRequest, error)

func (VerdictsRequest) IsRequest

func (req VerdictsRequest) IsRequest() bool

func (VerdictsRequest) MarshalJSON

func (req VerdictsRequest) MarshalJSON() ([]byte, error)

func (*VerdictsRequest) Ok

func (req *VerdictsRequest) Ok() (bool, error)

Directories

Path Synopsis
SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: Apache-2.0

Jump to

Keyboard shortcuts

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