upload

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	URL        string
	Token      string
	Timeout    time.Duration // default 30s
	MaxRetries int           // default 0
}

type Response

type Response struct {
	ID         string `json:"id"`
	ReceivedAt string `json:"received_at"`
	// ShareURL is a candidate-facing link to view this result (verdict, POPs,
	// map) without IT involvement. Optional in the response — older servers
	// omit it; treat an empty value as "no link to show". The URL is opaque;
	// it is rendered as-is, never parsed or validated client-side.
	ShareURL string `json:"share_url"`
}

func Upload

func Upload(ctx context.Context, opt Options, r *report.Report) (*Response, error)

Upload POSTs the report with exponential backoff retries on transient failure. The server may return 201 for a fresh report or 200 for a duplicate run_id (per PRD §7.3 idempotency); both are treated as success and the caller receives the server-side record either way.

Retries fire on 5xx status and transport errors only. 4xx is terminal — retrying a malformed / unauthorised request won't help.

Jump to

Keyboard shortcuts

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