npm

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package npm implements functions for iteracting with the npm registry

Index

Constants

View Source
const (
	BaseURL = "https://registry.npmjs.org"
)

Variables

This section is empty.

Functions

func Register

func Register(ext *sqlite.ExtensionApi, opt *options.Options) (_ sqlite.ErrorCode, err error)

Register registers npm API related functionality as a SQLite extension

Types

type Client

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

func NewClient

func NewClient(httpClient *http.Client, logger *zerolog.Logger) *Client

NewClient creates a new API client from an *http.Client. Pass nil to use http.DefaultClient

func (*Client) GetPackage

func (c *Client) GetPackage(ctx context.Context, packageName string) ([]byte, error)

GetPackage makes an HTTP request to https://registry.npmjs.org/<<packageName>> and returns the JSON response

func (*Client) GetPackageVersion

func (c *Client) GetPackageVersion(ctx context.Context, packageName, version string) ([]byte, error)

GetPackageVersion makes an HTTP request to https://registry.npmjs.org/<<packageName>>/<<version>> and returns the JSON response

type GetPackage

type GetPackage struct{ *Client }

func (*GetPackage) Apply

func (f *GetPackage) Apply(ctx *sqlite.Context, values ...sqlite.Value)

func (*GetPackage) Args

func (f *GetPackage) Args() int

func (*GetPackage) Deterministic

func (f *GetPackage) Deterministic() bool

Jump to

Keyboard shortcuts

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