go-client

module
v1.26.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT

README

Keboola Go Client

Packages

request package

The request package provides abstract and immutable definition of an HTTP request by the request.HTTPRequest.

One or more HTTP requests can be grouped together to the generic type request.APIRequest[R], where the R is a result type to which HTTP requests are mapped.

Request sending is provided by the Sender interface, the client package provides its default implementation.

client package

The client package provides default implementation of the request.Sender interface based on the standard net/http package.

keboola package

The keboola package provides the keboola.API implementation, it covers:

Not all API requests are covered, API requests are extended as needed.

Quick Start

ctx := context.TODO()

// Create API instance
api, err := keboola.NewAPI(
  ctx, 
  "https://connection.keboola.com", 
  keboola.WithTracerProvider(tracerProvider), 
  keboola.WithMeterProvider(meterProvider),
)
if err != nil {
  return err
}

// Send a request
config, err := api.CreateConfigRequest(&keboola.ConfigWithRows{/*...*/}).Send(ctx)
if err != nil {
  return err
}

Development

Clone the repository and run dev container:

docker-compose run --rm -u "$UID:$GID" --service-ports dev bash

Run lint and tests in container:

make lint
make tests

Run HTTP server with documentation:

make godoc

Open http://localhost:6060/pkg/github.com/keboola/go-client/pkg/ in browser.

License

MIT licensed, see LICENSE file.

Directories

Path Synopsis
pkg
client
Package client provides support for sending requests defined by the request package.
Package client provides support for sending requests defined by the request package.
client/trace
Package trace extends the httptrace.ClientTrace and adds additional HTTPRequest hooks.
Package trace extends the httptrace.ClientTrace and adds additional HTTPRequest hooks.
client/trace/otel
Package otel provides OpenTelemetry tracing and metrics for HTTP client requests.
Package otel provides OpenTelemetry tracing and metrics for HTTP client requests.
keboola
Package keboola contains request definitions for all supported Keboola APIs.
Package keboola contains request definitions for all supported Keboola APIs.
request
Package request provides to define immutable HTTP requests, see NewHTTPRequest function.
Package request provides to define immutable HTTP requests, see NewHTTPRequest function.

Jump to

Keyboard shortcuts

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