cargo

package
v2.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 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 (c *ClientImpl) GetCrate(ctx context.Context, crate string) (*CratePayload, error)

func (*ClientImpl) GetLatestVersion

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

func (*ClientImpl) ListVersions

func (c *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 (m *MockClient) GetCrate(ctx context.Context, crate string) (*CratePayload, error)

func (*MockClient) GetLatestVersion

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

func (*MockClient) ListVersions

func (m *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