2750 lines
95 KiB
Go
2750 lines
95 KiB
Go
//go:build go1.22
|
|
|
|
// 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.
|
|
package api
|
|
|
|
import (
|
|
"bytes"
|
|
"compress/flate"
|
|
"encoding/base64"
|
|
"errors"
|
|
"fmt"
|
|
"net/http"
|
|
"net/url"
|
|
"path"
|
|
"strings"
|
|
"time"
|
|
|
|
"github.com/getkin/kin-openapi/openapi3"
|
|
"github.com/oapi-codegen/runtime"
|
|
)
|
|
|
|
// Defines values for AgentProcessHealth.
|
|
const (
|
|
HealthExited AgentProcessHealth = "exited"
|
|
HealthOk AgentProcessHealth = "ok"
|
|
HealthStuck AgentProcessHealth = "stuck"
|
|
)
|
|
|
|
// Valid indicates whether the value is a known member of the AgentProcessHealth enum.
|
|
func (e AgentProcessHealth) Valid() bool {
|
|
switch e {
|
|
case HealthExited:
|
|
return true
|
|
case HealthOk:
|
|
return true
|
|
case HealthStuck:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
// Defines values for AgentSessionRole.
|
|
const (
|
|
Implementer AgentSessionRole = "implementer"
|
|
Lead AgentSessionRole = "lead"
|
|
)
|
|
|
|
// Valid indicates whether the value is a known member of the AgentSessionRole enum.
|
|
func (e AgentSessionRole) Valid() bool {
|
|
switch e {
|
|
case Implementer:
|
|
return true
|
|
case Lead:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
// Defines values for AgentSessionState.
|
|
const (
|
|
AgentSessionStateCompleted AgentSessionState = "completed"
|
|
AgentSessionStateIdle AgentSessionState = "idle"
|
|
AgentSessionStateQueued AgentSessionState = "queued"
|
|
AgentSessionStateRunning AgentSessionState = "running"
|
|
)
|
|
|
|
// Valid indicates whether the value is a known member of the AgentSessionState enum.
|
|
func (e AgentSessionState) Valid() bool {
|
|
switch e {
|
|
case AgentSessionStateCompleted:
|
|
return true
|
|
case AgentSessionStateIdle:
|
|
return true
|
|
case AgentSessionStateQueued:
|
|
return true
|
|
case AgentSessionStateRunning:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
// Defines values for AgentSessionVendor.
|
|
const (
|
|
Claude AgentSessionVendor = "claude"
|
|
)
|
|
|
|
// Valid indicates whether the value is a known member of the AgentSessionVendor enum.
|
|
func (e AgentSessionVendor) Valid() bool {
|
|
switch e {
|
|
case Claude:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
// Defines values for AttachmentKind.
|
|
const (
|
|
AttachmentKindDiagram AttachmentKind = "diagram"
|
|
AttachmentKindDiff AttachmentKind = "diff"
|
|
AttachmentKindFile AttachmentKind = "file"
|
|
AttachmentKindImage AttachmentKind = "image"
|
|
AttachmentKindSnapshot AttachmentKind = "snapshot"
|
|
AttachmentKindTask AttachmentKind = "task"
|
|
AttachmentKindUrl AttachmentKind = "url"
|
|
)
|
|
|
|
// Valid indicates whether the value is a known member of the AttachmentKind enum.
|
|
func (e AttachmentKind) Valid() bool {
|
|
switch e {
|
|
case AttachmentKindDiagram:
|
|
return true
|
|
case AttachmentKindDiff:
|
|
return true
|
|
case AttachmentKindFile:
|
|
return true
|
|
case AttachmentKindImage:
|
|
return true
|
|
case AttachmentKindSnapshot:
|
|
return true
|
|
case AttachmentKindTask:
|
|
return true
|
|
case AttachmentKindUrl:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
// Defines values for DirEntryType.
|
|
const (
|
|
DirEntryTypeDir DirEntryType = "dir"
|
|
DirEntryTypeFile DirEntryType = "file"
|
|
DirEntryTypeOther DirEntryType = "other"
|
|
)
|
|
|
|
// Valid indicates whether the value is a known member of the DirEntryType enum.
|
|
func (e DirEntryType) Valid() bool {
|
|
switch e {
|
|
case DirEntryTypeDir:
|
|
return true
|
|
case DirEntryTypeFile:
|
|
return true
|
|
case DirEntryTypeOther:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
// Defines values for FileChangeStatus.
|
|
const (
|
|
Added FileChangeStatus = "added"
|
|
Deleted FileChangeStatus = "deleted"
|
|
Modified FileChangeStatus = "modified"
|
|
Renamed FileChangeStatus = "renamed"
|
|
TypeChanged FileChangeStatus = "type_changed"
|
|
)
|
|
|
|
// Valid indicates whether the value is a known member of the FileChangeStatus enum.
|
|
func (e FileChangeStatus) Valid() bool {
|
|
switch e {
|
|
case Added:
|
|
return true
|
|
case Deleted:
|
|
return true
|
|
case Modified:
|
|
return true
|
|
case Renamed:
|
|
return true
|
|
case TypeChanged:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
// Defines values for InboxItemKind.
|
|
const (
|
|
Question InboxItemKind = "question"
|
|
RateLimited InboxItemKind = "rate_limited"
|
|
Report InboxItemKind = "report"
|
|
SessionError InboxItemKind = "session_error"
|
|
)
|
|
|
|
// Valid indicates whether the value is a known member of the InboxItemKind enum.
|
|
func (e InboxItemKind) Valid() bool {
|
|
switch e {
|
|
case Question:
|
|
return true
|
|
case RateLimited:
|
|
return true
|
|
case Report:
|
|
return true
|
|
case SessionError:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
// Defines values for InboxItemPriority.
|
|
const (
|
|
Blocked InboxItemPriority = "blocked"
|
|
Fyi InboxItemPriority = "fyi"
|
|
Gate InboxItemPriority = "gate"
|
|
Review InboxItemPriority = "review"
|
|
)
|
|
|
|
// Valid indicates whether the value is a known member of the InboxItemPriority enum.
|
|
func (e InboxItemPriority) Valid() bool {
|
|
switch e {
|
|
case Blocked:
|
|
return true
|
|
case Fyi:
|
|
return true
|
|
case Gate:
|
|
return true
|
|
case Review:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
// Defines values for InboxResponseType.
|
|
const (
|
|
Dismiss InboxResponseType = "dismiss"
|
|
Option InboxResponseType = "option"
|
|
Other InboxResponseType = "other"
|
|
)
|
|
|
|
// Valid indicates whether the value is a known member of the InboxResponseType enum.
|
|
func (e InboxResponseType) Valid() bool {
|
|
switch e {
|
|
case Dismiss:
|
|
return true
|
|
case Option:
|
|
return true
|
|
case Other:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
// Defines values for InboxState.
|
|
const (
|
|
Answered InboxState = "answered"
|
|
Dismissed InboxState = "dismissed"
|
|
Open InboxState = "open"
|
|
Superseded InboxState = "superseded"
|
|
)
|
|
|
|
// Valid indicates whether the value is a known member of the InboxState enum.
|
|
func (e InboxState) Valid() bool {
|
|
switch e {
|
|
case Answered:
|
|
return true
|
|
case Dismissed:
|
|
return true
|
|
case Open:
|
|
return true
|
|
case Superseded:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
// Defines values for SnapshotTrigger.
|
|
const (
|
|
SnapshotTriggerAskHuman SnapshotTrigger = "ask_human"
|
|
SnapshotTriggerTimer SnapshotTrigger = "timer"
|
|
SnapshotTriggerToolCall SnapshotTrigger = "tool_call"
|
|
SnapshotTriggerTurnEnd SnapshotTrigger = "turn_end"
|
|
)
|
|
|
|
// Valid indicates whether the value is a known member of the SnapshotTrigger enum.
|
|
func (e SnapshotTrigger) Valid() bool {
|
|
switch e {
|
|
case SnapshotTriggerAskHuman:
|
|
return true
|
|
case SnapshotTriggerTimer:
|
|
return true
|
|
case SnapshotTriggerToolCall:
|
|
return true
|
|
case SnapshotTriggerTurnEnd:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
// Defines values for TaskStatus.
|
|
const (
|
|
TaskStatusActive TaskStatus = "active"
|
|
TaskStatusDiscarded TaskStatus = "discarded"
|
|
TaskStatusMerged TaskStatus = "merged"
|
|
)
|
|
|
|
// Valid indicates whether the value is a known member of the TaskStatus enum.
|
|
func (e TaskStatus) Valid() bool {
|
|
switch e {
|
|
case TaskStatusActive:
|
|
return true
|
|
case TaskStatusDiscarded:
|
|
return true
|
|
case TaskStatusMerged:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
// Defines values for TaskTab.
|
|
const (
|
|
TabChanges TaskTab = "changes"
|
|
TabFiles TaskTab = "files"
|
|
TabInbox TaskTab = "inbox"
|
|
TabTodo TaskTab = "todo"
|
|
TabTranscript TaskTab = "transcript"
|
|
)
|
|
|
|
// Valid indicates whether the value is a known member of the TaskTab enum.
|
|
func (e TaskTab) Valid() bool {
|
|
switch e {
|
|
case TabChanges:
|
|
return true
|
|
case TabFiles:
|
|
return true
|
|
case TabInbox:
|
|
return true
|
|
case TabTodo:
|
|
return true
|
|
case TabTranscript:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
// Defines values for ZombieKind.
|
|
const (
|
|
ProcessWithoutSession ZombieKind = "process_without_session"
|
|
RunningWithoutProcess ZombieKind = "running_without_process"
|
|
)
|
|
|
|
// Valid indicates whether the value is a known member of the ZombieKind enum.
|
|
func (e ZombieKind) Valid() bool {
|
|
switch e {
|
|
case ProcessWithoutSession:
|
|
return true
|
|
case RunningWithoutProcess:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
// AgentProcess defines model for AgentProcess.
|
|
type AgentProcess struct {
|
|
// Health stuck means a turn is running and no stream event has arrived for stuck_after_seconds; exited means the process is gone.
|
|
Health AgentProcessHealth `json:"health"`
|
|
|
|
// LastEventAt When the process last wrote a line to its stream
|
|
LastEventAt time.Time `json:"last_event_at"`
|
|
Pid int `json:"pid"`
|
|
SessionId string `json:"session_id"`
|
|
|
|
// State The session's state
|
|
State string `json:"state"`
|
|
TaskId string `json:"task_id"`
|
|
Vendor string `json:"vendor"`
|
|
}
|
|
|
|
// AgentProcessHealth stuck means a turn is running and no stream event has arrived for stuck_after_seconds; exited means the process is gone.
|
|
type AgentProcessHealth string
|
|
|
|
// AgentSession defines model for AgentSession.
|
|
type AgentSession struct {
|
|
CreatedAt time.Time `json:"created_at"`
|
|
CreatedBy string `json:"created_by"`
|
|
Id string `json:"id"`
|
|
|
|
// Model Requested model; empty means the vendor's default.
|
|
Model string `json:"model"`
|
|
|
|
// Owner The login whose lead agent this is; empty for a task's session.
|
|
Owner string `json:"owner"`
|
|
Role AgentSessionRole `json:"role"`
|
|
|
|
// State queued means a turn is waiting for a free slot under the concurrency caps.
|
|
State AgentSessionState `json:"state"`
|
|
|
|
// TaskId Empty for a lead session.
|
|
TaskId string `json:"task_id"`
|
|
Vendor AgentSessionVendor `json:"vendor"`
|
|
VendorSessionId string `json:"vendor_session_id"`
|
|
}
|
|
|
|
// AgentSessionRole defines model for AgentSession.Role.
|
|
type AgentSessionRole string
|
|
|
|
// AgentSessionState queued means a turn is waiting for a free slot under the concurrency caps.
|
|
type AgentSessionState string
|
|
|
|
// AgentSessionVendor defines model for AgentSession.Vendor.
|
|
type AgentSessionVendor string
|
|
|
|
// Attachment defines model for Attachment.
|
|
type Attachment struct {
|
|
Caption *string `json:"caption,omitempty"`
|
|
EndLine *int `json:"end_line,omitempty"`
|
|
|
|
// Image image: data URL.
|
|
Image *string `json:"image,omitempty"`
|
|
Kind AttachmentKind `json:"kind"`
|
|
|
|
// Mermaid diagram: Mermaid source.
|
|
Mermaid *string `json:"mermaid,omitempty"`
|
|
|
|
// Path file: repo-relative path. image: an image file in the task's worktree, absolute or relative to it.
|
|
Path *string `json:"path,omitempty"`
|
|
|
|
// Ref diff: git revision range.
|
|
Ref *string `json:"ref,omitempty"`
|
|
SnapshotId *string `json:"snapshot_id,omitempty"`
|
|
StartLine *int `json:"start_line,omitempty"`
|
|
TaskId *string `json:"task_id,omitempty"`
|
|
Url *string `json:"url,omitempty"`
|
|
}
|
|
|
|
// AttachmentKind defines model for Attachment.Kind.
|
|
type AttachmentKind string
|
|
|
|
// Blob defines model for Blob.
|
|
type Blob struct {
|
|
ContentType string `json:"content_type"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
CreatedBy string `json:"created_by"`
|
|
Id string `json:"id"`
|
|
}
|
|
|
|
// Caps defines model for Caps.
|
|
type Caps struct {
|
|
// Global Most turns running at once across all vendors.
|
|
Global int `json:"global"`
|
|
|
|
// PerVendor Most turns running at once per vendor, keyed by vendor.
|
|
PerVendor map[string]int `json:"per_vendor"`
|
|
}
|
|
|
|
// DirEntry defines model for DirEntry.
|
|
type DirEntry struct {
|
|
// Ignored git ignores the entry: .gitignore and the other exclude files match it or a directory above it.
|
|
Ignored bool `json:"ignored"`
|
|
Name string `json:"name"`
|
|
|
|
// Size file: its size in bytes.
|
|
Size int64 `json:"size"`
|
|
Symlink bool `json:"symlink"`
|
|
|
|
// Type What the entry is, following a symlink that stays in the worktree. other: a symlink that leaves the worktree or points nowhere, or a device, socket or pipe.
|
|
Type DirEntryType `json:"type"`
|
|
}
|
|
|
|
// DirEntryType What the entry is, following a symlink that stays in the worktree. other: a symlink that leaves the worktree or points nowhere, or a device, socket or pipe.
|
|
type DirEntryType string
|
|
|
|
// DirListing defines model for DirListing.
|
|
type DirListing struct {
|
|
Entries []DirEntry `json:"entries"`
|
|
|
|
// Path The directory, relative to the worktree root; empty for the root.
|
|
Path string `json:"path"`
|
|
|
|
// Truncated The directory has more entries than were returned.
|
|
Truncated bool `json:"truncated"`
|
|
}
|
|
|
|
// Error defines model for Error.
|
|
type Error struct {
|
|
Message string `json:"message"`
|
|
}
|
|
|
|
// Event defines model for Event.
|
|
type Event struct {
|
|
Actor string `json:"actor"`
|
|
AgentSessionId *string `json:"agent_session_id,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
Kind string `json:"kind"`
|
|
|
|
// Owner Set on a lead agent's events and a user's focus.updated: the login they belong to. Only that user is sent them.
|
|
Owner *string `json:"owner,omitempty"`
|
|
Payload map[string]interface{} `json:"payload"`
|
|
ProjectId *string `json:"project_id,omitempty"`
|
|
Seq int64 `json:"seq"`
|
|
TaskId *string `json:"task_id,omitempty"`
|
|
}
|
|
|
|
// FileChange defines model for FileChange.
|
|
type FileChange struct {
|
|
Additions int `json:"additions"`
|
|
Binary bool `json:"binary"`
|
|
Deletions int `json:"deletions"`
|
|
|
|
// OldPath renamed: the path before the rename.
|
|
OldPath *string `json:"old_path,omitempty"`
|
|
Path string `json:"path"`
|
|
Status FileChangeStatus `json:"status"`
|
|
}
|
|
|
|
// FileChangeStatus defines model for FileChange.Status.
|
|
type FileChangeStatus string
|
|
|
|
// FileContent defines model for FileContent.
|
|
type FileContent struct {
|
|
// Binary The file isn't UTF-8 text; text is empty.
|
|
Binary bool `json:"binary"`
|
|
Path string `json:"path"`
|
|
Size int64 `json:"size"`
|
|
Text string `json:"text"`
|
|
|
|
// Truncated text holds only the start of the file.
|
|
Truncated bool `json:"truncated"`
|
|
}
|
|
|
|
// FileDiff defines model for FileDiff.
|
|
type FileDiff struct {
|
|
Patch string `json:"patch"`
|
|
Path string `json:"path"`
|
|
}
|
|
|
|
// Focus defines model for Focus.
|
|
type Focus struct {
|
|
Tab TaskTab `json:"tab"`
|
|
|
|
// Tabs The tabs the lead put first, in order. The other task tabs follow them.
|
|
Tabs []TaskTab `json:"tabs"`
|
|
|
|
// TaskId The task the right pane shows; absent for none.
|
|
TaskId *string `json:"task_id,omitempty"`
|
|
}
|
|
|
|
// InboxItem defines model for InboxItem.
|
|
type InboxItem struct {
|
|
AgentSessionId string `json:"agent_session_id"`
|
|
Blocking bool `json:"blocking"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
Id string `json:"id"`
|
|
Kind InboxItemKind `json:"kind"`
|
|
|
|
// Payload question: context (Markdown with the choices inline as `- ( ) text` / `- (*) text` pick-one or `- [ ] text` / `- [x] text` pick-any list items), question, why_blocked, options (each choice's text, in order), multiple (true for pick-any), recommended (the marked choices' text), attachments. report: text (the final message of a turn that ended normally). session_error: error. rate_limited: vendor, rate_limit (the vendor's rate-limit status), error.
|
|
Payload map[string]interface{} `json:"payload"`
|
|
Priority InboxItemPriority `json:"priority"`
|
|
ProjectId string `json:"project_id"`
|
|
ResolvedAt *time.Time `json:"resolved_at,omitempty"`
|
|
ResolvedBy *string `json:"resolved_by,omitempty"`
|
|
Responses []InboxResponse `json:"responses"`
|
|
State InboxState `json:"state"`
|
|
TaskId string `json:"task_id"`
|
|
ThreadId string `json:"thread_id"`
|
|
}
|
|
|
|
// InboxItemKind defines model for InboxItem.Kind.
|
|
type InboxItemKind string
|
|
|
|
// InboxItemPriority defines model for InboxItem.Priority.
|
|
type InboxItemPriority string
|
|
|
|
// InboxRespond defines model for InboxRespond.
|
|
type InboxRespond struct {
|
|
Responses []InboxResponseCreate `json:"responses"`
|
|
}
|
|
|
|
// InboxResponse defines model for InboxResponse.
|
|
type InboxResponse struct {
|
|
Attachments []Attachment `json:"attachments"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
DeliveredAt *time.Time `json:"delivered_at,omitempty"`
|
|
Id string `json:"id"`
|
|
ItemId string `json:"item_id"`
|
|
Options *[]string `json:"options,omitempty"`
|
|
Text *string `json:"text,omitempty"`
|
|
Type InboxResponseType `json:"type"`
|
|
User string `json:"user"`
|
|
}
|
|
|
|
// InboxResponseCreate defines model for InboxResponseCreate.
|
|
type InboxResponseCreate struct {
|
|
Attachments *[]Attachment `json:"attachments,omitempty"`
|
|
ItemId string `json:"item_id"`
|
|
|
|
// Options option: the chosen options; exactly one for a pick-one question, one or more for a pick-any question.
|
|
Options *[]string `json:"options,omitempty"`
|
|
|
|
// Text other: the text sent to the agent. option on a pick-any question: optional text sent along with the checked options.
|
|
Text *string `json:"text,omitempty"`
|
|
Type InboxResponseType `json:"type"`
|
|
}
|
|
|
|
// InboxResponseType defines model for InboxResponseType.
|
|
type InboxResponseType string
|
|
|
|
// InboxState defines model for InboxState.
|
|
type InboxState string
|
|
|
|
// MessageCreate defines model for MessageCreate.
|
|
type MessageCreate struct {
|
|
// Images Blob ids from uploadBlob, sent to the agent as images alongside the text.
|
|
Images *[]string `json:"images,omitempty"`
|
|
|
|
// Model Model for this turn and later ones. When it differs from the session's model, the session switches before the message is sent.
|
|
Model *string `json:"model,omitempty"`
|
|
|
|
// Text May be empty when images are given.
|
|
Text string `json:"text"`
|
|
}
|
|
|
|
// NotificationPrefs Which new inbox items send this user a push notification.
|
|
type NotificationPrefs struct {
|
|
// BlockingQuestions Questions asked with blocking: true. On by default.
|
|
BlockingQuestions bool `json:"blocking_questions"`
|
|
|
|
// Errors session_error items.
|
|
Errors bool `json:"errors"`
|
|
|
|
// Questions Non-blocking questions.
|
|
Questions bool `json:"questions"`
|
|
|
|
// RateLimits rate_limited items.
|
|
RateLimits bool `json:"rate_limits"`
|
|
|
|
// Reports Turn summaries.
|
|
Reports bool `json:"reports"`
|
|
}
|
|
|
|
// Participant defines model for Participant.
|
|
type Participant struct {
|
|
DisplayName string `json:"display_name"`
|
|
GitEmail string `json:"git_email"`
|
|
|
|
// GitName Empty when the user hasn't set a git identity; they then get no trailer.
|
|
GitName string `json:"git_name"`
|
|
Login string `json:"login"`
|
|
}
|
|
|
|
// Project defines model for Project.
|
|
type Project struct {
|
|
CreatedAt time.Time `json:"created_at"`
|
|
CreatedBy string `json:"created_by"`
|
|
DefaultBranch string `json:"default_branch"`
|
|
Id string `json:"id"`
|
|
Name string `json:"name"`
|
|
Remote string `json:"remote"`
|
|
RepoPath string `json:"repo_path"`
|
|
}
|
|
|
|
// ProjectCreate defines model for ProjectCreate.
|
|
type ProjectCreate struct {
|
|
Name string `json:"name"`
|
|
RepoPath string `json:"repo_path"`
|
|
}
|
|
|
|
// ProtocolError defines model for ProtocolError.
|
|
type ProtocolError struct {
|
|
At time.Time `json:"at"`
|
|
|
|
// Raw The line as received
|
|
Raw string `json:"raw"`
|
|
Reason string `json:"reason"`
|
|
SessionId string `json:"session_id"`
|
|
|
|
// Size The line's full length in bytes.
|
|
Size int `json:"size"`
|
|
Vendor string `json:"vendor"`
|
|
}
|
|
|
|
// ProtocolErrors defines model for ProtocolErrors.
|
|
type ProtocolErrors struct {
|
|
// Counts Stream lines the adapter couldn't parse or didn't recognise since byre started, keyed by vendor.
|
|
Counts map[string]int `json:"counts"`
|
|
|
|
// Recent The most recent ones, newest first.
|
|
Recent []ProtocolError `json:"recent"`
|
|
}
|
|
|
|
// PushKey defines model for PushKey.
|
|
type PushKey struct {
|
|
// PublicKey Base64url
|
|
PublicKey string `json:"public_key"`
|
|
}
|
|
|
|
// PushSubscription defines model for PushSubscription.
|
|
type PushSubscription struct {
|
|
// Auth The subscription's auth secret
|
|
Auth string `json:"auth"`
|
|
Endpoint string `json:"endpoint"`
|
|
|
|
// P256dh The subscription's p256dh key
|
|
P256dh string `json:"p256dh"`
|
|
}
|
|
|
|
// SessionCreate defines model for SessionCreate.
|
|
type SessionCreate struct {
|
|
// Images Blob ids from uploadBlob, sent to the agent as images alongside the prompt.
|
|
Images *[]string `json:"images,omitempty"`
|
|
Model *string `json:"model,omitempty"`
|
|
Prompt string `json:"prompt"`
|
|
}
|
|
|
|
// Snapshot defines model for Snapshot.
|
|
type Snapshot struct {
|
|
AgentSessionId string `json:"agent_session_id"`
|
|
|
|
// CommitSha A commit of tree_sha whose parent is the worktree's HEAD when it was taken.
|
|
CommitSha string `json:"commit_sha"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
|
|
// EventSeq The task's latest event when the snapshot was started: the tree holds at least the work up to it.
|
|
EventSeq int64 `json:"event_seq"`
|
|
Id string `json:"id"`
|
|
|
|
// N Position in the task's snapshots, from 1; the ref is refs/byre/tasks/{task_id}/snap/{n}.
|
|
N int `json:"n"`
|
|
TaskId string `json:"task_id"`
|
|
TreeSha string `json:"tree_sha"`
|
|
Trigger SnapshotTrigger `json:"trigger"`
|
|
}
|
|
|
|
// SnapshotTrigger defines model for Snapshot.Trigger.
|
|
type SnapshotTrigger string
|
|
|
|
// Status defines model for Status.
|
|
type Status struct {
|
|
ActiveTasks int `json:"active_tasks"`
|
|
|
|
// AgentProcesses Every agent process byre is tracking, idle sessions included.
|
|
AgentProcesses []AgentProcess `json:"agent_processes"`
|
|
Caps Caps `json:"caps"`
|
|
DbBytes int64 `json:"db_bytes"`
|
|
LastEventSeq int64 `json:"last_event_seq"`
|
|
|
|
// LiveAgents Agent processes currently running.
|
|
LiveAgents int `json:"live_agents"`
|
|
Projects int `json:"projects"`
|
|
ProtocolErrors ProtocolErrors `json:"protocol_errors"`
|
|
|
|
// QueuedTurns Turns waiting for room under the caps, in the order they will start.
|
|
QueuedTurns []TurnRef `json:"queued_turns"`
|
|
|
|
// RateLimits The latest rate-limit status each vendor reported, keyed by vendor.
|
|
RateLimits map[string]map[string]interface{} `json:"rate_limits"`
|
|
|
|
// RunningTurns Turns running now, oldest session first.
|
|
RunningTurns []TurnRef `json:"running_turns"`
|
|
SseClients int `json:"sse_clients"`
|
|
StartedAt time.Time `json:"started_at"`
|
|
|
|
// StuckAfterSeconds How long a running turn may go without a stream event before it counts as stuck.
|
|
StuckAfterSeconds int `json:"stuck_after_seconds"`
|
|
|
|
// Zombies Sessions marked running with no live process, and agent processes byre has no session for.
|
|
Zombies []Zombie `json:"zombies"`
|
|
}
|
|
|
|
// Task defines model for Task.
|
|
type Task struct {
|
|
BaseRef string `json:"base_ref"`
|
|
Branch string `json:"branch"`
|
|
|
|
// ClosedAt When the task was merged or discarded.
|
|
ClosedAt *time.Time `json:"closed_at,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
CreatedBy string `json:"created_by"`
|
|
Id string `json:"id"`
|
|
|
|
// MergeCommit merged: the squash commit on the default branch; empty when there was nothing to merge.
|
|
MergeCommit *string `json:"merge_commit,omitempty"`
|
|
|
|
// MergeTitle The title of the squash commit Merge makes: the task title until the agent sets another with set_merge_title.
|
|
MergeTitle string `json:"merge_title"`
|
|
ProjectId string `json:"project_id"`
|
|
Status TaskStatus `json:"status"`
|
|
Title string `json:"title"`
|
|
|
|
// TodoItem The title of the TODO.md item the task was started from; absent for other tasks.
|
|
TodoItem *string `json:"todo_item,omitempty"`
|
|
WorktreePath string `json:"worktree_path"`
|
|
}
|
|
|
|
// TaskStatus defines model for Task.Status.
|
|
type TaskStatus string
|
|
|
|
// TaskChanges defines model for TaskChanges.
|
|
type TaskChanges struct {
|
|
// Base The commit or tree compared with: the merge-base of the task branch and the default branch, since, or the previous snapshot's tree.
|
|
Base string `json:"base"`
|
|
Files []FileChange `json:"files"`
|
|
|
|
// Tree Tree of the worktree as if everything were staged, or the snapshot's tree.
|
|
Tree string `json:"tree"`
|
|
}
|
|
|
|
// TaskCreate defines model for TaskCreate.
|
|
type TaskCreate struct {
|
|
Title string `json:"title"`
|
|
}
|
|
|
|
// TaskTab defines model for TaskTab.
|
|
type TaskTab string
|
|
|
|
// Todo defines model for Todo.
|
|
type Todo struct {
|
|
// Exists Whether the default branch has a TODO.md at its root.
|
|
Exists bool `json:"exists"`
|
|
Items []TodoItem `json:"items"`
|
|
}
|
|
|
|
// TodoItem defines model for TodoItem.
|
|
type TodoItem struct {
|
|
// Body The item's further lines
|
|
Body string `json:"body"`
|
|
|
|
// Section The text of the nearest heading above the item; empty when there is none.
|
|
Section string `json:"section"`
|
|
|
|
// Title The item's first line, without its list marker: the item's identity.
|
|
Title string `json:"title"`
|
|
}
|
|
|
|
// TodoStart defines model for TodoStart.
|
|
type TodoStart struct {
|
|
Model *string `json:"model,omitempty"`
|
|
|
|
// Title The title of the item to start.
|
|
Title string `json:"title"`
|
|
}
|
|
|
|
// TurnRef defines model for TurnRef.
|
|
type TurnRef struct {
|
|
SessionId string `json:"session_id"`
|
|
TaskId string `json:"task_id"`
|
|
Vendor string `json:"vendor"`
|
|
}
|
|
|
|
// Unmerged defines model for Unmerged.
|
|
type Unmerged struct {
|
|
// Commits Commits on the task branch that aren't on the default branch.
|
|
Commits int `json:"commits"`
|
|
Deletions int `json:"deletions"`
|
|
|
|
// Files Files that differ from the merge base
|
|
Files int `json:"files"`
|
|
Insertions int `json:"insertions"`
|
|
|
|
// Uncommitted Paths with uncommitted changes in the worktree.
|
|
Uncommitted int `json:"uncommitted"`
|
|
}
|
|
|
|
// User defines model for User.
|
|
type User struct {
|
|
DisplayName string `json:"display_name"`
|
|
GitEmail string `json:"git_email"`
|
|
GitName string `json:"git_name"`
|
|
Login string `json:"login"`
|
|
|
|
// NotificationPrefs Which new inbox items send this user a push notification.
|
|
NotificationPrefs NotificationPrefs `json:"notification_prefs"`
|
|
}
|
|
|
|
// UserUpdate defines model for UserUpdate.
|
|
type UserUpdate struct {
|
|
GitEmail string `json:"git_email"`
|
|
GitName string `json:"git_name"`
|
|
}
|
|
|
|
// Zombie defines model for Zombie.
|
|
type Zombie struct {
|
|
Detail string `json:"detail"`
|
|
Kind ZombieKind `json:"kind"`
|
|
Pid *int `json:"pid,omitempty"`
|
|
SessionId *string `json:"session_id,omitempty"`
|
|
TaskId *string `json:"task_id,omitempty"`
|
|
}
|
|
|
|
// ZombieKind defines model for Zombie.Kind.
|
|
type ZombieKind string
|
|
|
|
// StreamEventsParams defines parameters for StreamEvents.
|
|
type StreamEventsParams struct {
|
|
After *int64 `form:"after,omitempty" json:"after,omitempty"`
|
|
TaskId *string `form:"task_id,omitempty" json:"task_id,omitempty"`
|
|
Lead *bool `form:"lead,omitempty" json:"lead,omitempty"`
|
|
LastEventID *int64 `json:"Last-Event-ID,omitempty"`
|
|
}
|
|
|
|
// ListInboxParams defines parameters for ListInbox.
|
|
type ListInboxParams struct {
|
|
ProjectId *string `form:"project_id,omitempty" json:"project_id,omitempty"`
|
|
TaskId *string `form:"task_id,omitempty" json:"task_id,omitempty"`
|
|
State *InboxState `form:"state,omitempty" json:"state,omitempty"`
|
|
}
|
|
|
|
// RemovePushSubscriptionParams defines parameters for RemovePushSubscription.
|
|
type RemovePushSubscriptionParams struct {
|
|
Endpoint string `form:"endpoint" json:"endpoint"`
|
|
}
|
|
|
|
// GetTaskChangesParams defines parameters for GetTaskChanges.
|
|
type GetTaskChangesParams struct {
|
|
// Since A commit to compare with instead of the merge-base, such as a user.message event's head. Not allowed with snapshot.
|
|
Since *string `form:"since,omitempty" json:"since,omitempty"`
|
|
|
|
// Snapshot A snapshot's n: show the task as it was in that snapshot rather than the live worktree.
|
|
Snapshot *int `form:"snapshot,omitempty" json:"snapshot,omitempty"`
|
|
|
|
// Step With snapshot: compare with the previous snapshot (the snapshot commit's parent for the first one).
|
|
Step *bool `form:"step,omitempty" json:"step,omitempty"`
|
|
}
|
|
|
|
// GetTaskDiffParams defines parameters for GetTaskDiff.
|
|
type GetTaskDiffParams struct {
|
|
Base string `form:"base" json:"base"`
|
|
Tree string `form:"tree" json:"tree"`
|
|
Path string `form:"path" json:"path"`
|
|
OldPath *string `form:"old_path,omitempty" json:"old_path,omitempty"`
|
|
}
|
|
|
|
// GetTaskDirParams defines parameters for GetTaskDir.
|
|
type GetTaskDirParams struct {
|
|
// Path Slash-separated, relative to the worktree root; empty or absent for the root.
|
|
Path *string `form:"path,omitempty" json:"path,omitempty"`
|
|
}
|
|
|
|
// ListTaskEventsParams defines parameters for ListTaskEvents.
|
|
type ListTaskEventsParams struct {
|
|
After *int64 `form:"after,omitempty" json:"after,omitempty"`
|
|
Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
|
|
}
|
|
|
|
// GetTaskFileParams defines parameters for GetTaskFile.
|
|
type GetTaskFileParams struct {
|
|
// Path Slash-separated, relative to the worktree root.
|
|
Path string `form:"path" json:"path"`
|
|
}
|
|
|
|
// GetTaskImageParams defines parameters for GetTaskImage.
|
|
type GetTaskImageParams struct {
|
|
Path string `form:"path" json:"path"`
|
|
}
|
|
|
|
// RespondInboxJSONRequestBody defines body for RespondInbox for application/json ContentType.
|
|
type RespondInboxJSONRequestBody = InboxRespond
|
|
|
|
// UpdateMeJSONRequestBody defines body for UpdateMe for application/json ContentType.
|
|
type UpdateMeJSONRequestBody = UserUpdate
|
|
|
|
// SetFocusJSONRequestBody defines body for SetFocus for application/json ContentType.
|
|
type SetFocusJSONRequestBody = Focus
|
|
|
|
// MessageLeadJSONRequestBody defines body for MessageLead for application/json ContentType.
|
|
type MessageLeadJSONRequestBody = MessageCreate
|
|
|
|
// UpdateNotificationPrefsJSONRequestBody defines body for UpdateNotificationPrefs for application/json ContentType.
|
|
type UpdateNotificationPrefsJSONRequestBody = NotificationPrefs
|
|
|
|
// AddPushSubscriptionJSONRequestBody defines body for AddPushSubscription for application/json ContentType.
|
|
type AddPushSubscriptionJSONRequestBody = PushSubscription
|
|
|
|
// CreateProjectJSONRequestBody defines body for CreateProject for application/json ContentType.
|
|
type CreateProjectJSONRequestBody = ProjectCreate
|
|
|
|
// CreateTaskJSONRequestBody defines body for CreateTask for application/json ContentType.
|
|
type CreateTaskJSONRequestBody = TaskCreate
|
|
|
|
// StartTodoItemJSONRequestBody defines body for StartTodoItem for application/json ContentType.
|
|
type StartTodoItemJSONRequestBody = TodoStart
|
|
|
|
// SendMessageJSONRequestBody defines body for SendMessage for application/json ContentType.
|
|
type SendMessageJSONRequestBody = MessageCreate
|
|
|
|
// CreateSessionJSONRequestBody defines body for CreateSession for application/json ContentType.
|
|
type CreateSessionJSONRequestBody = SessionCreate
|
|
|
|
// ServerInterface represents all server handlers.
|
|
type ServerInterface interface {
|
|
|
|
// (GET /api/admin/status)
|
|
GetStatus(w http.ResponseWriter, r *http.Request)
|
|
|
|
// (POST /api/blobs)
|
|
UploadBlob(w http.ResponseWriter, r *http.Request)
|
|
|
|
// (GET /api/blobs/{blobId})
|
|
GetBlob(w http.ResponseWriter, r *http.Request, blobId string)
|
|
|
|
// (GET /api/events)
|
|
StreamEvents(w http.ResponseWriter, r *http.Request, params StreamEventsParams)
|
|
|
|
// (GET /api/inbox)
|
|
ListInbox(w http.ResponseWriter, r *http.Request, params ListInboxParams)
|
|
|
|
// (POST /api/inbox/responses)
|
|
RespondInbox(w http.ResponseWriter, r *http.Request)
|
|
|
|
// (GET /api/inbox/{itemId})
|
|
GetInboxItem(w http.ResponseWriter, r *http.Request, itemId string)
|
|
|
|
// (GET /api/me)
|
|
GetMe(w http.ResponseWriter, r *http.Request)
|
|
|
|
// (PUT /api/me)
|
|
UpdateMe(w http.ResponseWriter, r *http.Request)
|
|
|
|
// (GET /api/me/focus)
|
|
GetFocus(w http.ResponseWriter, r *http.Request)
|
|
|
|
// (PUT /api/me/focus)
|
|
SetFocus(w http.ResponseWriter, r *http.Request)
|
|
|
|
// (POST /api/me/lead/messages)
|
|
MessageLead(w http.ResponseWriter, r *http.Request)
|
|
|
|
// (GET /api/me/lead/sessions)
|
|
ListLeadSessions(w http.ResponseWriter, r *http.Request)
|
|
|
|
// (PUT /api/me/notifications)
|
|
UpdateNotificationPrefs(w http.ResponseWriter, r *http.Request)
|
|
|
|
// (DELETE /api/me/push-subscriptions)
|
|
RemovePushSubscription(w http.ResponseWriter, r *http.Request, params RemovePushSubscriptionParams)
|
|
|
|
// (POST /api/me/push-subscriptions)
|
|
AddPushSubscription(w http.ResponseWriter, r *http.Request)
|
|
|
|
// (GET /api/projects)
|
|
ListProjects(w http.ResponseWriter, r *http.Request)
|
|
|
|
// (POST /api/projects)
|
|
CreateProject(w http.ResponseWriter, r *http.Request)
|
|
|
|
// (GET /api/projects/{projectId})
|
|
GetProject(w http.ResponseWriter, r *http.Request, projectId string)
|
|
|
|
// (GET /api/projects/{projectId}/tasks)
|
|
ListTasks(w http.ResponseWriter, r *http.Request, projectId string)
|
|
|
|
// (POST /api/projects/{projectId}/tasks)
|
|
CreateTask(w http.ResponseWriter, r *http.Request, projectId string)
|
|
|
|
// (GET /api/projects/{projectId}/todo)
|
|
GetTodo(w http.ResponseWriter, r *http.Request, projectId string)
|
|
|
|
// (POST /api/projects/{projectId}/todo/tasks)
|
|
StartTodoItem(w http.ResponseWriter, r *http.Request, projectId string)
|
|
|
|
// (GET /api/push/key)
|
|
GetPushKey(w http.ResponseWriter, r *http.Request)
|
|
|
|
// (GET /api/sessions/{sessionId})
|
|
GetSession(w http.ResponseWriter, r *http.Request, sessionId string)
|
|
|
|
// (POST /api/sessions/{sessionId}/compact)
|
|
CompactSession(w http.ResponseWriter, r *http.Request, sessionId string)
|
|
|
|
// (POST /api/sessions/{sessionId}/interrupt)
|
|
InterruptSession(w http.ResponseWriter, r *http.Request, sessionId string)
|
|
|
|
// (POST /api/sessions/{sessionId}/messages)
|
|
SendMessage(w http.ResponseWriter, r *http.Request, sessionId string)
|
|
|
|
// (GET /api/tasks/{taskId})
|
|
GetTask(w http.ResponseWriter, r *http.Request, taskId string)
|
|
|
|
// (GET /api/tasks/{taskId}/changes)
|
|
GetTaskChanges(w http.ResponseWriter, r *http.Request, taskId string, params GetTaskChangesParams)
|
|
|
|
// (GET /api/tasks/{taskId}/co-authors)
|
|
GetCoAuthors(w http.ResponseWriter, r *http.Request, taskId string)
|
|
|
|
// (GET /api/tasks/{taskId}/diff)
|
|
GetTaskDiff(w http.ResponseWriter, r *http.Request, taskId string, params GetTaskDiffParams)
|
|
|
|
// (GET /api/tasks/{taskId}/dir)
|
|
GetTaskDir(w http.ResponseWriter, r *http.Request, taskId string, params GetTaskDirParams)
|
|
|
|
// (POST /api/tasks/{taskId}/discard)
|
|
DiscardTask(w http.ResponseWriter, r *http.Request, taskId string)
|
|
|
|
// (GET /api/tasks/{taskId}/events)
|
|
ListTaskEvents(w http.ResponseWriter, r *http.Request, taskId string, params ListTaskEventsParams)
|
|
|
|
// (GET /api/tasks/{taskId}/file)
|
|
GetTaskFile(w http.ResponseWriter, r *http.Request, taskId string, params GetTaskFileParams)
|
|
|
|
// (GET /api/tasks/{taskId}/image)
|
|
GetTaskImage(w http.ResponseWriter, r *http.Request, taskId string, params GetTaskImageParams)
|
|
|
|
// (POST /api/tasks/{taskId}/merge)
|
|
MergeTask(w http.ResponseWriter, r *http.Request, taskId string)
|
|
|
|
// (POST /api/tasks/{taskId}/merge-in)
|
|
MergeIn(w http.ResponseWriter, r *http.Request, taskId string)
|
|
|
|
// (GET /api/tasks/{taskId}/sessions)
|
|
ListSessions(w http.ResponseWriter, r *http.Request, taskId string)
|
|
|
|
// (POST /api/tasks/{taskId}/sessions)
|
|
CreateSession(w http.ResponseWriter, r *http.Request, taskId string)
|
|
|
|
// (GET /api/tasks/{taskId}/snapshots)
|
|
ListSnapshots(w http.ResponseWriter, r *http.Request, taskId string)
|
|
|
|
// (GET /api/tasks/{taskId}/unmerged)
|
|
GetUnmerged(w http.ResponseWriter, r *http.Request, taskId string)
|
|
}
|
|
|
|
// ServerInterfaceWrapper converts contexts to parameters.
|
|
type ServerInterfaceWrapper struct {
|
|
Handler ServerInterface
|
|
HandlerMiddlewares []MiddlewareFunc
|
|
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
|
|
}
|
|
|
|
type MiddlewareFunc func(http.Handler) http.Handler
|
|
|
|
// GetStatus operation middleware
|
|
func (siw *ServerInterfaceWrapper) GetStatus(w http.ResponseWriter, r *http.Request) {
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.GetStatus(w, r)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// UploadBlob operation middleware
|
|
func (siw *ServerInterfaceWrapper) UploadBlob(w http.ResponseWriter, r *http.Request) {
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.UploadBlob(w, r)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// GetBlob operation middleware
|
|
func (siw *ServerInterfaceWrapper) GetBlob(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "blobId" -------------
|
|
var blobId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "blobId", r.PathValue("blobId"), &blobId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "blobId", Err: err})
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.GetBlob(w, r, blobId)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// StreamEvents operation middleware
|
|
func (siw *ServerInterfaceWrapper) StreamEvents(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// Parameter object where we will unmarshal all parameters from the context
|
|
var params StreamEventsParams
|
|
|
|
// ------------- Optional query parameter "after" -------------
|
|
|
|
err = runtime.BindQueryParameterWithOptions("form", true, false, "after", r.URL.Query(), ¶ms.After, runtime.BindQueryParameterOptions{Type: "integer", Format: "int64"})
|
|
if err != nil {
|
|
var requiredError *runtime.RequiredParameterError
|
|
if errors.As(err, &requiredError) {
|
|
siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "after"})
|
|
} else {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "after", Err: err})
|
|
}
|
|
return
|
|
}
|
|
|
|
// ------------- Optional query parameter "task_id" -------------
|
|
|
|
err = runtime.BindQueryParameterWithOptions("form", true, false, "task_id", r.URL.Query(), ¶ms.TaskId, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
|
|
if err != nil {
|
|
var requiredError *runtime.RequiredParameterError
|
|
if errors.As(err, &requiredError) {
|
|
siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "task_id"})
|
|
} else {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "task_id", Err: err})
|
|
}
|
|
return
|
|
}
|
|
|
|
// ------------- Optional query parameter "lead" -------------
|
|
|
|
err = runtime.BindQueryParameterWithOptions("form", true, false, "lead", r.URL.Query(), ¶ms.Lead, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""})
|
|
if err != nil {
|
|
var requiredError *runtime.RequiredParameterError
|
|
if errors.As(err, &requiredError) {
|
|
siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "lead"})
|
|
} else {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "lead", Err: err})
|
|
}
|
|
return
|
|
}
|
|
|
|
headers := r.Header
|
|
|
|
// ------------- Optional header parameter "Last-Event-ID" -------------
|
|
if valueList, found := headers[http.CanonicalHeaderKey("Last-Event-ID")]; found {
|
|
var LastEventID int64
|
|
n := len(valueList)
|
|
if n != 1 {
|
|
siw.ErrorHandlerFunc(w, r, &TooManyValuesForParamError{ParamName: "Last-Event-ID", Count: n})
|
|
return
|
|
}
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "Last-Event-ID", valueList[0], &LastEventID, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: false, Required: false, Type: "integer", Format: "int64"})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "Last-Event-ID", Err: err})
|
|
return
|
|
}
|
|
|
|
params.LastEventID = &LastEventID
|
|
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.StreamEvents(w, r, params)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// ListInbox operation middleware
|
|
func (siw *ServerInterfaceWrapper) ListInbox(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// Parameter object where we will unmarshal all parameters from the context
|
|
var params ListInboxParams
|
|
|
|
// ------------- Optional query parameter "project_id" -------------
|
|
|
|
err = runtime.BindQueryParameterWithOptions("form", true, false, "project_id", r.URL.Query(), ¶ms.ProjectId, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
|
|
if err != nil {
|
|
var requiredError *runtime.RequiredParameterError
|
|
if errors.As(err, &requiredError) {
|
|
siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "project_id"})
|
|
} else {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "project_id", Err: err})
|
|
}
|
|
return
|
|
}
|
|
|
|
// ------------- Optional query parameter "task_id" -------------
|
|
|
|
err = runtime.BindQueryParameterWithOptions("form", true, false, "task_id", r.URL.Query(), ¶ms.TaskId, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
|
|
if err != nil {
|
|
var requiredError *runtime.RequiredParameterError
|
|
if errors.As(err, &requiredError) {
|
|
siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "task_id"})
|
|
} else {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "task_id", Err: err})
|
|
}
|
|
return
|
|
}
|
|
|
|
// ------------- Optional query parameter "state" -------------
|
|
|
|
err = runtime.BindQueryParameterWithOptions("form", true, false, "state", r.URL.Query(), ¶ms.State, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
|
|
if err != nil {
|
|
var requiredError *runtime.RequiredParameterError
|
|
if errors.As(err, &requiredError) {
|
|
siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "state"})
|
|
} else {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "state", Err: err})
|
|
}
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.ListInbox(w, r, params)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// RespondInbox operation middleware
|
|
func (siw *ServerInterfaceWrapper) RespondInbox(w http.ResponseWriter, r *http.Request) {
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.RespondInbox(w, r)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// GetInboxItem operation middleware
|
|
func (siw *ServerInterfaceWrapper) GetInboxItem(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "itemId" -------------
|
|
var itemId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "itemId", r.PathValue("itemId"), &itemId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "itemId", Err: err})
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.GetInboxItem(w, r, itemId)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// GetMe operation middleware
|
|
func (siw *ServerInterfaceWrapper) GetMe(w http.ResponseWriter, r *http.Request) {
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.GetMe(w, r)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// UpdateMe operation middleware
|
|
func (siw *ServerInterfaceWrapper) UpdateMe(w http.ResponseWriter, r *http.Request) {
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.UpdateMe(w, r)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// GetFocus operation middleware
|
|
func (siw *ServerInterfaceWrapper) GetFocus(w http.ResponseWriter, r *http.Request) {
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.GetFocus(w, r)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// SetFocus operation middleware
|
|
func (siw *ServerInterfaceWrapper) SetFocus(w http.ResponseWriter, r *http.Request) {
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.SetFocus(w, r)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// MessageLead operation middleware
|
|
func (siw *ServerInterfaceWrapper) MessageLead(w http.ResponseWriter, r *http.Request) {
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.MessageLead(w, r)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// ListLeadSessions operation middleware
|
|
func (siw *ServerInterfaceWrapper) ListLeadSessions(w http.ResponseWriter, r *http.Request) {
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.ListLeadSessions(w, r)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// UpdateNotificationPrefs operation middleware
|
|
func (siw *ServerInterfaceWrapper) UpdateNotificationPrefs(w http.ResponseWriter, r *http.Request) {
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.UpdateNotificationPrefs(w, r)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// RemovePushSubscription operation middleware
|
|
func (siw *ServerInterfaceWrapper) RemovePushSubscription(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// Parameter object where we will unmarshal all parameters from the context
|
|
var params RemovePushSubscriptionParams
|
|
|
|
// ------------- Required query parameter "endpoint" -------------
|
|
|
|
err = runtime.BindQueryParameterWithOptions("form", true, true, "endpoint", r.URL.Query(), ¶ms.Endpoint, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
|
|
if err != nil {
|
|
var requiredError *runtime.RequiredParameterError
|
|
if errors.As(err, &requiredError) {
|
|
siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "endpoint"})
|
|
} else {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "endpoint", Err: err})
|
|
}
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.RemovePushSubscription(w, r, params)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// AddPushSubscription operation middleware
|
|
func (siw *ServerInterfaceWrapper) AddPushSubscription(w http.ResponseWriter, r *http.Request) {
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.AddPushSubscription(w, r)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// ListProjects operation middleware
|
|
func (siw *ServerInterfaceWrapper) ListProjects(w http.ResponseWriter, r *http.Request) {
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.ListProjects(w, r)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// CreateProject operation middleware
|
|
func (siw *ServerInterfaceWrapper) CreateProject(w http.ResponseWriter, r *http.Request) {
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.CreateProject(w, r)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// GetProject operation middleware
|
|
func (siw *ServerInterfaceWrapper) GetProject(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "projectId" -------------
|
|
var projectId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "projectId", r.PathValue("projectId"), &projectId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "projectId", Err: err})
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.GetProject(w, r, projectId)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// ListTasks operation middleware
|
|
func (siw *ServerInterfaceWrapper) ListTasks(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "projectId" -------------
|
|
var projectId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "projectId", r.PathValue("projectId"), &projectId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "projectId", Err: err})
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.ListTasks(w, r, projectId)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// CreateTask operation middleware
|
|
func (siw *ServerInterfaceWrapper) CreateTask(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "projectId" -------------
|
|
var projectId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "projectId", r.PathValue("projectId"), &projectId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "projectId", Err: err})
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.CreateTask(w, r, projectId)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// GetTodo operation middleware
|
|
func (siw *ServerInterfaceWrapper) GetTodo(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "projectId" -------------
|
|
var projectId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "projectId", r.PathValue("projectId"), &projectId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "projectId", Err: err})
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.GetTodo(w, r, projectId)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// StartTodoItem operation middleware
|
|
func (siw *ServerInterfaceWrapper) StartTodoItem(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "projectId" -------------
|
|
var projectId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "projectId", r.PathValue("projectId"), &projectId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "projectId", Err: err})
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.StartTodoItem(w, r, projectId)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// GetPushKey operation middleware
|
|
func (siw *ServerInterfaceWrapper) GetPushKey(w http.ResponseWriter, r *http.Request) {
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.GetPushKey(w, r)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// GetSession operation middleware
|
|
func (siw *ServerInterfaceWrapper) GetSession(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "sessionId" -------------
|
|
var sessionId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "sessionId", r.PathValue("sessionId"), &sessionId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "sessionId", Err: err})
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.GetSession(w, r, sessionId)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// CompactSession operation middleware
|
|
func (siw *ServerInterfaceWrapper) CompactSession(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "sessionId" -------------
|
|
var sessionId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "sessionId", r.PathValue("sessionId"), &sessionId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "sessionId", Err: err})
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.CompactSession(w, r, sessionId)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// InterruptSession operation middleware
|
|
func (siw *ServerInterfaceWrapper) InterruptSession(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "sessionId" -------------
|
|
var sessionId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "sessionId", r.PathValue("sessionId"), &sessionId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "sessionId", Err: err})
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.InterruptSession(w, r, sessionId)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// SendMessage operation middleware
|
|
func (siw *ServerInterfaceWrapper) SendMessage(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "sessionId" -------------
|
|
var sessionId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "sessionId", r.PathValue("sessionId"), &sessionId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "sessionId", Err: err})
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.SendMessage(w, r, sessionId)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// GetTask operation middleware
|
|
func (siw *ServerInterfaceWrapper) GetTask(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "taskId" -------------
|
|
var taskId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "taskId", r.PathValue("taskId"), &taskId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "taskId", Err: err})
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.GetTask(w, r, taskId)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// GetTaskChanges operation middleware
|
|
func (siw *ServerInterfaceWrapper) GetTaskChanges(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "taskId" -------------
|
|
var taskId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "taskId", r.PathValue("taskId"), &taskId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "taskId", Err: err})
|
|
return
|
|
}
|
|
|
|
// Parameter object where we will unmarshal all parameters from the context
|
|
var params GetTaskChangesParams
|
|
|
|
// ------------- Optional query parameter "since" -------------
|
|
|
|
err = runtime.BindQueryParameterWithOptions("form", true, false, "since", r.URL.Query(), ¶ms.Since, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
|
|
if err != nil {
|
|
var requiredError *runtime.RequiredParameterError
|
|
if errors.As(err, &requiredError) {
|
|
siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "since"})
|
|
} else {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "since", Err: err})
|
|
}
|
|
return
|
|
}
|
|
|
|
// ------------- Optional query parameter "snapshot" -------------
|
|
|
|
err = runtime.BindQueryParameterWithOptions("form", true, false, "snapshot", r.URL.Query(), ¶ms.Snapshot, runtime.BindQueryParameterOptions{Type: "integer", Format: ""})
|
|
if err != nil {
|
|
var requiredError *runtime.RequiredParameterError
|
|
if errors.As(err, &requiredError) {
|
|
siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "snapshot"})
|
|
} else {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "snapshot", Err: err})
|
|
}
|
|
return
|
|
}
|
|
|
|
// ------------- Optional query parameter "step" -------------
|
|
|
|
err = runtime.BindQueryParameterWithOptions("form", true, false, "step", r.URL.Query(), ¶ms.Step, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""})
|
|
if err != nil {
|
|
var requiredError *runtime.RequiredParameterError
|
|
if errors.As(err, &requiredError) {
|
|
siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "step"})
|
|
} else {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "step", Err: err})
|
|
}
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.GetTaskChanges(w, r, taskId, params)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// GetCoAuthors operation middleware
|
|
func (siw *ServerInterfaceWrapper) GetCoAuthors(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "taskId" -------------
|
|
var taskId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "taskId", r.PathValue("taskId"), &taskId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "taskId", Err: err})
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.GetCoAuthors(w, r, taskId)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// GetTaskDiff operation middleware
|
|
func (siw *ServerInterfaceWrapper) GetTaskDiff(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "taskId" -------------
|
|
var taskId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "taskId", r.PathValue("taskId"), &taskId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "taskId", Err: err})
|
|
return
|
|
}
|
|
|
|
// Parameter object where we will unmarshal all parameters from the context
|
|
var params GetTaskDiffParams
|
|
|
|
// ------------- Required query parameter "base" -------------
|
|
|
|
err = runtime.BindQueryParameterWithOptions("form", true, true, "base", r.URL.Query(), ¶ms.Base, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
|
|
if err != nil {
|
|
var requiredError *runtime.RequiredParameterError
|
|
if errors.As(err, &requiredError) {
|
|
siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "base"})
|
|
} else {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "base", Err: err})
|
|
}
|
|
return
|
|
}
|
|
|
|
// ------------- Required query parameter "tree" -------------
|
|
|
|
err = runtime.BindQueryParameterWithOptions("form", true, true, "tree", r.URL.Query(), ¶ms.Tree, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
|
|
if err != nil {
|
|
var requiredError *runtime.RequiredParameterError
|
|
if errors.As(err, &requiredError) {
|
|
siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "tree"})
|
|
} else {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "tree", Err: err})
|
|
}
|
|
return
|
|
}
|
|
|
|
// ------------- Required query parameter "path" -------------
|
|
|
|
err = runtime.BindQueryParameterWithOptions("form", true, true, "path", r.URL.Query(), ¶ms.Path, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
|
|
if err != nil {
|
|
var requiredError *runtime.RequiredParameterError
|
|
if errors.As(err, &requiredError) {
|
|
siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "path"})
|
|
} else {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "path", Err: err})
|
|
}
|
|
return
|
|
}
|
|
|
|
// ------------- Optional query parameter "old_path" -------------
|
|
|
|
err = runtime.BindQueryParameterWithOptions("form", true, false, "old_path", r.URL.Query(), ¶ms.OldPath, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
|
|
if err != nil {
|
|
var requiredError *runtime.RequiredParameterError
|
|
if errors.As(err, &requiredError) {
|
|
siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "old_path"})
|
|
} else {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "old_path", Err: err})
|
|
}
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.GetTaskDiff(w, r, taskId, params)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// GetTaskDir operation middleware
|
|
func (siw *ServerInterfaceWrapper) GetTaskDir(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "taskId" -------------
|
|
var taskId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "taskId", r.PathValue("taskId"), &taskId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "taskId", Err: err})
|
|
return
|
|
}
|
|
|
|
// Parameter object where we will unmarshal all parameters from the context
|
|
var params GetTaskDirParams
|
|
|
|
// ------------- Optional query parameter "path" -------------
|
|
|
|
err = runtime.BindQueryParameterWithOptions("form", true, false, "path", r.URL.Query(), ¶ms.Path, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
|
|
if err != nil {
|
|
var requiredError *runtime.RequiredParameterError
|
|
if errors.As(err, &requiredError) {
|
|
siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "path"})
|
|
} else {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "path", Err: err})
|
|
}
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.GetTaskDir(w, r, taskId, params)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// DiscardTask operation middleware
|
|
func (siw *ServerInterfaceWrapper) DiscardTask(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "taskId" -------------
|
|
var taskId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "taskId", r.PathValue("taskId"), &taskId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "taskId", Err: err})
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.DiscardTask(w, r, taskId)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// ListTaskEvents operation middleware
|
|
func (siw *ServerInterfaceWrapper) ListTaskEvents(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "taskId" -------------
|
|
var taskId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "taskId", r.PathValue("taskId"), &taskId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "taskId", Err: err})
|
|
return
|
|
}
|
|
|
|
// Parameter object where we will unmarshal all parameters from the context
|
|
var params ListTaskEventsParams
|
|
|
|
// ------------- Optional query parameter "after" -------------
|
|
|
|
err = runtime.BindQueryParameterWithOptions("form", true, false, "after", r.URL.Query(), ¶ms.After, runtime.BindQueryParameterOptions{Type: "integer", Format: "int64"})
|
|
if err != nil {
|
|
var requiredError *runtime.RequiredParameterError
|
|
if errors.As(err, &requiredError) {
|
|
siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "after"})
|
|
} else {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "after", Err: err})
|
|
}
|
|
return
|
|
}
|
|
|
|
// ------------- Optional query parameter "limit" -------------
|
|
|
|
err = runtime.BindQueryParameterWithOptions("form", true, false, "limit", r.URL.Query(), ¶ms.Limit, runtime.BindQueryParameterOptions{Type: "integer", Format: ""})
|
|
if err != nil {
|
|
var requiredError *runtime.RequiredParameterError
|
|
if errors.As(err, &requiredError) {
|
|
siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "limit"})
|
|
} else {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "limit", Err: err})
|
|
}
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.ListTaskEvents(w, r, taskId, params)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// GetTaskFile operation middleware
|
|
func (siw *ServerInterfaceWrapper) GetTaskFile(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "taskId" -------------
|
|
var taskId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "taskId", r.PathValue("taskId"), &taskId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "taskId", Err: err})
|
|
return
|
|
}
|
|
|
|
// Parameter object where we will unmarshal all parameters from the context
|
|
var params GetTaskFileParams
|
|
|
|
// ------------- Required query parameter "path" -------------
|
|
|
|
err = runtime.BindQueryParameterWithOptions("form", true, true, "path", r.URL.Query(), ¶ms.Path, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
|
|
if err != nil {
|
|
var requiredError *runtime.RequiredParameterError
|
|
if errors.As(err, &requiredError) {
|
|
siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "path"})
|
|
} else {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "path", Err: err})
|
|
}
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.GetTaskFile(w, r, taskId, params)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// GetTaskImage operation middleware
|
|
func (siw *ServerInterfaceWrapper) GetTaskImage(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "taskId" -------------
|
|
var taskId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "taskId", r.PathValue("taskId"), &taskId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "taskId", Err: err})
|
|
return
|
|
}
|
|
|
|
// Parameter object where we will unmarshal all parameters from the context
|
|
var params GetTaskImageParams
|
|
|
|
// ------------- Required query parameter "path" -------------
|
|
|
|
err = runtime.BindQueryParameterWithOptions("form", true, true, "path", r.URL.Query(), ¶ms.Path, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
|
|
if err != nil {
|
|
var requiredError *runtime.RequiredParameterError
|
|
if errors.As(err, &requiredError) {
|
|
siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "path"})
|
|
} else {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "path", Err: err})
|
|
}
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.GetTaskImage(w, r, taskId, params)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// MergeTask operation middleware
|
|
func (siw *ServerInterfaceWrapper) MergeTask(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "taskId" -------------
|
|
var taskId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "taskId", r.PathValue("taskId"), &taskId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "taskId", Err: err})
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.MergeTask(w, r, taskId)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// MergeIn operation middleware
|
|
func (siw *ServerInterfaceWrapper) MergeIn(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "taskId" -------------
|
|
var taskId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "taskId", r.PathValue("taskId"), &taskId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "taskId", Err: err})
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.MergeIn(w, r, taskId)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// ListSessions operation middleware
|
|
func (siw *ServerInterfaceWrapper) ListSessions(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "taskId" -------------
|
|
var taskId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "taskId", r.PathValue("taskId"), &taskId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "taskId", Err: err})
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.ListSessions(w, r, taskId)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// CreateSession operation middleware
|
|
func (siw *ServerInterfaceWrapper) CreateSession(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "taskId" -------------
|
|
var taskId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "taskId", r.PathValue("taskId"), &taskId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "taskId", Err: err})
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.CreateSession(w, r, taskId)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// ListSnapshots operation middleware
|
|
func (siw *ServerInterfaceWrapper) ListSnapshots(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "taskId" -------------
|
|
var taskId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "taskId", r.PathValue("taskId"), &taskId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "taskId", Err: err})
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.ListSnapshots(w, r, taskId)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
// GetUnmerged operation middleware
|
|
func (siw *ServerInterfaceWrapper) GetUnmerged(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var err error
|
|
_ = err
|
|
|
|
// ------------- Path parameter "taskId" -------------
|
|
var taskId string
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "taskId", r.PathValue("taskId"), &taskId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "", ValueIsUnescaped: true})
|
|
if err != nil {
|
|
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "taskId", Err: err})
|
|
return
|
|
}
|
|
|
|
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
siw.Handler.GetUnmerged(w, r, taskId)
|
|
}))
|
|
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|
handler = middleware(handler)
|
|
}
|
|
|
|
handler.ServeHTTP(w, r)
|
|
}
|
|
|
|
type UnescapedCookieParamError struct {
|
|
ParamName string
|
|
Err error
|
|
}
|
|
|
|
func (e *UnescapedCookieParamError) Error() string {
|
|
return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName)
|
|
}
|
|
|
|
func (e *UnescapedCookieParamError) Unwrap() error {
|
|
return e.Err
|
|
}
|
|
|
|
type UnmarshalingParamError struct {
|
|
ParamName string
|
|
Err error
|
|
}
|
|
|
|
func (e *UnmarshalingParamError) Error() string {
|
|
return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error())
|
|
}
|
|
|
|
func (e *UnmarshalingParamError) Unwrap() error {
|
|
return e.Err
|
|
}
|
|
|
|
type RequiredParamError struct {
|
|
ParamName string
|
|
}
|
|
|
|
func (e *RequiredParamError) Error() string {
|
|
return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName)
|
|
}
|
|
|
|
type RequiredHeaderError struct {
|
|
ParamName string
|
|
Err error
|
|
}
|
|
|
|
func (e *RequiredHeaderError) Error() string {
|
|
return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName)
|
|
}
|
|
|
|
func (e *RequiredHeaderError) Unwrap() error {
|
|
return e.Err
|
|
}
|
|
|
|
type InvalidParamFormatError struct {
|
|
ParamName string
|
|
Err error
|
|
}
|
|
|
|
func (e *InvalidParamFormatError) Error() string {
|
|
return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error())
|
|
}
|
|
|
|
func (e *InvalidParamFormatError) Unwrap() error {
|
|
return e.Err
|
|
}
|
|
|
|
type TooManyValuesForParamError struct {
|
|
ParamName string
|
|
Count int
|
|
}
|
|
|
|
func (e *TooManyValuesForParamError) Error() string {
|
|
return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count)
|
|
}
|
|
|
|
// Handler creates http.Handler with routing matching OpenAPI spec.
|
|
func Handler(si ServerInterface) http.Handler {
|
|
return HandlerWithOptions(si, StdHTTPServerOptions{})
|
|
}
|
|
|
|
// ServeMux is an abstraction of [http.ServeMux].
|
|
type ServeMux interface {
|
|
HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
|
|
http.Handler
|
|
}
|
|
|
|
type StdHTTPServerOptions struct {
|
|
BaseURL string
|
|
BaseRouter ServeMux
|
|
Middlewares []MiddlewareFunc
|
|
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
|
|
}
|
|
|
|
// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
|
|
func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler {
|
|
return HandlerWithOptions(si, StdHTTPServerOptions{
|
|
BaseRouter: m,
|
|
})
|
|
}
|
|
|
|
func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler {
|
|
return HandlerWithOptions(si, StdHTTPServerOptions{
|
|
BaseURL: baseURL,
|
|
BaseRouter: m,
|
|
})
|
|
}
|
|
|
|
// HandlerWithOptions creates http.Handler with additional options
|
|
func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler {
|
|
m := options.BaseRouter
|
|
|
|
if m == nil {
|
|
m = http.NewServeMux()
|
|
}
|
|
if options.ErrorHandlerFunc == nil {
|
|
options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) {
|
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
|
}
|
|
}
|
|
|
|
wrapper := ServerInterfaceWrapper{
|
|
Handler: si,
|
|
HandlerMiddlewares: options.Middlewares,
|
|
ErrorHandlerFunc: options.ErrorHandlerFunc,
|
|
}
|
|
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/me", wrapper.GetMe)
|
|
m.HandleFunc(http.MethodPut+" "+options.BaseURL+"/api/me", wrapper.UpdateMe)
|
|
m.HandleFunc(http.MethodPut+" "+options.BaseURL+"/api/me/notifications", wrapper.UpdateNotificationPrefs)
|
|
m.HandleFunc(http.MethodDelete+" "+options.BaseURL+"/api/me/push-subscriptions", wrapper.RemovePushSubscription)
|
|
m.HandleFunc(http.MethodPost+" "+options.BaseURL+"/api/me/push-subscriptions", wrapper.AddPushSubscription)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/me/lead/sessions", wrapper.ListLeadSessions)
|
|
m.HandleFunc(http.MethodPost+" "+options.BaseURL+"/api/me/lead/messages", wrapper.MessageLead)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/me/focus", wrapper.GetFocus)
|
|
m.HandleFunc(http.MethodPut+" "+options.BaseURL+"/api/me/focus", wrapper.SetFocus)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/push/key", wrapper.GetPushKey)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/projects", wrapper.ListProjects)
|
|
m.HandleFunc(http.MethodPost+" "+options.BaseURL+"/api/projects", wrapper.CreateProject)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/projects/{projectId}", wrapper.GetProject)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/projects/{projectId}/tasks", wrapper.ListTasks)
|
|
m.HandleFunc(http.MethodPost+" "+options.BaseURL+"/api/projects/{projectId}/tasks", wrapper.CreateTask)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/projects/{projectId}/todo", wrapper.GetTodo)
|
|
m.HandleFunc(http.MethodPost+" "+options.BaseURL+"/api/projects/{projectId}/todo/tasks", wrapper.StartTodoItem)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/tasks/{taskId}", wrapper.GetTask)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/tasks/{taskId}/unmerged", wrapper.GetUnmerged)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/tasks/{taskId}/co-authors", wrapper.GetCoAuthors)
|
|
m.HandleFunc(http.MethodPost+" "+options.BaseURL+"/api/tasks/{taskId}/merge", wrapper.MergeTask)
|
|
m.HandleFunc(http.MethodPost+" "+options.BaseURL+"/api/tasks/{taskId}/merge-in", wrapper.MergeIn)
|
|
m.HandleFunc(http.MethodPost+" "+options.BaseURL+"/api/tasks/{taskId}/discard", wrapper.DiscardTask)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/tasks/{taskId}/events", wrapper.ListTaskEvents)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/tasks/{taskId}/changes", wrapper.GetTaskChanges)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/tasks/{taskId}/image", wrapper.GetTaskImage)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/tasks/{taskId}/diff", wrapper.GetTaskDiff)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/tasks/{taskId}/dir", wrapper.GetTaskDir)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/tasks/{taskId}/file", wrapper.GetTaskFile)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/tasks/{taskId}/snapshots", wrapper.ListSnapshots)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/tasks/{taskId}/sessions", wrapper.ListSessions)
|
|
m.HandleFunc(http.MethodPost+" "+options.BaseURL+"/api/tasks/{taskId}/sessions", wrapper.CreateSession)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/sessions/{sessionId}", wrapper.GetSession)
|
|
m.HandleFunc(http.MethodPost+" "+options.BaseURL+"/api/sessions/{sessionId}/messages", wrapper.SendMessage)
|
|
m.HandleFunc(http.MethodPost+" "+options.BaseURL+"/api/sessions/{sessionId}/compact", wrapper.CompactSession)
|
|
m.HandleFunc(http.MethodPost+" "+options.BaseURL+"/api/sessions/{sessionId}/interrupt", wrapper.InterruptSession)
|
|
m.HandleFunc(http.MethodPost+" "+options.BaseURL+"/api/blobs", wrapper.UploadBlob)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/blobs/{blobId}", wrapper.GetBlob)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/inbox", wrapper.ListInbox)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/inbox/{itemId}", wrapper.GetInboxItem)
|
|
m.HandleFunc(http.MethodPost+" "+options.BaseURL+"/api/inbox/responses", wrapper.RespondInbox)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/events", wrapper.StreamEvents)
|
|
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/admin/status", wrapper.GetStatus)
|
|
|
|
return m
|
|
}
|
|
|
|
// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec.
|
|
// Stored as a slice of fixed-width chunks rather than one concatenated
|
|
// const string: with thousands of chunks the chained `+` fold is several
|
|
// times slower for the Go compiler than parsing a slice literal.
|
|
var swaggerSpec = []string{
|
|
"7D1/c9u2kl8Fo7sZJ3e0nLZp586Z+8NN0jbvNU1e7L7OXK+jB5ErCc8koACgZTXj736DXYAERdCiHdtJ",
|
|
"r/dP64gksFjsLvY3PkxyVa2VBGnN5PjDRINZK2kA//FSa6XdH7mSFqR1f/L1uhQ5t0LJo38aJd1vJl9B",
|
|
"xd1f/6phMTme/MtRO+oRPTVHNNrV1VU2KcDkWqzdIJNjmmY6cQ/8u26okyVI+1arHAz+e63VGrQVBNoK",
|
|
"eGlX7q/uWMbW+TmrgEvDOLO1lkwYpmsphVwyLgsmFTNWA68YXIC0bMUN41qLCyjYQmmGI8z4woKeGciV",
|
|
"LMwzBpfCQuHHtStgawLMDb5UEqaTbAKyribHv07U+SQjONyP+OHkt2xit2tAALWQy0k2uTx0HxxecC15",
|
|
"5Rb16+QHXNQb9x39eepHoX+99GNdZZOSGztD+Gfc9rHwywpkB0z3PttoZYFxVgoJzComrPGomGSThdKV",
|
|
"G2pScAuHVlQwySZKs40bSlhmLNcWiunkWNZlubucq2yyFoUDxP8upIUlaPfAgDFCyVnnefudsdwCUpZh",
|
|
"SjLc9lP6pJmsu7qzFTA/6IFbgfs+AZDl5nxo0guQBZH2zqOrbKLhfS00FG5HItjbAZvPadFhCbu7kgUi",
|
|
"bTdfzf8JuXUAxMvsU3eugVso/N4mt6a3pPDNfJtc8QAiKlVA2Segd/C+BoMk7154xqBa221E/4SBA8MK",
|
|
"WPC6tNMUSGojQfcHd/tXqqWQbLNSBlgJvGDcIYTZlXA8FeZz/MiZw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6bJvP32aEgzDHUpcA/Dz3Yp39Ya/Lq6n8DAAD//w==",
|
|
}
|
|
|
|
// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes,
|
|
// after base64-decoding and flate-decompressing the embedded blob.
|
|
func decodeSpec() ([]byte, error) {
|
|
encoded := strings.Join(swaggerSpec, "")
|
|
compressed, err := base64.StdEncoding.DecodeString(encoded)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("error base64 decoding spec: %w", err)
|
|
}
|
|
zr := flate.NewReader(bytes.NewReader(compressed))
|
|
var buf bytes.Buffer
|
|
if _, err := buf.ReadFrom(zr); err != nil {
|
|
return nil, fmt.Errorf("read flate: %w", err)
|
|
}
|
|
if err := zr.Close(); err != nil {
|
|
return nil, fmt.Errorf("close flate reader: %w", err)
|
|
}
|
|
|
|
return buf.Bytes(), nil
|
|
}
|
|
|
|
var rawSpec = decodeSpecCached()
|
|
|
|
// a naive cache of the decoded OpenAPI spec
|
|
func decodeSpecCached() func() ([]byte, error) {
|
|
data, err := decodeSpec()
|
|
return func() ([]byte, error) {
|
|
return data, err
|
|
}
|
|
}
|
|
|
|
// Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
|
|
func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
|
|
res := make(map[string]func() ([]byte, error))
|
|
if len(pathToFile) > 0 {
|
|
res[pathToFile] = rawSpec
|
|
}
|
|
|
|
return res
|
|
}
|
|
|
|
// GetSpec returns the OpenAPI specification corresponding to the generated
|
|
// code in this file. External references in the spec are resolved through
|
|
// PathToRawSpec; externally-referenced files must be embedded in their
|
|
// corresponding Go packages (via the import-mapping feature). URL-based
|
|
// external refs are not supported.
|
|
func GetSpec() (swagger *openapi3.T, err error) {
|
|
resolvePath := PathToRawSpec("")
|
|
|
|
loader := openapi3.NewLoader()
|
|
loader.IsExternalRefsAllowed = true
|
|
loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
|
|
pathToFile := url.String()
|
|
pathToFile = path.Clean(pathToFile)
|
|
getSpec, ok := resolvePath[pathToFile]
|
|
if !ok {
|
|
err1 := fmt.Errorf("path not found: %s", pathToFile)
|
|
return nil, err1
|
|
}
|
|
return getSpec()
|
|
}
|
|
var specData []byte
|
|
specData, err = rawSpec()
|
|
if err != nil {
|
|
return
|
|
}
|
|
swagger, err = loader.LoadFromData(specData)
|
|
if err != nil {
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI
|
|
// specification: decompressed but not unmarshaled. External references
|
|
// are not resolved here; the bytes are the spec exactly as embedded by
|
|
// codegen. The result is cached at package init time, so repeated calls
|
|
// are cheap.
|
|
func GetSpecJSON() ([]byte, error) {
|
|
return rawSpec()
|
|
}
|
|
|
|
// GetSwagger returns the OpenAPI specification corresponding to the
|
|
// generated code in this file.
|
|
//
|
|
// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger
|
|
// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for
|
|
// backwards compatibility.
|
|
func GetSwagger() (*openapi3.T, error) {
|
|
return GetSpec()
|
|
}
|