Files
query-orchestration/api/queryAPI/api.gen.go
T
Michael McGuinness 76e4f5790f Merged in feature/health (pull request #163)
Health Endpoint

* health
2025-06-09 23:30:06 +00:00

1006 lines
36 KiB
Go

// Package queryapi provides primitives to interact with the openapi HTTP API.
//
// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version 2.4.1 DO NOT EDIT.
package queryapi
import (
"bytes"
"compress/gzip"
"encoding/base64"
"fmt"
"net/http"
"net/url"
"path"
"strings"
"time"
"github.com/getkin/kin-openapi/openapi3"
"github.com/labstack/echo/v4"
"github.com/oapi-codegen/runtime"
openapi_types "github.com/oapi-codegen/runtime/types"
)
const (
CognitoAuthScopes = "cognitoAuth.Scopes"
JwtAuthScopes = "jwtAuth.Scopes"
)
// Defines values for ClientStatus.
const (
INSYNC ClientStatus = "IN_SYNC"
NOTSYNCED ClientStatus = "NOT_SYNCED"
NOTSYNCING ClientStatus = "NOT_SYNCING"
)
// Defines values for ExportStatus.
const (
Completed ExportStatus = "completed"
Failed ExportStatus = "failed"
InProgress ExportStatus = "in_progress"
)
// Defines values for FieldFilterCondition.
const (
ClosedInterval FieldFilterCondition = "closed_interval"
Exclude FieldFilterCondition = "exclude"
GreaterThan FieldFilterCondition = "greater_than"
Include FieldFilterCondition = "include"
LeftClosedInterval FieldFilterCondition = "left_closed_interval"
LessThan FieldFilterCondition = "less_than"
OpenInterval FieldFilterCondition = "open_interval"
RightClosedInterval FieldFilterCondition = "right_closed_interval"
)
// Defines values for QueryType.
const (
CONTEXTFULL QueryType = "CONTEXT_FULL"
JSONEXTRACTOR QueryType = "JSON_EXTRACTOR"
)
// ClientCanSync If the client is allowing active syncs
type ClientCanSync = bool
// ClientCreate The properties for creation.
type ClientCreate struct {
// Id The client external id
Id ClientID `json:"id"`
// Name The client name
Name ClientName `json:"name"`
}
// ClientID The client external id
type ClientID = string
// ClientIDBody The client id.
type ClientIDBody struct {
// Id The client external id
Id ClientID `json:"id"`
}
// ClientName The client name
type ClientName = string
// ClientStatus Specifies the status of a client.
type ClientStatus string
// ClientStatusBody A client status information object.
type ClientStatusBody struct {
// Status Specifies the status of a client.
Status ClientStatus `json:"status"`
}
// ClientUpdate The properties that may be updated.
type ClientUpdate struct {
// CanSync If the client is allowing active syncs
CanSync *ClientCanSync `json:"can_sync,omitempty"`
// Name The client name
Name *ClientName `json:"name,omitempty"`
}
// CodeVersion The desired code version.
type CodeVersion = int64
// Collector Collector model.
type Collector struct {
// ActiveVersion The desired version.
ActiveVersion Version `json:"active_version"`
// ClientId The client external id
ClientId ClientID `json:"client_id"`
// Fields The fields in the collector.
Fields CollectorFields `json:"fields"`
// LatestVersion The desired version.
LatestVersion Version `json:"latest_version"`
// MinimumCleanerVersion The desired code version.
MinimumCleanerVersion CodeVersion `json:"minimum_cleaner_version"`
// MinimumTextVersion The desired code version.
MinimumTextVersion CodeVersion `json:"minimum_text_version"`
}
// CollectorField The field properties for the collector.
type CollectorField struct {
// Name The output field name.
Name CollectorFieldName `json:"name"`
// QueryId The query id.
QueryId QueryID `json:"query_id"`
}
// CollectorFieldName The output field name.
type CollectorFieldName = string
// CollectorFields The fields in the collector.
type CollectorFields = []CollectorField
// CollectorSet Payload for updating a Collector.
type CollectorSet struct {
// ActiveVersion The desired version.
ActiveVersion *Version `json:"active_version,omitempty"`
// Fields The fields in the collector.
Fields *CollectorFields `json:"fields,omitempty"`
// MinimumCleanerVersion The desired code version.
MinimumCleanerVersion *CodeVersion `json:"minimum_cleaner_version,omitempty"`
// MinimumTextVersion The desired code version.
MinimumTextVersion *CodeVersion `json:"minimum_text_version,omitempty"`
}
// DocClient The properties of a client.
type DocClient struct {
// CanSync If the client is allowing active syncs
CanSync ClientCanSync `json:"can_sync"`
// Id The client external id
Id ClientID `json:"id"`
// Name The client name
Name ClientName `json:"name"`
}
// Document The document properties.
type Document struct {
// ClientId The client external id
ClientId ClientID `json:"client_id"`
// Fields The fields and the value for the document
Fields map[string]interface{} `json:"fields"`
// Hash The document hash
Hash Hash `json:"hash"`
// Id The document id.
Id DocumentID `json:"id"`
}
// DocumentID The document id.
type DocumentID = openapi_types.UUID
// DocumentSummary The document summary properties.
type DocumentSummary struct {
// Hash The document hash
Hash Hash `json:"hash"`
// Id The document id.
Id DocumentID `json:"id"`
}
// ErrorMessage Description of error
type ErrorMessage struct {
// Message Message describing the cause.
Message string `json:"message"`
}
// ExportDetails Payload for export trigger response.
type ExportDetails struct {
// ClientId The client external id
ClientId ClientID `json:"client_id"`
// OutputLocation The location in which the export zip file will be found.
OutputLocation *string `json:"output_location,omitempty"`
// Status The possible export states.
Status ExportStatus `json:"status"`
}
// ExportID The export id.
type ExportID = openapi_types.UUID
// ExportStatus The possible export states.
type ExportStatus string
// ExportTrigger Payload for triggering an export.
type ExportTrigger struct {
// FieldFilters Filter the scope based on field output values.
FieldFilters *[]FieldFilter `json:"field_filters,omitempty"`
// IngestionFilters Filter the scope based on ingestion parameters.
IngestionFilters *struct {
// EndDate The last date of ingestion.
EndDate *time.Time `json:"end_date,omitempty"`
// StartDate This first date of ingestion.
StartDate *time.Time `json:"start_date,omitempty"`
} `json:"ingestion_filters,omitempty"`
}
// FieldFilter Filtering a column
type FieldFilter struct {
// Condition The possible field filtering conditions.
Condition FieldFilterCondition `json:"condition"`
// FieldName The output field name.
FieldName CollectorFieldName `json:"field_name"`
// Values The values useful to the filter.
Values []string `json:"values"`
}
// FieldFilterCondition The possible field filtering conditions.
type FieldFilterCondition string
// Hash The document hash
type Hash = string
// IdMessage A single uuid.
type IdMessage struct {
// Id Unique identifier for entity.
Id openapi_types.UUID `json:"id"`
}
// ListDocuments The documents in the client.
type ListDocuments = []DocumentSummary
// ListQueries A set of queries.
type ListQueries struct {
// Queries List of queries.
Queries []Query `json:"queries"`
}
// Query A logic unit of execution.
type Query struct {
// ActiveVersion The desired version.
ActiveVersion Version `json:"active_version"`
// Config Configuration for the query.
Config *QueryConfig `json:"config,omitempty"`
// Id The query id.
Id QueryID `json:"id"`
// LatestVersion The desired version.
LatestVersion Version `json:"latest_version"`
// RequiredQueries List of required query IDs.
RequiredQueries *RequiredQueryIDs `json:"required_queries,omitempty"`
// Type Specifies the type of the query.
Type QueryType `json:"type"`
}
// QueryConfig Configuration for the query.
type QueryConfig = string
// QueryCreate The parameters required to create a query.
type QueryCreate struct {
// Config Configuration for the query.
Config *QueryConfig `json:"config,omitempty"`
// RequiredQueries List of required query IDs.
RequiredQueries *RequiredQueryIDs `json:"required_queries,omitempty"`
// Type Specifies the type of the query.
Type QueryType `json:"type"`
}
// QueryID The query id.
type QueryID = openapi_types.UUID
// QueryTestRequest The properties for a query test request.
type QueryTestRequest struct {
// DocumentId The document id.
DocumentId DocumentID `json:"document_id"`
// QueryVersion The desired version.
QueryVersion Version `json:"query_version"`
}
// QueryTestResponse The response from a query test.
type QueryTestResponse struct {
// Value Result of the query test.
Value string `json:"value"`
}
// QueryType Specifies the type of the query.
type QueryType string
// QueryUpdate The properties that may be updated for a query.
type QueryUpdate struct {
// ActiveVersion The desired version.
ActiveVersion *Version `json:"active_version,omitempty"`
// Config Configuration for the query.
Config *QueryConfig `json:"config,omitempty"`
// RequiredQueries List of required query IDs.
RequiredQueries *RequiredQueryIDs `json:"required_queries,omitempty"`
}
// RequiredQueryIDs List of required query IDs.
type RequiredQueryIDs = []QueryID
// Version The desired version.
type Version = int32
// InternalError Description of error
type InternalError = ErrorMessage
// InvalidRequest Description of error
type InvalidRequest = ErrorMessage
// TooManyRequests Description of error
type TooManyRequests = ErrorMessage
// Unauthorized Description of error
type Unauthorized = ErrorMessage
// UploadDocumentMultipartBody defines parameters for UploadDocument.
type UploadDocumentMultipartBody struct {
// File The file to upload
File openapi_types.File `json:"file"`
// Filename Optional custom filename
Filename *string `json:"filename,omitempty"`
}
// LoginCallbackParams defines parameters for LoginCallback.
type LoginCallbackParams struct {
// Code Authorization code from Cognito
Code string `form:"code" json:"code"`
// State State parameter for CSRF protection
State string `form:"state" json:"state"`
}
// CreateClientJSONRequestBody defines body for CreateClient for application/json ContentType.
type CreateClientJSONRequestBody = ClientCreate
// UpdateClientJSONRequestBody defines body for UpdateClient for application/json ContentType.
type UpdateClientJSONRequestBody = ClientUpdate
// SetCollectorByClientIdJSONRequestBody defines body for SetCollectorByClientId for application/json ContentType.
type SetCollectorByClientIdJSONRequestBody = CollectorSet
// UploadDocumentMultipartRequestBody defines body for UploadDocument for multipart/form-data ContentType.
type UploadDocumentMultipartRequestBody UploadDocumentMultipartBody
// TriggerExportJSONRequestBody defines body for TriggerExport for application/json ContentType.
type TriggerExportJSONRequestBody = ExportTrigger
// CreateQueryJSONRequestBody defines body for CreateQuery for application/json ContentType.
type CreateQueryJSONRequestBody = QueryCreate
// UpdateQueryJSONRequestBody defines body for UpdateQuery for application/json ContentType.
type UpdateQueryJSONRequestBody = QueryUpdate
// TestQueryJSONRequestBody defines body for TestQuery for application/json ContentType.
type TestQueryJSONRequestBody = QueryTestRequest
// ServerInterface represents all server handlers.
type ServerInterface interface {
// Create a new client
// (POST /client)
CreateClient(ctx echo.Context) error
// Get a client by ID
// (GET /client/{id})
GetClient(ctx echo.Context, id ClientID) error
// Update a client
// (PATCH /client/{id})
UpdateClient(ctx echo.Context, id ClientID) error
// Get a collector by client ID
// (GET /client/{id}/collector)
GetCollectorByClientId(ctx echo.Context, id ClientID) error
// Set a collector
// (PATCH /client/{id}/collector)
SetCollectorByClientId(ctx echo.Context, id ClientID) error
// List the documents for a client
// (GET /client/{id}/document)
ListDocumentsByClientId(ctx echo.Context, id ClientID) error
// Upload a file
// (POST /client/{id}/document)
UploadDocument(ctx echo.Context, id ClientID) error
// Trigger an export
// (POST /client/{id}/export)
TriggerExport(ctx echo.Context, id ClientID) error
// Get client sync status
// (GET /client/{id}/status)
GetStatusByClientId(ctx echo.Context, id ClientID) error
// Get document details by its id
// (GET /document/{id})
GetDocument(ctx echo.Context, id DocumentID) error
// Check export state.
// (GET /export/{id})
ExportState(ctx echo.Context, id ExportID) error
// Provide health endpoint
// (GET /health)
IsHealthy(ctx echo.Context) error
// Get the home page menu
// (GET /home)
GetHomePage(ctx echo.Context) error
// Login to the application
// (GET /login)
Login(ctx echo.Context) error
// OAuth2 callback endpoint
// (GET /login-callback)
LoginCallback(ctx echo.Context, params LoginCallbackParams) error
// Logout from the application
// (GET /logout)
Logout(ctx echo.Context) error
// List queries
// (GET /query)
ListQueries(ctx echo.Context) error
// Create a new query
// (POST /query)
CreateQuery(ctx echo.Context) error
// Get a query by ID
// (GET /query/{id})
GetQuery(ctx echo.Context, id QueryID) error
// Update a query
// (PATCH /query/{id})
UpdateQuery(ctx echo.Context, id QueryID) error
// Test a query
// (POST /query/{id}/test)
TestQuery(ctx echo.Context, id QueryID) error
}
// ServerInterfaceWrapper converts echo contexts to parameters.
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
// CreateClient converts echo context to params.
func (w *ServerInterfaceWrapper) CreateClient(ctx echo.Context) error {
var err error
ctx.Set(JwtAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.CreateClient(ctx)
return err
}
// GetClient converts echo context to params.
func (w *ServerInterfaceWrapper) GetClient(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id ClientID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(JwtAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.GetClient(ctx, id)
return err
}
// UpdateClient converts echo context to params.
func (w *ServerInterfaceWrapper) UpdateClient(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id ClientID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(JwtAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.UpdateClient(ctx, id)
return err
}
// GetCollectorByClientId converts echo context to params.
func (w *ServerInterfaceWrapper) GetCollectorByClientId(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id ClientID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(JwtAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.GetCollectorByClientId(ctx, id)
return err
}
// SetCollectorByClientId converts echo context to params.
func (w *ServerInterfaceWrapper) SetCollectorByClientId(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id ClientID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(JwtAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.SetCollectorByClientId(ctx, id)
return err
}
// ListDocumentsByClientId converts echo context to params.
func (w *ServerInterfaceWrapper) ListDocumentsByClientId(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id ClientID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(JwtAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.ListDocumentsByClientId(ctx, id)
return err
}
// UploadDocument converts echo context to params.
func (w *ServerInterfaceWrapper) UploadDocument(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id ClientID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(JwtAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.UploadDocument(ctx, id)
return err
}
// TriggerExport converts echo context to params.
func (w *ServerInterfaceWrapper) TriggerExport(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id ClientID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(JwtAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.TriggerExport(ctx, id)
return err
}
// GetStatusByClientId converts echo context to params.
func (w *ServerInterfaceWrapper) GetStatusByClientId(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id ClientID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(JwtAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.GetStatusByClientId(ctx, id)
return err
}
// GetDocument converts echo context to params.
func (w *ServerInterfaceWrapper) GetDocument(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id DocumentID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(JwtAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.GetDocument(ctx, id)
return err
}
// ExportState converts echo context to params.
func (w *ServerInterfaceWrapper) ExportState(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id ExportID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(JwtAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.ExportState(ctx, id)
return err
}
// IsHealthy converts echo context to params.
func (w *ServerInterfaceWrapper) IsHealthy(ctx echo.Context) error {
var err error
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.IsHealthy(ctx)
return err
}
// GetHomePage converts echo context to params.
func (w *ServerInterfaceWrapper) GetHomePage(ctx echo.Context) error {
var err error
ctx.Set(JwtAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.GetHomePage(ctx)
return err
}
// Login converts echo context to params.
func (w *ServerInterfaceWrapper) Login(ctx echo.Context) error {
var err error
ctx.Set(CognitoAuthScopes, []string{"openid", "email", "profile"})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.Login(ctx)
return err
}
// LoginCallback converts echo context to params.
func (w *ServerInterfaceWrapper) LoginCallback(ctx echo.Context) error {
var err error
// Parameter object where we will unmarshal all parameters from the context
var params LoginCallbackParams
// ------------- Required query parameter "code" -------------
err = runtime.BindQueryParameter("form", true, true, "code", ctx.QueryParams(), &params.Code)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter code: %s", err))
}
// ------------- Required query parameter "state" -------------
err = runtime.BindQueryParameter("form", true, true, "state", ctx.QueryParams(), &params.State)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter state: %s", err))
}
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.LoginCallback(ctx, params)
return err
}
// Logout converts echo context to params.
func (w *ServerInterfaceWrapper) Logout(ctx echo.Context) error {
var err error
ctx.Set(JwtAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.Logout(ctx)
return err
}
// ListQueries converts echo context to params.
func (w *ServerInterfaceWrapper) ListQueries(ctx echo.Context) error {
var err error
ctx.Set(JwtAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.ListQueries(ctx)
return err
}
// CreateQuery converts echo context to params.
func (w *ServerInterfaceWrapper) CreateQuery(ctx echo.Context) error {
var err error
ctx.Set(JwtAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.CreateQuery(ctx)
return err
}
// GetQuery converts echo context to params.
func (w *ServerInterfaceWrapper) GetQuery(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id QueryID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(JwtAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.GetQuery(ctx, id)
return err
}
// UpdateQuery converts echo context to params.
func (w *ServerInterfaceWrapper) UpdateQuery(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id QueryID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(JwtAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.UpdateQuery(ctx, id)
return err
}
// TestQuery converts echo context to params.
func (w *ServerInterfaceWrapper) TestQuery(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id QueryID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(JwtAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.TestQuery(ctx, id)
return err
}
// This is a simple interface which specifies echo.Route addition functions which
// are present on both echo.Echo and echo.Group, since we want to allow using
// either of them for path registration
type EchoRouter interface {
CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}
// RegisterHandlers adds each server route to the EchoRouter.
func RegisterHandlers(router EchoRouter, si ServerInterface) {
RegisterHandlersWithBaseURL(router, si, "")
}
// Registers handlers, and prepends BaseURL to the paths, so that the paths
// can be served under a prefix.
func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {
wrapper := ServerInterfaceWrapper{
Handler: si,
}
router.POST(baseURL+"/client", wrapper.CreateClient)
router.GET(baseURL+"/client/:id", wrapper.GetClient)
router.PATCH(baseURL+"/client/:id", wrapper.UpdateClient)
router.GET(baseURL+"/client/:id/collector", wrapper.GetCollectorByClientId)
router.PATCH(baseURL+"/client/:id/collector", wrapper.SetCollectorByClientId)
router.GET(baseURL+"/client/:id/document", wrapper.ListDocumentsByClientId)
router.POST(baseURL+"/client/:id/document", wrapper.UploadDocument)
router.POST(baseURL+"/client/:id/export", wrapper.TriggerExport)
router.GET(baseURL+"/client/:id/status", wrapper.GetStatusByClientId)
router.GET(baseURL+"/document/:id", wrapper.GetDocument)
router.GET(baseURL+"/export/:id", wrapper.ExportState)
router.GET(baseURL+"/health", wrapper.IsHealthy)
router.GET(baseURL+"/home", wrapper.GetHomePage)
router.GET(baseURL+"/login", wrapper.Login)
router.GET(baseURL+"/login-callback", wrapper.LoginCallback)
router.GET(baseURL+"/logout", wrapper.Logout)
router.GET(baseURL+"/query", wrapper.ListQueries)
router.POST(baseURL+"/query", wrapper.CreateQuery)
router.GET(baseURL+"/query/:id", wrapper.GetQuery)
router.PATCH(baseURL+"/query/:id", wrapper.UpdateQuery)
router.POST(baseURL+"/query/:id/test", wrapper.TestQuery)
}
// Base64 encoded, gzipped, json marshaled Swagger object
var swaggerSpec = []string{
"H4sIAAAAAAAC/+xceW8juXL/KkTnAQF2dUs+gyDxs2d2tJhrbU/eS8aOQXWXJO52kxqSbY9m4O8e8OqT",
"rcMjexeIAP9hdfMoFn/1Y7FY7O9ByJIFo0ClCE6/B3PAEXD97yWW8JYkRKofEYiQk4UkjAan+hWK1TtE",
"6JTxBKsXiFBkfqCbQL/9twdCI/bw75Ik0Db/3wRBK4CvOFnEEJwG/V7PFer3glYgwjkkWPXoLXOoyiT4",
"61ugMzkPToeDVrDAUgJXYv3v51775PZnV9j8+lvQCuRyoRoSkhM6Cx4fH1UtjhOQdqznMQEqxxf1oV7P",
"AYX6LRpfdIJWQNTTBZbzoBVQnKh2SRS0Ag5fUsIhCk4lT6E4kr9xmAanwb90c1V3zVvR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x5cN56dxll1BPu9",
"8Q6zHb5k8+uwpu9wlCIrG9zAMLfGtr6A8Zt1D57jgLF4X/gp1y++FGT7Cxw2mqs1+5sXL3Tzws1+g1Vk",
"FPyEaxfGVlbfusgN45lI137roQln+9OYZ8j9zSa+lPBb59utItnZ7dvtLlsUCHuDuxbPztOrb1qYuxHu",
"Q0TZdyXtheHs/vYT0qAM2vd3L17g7sVWjNqV9nsRP2AMXrfllf7WjCZk84WJlJrz8iYPpvzhs0qeFAj5",
"7KZR/IBGg31UvpixTapU7zmEtR+58ElrZBRpvE9a3lWClFLpevPS7fF7f+TxI2dRGmbXwfU99tRziz9k",
"Sfe+r83L9lNPnLUGorzqWLOqcqp1covIA4HlbJl6iLGhGXctoNhS9arApo1lOd55W7VciE3byndRtqWS",
"9jdtxRx2F1opn3Jv2kz5wwZ5a8UgwqZt2YPxrI3yyenj7eP/BQAA///MtX56kW0AAA==",
}
// GetSwagger returns the content of the embedded swagger specification file
// or error if failed to decode
func decodeSpec() ([]byte, error) {
zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, ""))
if err != nil {
return nil, fmt.Errorf("error base64 decoding spec: %w", err)
}
zr, err := gzip.NewReader(bytes.NewReader(zipped))
if err != nil {
return nil, fmt.Errorf("error decompressing spec: %w", err)
}
var buf bytes.Buffer
_, err = buf.ReadFrom(zr)
if err != nil {
return nil, fmt.Errorf("error decompressing spec: %w", err)
}
return buf.Bytes(), nil
}
var rawSpec = decodeSpecCached()
// a naive cached of a decoded swagger 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
}
// GetSwagger returns the Swagger specification corresponding to the generated code
// in this file. The external references of Swagger specification are resolved.
// The logic of resolving external references is tightly connected to "import-mapping" feature.
// Externally referenced files must be embedded in the corresponding golang packages.
// Urls can be supported but this task was out of the scope.
func GetSwagger() (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
}