client

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 8 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.3.1-0.20240823215434-d232e9efa9f5 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.3.1-0.20240823215434-d232e9efa9f5 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 NewHealthCheckRequest

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

NewHealthCheckRequest generates requests for HealthCheck

func NewRetrieveDependenciesRequest

func NewRetrieveDependenciesRequest(server string, params *RetrieveDependenciesParams) (*http.Request, error)

NewRetrieveDependenciesRequest generates requests for RetrieveDependencies

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) HealthCheck

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

func (*Client) RetrieveDependencies

func (c *Client) RetrieveDependencies(ctx context.Context, params *RetrieveDependenciesParams, 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)

	// RetrieveDependencies request
	RetrieveDependencies(ctx context.Context, params *RetrieveDependenciesParams, 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) HealthCheckWithResponse

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

HealthCheckWithResponse request returning *HealthCheckResponse

func (*ClientWithResponses) RetrieveDependenciesWithResponse

func (c *ClientWithResponses) RetrieveDependenciesWithResponse(ctx context.Context, params *RetrieveDependenciesParams, reqEditors ...RequestEditorFn) (*RetrieveDependenciesResponse, error)

RetrieveDependenciesWithResponse request returning *RetrieveDependenciesResponse

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)

	// RetrieveDependenciesWithResponse request
	RetrieveDependenciesWithResponse(ctx context.Context, params *RetrieveDependenciesParams, reqEditors ...RequestEditorFn) (*RetrieveDependenciesResponse, 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 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 RetrieveDependenciesParams

type RetrieveDependenciesParams 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"`

	// LinkCondition Whether links between nouns must be made by digest or if they  can be made just by name (i.e. purl). Specify 'name' to allow using SBOMs that don't provide the digest of the subject. The default is  'digest'. To search by purl, 'name' must be specified.
	LinkCondition *RetrieveDependenciesParamsLinkCondition `form:"linkCondition,omitempty" json:"linkCondition,omitempty"`

	// Purl The purl of the dependent package.
	Purl *string `form:"purl,omitempty" json:"purl,omitempty"`

	// Digest The digest of the dependent package.
	Digest *string `form:"digest,omitempty" json:"digest,omitempty"`
}

RetrieveDependenciesParams defines parameters for RetrieveDependencies.

type RetrieveDependenciesParamsLinkCondition added in v0.6.0

type RetrieveDependenciesParamsLinkCondition string

RetrieveDependenciesParamsLinkCondition defines parameters for RetrieveDependencies.

Defines values for RetrieveDependenciesParamsLinkCondition.

type RetrieveDependenciesResponse

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

func ParseRetrieveDependenciesResponse

func ParseRetrieveDependenciesResponse(rsp *http.Response) (*RetrieveDependenciesResponse, error)

ParseRetrieveDependenciesResponse parses an HTTP response from a RetrieveDependenciesWithResponse call

func (RetrieveDependenciesResponse) Status

Status returns HTTPResponse.Status

func (RetrieveDependenciesResponse) StatusCode

func (r RetrieveDependenciesResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

Jump to

Keyboard shortcuts

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