Documentation
¶
Index ¶
- Variables
- type Digests
- type Info
- type MaintainerType
- type MockRegistryClient
- func (r *MockRegistryClient) GetPackageLatestVersion(_ context.Context, _ string) (*PackageVersion, error)
- func (r *MockRegistryClient) GetPackageList(_ context.Context, _ string) (*PackageList, error)
- func (r *MockRegistryClient) GetPackageVersion(_ context.Context, _, version string) (*PackageVersion, error)
- type NoOpRegistryClient
- func (c *NoOpRegistryClient) GetPackageLatestVersion(_ context.Context, _ string) (*PackageVersion, error)
- func (c *NoOpRegistryClient) GetPackageList(_ context.Context, _ string) (*PackageList, error)
- func (c *NoOpRegistryClient) GetPackageVersion(_ context.Context, _, _ string) (*PackageVersion, error)
- type PackageList
- type PackageMaintainer
- type PackageMaintainers
- type PackageVersion
- type PackageVersions
- type Registry
- type RegistryClient
- func (c *RegistryClient) GetPackageLatestVersion(parent context.Context, name string) (*PackageVersion, error)
- func (c *RegistryClient) GetPackageList(parent context.Context, name string) (*PackageList, error)
- func (c *RegistryClient) GetPackageVersion(parent context.Context, name, version string) (*PackageVersion, error)
- type RegistryClientConfig
- type ServiceError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrPackageNotFound = errors.New("package not found") ErrVersionNotFound = errors.New("version not found") ErrLatestVersionNotFound = errors.New("latest version not found") ErrCouldNotDecodeResponse = errors.New("could not decode registry response") ErrCouldNotDoRequest = errors.New("could not start request to the registry") ErrCouldNotCreateRequest = errors.New("could not create request to the registry") ErrMissingSdistPackageVersion = errors.New("could not find the sdist package type version") ErrVersionMismatch = errors.New("version mismatch") )
View Source
var ErrNoDist = errors.New("could not find a version with 'sdist' package type")
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct {
Name string `json:"name"`
Author string `json:"author,omitempty"`
AuthorEmail string `json:"author_email,omitempty"`
Maintainer string `json:"maintainer,omitempty"`
MaintainerEmail string `json:"maintainer_email,omitempty"`
Description string `json:"description"`
// Version is the last version (list endpoint) or the current version (version endpoint)
Version string `json:"version"`
}
type MaintainerType ¶
type MaintainerType string
const ( PackageAuthorType MaintainerType = "author" PackageMaintainerType MaintainerType = "maintainer" )
type MockRegistryClient ¶
type MockRegistryClient struct {
// contains filtered or unexported fields
}
func NewMockRegistryClient ¶
func NewMockRegistryClient(listFilename, versionFilename string) (*MockRegistryClient, error)
func (*MockRegistryClient) GetPackageLatestVersion ¶
func (r *MockRegistryClient) GetPackageLatestVersion(_ context.Context, _ string) (*PackageVersion, error)
func (*MockRegistryClient) GetPackageList ¶
func (r *MockRegistryClient) GetPackageList(_ context.Context, _ string) (*PackageList, error)
func (*MockRegistryClient) GetPackageVersion ¶
func (r *MockRegistryClient) GetPackageVersion(_ context.Context, _, version string) (*PackageVersion, error)
type NoOpRegistryClient ¶
type NoOpRegistryClient struct{}
func (*NoOpRegistryClient) GetPackageLatestVersion ¶
func (c *NoOpRegistryClient) GetPackageLatestVersion(_ context.Context, _ string) (*PackageVersion, error)
func (*NoOpRegistryClient) GetPackageList ¶
func (c *NoOpRegistryClient) GetPackageList(_ context.Context, _ string) (*PackageList, error)
func (*NoOpRegistryClient) GetPackageVersion ¶
func (c *NoOpRegistryClient) GetPackageVersion(_ context.Context, _, _ string) (*PackageVersion, error)
type PackageList ¶
type PackageList struct {
Info Info `json:"info"`
Versions map[string]PackageVersions `json:"releases"`
URLs PackageVersions `json:"urls"`
}
func (*PackageList) Fill ¶
func (p *PackageList) Fill()
Fill the version and name field for all the package versions.
func (*PackageList) GetVersion ¶
func (p *PackageList) GetVersion(version string) (*PackageVersion, error)
func (*PackageList) LatestVersionTime ¶
func (p *PackageList) LatestVersionTime() (*time.Time, error)
func (*PackageList) MaintainersByVersion ¶
func (p *PackageList) MaintainersByVersion(version string) (PackageMaintainers, error)
type PackageMaintainer ¶
type PackageMaintainer struct {
Name string
Mail string
Type MaintainerType
}
type PackageMaintainers ¶
type PackageMaintainers []PackageMaintainer
func (PackageMaintainers) Emails ¶
func (pm PackageMaintainers) Emails() []string
type PackageVersion ¶
type PackageVersion struct {
// These without json tags get filled in
Name string
Version string
Authors PackageMaintainers
Maintainers PackageMaintainers
URL string `json:"url"`
Digests Digests `json:"digests"`
PackageType string `json:"packagetype"`
UploadTime time.Time `json:"upload_time_iso_8601"`
Filename string `json:"filename"`
}
type PackageVersions ¶
type PackageVersions []PackageVersion
func (PackageVersions) GetSdist ¶
func (vs PackageVersions) GetSdist() (*PackageVersion, error)
type Registry ¶
type Registry interface {
GetPackageList(ctx context.Context, name string) (*PackageList, error)
GetPackageVersion(ctx context.Context, name, version string) (*PackageVersion, error)
GetPackageLatestVersion(ctx context.Context, name string) (*PackageVersion, error)
}
func NewNoOpRegistryClient ¶
func NewNoOpRegistryClient() Registry
func NewRegistryClient ¶
func NewRegistryClient(config RegistryClientConfig) (Registry, error)
type RegistryClient ¶
type RegistryClient struct {
// contains filtered or unexported fields
}
func (*RegistryClient) GetPackageLatestVersion ¶
func (c *RegistryClient) GetPackageLatestVersion(parent context.Context, name string) (*PackageVersion, error)
func (*RegistryClient) GetPackageList ¶
func (c *RegistryClient) GetPackageList(parent context.Context, name string) (*PackageList, error)
func (*RegistryClient) GetPackageVersion ¶
func (c *RegistryClient) GetPackageVersion(parent context.Context, name, version string) (*PackageVersion, error)
type RegistryClientConfig ¶
type ServiceError ¶
func (*ServiceError) Error ¶
func (e *ServiceError) Error() string
Click to show internal directories.
Click to hide internal directories.