npm

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: MIT Imports: 6 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 struct {
	// contains filtered or unexported fields
}

Client is a client for the NPM API. It should never be created directly, use NewClient instead.

func NewClient

func NewClient(options ...ClientOption) (*Client, error)

func (*Client) GetPackage

func (c *Client) GetPackage(name string) (oslc.Entry, error)

GetPackage returns the package with the given name. It is a convenience function for [GetPackageVersion] with an empty version.

func (*Client) GetPackageVersion

func (c *Client) GetPackageVersion(name, version string) (oslc.Entry, error)

GetPackageVersion returns the package with the given name and version. If version is empty, the latest version is returned.

type ClientOption

type ClientOption interface {
	// contains filtered or unexported methods
}

ClientOption is an option for configuring a Client.

func WithHTTPClient

func WithHTTPClient(c *http.Client) ClientOption

WithHTTPClient returns a ClientOption that uses the provided http.Client.

func WithLogger

func WithLogger(logger *slog.Logger) ClientOption

WithLogger returns a ClientOption that uses the provided logger.

Jump to

Keyboard shortcuts

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