api

package
v5.0.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

internal/api/client.go

Index

Constants

View Source
const DefaultUploadTimeout = 10 * time.Minute

DefaultUploadTimeout is the default upload timeout when the caller does not provide one. It covers the full request (including body streaming), so it must be generous enough for tens-of-MB uploads across a slow reverse proxy.

View Source
const PathPrefix = "/api"

PathPrefix is the API path prefix appended to the base server URL.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client handles communication with the OCAP web frontend.

func New

func New(baseURL, apiKey string) *Client

New creates a new API client with default configuration.

func NewWithConfig

func NewWithConfig(baseURL, apiKey string, cfg ClientConfig) *Client

NewWithConfig creates a new API client with custom configuration.

func (*Client) Healthcheck

func (c *Client) Healthcheck() error

Healthcheck checks if the OCAP web frontend is reachable.

func (*Client) Upload

func (c *Client) Upload(filePath string, meta core.UploadMetadata) error

Upload sends a gzipped JSON mission file to the OCAP web frontend.

type ClientConfig

type ClientConfig struct {
	// UploadTimeout is the maximum duration for the total upload request
	// (including streaming the body). Defaults to DefaultUploadTimeout.
	UploadTimeout time.Duration
}

ClientConfig configures the API client. All fields are optional — zero values resolve to sensible defaults.

Jump to

Keyboard shortcuts

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