Documentation
¶
Index ¶
- type APIError
- type Candidate
- type Client
- func (c *Client) GetImportedBy(ctx context.Context, packagePath string, opts *GetImportedByOptions) (*PackageImportedBy, error)
- func (c *Client) GetModule(ctx context.Context, modulePath string, opts *GetModuleOptions) (*Module, error)
- func (c *Client) GetPackage(ctx context.Context, packagePath string, opts *GetPackageOptions) (*Package, error)
- func (c *Client) GetPackages(ctx context.Context, modulePath string, opts *GetPackagesOptions) (*PackagesResponse, error)
- func (c *Client) GetSearch(ctx context.Context, opts *GetSearchOptions) (*PaginatedResponse, error)
- func (c *Client) GetSymbols(ctx context.Context, packagePath string, opts *GetSymbolsOptions) (*PackageSymbols, error)
- func (c *Client) GetVersions(ctx context.Context, modulePath string, opts *GetVersionsOptions) (*PaginatedResponse, error)
- func (c *Client) GetVulns(ctx context.Context, moduleOrPackagePath string, opts *GetVulnsOptions) (*PaginatedResponse, error)
- type ClientOption
- type Error
- type GetImportedByOptions
- type GetModuleOptions
- type GetPackageOptions
- type GetPackagesOptions
- type GetSearchOptions
- type GetSymbolsOptions
- type GetVersionsOptions
- type GetVulnsOptions
- type License
- type Module
- type ModuleVersion
- type Package
- type PackageImportedBy
- type PackageInfo
- type PackageSymbols
- type PackagesResponse
- type PaginatedResponse
- type Readme
- type SearchResult
- type Symbol
- type Vulnerability
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an HTTP client for the API.
func (*Client) GetImportedBy ¶
func (c *Client) GetImportedBy(ctx context.Context, packagePath string, opts *GetImportedByOptions) (*PackageImportedBy, error)
GetImportedBy Paths of packages importing the package at package path, not including packages in the same module. Filtering is applied to the list of paths in the response. Only paths that match the filter query parameter are returned. Within a filter, the variable `path` is set to the import path.
func (*Client) GetModule ¶
func (c *Client) GetModule(ctx context.Context, modulePath string, opts *GetModuleOptions) (*Module, error)
GetModule Information about the module at the given module path.
func (*Client) GetPackage ¶
func (c *Client) GetPackage(ctx context.Context, packagePath string, opts *GetPackageOptions) (*Package, error)
GetPackage Information about the package at package path.
func (*Client) GetPackages ¶
func (c *Client) GetPackages(ctx context.Context, modulePath string, opts *GetPackagesOptions) (*PackagesResponse, error)
GetPackages Information about packages of the module at module path. Filtering is applied to the list of packages in the response. Only packages that match the filter query parameter are returned.
func (*Client) GetSearch ¶
func (c *Client) GetSearch(ctx context.Context, opts *GetSearchOptions) (*PaginatedResponse, error)
GetSearch Search results. Only results that match the filter query parameter are returned. Results are sorted by how well the match the query, with the best match first.
func (*Client) GetSymbols ¶
func (c *Client) GetSymbols(ctx context.Context, packagePath string, opts *GetSymbolsOptions) (*PackageSymbols, error)
GetSymbols List of symbols for the package at package path. Filtering is applied to the list of symbols in the response. Only symbols that match the filter query parameter are returned.
func (*Client) GetVersions ¶
func (c *Client) GetVersions(ctx context.Context, modulePath string, opts *GetVersionsOptions) (*PaginatedResponse, error)
GetVersions Versions of the module at module path. If there are tagged versions, they are returned. Otherwise, the 10 most recent pseudo-versions are returned. The versions are in descending order. Only results that match the filter query parameter are returned.
func (*Client) GetVulns ¶
func (c *Client) GetVulns(ctx context.Context, moduleOrPackagePath string, opts *GetVulnsOptions) (*PaginatedResponse, error)
GetVulns Vulnerabilities of the module or package path, from the Go vulnerability database (https://vuln.go.dev). Only results that match the filter query parameter are returned.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption configures a Client.
func WithBasicAuth ¶
func WithBasicAuth(ctx context.Context, user, password string) ClientOption
WithBasicAuth sets HTTP Basic authentication.
func WithBearerToken ¶
func WithBearerToken(token string) ClientOption
WithBearerToken sets Authorization: Bearer <token>.
func WithHTTPClient ¶
func WithHTTPClient(hc httpi.Doer) ClientOption
WithHTTPClient sets a custom httpi.Doer.
func WithHeader ¶
func WithHeader(key, value string) ClientOption
WithHeader sets a default request header.
type Error ¶
type Error struct {
Candidates []*Candidate `json:"candidates,omitempty"`
// HTTP status code
Code *int64 `json:"code,omitempty"`
// Unexported field for internal tracking
Err interface{} `json:"err,omitempty"`
// suggestions for how to fix
Fixes []string `json:"fixes,omitempty"`
Message *string `json:"message,omitempty"`
}
type GetImportedByOptions ¶
type GetImportedByOptions struct {
Filter *string
Limit *int64
Module *string
Token *string
Version *string
}
GetImportedByOptions holds optional parameters for GetImportedBy.
type GetModuleOptions ¶
GetModuleOptions holds optional parameters for GetModule.
type GetPackageOptions ¶
type GetPackageOptions struct {
Doc *string
Examples *bool
Goarch *string
Goos *string
Imports *bool
Licenses *bool
Module *string
Version *string
}
GetPackageOptions holds optional parameters for GetPackage.
type GetPackagesOptions ¶
GetPackagesOptions holds optional parameters for GetPackages.
type GetSearchOptions ¶
GetSearchOptions holds optional parameters for GetSearch.
type GetSymbolsOptions ¶
type GetSymbolsOptions struct {
Filter *string
Goarch *string
Goos *string
Limit *int64
Module *string
Token *string
Version *string
}
GetSymbolsOptions holds optional parameters for GetSymbols.
type GetVersionsOptions ¶
GetVersionsOptions holds optional parameters for GetVersions.
type GetVulnsOptions ¶
type GetVulnsOptions struct {
Filter *string
Limit *int64
Module *string
Token *string
Version *string
}
GetVulnsOptions holds optional parameters for GetVulns.
type Module ¶
type Module struct {
// CommitTime is the timestamp returned by the module proxy's .info endpoint,
// representing the time the version was created.
CommitTime *string `json:"commitTime,omitempty"`
GoModContents *string `json:"goModContents,omitempty"`
HasGoMod *bool `json:"hasGoMod,omitempty"`
IsLatest *bool `json:"isLatest,omitempty"`
IsRedistributable *bool `json:"isRedistributable,omitempty"`
IsStandardLibrary *bool `json:"isStandardLibrary,omitempty"`
Licenses []*License `json:"licenses,omitempty"`
Path *string `json:"path,omitempty"`
Readme *Readme `json:"readme,omitempty"`
RepoUrl *string `json:"repoUrl,omitempty"`
Version *string `json:"version,omitempty"`
}
type ModuleVersion ¶
type ModuleVersion struct {
CommitTime *string `json:"commitTime,omitempty"`
Deprecated *bool `json:"deprecated,omitempty"`
DeprecationReason *string `json:"deprecationReason,omitempty"`
// Whether the module has a go.mod file.
HasGoMod *bool `json:"hasGoMod,omitempty"`
// Whether the license allows distribution.
IsRedistributable *bool `json:"isRedistributable,omitempty"`
// latest unretracted version
LatestVersion *string `json:"latestVersion,omitempty"`
ModulePath *string `json:"modulePath,omitempty"`
Retracted *bool `json:"retracted,omitempty"`
RetractionReason *string `json:"retractionReason,omitempty"`
Version *string `json:"version,omitempty"`
}
type Package ¶
type Package struct {
Docs *string `json:"docs,omitempty"`
Goarch *string `json:"goarch,omitempty"`
Goos *string `json:"goos,omitempty"`
Imports []string `json:"imports,omitempty"`
IsLatest *bool `json:"isLatest,omitempty"`
// Whether the license allows distribution.
IsRedistributable *bool `json:"isRedistributable,omitempty"`
IsStandardLibrary *bool `json:"isStandardLibrary,omitempty"`
Licenses []*License `json:"licenses,omitempty"`
ModulePath *string `json:"modulePath,omitempty"`
Name *string `json:"name,omitempty"`
Path *string `json:"path,omitempty"`
Synopsis *string `json:"synopsis,omitempty"`
Version *string `json:"version,omitempty"`
}
type PackageImportedBy ¶
type PackageImportedBy struct {
ImportedBy *PaginatedResponse `json:"importedBy,omitempty"`
ModulePath *string `json:"modulePath,omitempty"`
Version *string `json:"version,omitempty"`
}
type PackageInfo ¶
type PackageSymbols ¶
type PackageSymbols struct {
ModulePath *string `json:"modulePath,omitempty"`
Symbols *PaginatedResponse `json:"symbols,omitempty"`
Version *string `json:"version,omitempty"`
}
type PackagesResponse ¶
type PackagesResponse struct {
IsStandardLibrary *bool `json:"isStandardLibrary,omitempty"`
ModulePath *string `json:"modulePath,omitempty"`
Packages *PaginatedResponse `json:"packages,omitempty"`
Version *string `json:"version,omitempty"`
}