client

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package client provides a simple, generic HTTP client for sending various API requests to external services, which is used by other packages under pkg/api.

Index

Constants

View Source
const (
	Timeout = 3 * time.Second
	MaxSize = 3 << 20 // 3 MiB.

	AcceptJSON = "application/json"
	AcceptText = "text/plain"

	ContentForm = "application/x-www-form-urlencoded"
	ContentJSON = "application/json; charset=utf-8"
)

Variables

This section is empty.

Functions

func HTTPRequest

func HTTPRequest(ctx context.Context, method, apiURL, auth, accept, contentType string, queryOrBody any) ([]byte, http.Header, int, error)

HTTPRequest sends an HTTP request to an external API service.

The queryOrBody parameter may be nil, url.Values, a []byte slice, or any struct that can be encoded as JSON.

Some errors (failure to construct a request or decode a response body) are returned as non-retryable temporal.ApplicationErrors.

On HTTP 429 (Too Many Requests) responses, the third return value contains the number of seconds to wait before retrying the request.

Types

This section is empty.

Jump to

Keyboard shortcuts

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