api

package
v0.0.0-...-57459dd Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package api holds the agent OpenAPI document (spec-first source of truth).

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

View Source
var AgentSchemaNames = []string{
	"TripPatch",
	"UpdateDay",
	"PlacePatch",
	"DayPatch",
	"UpsertStop",
	"RemoveStop",
	"InsertDay",
	"PlaceInfo",
	"PlaceSource",
	"PlaceLink",
	"PlaceStats",
	"PlaceLogistics",
	"PlaceFacilities",
	"StopRef",
	"ReplaceDayRoutesRequest",
}

AgentSchemaNames are the OpenAPI component schemas agents need for patches.

View Source
var OpenAPIYAML string

OpenAPIYAML is the agent API OpenAPI 3.1 document. The {{BASE_URL}} placeholder is replaced at serve time.

Functions

func AgentSchemaDocument

func AgentSchemaDocument() (map[string]any, error)

AgentSchemaDocument returns schema_version metadata plus the named components/schemas entries from the embedded OpenAPI document (with $refs).

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

Types

type CreateTripJSONRequestBody

type CreateTripJSONRequestBody = CreateTripRequest

CreateTripJSONRequestBody defines body for CreateTrip for application/json ContentType.

type CreateTripParams

type CreateTripParams struct {
	IdempotencyKey string `json:"Idempotency-Key"`
}

CreateTripParams defines parameters for CreateTrip.

type CreateTripRequest

type CreateTripRequest struct {
	Id   string `json:"id"`
	Yaml string `json:"yaml"`
}

CreateTripRequest defines model for CreateTripRequest.

type DayPatch

type DayPatch struct {
	Ferry *bool `json:"ferry,omitempty"`
	Hike  *bool `json:"hike,omitempty"`

	// Notes Day narrative; set when the overnight or story changes
	Notes *string `json:"notes,omitempty"`

	// Route Full replacement of that day's route (ordered place refs)
	Route *[]StopRef `json:"route,omitempty"`

	// Stops Full replacement of that day's stops list
	Stops *[]StopRef `json:"stops,omitempty"`
	Title *string    `json:"title,omitempty"`
}

DayPatch Partial day body (prefer update_day for title/notes alone)

type GetTripYAMLParams

type GetTripYAMLParams struct {
	// Scope day = neighborhood YAML (days N±1 + referenced places).
	// full = entire itinerary.
	Scope *GetTripYAMLParamsScope `form:"scope,omitempty" json:"scope,omitempty"`

	// Day Center day for scope=day.
	Day *int `form:"day,omitempty" json:"day,omitempty"`
}

GetTripYAMLParams defines parameters for GetTripYAML.

type GetTripYAMLParamsScope

type GetTripYAMLParamsScope string

GetTripYAMLParamsScope defines parameters for GetTripYAML.

const (
	Day  GetTripYAMLParamsScope = "day"
	Full GetTripYAMLParamsScope = "full"
)

Defines values for GetTripYAMLParamsScope.

func (GetTripYAMLParamsScope) Valid

func (e GetTripYAMLParamsScope) Valid() bool

Valid indicates whether the value is a known member of the GetTripYAMLParamsScope enum.

type Health

type Health struct {
	Status *string `json:"status,omitempty"`
}

Health defines model for Health.

type InsertDay

type InsertDay struct {
	After *int `json:"after,omitempty"`
	Day   *struct {
		Ferry *bool `json:"ferry,omitempty"`
		Hike  *bool `json:"hike,omitempty"`

		// Notes Human-authored; agents should not set unless asked
		Notes *string    `json:"notes,omitempty"`
		Route *[]StopRef `json:"route,omitempty"`
		Stops *[]StopRef `json:"stops,omitempty"`
		Title *string    `json:"title,omitempty"`
	} `json:"day,omitempty"`
}

InsertDay defines model for InsertDay.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type MutateResult

type MutateResult struct {
	BundleError   *string `json:"bundle_error,omitempty"`
	BundleOk      *bool   `json:"bundle_ok,omitempty"`
	Id            *string `json:"id,omitempty"`
	SchemaVersion *int    `json:"schema_version,omitempty"`
	VersionId     *string `json:"version_id,omitempty"`

	// ViewerUrl Signed-in tripmap viewer path /me/trips/{id}/ (Hellō login required)
	ViewerUrl *string `json:"viewer_url,omitempty"`
}

MutateResult defines model for MutateResult.

type PatchTripJSONRequestBody

type PatchTripJSONRequestBody = TripPatch

PatchTripJSONRequestBody defines body for PatchTrip for application/json ContentType.

type PatchTripParams

type PatchTripParams struct {
	IdempotencyKey string `json:"Idempotency-Key"`
}

PatchTripParams defines parameters for PatchTrip.

type PlaceFacilities

type PlaceFacilities struct {
	DrinkingWater *bool `json:"drinking_water,omitempty"`
	Toilets       *bool `json:"toilets,omitempty"`
}

PlaceFacilities defines model for PlaceFacilities.

type PlaceInfo

type PlaceInfo struct {
	Facilities *PlaceFacilities `json:"facilities,omitempty"`
	Highlights *[]string        `json:"highlights,omitempty"`
	Links      *[]PlaceLink     `json:"links,omitempty"`
	Logistics  *PlaceLogistics  `json:"logistics,omitempty"`
	Source     *PlaceSource     `json:"source,omitempty"`

	// Stats Trail/drive statistics only — not opening hours
	Stats    *PlaceStats `json:"stats,omitempty"`
	Warnings *[]string   `json:"warnings,omitempty"`
}

PlaceInfo Structured enrichment for a place (optional throughout). Does not include title, lat, lon, or type — those belong on the place object itself. Opening hours belong in logistics.opening_hours (not under stats).

type PlaceLink struct {
	Title *string `json:"title,omitempty"`
	Type  string  `json:"type"`
	Url   string  `json:"url"`
}

PlaceLink defines model for PlaceLink.

type PlaceLogistics

type PlaceLogistics struct {
	BookingRequired *bool `json:"booking_required,omitempty"`

	// OpeningHours Human-readable opening hours (e.g. Daily 10:00–22:30)
	OpeningHours *string `json:"opening_hours,omitempty"`
	Parking      *string `json:"parking,omitempty"`
}

PlaceLogistics defines model for PlaceLogistics.

type PlacePatch

type PlacePatch struct {
	// Info Structured enrichment for a place (optional throughout). Does not include title, lat, lon, or type — those belong on the place object itself. Opening hours belong in logistics.opening_hours (not under stats).
	Info *PlaceInfo `json:"info,omitempty"`
	Lat  *float32   `json:"lat,omitempty"`
	Lon  *float32   `json:"lon,omitempty"`

	// MapsUrl Google Maps place URL for the viewer pin; when set, overrides lat/lon search
	MapsUrl      *string `json:"maps_url,omitempty"`
	Notes        *string `json:"notes,omitempty"`
	Photo        *string `json:"photo,omitempty"`
	PhotoCaption *string `json:"photo_caption,omitempty"`

	// Title Display name; required on the place for new ids (not under info)
	Title *string `json:"title,omitempty"`

	// Type e.g. overnight, restaurant, attraction, via
	Type *string `json:"type,omitempty"`
}

PlacePatch Partial place catalog upsert (top-level identity fields + optional PlaceInfo)

type PlaceSource

type PlaceSource struct {
	GeneratedAt *string `json:"generated_at,omitempty"`
	GeneratedBy *string `json:"generated_by,omitempty"`
}

PlaceSource defines model for PlaceSource.

type PlaceStats

type PlaceStats struct {
	AscentM    *float32 `json:"ascent_m,omitempty"`
	Difficulty *string  `json:"difficulty,omitempty"`
	DistanceKm *float32 `json:"distance_km,omitempty"`
	Duration   *string  `json:"duration,omitempty"`
}

PlaceStats Trail/drive statistics only — not opening hours

type PutTripYAMLParams

type PutTripYAMLParams struct {
	IdempotencyKey string `json:"Idempotency-Key"`
}

PutTripYAMLParams defines parameters for PutTripYAML.

type PutTripYAMLTextBody

type PutTripYAMLTextBody = string

PutTripYAMLTextBody defines parameters for PutTripYAML.

type PutTripYAMLTextRequestBody

type PutTripYAMLTextRequestBody = PutTripYAMLTextBody

PutTripYAMLTextRequestBody defines body for PutTripYAML for text/plain ContentType.

type RemoveStop

type RemoveStop struct {
	Day *int `json:"day,omitempty"`

	// List route, stops, or empty for both
	List *string `json:"list,omitempty"`

	// Place Place id or exact title
	Place *string `json:"place,omitempty"`

	// Places Several place ids or exact titles
	Places *[]string `json:"places,omitempty"`
}

RemoveStop Remove one or more place refs from route and/or stops. Use when replacing a day's overnight — remove the old end before upserting the new one.

type ReplaceDayRoutesJSONRequestBody

type ReplaceDayRoutesJSONRequestBody = ReplaceDayRoutesRequest

ReplaceDayRoutesJSONRequestBody defines body for ReplaceDayRoutes for application/json ContentType.

type ReplaceDayRoutesParams

type ReplaceDayRoutesParams struct {
	IdempotencyKey string `json:"Idempotency-Key"`
}

ReplaceDayRoutesParams defines parameters for ReplaceDayRoutes.

type ReplaceDayRoutesRequest

type ReplaceDayRoutesRequest struct {
	// Days Day-number string keys (e.g. "7"). Each entry replaces that day's full route. Include title when the overnight/endpoint changes. Typically update day N and day N+1 together. On each route, mark start/end lodging as overnight so the viewer can label Depart.
	Days map[string]struct {
		Notes *string   `json:"notes,omitempty"`
		Route []StopRef `json:"route"`
		Title *string   `json:"title,omitempty"`
	} `json:"days"`

	// Places Optional place catalog upserts (kebab-case ids). New places need top-level title, lat, lon, and type — not under info.
	Places *map[string]PlacePatch `json:"places,omitempty"`
}

ReplaceDayRoutesRequest defines model for ReplaceDayRoutesRequest.

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type RestoreRequest

type RestoreRequest struct {
	VersionId string `json:"version_id"`
}

RestoreRequest defines model for RestoreRequest.

type RestoreVersionJSONRequestBody

type RestoreVersionJSONRequestBody = RestoreRequest

RestoreVersionJSONRequestBody defines body for RestoreVersion for application/json ContentType.

type RestoreVersionParams

type RestoreVersionParams struct {
	IdempotencyKey string `json:"Idempotency-Key"`
}

RestoreVersionParams defines parameters for RestoreVersion.

type SchemaInfo

type SchemaInfo struct {
	DaysPatchExample *map[string]interface{} `json:"days_patch_example,omitempty"`
	Description      *string                 `json:"description,omitempty"`
	Fields           *map[string]string      `json:"fields,omitempty"`

	// NotesPolicy Human-authored notes usage rule for agents (not enforced)
	NotesPolicy   *string   `json:"notes_policy,omitempty"`
	PatchOps      *[]string `json:"patch_ops,omitempty"`
	SchemaVersion *int      `json:"schema_version,omitempty"`
}

SchemaInfo defines model for SchemaInfo.

type ServeMux

type ServeMux interface {
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
	http.Handler
}

ServeMux is an abstraction of http.ServeMux.

type ServerInterface

type ServerInterface interface {
	// GetSchema Itinerary schema and version
	// (GET /api/agent/schema)
	GetSchema(w http.ResponseWriter, r *http.Request)
	// ListTrips List itinerary IDs
	// (GET /api/agent/trips)
	ListTrips(w http.ResponseWriter, r *http.Request)
	// CreateTrip Create itinerary
	// (POST /api/agent/trips)
	CreateTrip(w http.ResponseWriter, r *http.Request, params CreateTripParams)
	// GetTrip Compact trip title card (not full routes)
	// (GET /api/agent/trips/{id})
	GetTrip(w http.ResponseWriter, r *http.Request, id string)
	// PatchTrip Patch places info, day narrative, or structure
	// (PATCH /api/agent/trips/{id})
	PatchTrip(w http.ResponseWriter, r *http.Request, id string, params PatchTripParams)
	// ReplaceDayRoutes Replace full day routes (overnight / endpoint changes)
	// (POST /api/agent/trips/{id}/day-routes)
	ReplaceDayRoutes(w http.ResponseWriter, r *http.Request, id string, params ReplaceDayRoutesParams)
	// RestoreVersion Restore a prior YAML version
	// (POST /api/agent/trips/{id}/restore)
	RestoreVersion(w http.ResponseWriter, r *http.Request, id string, params RestoreVersionParams)
	// ListVersions List YAML versions
	// (GET /api/agent/trips/{id}/versions)
	ListVersions(w http.ResponseWriter, r *http.Request, id string)
	// GetVersion Get YAML for a prior version
	// (GET /api/agent/trips/{id}/versions/{version_id})
	GetVersion(w http.ResponseWriter, r *http.Request, id string, versionId string)
	// GetTripYAML Get itinerary YAML
	// (GET /api/agent/trips/{id}/yaml)
	GetTripYAML(w http.ResponseWriter, r *http.Request, id string, params GetTripYAMLParams)
	// PutTripYAML Replace YAML (raw text body)
	// (PUT /api/agent/trips/{id}/yaml)
	PutTripYAML(w http.ResponseWriter, r *http.Request, id string, params PutTripYAMLParams)
	// Health Liveness
	// (GET /health)
	Health(w http.ResponseWriter, r *http.Request)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) CreateTrip

func (siw *ServerInterfaceWrapper) CreateTrip(w http.ResponseWriter, r *http.Request)

CreateTrip operation middleware

func (*ServerInterfaceWrapper) GetSchema

func (siw *ServerInterfaceWrapper) GetSchema(w http.ResponseWriter, r *http.Request)

GetSchema operation middleware

func (*ServerInterfaceWrapper) GetTrip

GetTrip operation middleware

func (*ServerInterfaceWrapper) GetTripYAML

func (siw *ServerInterfaceWrapper) GetTripYAML(w http.ResponseWriter, r *http.Request)

GetTripYAML operation middleware

func (*ServerInterfaceWrapper) GetVersion

func (siw *ServerInterfaceWrapper) GetVersion(w http.ResponseWriter, r *http.Request)

GetVersion operation middleware

func (*ServerInterfaceWrapper) Health

Health operation middleware

func (*ServerInterfaceWrapper) ListTrips

func (siw *ServerInterfaceWrapper) ListTrips(w http.ResponseWriter, r *http.Request)

ListTrips operation middleware

func (*ServerInterfaceWrapper) ListVersions

func (siw *ServerInterfaceWrapper) ListVersions(w http.ResponseWriter, r *http.Request)

ListVersions operation middleware

func (*ServerInterfaceWrapper) PatchTrip

func (siw *ServerInterfaceWrapper) PatchTrip(w http.ResponseWriter, r *http.Request)

PatchTrip operation middleware

func (*ServerInterfaceWrapper) PutTripYAML

func (siw *ServerInterfaceWrapper) PutTripYAML(w http.ResponseWriter, r *http.Request)

PutTripYAML operation middleware

func (*ServerInterfaceWrapper) ReplaceDayRoutes

func (siw *ServerInterfaceWrapper) ReplaceDayRoutes(w http.ResponseWriter, r *http.Request)

ReplaceDayRoutes operation middleware

func (*ServerInterfaceWrapper) RestoreVersion

func (siw *ServerInterfaceWrapper) RestoreVersion(w http.ResponseWriter, r *http.Request)

RestoreVersion operation middleware

type StdHTTPServerOptions

type StdHTTPServerOptions struct {
	BaseURL          string
	BaseRouter       ServeMux
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type StopRef

type StopRef struct {
	// MapsUrl Optional per-stop Google Maps URL override for the viewer pin
	MapsUrl *string `json:"maps_url,omitempty"`
	Notes   *string `json:"notes,omitempty"`

	// Place Kebab-case place id from places
	Place string `json:"place"`

	// Type Day-local role for this stop on the route (overrides places.*.type). Travel day: first and last lodging = overnight (never via; never depart — the viewer shows Depart on the morning start). Mid road waypoints = via. Sights = attraction, viewpoint, trailhead, etc.
	Type *string `json:"type,omitempty"`
}

StopRef defines model for StopRef.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type TripList

type TripList struct {
	Trips *[]string `json:"trips,omitempty"`
}

TripList defines model for TripList.

type TripPatch

type TripPatch struct {
	// Days Day-number string keys (e.g. "10") to partial day updates. Prefer update_day for title/notes alone. To change an overnight or reorder a route — especially when the next day's start must change too — prefer replaceDayRoutes. Include title (and notes if the narrative should change) on those days.
	Days      *map[string]DayPatch `json:"days,omitempty"`
	DeleteDay *int                 `json:"delete_day,omitempty"`
	InsertDay *InsertDay           `json:"insert_day,omitempty"`

	// Places Map of kebab-case place id to partial place fields. For a new place, title, lat, lon, and type are required at the top level of that object. Never put title under info — info is structured enrichment only (see PlaceInfo) and is deep-merged.
	Places *map[string]PlacePatch `json:"places,omitempty"`

	// RemoveStop Remove one or more place refs from route and/or stops. Use when replacing a day's overnight — remove the old end before upserting the new one.
	RemoveStop *RemoveStop `json:"remove_stop,omitempty"`

	// SwapDays Exactly two day numbers whose entire day bodies are exchanged (reorder). Do not use for changing an overnight or day endpoint — that needs route edits on the affected days (and the next day's start), not a swap.
	SwapDays *[]int `json:"swap_days,omitempty"`

	// UpdateDay Partial update of one existing day (omit fields to leave unchanged)
	UpdateDay *UpdateDay `json:"update_day,omitempty"`

	// UpsertStop Add or update a stop ref by place id on route or stops. If that place id is not already on the list, it is appended. For overnight/endpoint or full route replacement, use replaceDayRoutes instead. place must be a kebab-case id that exists in places (not a display title).
	UpsertStop *UpsertStop `json:"upsert_stop,omitempty"`
}

TripPatch One or more structured ops. Prefer update_day for day narrative and places.<id>.info for enrichment. Day calendar dates are derived from trip.start + (day − 1) when start is set — do not patch per-day dates.

type TripSummary

type TripSummary struct {
	Days          *int    `json:"days,omitempty"`
	Description   *string `json:"description,omitempty"`
	Id            *string `json:"id,omitempty"`
	SchemaVersion *int    `json:"schema_version,omitempty"`
	Start         *string `json:"start,omitempty"`
	Trip          *string `json:"trip,omitempty"`
	VersionId     *string `json:"version_id,omitempty"`
}

TripSummary defines model for TripSummary.

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

type UpdateDay

type UpdateDay struct {
	Day   int   `json:"day"`
	Ferry *bool `json:"ferry,omitempty"`
	Hike  *bool `json:"hike,omitempty"`

	// Notes Day narrative; set when the user asks to edit notes
	Notes        *string `json:"notes,omitempty"`
	Photo        *string `json:"photo,omitempty"`
	PhotoCaption *string `json:"photo_caption,omitempty"`
	Title        *string `json:"title,omitempty"`
}

UpdateDay Partial update of one existing day (omit fields to leave unchanged)

type UpsertStop

type UpsertStop struct {
	Day *int `json:"day,omitempty"`

	// List route or stops
	List *string `json:"list,omitempty"`

	// MapsUrl Optional Google Maps URL override on this stop ref
	MapsUrl *string `json:"maps_url,omitempty"`
	Notes   *string `json:"notes,omitempty"`

	// Place Kebab-case place id from places (e.g. greymouth), not a display title
	Place *string `json:"place,omitempty"`
	Type  *string `json:"type,omitempty"`
}

UpsertStop Add or update a stop ref by place id on route or stops. If that place id is not already on the list, it is appended. For overnight/endpoint or full route replacement, use replaceDayRoutes instead. place must be a kebab-case id that exists in places (not a display title).

type VersionList

type VersionList struct {
	Id       *string `json:"id,omitempty"`
	Versions *[]struct {
		IsLatest     *bool   `json:"is_latest,omitempty"`
		LastModified *string `json:"last_modified,omitempty"`
		VersionId    *string `json:"version_id,omitempty"`
	} `json:"versions,omitempty"`
}

VersionList defines model for VersionList.

Jump to

Keyboard shortcuts

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