Files
byre/internal/api/api.gen.go
T

2005 lines
68 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 AgentSessionRole.
const (
Implementer AgentSessionRole = "implementer"
)
// Valid indicates whether the value is a known member of the AgentSessionRole enum.
func (e AgentSessionRole) Valid() bool {
switch e {
case Implementer:
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 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"
Snooze InboxResponseType = "snooze"
)
// 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
case Snooze:
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 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
}
}
// 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"`
Role AgentSessionRole `json:"role"`
// State queued means a turn is waiting for a free slot under the concurrency caps.
State AgentSessionState `json:"state"`
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.
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"`
}
// 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"`
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
// FileDiff defines model for FileDiff.
type FileDiff struct {
Patch string `json:"patch"`
Path string `json:"path"`
}
// 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, question, why_blocked, options, recommended_option, 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"`
SnoozedUntil *time.Time `json:"snoozed_until,omitempty"`
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"`
Option *string `json:"option,omitempty"`
SnoozeUntil *time.Time `json:"snooze_until,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"`
// Option option: one of the question's options.
Option *string `json:"option,omitempty"`
// SnoozeUntil snooze: when the item reappears.
SnoozeUntil *time.Time `json:"snooze_until,omitempty"`
// Text other: the text sent to the agent.
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"`
}
// 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"`
}
// 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"`
}
// Status defines model for Status.
type Status struct {
ActiveTasks int `json:"active_tasks"`
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"`
// 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"`
}
// 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"`
WorktreePath string `json:"worktree_path"`
}
// TaskStatus defines model for Task.Status.
type TaskStatus string
// TaskChanges defines model for TaskChanges.
type TaskChanges struct {
// Base Merge-base commit of the task branch and the default branch.
Base string `json:"base"`
Files []FileChange `json:"files"`
// Tree Tree of the worktree as if everything were staged.
Tree string `json:"tree"`
}
// TaskCreate defines model for TaskCreate.
type TaskCreate struct {
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"`
}
// StreamEventsParams defines parameters for StreamEvents.
type StreamEventsParams struct {
After *int64 `form:"after,omitempty" json:"after,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"`
IncludeSnoozed *bool `form:"include_snoozed,omitempty" json:"include_snoozed,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.
Since *string `form:"since,omitempty" json:"since,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"`
}
// ListTaskEventsParams defines parameters for ListTaskEvents.
type ListTaskEventsParams struct {
After *int64 `form:"after,omitempty" json:"after,omitempty"`
Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
}
// RespondInboxJSONRequestBody defines body for RespondInbox for application/json ContentType.
type RespondInboxJSONRequestBody = InboxRespond
// UpdateMeJSONRequestBody defines body for UpdateMe for application/json ContentType.
type UpdateMeJSONRequestBody = UserUpdate
// 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
// 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)
// (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/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}/diff)
GetTaskDiff(w http.ResponseWriter, r *http.Request, taskId string, params GetTaskDiffParams)
// (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)
// (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}/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(), &params.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
}
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(), &params.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(), &params.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(), &params.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
}
// ------------- Optional query parameter "include_snoozed" -------------
err = runtime.BindQueryParameterWithOptions("form", true, false, "include_snoozed", r.URL.Query(), &params.IncludeSnoozed, runtime.BindQueryParameterOptions{Type: "boolean", Format: ""})
if err != nil {
var requiredError *runtime.RequiredParameterError
if errors.As(err, &requiredError) {
siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "include_snoozed"})
} else {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "include_snoozed", 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)
}
// 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(), &params.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)
}
// 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(), &params.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
}
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)
}
// 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(), &params.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(), &params.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(), &params.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(), &params.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)
}
// 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(), &params.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(), &params.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)
}
// 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)
}
// 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/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/tasks/{taskId}", wrapper.GetTask)
m.HandleFunc(http.MethodGet+" "+options.BaseURL+"/api/tasks/{taskId}/unmerged", wrapper.GetUnmerged)
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}/diff", wrapper.GetTaskDiff)
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{
"7Fzdcxs3kv9XUHNXJbtqRCmJk6pjnhzbSWk38mot+/Kwl2KBM00S0QwwBjCieS7971fdAOaDgyEpRZS9",
"t/skaj6ARvevG/2F+ZxkqqyUBGlNMv2caDCVkgbonzdaK40/MiUtSIs/eVUVIuNWKHn2h1ESr5lsBSXH",
"X/+pYZFMk/84a0c9c3fNmRvt7u4uTXIwmRYVDpJM3TSTBG/4Z3Gol0uQ9hqMEW6SSqsKtBWOtEwDt5DP",
"OBG1ULrEX0nOLZxaUUKSJnZTQTJNjNVCLpO7tHlnvsF3BrdFHr1cqhwKvNMn+h18rMFYyBk98CODsrIb",
"VgKXhtkVsFuQudInhuWw4HVhJzGStCoAxwZZl8n0H4koqwJKkBZ08nvkeWO5hSExH2uokRKanDNba8mE",
"YWsurJBLtlCacbbQAMwUyrJa5qCJyEzJrNYaZLZhGa8MEtnQkhfIRjd2kia6lhLJSAkyBVjIhzSmyadT",
"HOD0lmvJSxTWP3qivMYVXLihB9f/HuYa3HnXTD649aql5i5NLDc3sxFROpF0+Z0VvM4hymr38My4meJD",
"ogThYy005I5jSUtAM12AUGzIIFGPhB5G0y7IWwrV/A/ILFL40lqerUqvmFv6wT02ImwAmc8KIaFzU0gL",
"S9CkBiVfR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0cr2rjS5H5Z08fVicCXiGpcgT5Fj44cv6+tQPjEypf7T2FFNY/S+JI+30XdzwgSJYHcYTYHuwaQjFML",
"tNOCJhew7IFzMgbe1+5zlQdk5n2b9eELHuvScG37f3ocL5A/PU7zjbYvpSvN99DGkljcZqt/dR2hE0CH",
"eZgPmXe88lOq2372rT3EIvOwAaEdV7Ul2y3k0u0q/nkNmdJuE3T9cUxDyUUk2vDnnL6kv9Ic5XqY5/I4",
"zty+JsgOc6HbxMiZgY/pVkfbFW6Y8w2ruDF0VI8OyNLJ1I9szrMb2l/x/Um0ew25tbNv8RF6DEcsEx3/",
"7A1V8k+irMtk+s35+Tl99Mv/+6DGxUdIxruvmB6Qjf9Qod/jTiN7oT0LTtr35+fPv34nmfyyp7dAPsBt",
"klYuoea+BeTP4p4KGU2MNZ9TTNl8o8PR0hFrJqRV5FoEL1XYouuB++c7RyNDLm3c615wY08XSq+59umW",
"9tlsBdkN2kyrmLC+GVV3zG3MzlKyjuubdgn+NPKEvfVHcYUrzOOld7CoDa5hhd5S+6X4cE69zYRFnHs6",
"aRk3xU8bj7tDbnvTeF93fH4WgPr0CtRkpj2CvQKpwNgdCHZKsRVtUgCrilvXzrFhmZKLQmTWnQvSsARJ",
"OJJL5n9C7tLXE3bd+f6IJ6ebL6c41YSMVshYrf0nvlbUtCLhMYB9If8N68eAdUiI7qyNX4eHnmJH7vP+",
"sDJ5TzPCkrYcqa9nf96XCpb9hYylrFBbDW2TuNs1n/zpl3viZQGXvO3WBB4/T9z/9tET188PUeBOVe2f",
"Q1frzhn4aFzxG3lPEaisVJH7I+gIjdHtIldg5ImNJluaE/jHbAYNc4w1hPr74YD65J82TXB3938BAAD/",
"/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()
}