client

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package client is the REST client of the graphnest command-line tool.

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 talks to a GraphNest server with a bearer token.

func New

func New(config Config) (*Client, error)

New validates config and builds a client that refuses cross-origin redirects.

func (*Client) GraphStatus

func (c *Client) GraphStatus(ctx context.Context, id int64) (api.GraphStatus, error)

GraphStatus fetches GET /v1/graph/repositories/{id}/status.

func (*Client) Publish

func (c *Client) Publish(ctx context.Context, id int64, commit string, expectedGeneration int64, replaceProducer bool, artifact []byte) (api.GraphPublicationResult, error)

Publish uploads a v2 graph artifact.

func (*Client) Repository

func (c *Client) Repository(ctx context.Context, id int64) (api.RepositorySummary, error)

Repository fetches GET /v1/repositories/{id}.

type Config

type Config struct {
	ServerURL string        // GRAPHNEST_SERVER_URL, required, http or https
	Token     string        // GRAPHNEST_TOKEN, or the trimmed contents of the file named by GRAPHNEST_TOKEN_FILE; exactly one must be set
	CAPEM     []byte        // contents of GRAPHNEST_CA_FILE when set
	Timeout   time.Duration // whole-request timeout; zero means 2 minutes
}

Config comes from the environment only; a token never comes from arguments.

func FromEnv

func FromEnv(getenv func(string) string, readFile func(string) ([]byte, error)) (Config, error)

FromEnv reads Config from environment variables. Errors name variables, never values.

type Error

type Error struct {
	Status    int
	Code      string
	Message   string
	Retryable bool
}

Error is the server's error envelope for a non-2xx response.

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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