httpclient

package
v1.7.5 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 11 Imported by: ? 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 httpclient is a client of the webhooks' 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 webhooks' 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 webhooks' API, at the URL, which is the server's API endpoint, such as http://localhost:8084/api, with the options

func (*Client) CreateWebhook

func (c *Client) CreateWebhook(ctx context.Context, meta schema.WebhookMeta) (*schema.WebhookToken, error)

CreateWebhook creates the webhook, and returns it, with its token, and its URL, when the server has a public endpoint, which aren't returned again

func (*Client) DeleteCall added in v1.7.4

func (c *Client) DeleteCall(ctx context.Context, id uint64) (*schema.Call, error)

DeleteCall deletes the call with the serial number, and returns it, as it was

func (*Client) DeleteWebhook

func (c *Client) DeleteWebhook(ctx context.Context, id uint64) (*schema.Webhook, error)

DeleteWebhook deletes the webhook with the serial number, and its calls, and returns it, as it was

func (*Client) GetCall

func (c *Client) GetCall(ctx context.Context, id uint64) (*schema.Call, error)

GetCall returns the call with the serial number

func (*Client) GetWebhook

func (c *Client) GetWebhook(ctx context.Context, id uint64) (*schema.Webhook, error)

GetWebhook returns the webhook with the serial number

func (*Client) Hook

func (c *Client) Hook(ctx context.Context, token, method, contentType string, body io.Reader, header http.Header) (*schema.HookResponse, error)

Hook calls the URL of the webhook with the token, as its service does, with the method, the body, of its content type, which is sent as it is, and the headers, such as a signature, and returns the response: the call which was kept, or whether it was a delivery which was sent again. The token isn't in the client's log, its traces, nor its errors.

func (*Client) ListCalls

func (c *Client) ListCalls(ctx context.Context, req schema.CallListRequest) (*schema.CallList, error)

ListCalls returns the calls, oldest first, or newest, as the request selects, after the call with its serial number, and since its time, and how many there are

func (*Client) ListWebhooks

func (c *Client) ListWebhooks(ctx context.Context, req schema.WebhookListRequest) (*schema.WebhookList, error)

ListWebhooks returns the webhooks, newest first, as the request selects, and how many there are

func (*Client) TestCall added in v1.7.4

func (c *Client) TestCall(ctx context.Context, test schema.TestRequest) (*schema.Call, error)

TestCall makes a test call to the webhook, signed as the request says, and returns it, as it was kept, whether it was accepted, or refused

func (*Client) UpdateWebhook

func (c *Client) UpdateWebhook(ctx context.Context, id uint64, change schema.WebhookRequest) (*schema.Webhook, error)

UpdateWebhook changes the webhook with the serial number, as the request says, such as its secret, and returns it

Jump to

Keyboard shortcuts

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