client

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

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

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.

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

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAnalyzeDependenciesRequest

func NewAnalyzeDependenciesRequest(server string, params *AnalyzeDependenciesParams) (*http.Request, error)

NewAnalyzeDependenciesRequest generates requests for AnalyzeDependencies

func NewGetArtifactDepsRequest added in v0.14.0

func NewGetArtifactDepsRequest(server string, digest string) (*http.Request, error)

NewGetArtifactDepsRequest generates requests for GetArtifactDeps

func NewGetArtifactVulnsRequest added in v0.14.0

func NewGetArtifactVulnsRequest(server string, digest string) (*http.Request, error)

NewGetArtifactVulnsRequest generates requests for GetArtifactVulns

func NewGetPackageDepsRequest added in v0.14.0

func NewGetPackageDepsRequest(server string, purl string) (*http.Request, error)

NewGetPackageDepsRequest generates requests for GetPackageDeps

func NewGetPackagePurlsRequest added in v0.14.0

func NewGetPackagePurlsRequest(server string, purl string) (*http.Request, error)

NewGetPackagePurlsRequest generates requests for GetPackagePurls

func NewGetPackageVulnsRequest added in v0.14.0

func NewGetPackageVulnsRequest(server string, purl string, params *GetPackageVulnsParams) (*http.Request, error)

NewGetPackageVulnsRequest generates requests for GetPackageVulns

func NewHealthCheckRequest

func NewHealthCheckRequest(server string) (*http.Request, error)

NewHealthCheckRequest generates requests for HealthCheck

Types

type AnalyzeDependenciesParams

type AnalyzeDependenciesParams struct {
	// PaginationSpec The pagination configuration for the query.
	//   * 'PageSize' specifies the number of results returned
	//   * 'Cursor' is returned by previous calls and specifies what page to return
	PaginationSpec *PaginationSpec `form:"paginationSpec,omitempty" json:"paginationSpec,omitempty"`

	// Sort The sort order of the packages
	//   * 'frequency' - The packages with the highest number of dependents
	//   * 'scorecard' - The packages with the lowest OpenSSF scorecard score
	Sort AnalyzeDependenciesParamsSort `form:"sort" json:"sort"`
}

AnalyzeDependenciesParams defines parameters for AnalyzeDependencies.

type AnalyzeDependenciesParamsSort

type AnalyzeDependenciesParamsSort string

AnalyzeDependenciesParamsSort defines parameters for AnalyzeDependencies.

const (
	Frequency AnalyzeDependenciesParamsSort = "frequency"
	Scorecard AnalyzeDependenciesParamsSort = "scorecard"
)

Defines values for AnalyzeDependenciesParamsSort.

type AnalyzeDependenciesResponse

type AnalyzeDependenciesResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *PackageNameList
	JSON400      *BadRequest
	JSON500      *InternalServerError
	JSON502      *BadGateway
}

func ParseAnalyzeDependenciesResponse

func ParseAnalyzeDependenciesResponse(rsp *http.Response) (*AnalyzeDependenciesResponse, error)

ParseAnalyzeDependenciesResponse parses an HTTP response from a AnalyzeDependenciesWithResponse call

func (AnalyzeDependenciesResponse) Status

Status returns HTTPResponse.Status

func (AnalyzeDependenciesResponse) StatusCode

func (r AnalyzeDependenciesResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type BadGateway

type BadGateway = Error

BadGateway defines model for BadGateway.

type BadRequest

type BadRequest = Error

BadRequest defines model for BadRequest.

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) AnalyzeDependencies

func (c *Client) AnalyzeDependencies(ctx context.Context, params *AnalyzeDependenciesParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetArtifactDeps added in v0.14.0

func (c *Client) GetArtifactDeps(ctx context.Context, digest string, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetArtifactVulns added in v0.14.0

func (c *Client) GetArtifactVulns(ctx context.Context, digest string, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetPackageDeps added in v0.14.0

func (c *Client) GetPackageDeps(ctx context.Context, purl string, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetPackagePurls added in v0.14.0

func (c *Client) GetPackagePurls(ctx context.Context, purl string, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetPackageVulns added in v0.14.0

func (c *Client) GetPackageVulns(ctx context.Context, purl string, params *GetPackageVulnsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) HealthCheck

func (c *Client) HealthCheck(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// AnalyzeDependencies request
	AnalyzeDependencies(ctx context.Context, params *AnalyzeDependenciesParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// HealthCheck request
	HealthCheck(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetArtifactDeps request
	GetArtifactDeps(ctx context.Context, digest string, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetArtifactVulns request
	GetArtifactVulns(ctx context.Context, digest string, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetPackagePurls request
	GetPackagePurls(ctx context.Context, purl string, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetPackageDeps request
	GetPackageDeps(ctx context.Context, purl string, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetPackageVulns request
	GetPackageVulns(ctx context.Context, purl string, params *GetPackageVulnsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) AnalyzeDependenciesWithResponse

func (c *ClientWithResponses) AnalyzeDependenciesWithResponse(ctx context.Context, params *AnalyzeDependenciesParams, reqEditors ...RequestEditorFn) (*AnalyzeDependenciesResponse, error)

AnalyzeDependenciesWithResponse request returning *AnalyzeDependenciesResponse

func (*ClientWithResponses) GetArtifactDepsWithResponse added in v0.14.0

func (c *ClientWithResponses) GetArtifactDepsWithResponse(ctx context.Context, digest string, reqEditors ...RequestEditorFn) (*GetArtifactDepsResponse, error)

GetArtifactDepsWithResponse request returning *GetArtifactDepsResponse

func (*ClientWithResponses) GetArtifactVulnsWithResponse added in v0.14.0

func (c *ClientWithResponses) GetArtifactVulnsWithResponse(ctx context.Context, digest string, reqEditors ...RequestEditorFn) (*GetArtifactVulnsResponse, error)

GetArtifactVulnsWithResponse request returning *GetArtifactVulnsResponse

func (*ClientWithResponses) GetPackageDepsWithResponse added in v0.14.0

func (c *ClientWithResponses) GetPackageDepsWithResponse(ctx context.Context, purl string, reqEditors ...RequestEditorFn) (*GetPackageDepsResponse, error)

GetPackageDepsWithResponse request returning *GetPackageDepsResponse

func (*ClientWithResponses) GetPackagePurlsWithResponse added in v0.14.0

func (c *ClientWithResponses) GetPackagePurlsWithResponse(ctx context.Context, purl string, reqEditors ...RequestEditorFn) (*GetPackagePurlsResponse, error)

GetPackagePurlsWithResponse request returning *GetPackagePurlsResponse

func (*ClientWithResponses) GetPackageVulnsWithResponse added in v0.14.0

func (c *ClientWithResponses) GetPackageVulnsWithResponse(ctx context.Context, purl string, params *GetPackageVulnsParams, reqEditors ...RequestEditorFn) (*GetPackageVulnsResponse, error)

GetPackageVulnsWithResponse request returning *GetPackageVulnsResponse

func (*ClientWithResponses) HealthCheckWithResponse

func (c *ClientWithResponses) HealthCheckWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*HealthCheckResponse, error)

HealthCheckWithResponse request returning *HealthCheckResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// AnalyzeDependenciesWithResponse request
	AnalyzeDependenciesWithResponse(ctx context.Context, params *AnalyzeDependenciesParams, reqEditors ...RequestEditorFn) (*AnalyzeDependenciesResponse, error)

	// HealthCheckWithResponse request
	HealthCheckWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*HealthCheckResponse, error)

	// GetArtifactDepsWithResponse request
	GetArtifactDepsWithResponse(ctx context.Context, digest string, reqEditors ...RequestEditorFn) (*GetArtifactDepsResponse, error)

	// GetArtifactVulnsWithResponse request
	GetArtifactVulnsWithResponse(ctx context.Context, digest string, reqEditors ...RequestEditorFn) (*GetArtifactVulnsResponse, error)

	// GetPackagePurlsWithResponse request
	GetPackagePurlsWithResponse(ctx context.Context, purl string, reqEditors ...RequestEditorFn) (*GetPackagePurlsResponse, error)

	// GetPackageDepsWithResponse request
	GetPackageDepsWithResponse(ctx context.Context, purl string, reqEditors ...RequestEditorFn) (*GetPackageDepsResponse, error)

	// GetPackageVulnsWithResponse request
	GetPackageVulnsWithResponse(ctx context.Context, purl string, params *GetPackageVulnsParams, reqEditors ...RequestEditorFn) (*GetPackageVulnsResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type Error

type Error struct {
	Message string `json:"Message"`
}

Error defines model for Error.

type GetArtifactDepsResponse added in v0.14.0

type GetArtifactDepsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *PurlList
	JSON400      *BadRequest
	JSON500      *InternalServerError
	JSON502      *BadGateway
}

func ParseGetArtifactDepsResponse added in v0.14.0

func ParseGetArtifactDepsResponse(rsp *http.Response) (*GetArtifactDepsResponse, error)

ParseGetArtifactDepsResponse parses an HTTP response from a GetArtifactDepsWithResponse call

func (GetArtifactDepsResponse) Status added in v0.14.0

func (r GetArtifactDepsResponse) Status() string

Status returns HTTPResponse.Status

func (GetArtifactDepsResponse) StatusCode added in v0.14.0

func (r GetArtifactDepsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetArtifactVulnsResponse added in v0.14.0

type GetArtifactVulnsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *VulnerabilityList
	JSON400      *BadRequest
	JSON500      *InternalServerError
	JSON502      *BadGateway
}

func ParseGetArtifactVulnsResponse added in v0.14.0

func ParseGetArtifactVulnsResponse(rsp *http.Response) (*GetArtifactVulnsResponse, error)

ParseGetArtifactVulnsResponse parses an HTTP response from a GetArtifactVulnsWithResponse call

func (GetArtifactVulnsResponse) Status added in v0.14.0

func (r GetArtifactVulnsResponse) Status() string

Status returns HTTPResponse.Status

func (GetArtifactVulnsResponse) StatusCode added in v0.14.0

func (r GetArtifactVulnsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetPackageDepsResponse added in v0.14.0

type GetPackageDepsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *PurlList
	JSON400      *BadRequest
	JSON500      *InternalServerError
	JSON502      *BadGateway
}

func ParseGetPackageDepsResponse added in v0.14.0

func ParseGetPackageDepsResponse(rsp *http.Response) (*GetPackageDepsResponse, error)

ParseGetPackageDepsResponse parses an HTTP response from a GetPackageDepsWithResponse call

func (GetPackageDepsResponse) Status added in v0.14.0

func (r GetPackageDepsResponse) Status() string

Status returns HTTPResponse.Status

func (GetPackageDepsResponse) StatusCode added in v0.14.0

func (r GetPackageDepsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetPackagePurlsResponse added in v0.14.0

type GetPackagePurlsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *PurlList
	JSON400      *BadRequest
	JSON500      *InternalServerError
	JSON502      *BadGateway
}

func ParseGetPackagePurlsResponse added in v0.14.0

func ParseGetPackagePurlsResponse(rsp *http.Response) (*GetPackagePurlsResponse, error)

ParseGetPackagePurlsResponse parses an HTTP response from a GetPackagePurlsWithResponse call

func (GetPackagePurlsResponse) Status added in v0.14.0

func (r GetPackagePurlsResponse) Status() string

Status returns HTTPResponse.Status

func (GetPackagePurlsResponse) StatusCode added in v0.14.0

func (r GetPackagePurlsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetPackageVulnsParams added in v0.14.0

type GetPackageVulnsParams struct {
	// IncludeDependencies A flag to include vulnerabilities of the dependencies. If true, the  response will include vulnerabilities for the purl and its dependencies  instead of the vulnerabilities of just the purl.
	IncludeDependencies *bool `form:"includeDependencies,omitempty" json:"includeDependencies,omitempty"`
}

GetPackageVulnsParams defines parameters for GetPackageVulns.

type GetPackageVulnsResponse added in v0.14.0

type GetPackageVulnsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *VulnerabilityList
	JSON400      *BadRequest
	JSON500      *InternalServerError
	JSON502      *BadGateway
}

func ParseGetPackageVulnsResponse added in v0.14.0

func ParseGetPackageVulnsResponse(rsp *http.Response) (*GetPackageVulnsResponse, error)

ParseGetPackageVulnsResponse parses an HTTP response from a GetPackageVulnsWithResponse call

func (GetPackageVulnsResponse) Status added in v0.14.0

func (r GetPackageVulnsResponse) Status() string

Status returns HTTPResponse.Status

func (GetPackageVulnsResponse) StatusCode added in v0.14.0

func (r GetPackageVulnsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HealthCheckResponse

type HealthCheckResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *string
}

func ParseHealthCheckResponse

func ParseHealthCheckResponse(rsp *http.Response) (*HealthCheckResponse, error)

ParseHealthCheckResponse parses an HTTP response from a HealthCheckWithResponse call

func (HealthCheckResponse) Status

func (r HealthCheckResponse) Status() string

Status returns HTTPResponse.Status

func (HealthCheckResponse) StatusCode

func (r HealthCheckResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type InternalServerError

type InternalServerError = Error

InternalServerError defines model for InternalServerError.

type PackageName added in v0.7.0

type PackageName struct {
	DependentCount int  `json:"DependentCount"`
	Name           Purl `json:"Name"`
}

PackageName defines model for PackageName.

type PackageNameList added in v0.7.0

type PackageNameList = []PackageName

PackageNameList defines model for PackageNameList.

type PaginationInfo added in v0.5.1

type PaginationInfo struct {
	NextCursor *string `json:"NextCursor,omitempty"`
	TotalCount *int    `json:"TotalCount,omitempty"`
}

PaginationInfo Contains the cursor to retrieve more pages. If there are no more, NextCursor will be nil.

type PaginationSpec added in v0.5.1

type PaginationSpec struct {
	Cursor   *string `json:"Cursor,omitempty"`
	PageSize *int    `json:"PageSize,omitempty"`
}

PaginationSpec defines model for PaginationSpec.

type Purl

type Purl = string

Purl defines model for Purl.

type PurlList

type PurlList struct {
	// PaginationInfo Contains the cursor to retrieve more pages. If there are no more,  NextCursor will be nil.
	PaginationInfo PaginationInfo `json:"PaginationInfo"`
	PurlList       []Purl         `json:"PurlList"`
}

PurlList defines model for PurlList.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type ScanMetadata added in v0.14.0

type ScanMetadata struct {
	Collector      *string    `json:"collector,omitempty"`
	DbUri          *string    `json:"dbUri,omitempty"`
	DbVersion      *string    `json:"dbVersion,omitempty"`
	Origin         *string    `json:"origin,omitempty"`
	ScannerUri     *string    `json:"scannerUri,omitempty"`
	ScannerVersion *string    `json:"scannerVersion,omitempty"`
	TimeScanned    *time.Time `json:"timeScanned,omitempty"`
}

ScanMetadata defines model for ScanMetadata.

type Vulnerability added in v0.14.0

type Vulnerability struct {
	Metadata      ScanMetadata         `json:"metadata"`
	Package       string               `json:"package"`
	Vulnerability VulnerabilityDetails `json:"vulnerability"`
}

Vulnerability defines model for Vulnerability.

type VulnerabilityDetails added in v0.14.0

type VulnerabilityDetails struct {
	Type *string `json:"type,omitempty"`

	// VulnerabilityIDs A list of vulnerability identifiers. These can be CVE IDs or other  formats used to identify vulnerabilities.
	VulnerabilityIDs []string `json:"vulnerabilityIDs"`
}

VulnerabilityDetails defines model for VulnerabilityDetails.

type VulnerabilityList added in v0.14.0

type VulnerabilityList = []Vulnerability

VulnerabilityList defines model for VulnerabilityList.

Jump to

Keyboard shortcuts

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