Documentation
¶
Overview ¶
Package apicontract defines the release-independent Tapper REST contract.
Index ¶
- Constants
- func Do(client *http.Client, req *http.Request) (*http.Response, error)
- func IsCompatibility(err error) bool
- func LogFailure(ctx context.Context, logger *slog.Logger, level slog.Level, client string, ...)
- func Middleware(server string, logger *slog.Logger) func(http.Handler) http.Handler
- func WithSession(ctx context.Context, s *Session) context.Context
- type CompatibilityError
- type Discovery
- type Session
Constants ¶
const ClientHeader = "Tapper-Client-Version"
const DiscoveryInvalid = "API_DISCOVERY_INVALID"
const Required = "API_VERSION_REQUIRED"
const Revision = "2026-09-11"
const Unsupported = "API_VERSION_UNSUPPORTED"
const VersionHeader = "Tapper-API-Version"
Variables ¶
This section is empty.
Functions ¶
func Do ¶
Do applies discovery, mandatory headers, redirect restrictions and typed errors to a REST request. Non-REST OAuth and archive requests pass through unchanged.
func IsCompatibility ¶
func LogFailure ¶
func LogFailure(ctx context.Context, logger *slog.Logger, level slog.Level, client string, err error, requestID string)
LogFailure emits only compatibility metadata, never request contents or credentials.
func Middleware ¶
Middleware gates all /api/v1 paths, including unknown operations, before auth. Discovery is build-only and remains usable when database services are down.
Types ¶
type CompatibilityError ¶
type CompatibilityError struct {
Message string `json:"error"`
Code string `json:"code"`
Requested []string `json:"requested_api_versions"`
Supported []string `json:"supported_api_versions"`
ServerVersion string `json:"server_version,omitempty"`
OperationPerformed bool `json:"operationPerformed"`
}
CompatibilityError guarantees the blocked application operation was not sent or was rejected by the server before authentication and dispatch.
func Validate ¶
func Validate(h http.Header, server string) *CompatibilityError
Validate accepts exactly one unmodified contract revision header value.
func (*CompatibilityError) Error ¶
func (e *CompatibilityError) Error() string