httpclient

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 8 Imported by: 1 module, 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 httpclient is a client of the resources' HTTP API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*client.Client
}

Client is a client of the resources' HTTP API, which wraps the base HTTP client, with typed methods for its requests

func New

func New(url string, opts ...client.ClientOpt) (*Client, error)

New returns a client of the resources' API, at the URL, which is the server's API endpoint, such as http://localhost:8084/api, with the options

func (*Client) CreateResource

func (c *Client) CreateResource(ctx context.Context, req schema.ResourceCreateRequest, file string, content io.Reader) (*schema.Resource, error)

CreateResource uploads the content, as it's read, as the request's body, as a resource, which is what the request says it is, whose name, when it isn't given, is the file's, and whose type, when it isn't given, is detected, and returns it. The upload isn't timed out, as a large file can take a while.

func (*Client) DeleteResource

func (c *Client) DeleteResource(ctx context.Context, hash string, req schema.ResourceRequest) (*schema.Resource, error)

DeleteResource deletes the resource with the hash, on its own, or in the request's session, and returns it, as it was

func (*Client) GetResource

func (c *Client) GetResource(ctx context.Context, hash string, req schema.ResourceRequest) (*schema.Resource, error)

GetResource returns the resource with the hash, on its own, or in the request's session

func (*Client) ListResources

func (c *Client) ListResources(ctx context.Context, req schema.ResourceListRequest) (*schema.ResourceList, error)

ListResources returns the resources on their own, or those in the request's session, the most recently used first, and how many there are

func (*Client) ReadResource

func (c *Client) ReadResource(ctx context.Context, hash string, req schema.ResourceRequest, w io.Writer) (string, error)

ReadResource writes the content of the resource with the hash, on its own, or in the request's session, to the writer, as it's read, and returns its type. The download isn't timed out, as a large file can take a while.

Jump to

Keyboard shortcuts

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