cargo

package
v2.9.1-0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	ListVersions(ctx context.Context, crate string) ([]string, error)
	GetLatestVersion(ctx context.Context, crate string) (string, error)
	GetCrate(ctx context.Context, crate string) (*CratePayload, error)
}

type ClientImpl

type ClientImpl struct {
	// contains filtered or unexported fields
}

func NewClientImpl

func NewClientImpl(client *http.Client) *ClientImpl

func (*ClientImpl) GetCrate

func (searcher *ClientImpl) GetCrate(ctx context.Context, crate string) (*CratePayload, error)

func (*ClientImpl) GetLatestVersion

func (searcher *ClientImpl) GetLatestVersion(ctx context.Context, crate string) (string, error)

func (*ClientImpl) ListVersions

func (searcher *ClientImpl) ListVersions(ctx context.Context, crate string) ([]string, error)

type Crate

type Crate struct {
	Homepage    string `json:"homepage"`
	Description string `json:"description"`
	Repository  string `json:"repository"`
}

type CratePayload

type CratePayload struct {
	Crate *Crate `json:"crate"`
}

type MockClient

type MockClient struct {
	Versions     []string
	Err          error
	CratePayload *CratePayload
}

func (*MockClient) GetCrate

func (mock *MockClient) GetCrate(ctx context.Context, crate string) (*CratePayload, error)

func (*MockClient) GetLatestVersion

func (mock *MockClient) GetLatestVersion(ctx context.Context, crate string) (string, error)

func (*MockClient) ListVersions

func (mock *MockClient) ListVersions(ctx context.Context, crate string) ([]string, error)

type Payload

type Payload struct {
	Versions []*PayloadVersion `json:"versions"`
}

type PayloadVersion

type PayloadVersion struct {
	Num string `json:"num"`
}

Jump to

Keyboard shortcuts

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