Files
query-orchestration/api/queryAPI/api.gen.go
T

955 lines
34 KiB
Go
Raw Normal View History

// Package queryapi provides primitives to interact with the openapi HTTP API.
2025-01-15 19:45:51 +00:00
//
// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version 2.4.1 DO NOT EDIT.
package queryapi
2025-01-15 19:45:51 +00:00
import (
"bytes"
"compress/gzip"
"encoding/base64"
"fmt"
"net/http"
"net/url"
"path"
"strings"
"time"
2025-01-15 19:45:51 +00:00
"github.com/getkin/kin-openapi/openapi3"
"github.com/labstack/echo/v4"
"github.com/oapi-codegen/runtime"
openapi_types "github.com/oapi-codegen/runtime/types"
2025-01-15 19:45:51 +00:00
)
const (
2025-04-21 15:12:38 -07:00
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"
)
2025-01-15 19:45:51 +00:00
// 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.
2025-01-21 18:24:14 +00:00
type ClientCreate struct {
// Id The client external id
Id ClientID `json:"id"`
2025-01-21 18:24:14 +00:00
// 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"`
2025-01-21 18:24:14 +00:00
}
// 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.
2025-01-21 18:24:14 +00:00
type ClientUpdate struct {
// CanSync If the client is allowing active syncs
CanSync *ClientCanSync `json:"can_sync,omitempty"`
2025-01-21 18:24:14 +00:00
// Name The client name
Name *ClientName `json:"name,omitempty"`
2025-01-21 18:24:14 +00:00
}
// 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
2025-01-15 19:45:51 +00:00
// 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"`
2025-01-15 19:45:51 +00:00
}
// 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.
2025-01-15 19:45:51 +00:00
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.
2025-01-15 19:45:51 +00:00
type ListQueries struct {
// Queries List of queries.
Queries []Query `json:"queries"`
}
// Query A logic unit of execution.
2025-01-15 19:45:51 +00:00
type Query struct {
// ActiveVersion The desired version.
ActiveVersion Version `json:"active_version"`
2025-01-15 19:45:51 +00:00
// Config Configuration for the query.
Config *QueryConfig `json:"config,omitempty"`
2025-01-15 19:45:51 +00:00
// Id The query id.
Id QueryID `json:"id"`
2025-01-15 19:45:51 +00:00
// LatestVersion The desired version.
LatestVersion Version `json:"latest_version"`
2025-01-15 19:45:51 +00:00
// RequiredQueries List of required query IDs.
RequiredQueries *RequiredQueryIDs `json:"required_queries,omitempty"`
2025-01-15 19:45:51 +00:00
// 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.
2025-01-15 19:45:51 +00:00
type QueryCreate struct {
// Config Configuration for the query.
Config *QueryConfig `json:"config,omitempty"`
2025-01-15 19:45:51 +00:00
// RequiredQueries List of required query IDs.
RequiredQueries *RequiredQueryIDs `json:"required_queries,omitempty"`
2025-01-15 19:45:51 +00:00
// 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.
2025-01-15 19:45:51 +00:00
type QueryTestRequest struct {
// DocumentId The document id.
DocumentId DocumentID `json:"document_id"`
2025-01-15 19:45:51 +00:00
// QueryVersion The desired version.
QueryVersion Version `json:"query_version"`
2025-01-15 19:45:51 +00:00
}
// QueryTestResponse The response from a query test.
2025-01-15 19:45:51 +00:00
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.
2025-01-15 19:45:51 +00:00
type QueryUpdate struct {
// ActiveVersion The desired version.
ActiveVersion *Version `json:"active_version,omitempty"`
2025-01-15 19:45:51 +00:00
// Config Configuration for the query.
Config *QueryConfig `json:"config,omitempty"`
2025-01-15 19:45:51 +00:00
// RequiredQueries List of required query IDs.
RequiredQueries *RequiredQueryIDs `json:"required_queries,omitempty"`
2025-01-15 19:45:51 +00:00
}
// 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
2025-04-07 14:10:39 -07:00
// 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"`
}
2025-01-21 18:24:14 +00:00
// 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
2025-01-15 19:45:51 +00:00
2025-03-05 19:37:06 +00:00
// TriggerExportJSONRequestBody defines body for TriggerExport for application/json ContentType.
type TriggerExportJSONRequestBody = ExportTrigger
2025-01-15 19:45:51 +00:00
// 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 {
2025-01-21 18:24:14 +00:00
// Create a new client
// (POST /client)
2025-01-21 18:24:14 +00:00
CreateClient(ctx echo.Context) error
// Get a client by ID
// (GET /client/{id})
GetClient(ctx echo.Context, id ClientID) error
2025-01-21 18:24:14 +00:00
// 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}/documents)
ListDocumentsByClientId(ctx echo.Context, id ClientID) error
2025-03-05 19:37:06 +00:00
// 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
2025-04-07 14:10:39 -07:00
// 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
2025-01-15 19:45:51 +00:00
// List queries
// (GET /query)
2025-01-15 19:45:51 +00:00
ListQueries(ctx echo.Context) error
// Create a new query
// (POST /query)
2025-01-15 19:45:51 +00:00
CreateQuery(ctx echo.Context) error
// Get a query by ID
// (GET /query/{id})
GetQuery(ctx echo.Context, id QueryID) error
2025-01-15 19:45:51 +00:00
// Update a query
// (PATCH /query/{id})
UpdateQuery(ctx echo.Context, id QueryID) error
2025-01-15 19:45:51 +00:00
// Test a query
// (POST /query/{id}/test)
TestQuery(ctx echo.Context, id QueryID) error
2025-01-15 19:45:51 +00:00
}
// ServerInterfaceWrapper converts echo contexts to parameters.
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
2025-01-21 18:24:14 +00:00
// CreateClient converts echo context to params.
func (w *ServerInterfaceWrapper) CreateClient(ctx echo.Context) error {
var err error
2025-04-21 15:12:38 -07:00
ctx.Set(JwtAuthScopes, []string{})
2025-01-21 18:24:14 +00:00
// 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
2025-01-21 18:24:14 +00:00
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))
}
2025-04-21 15:12:38 -07:00
ctx.Set(JwtAuthScopes, []string{})
2025-01-21 18:24:14 +00:00
// 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
2025-01-21 18:24:14 +00:00
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))
}
2025-04-21 15:12:38 -07:00
ctx.Set(JwtAuthScopes, []string{})
2025-01-21 18:24:14 +00:00
// 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))
}
2025-04-21 15:12:38 -07:00
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 {
2025-01-15 19:45:51 +00:00
var err error
// ------------- Path parameter "id" -------------
var id ClientID
2025-01-15 19:45:51 +00:00
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))
}
2025-04-21 15:12:38 -07:00
ctx.Set(JwtAuthScopes, []string{})
2025-01-15 19:45:51 +00:00
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.SetCollectorByClientId(ctx, id)
2025-01-15 19:45:51 +00:00
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))
}
2025-04-21 15:12:38 -07:00
ctx.Set(JwtAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.ListDocumentsByClientId(ctx, id)
return err
}
// TriggerExport converts echo context to params.
func (w *ServerInterfaceWrapper) TriggerExport(ctx echo.Context) error {
2025-01-15 19:45:51 +00:00
var err error
// ------------- Path parameter "id" -------------
var id ClientID
2025-01-15 19:45:51 +00:00
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))
}
2025-04-21 15:12:38 -07:00
ctx.Set(JwtAuthScopes, []string{})
2025-01-15 19:45:51 +00:00
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.TriggerExport(ctx, id)
2025-01-15 19:45:51 +00:00
return err
}
// GetStatusByClientId converts echo context to params.
func (w *ServerInterfaceWrapper) GetStatusByClientId(ctx echo.Context) error {
2025-03-05 19:37:06 +00:00
var err error
// ------------- Path parameter "id" -------------
var id ClientID
2025-03-05 19:37:06 +00:00
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))
}
2025-04-21 15:12:38 -07:00
ctx.Set(JwtAuthScopes, []string{})
2025-03-05 19:37:06 +00:00
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.GetStatusByClientId(ctx, id)
2025-03-05 19:37:06 +00:00
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))
}
2025-04-21 15:12:38 -07:00
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))
}
2025-04-21 15:12:38 -07:00
ctx.Set(JwtAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.ExportState(ctx, id)
return err
}
2025-04-07 14:10:39 -07:00
// GetHomePage converts echo context to params.
func (w *ServerInterfaceWrapper) GetHomePage(ctx echo.Context) error {
var err error
2025-04-21 15:12:38 -07:00
ctx.Set(JwtAuthScopes, []string{})
2025-04-07 14:10:39 -07:00
// 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
2025-04-21 15:12:38 -07:00
ctx.Set(JwtAuthScopes, []string{})
2025-04-07 14:10:39 -07:00
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.Logout(ctx)
return err
}
2025-01-15 19:45:51 +00:00
// ListQueries converts echo context to params.
func (w *ServerInterfaceWrapper) ListQueries(ctx echo.Context) error {
var err error
2025-04-21 15:12:38 -07:00
ctx.Set(JwtAuthScopes, []string{})
2025-01-15 19:45:51 +00:00
// 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
2025-04-21 15:12:38 -07:00
ctx.Set(JwtAuthScopes, []string{})
2025-01-15 19:45:51 +00:00
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.CreateQuery(ctx)
return err
}
2025-01-21 18:24:14 +00:00
// GetQuery converts echo context to params.
func (w *ServerInterfaceWrapper) GetQuery(ctx echo.Context) error {
2025-01-15 19:45:51 +00:00
var err error
// ------------- Path parameter "id" -------------
var id QueryID
2025-01-15 19:45:51 +00:00
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))
}
2025-04-21 15:12:38 -07:00
ctx.Set(JwtAuthScopes, []string{})
2025-01-15 19:45:51 +00:00
// Invoke the callback with all the unmarshaled arguments
2025-01-21 18:24:14 +00:00
err = w.Handler.GetQuery(ctx, id)
2025-01-15 19:45:51 +00:00
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
2025-01-15 19:45:51 +00:00
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))
}
2025-04-21 15:12:38 -07:00
ctx.Set(JwtAuthScopes, []string{})
2025-01-15 19:45:51 +00:00
// 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
2025-01-15 19:45:51 +00:00
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))
}
2025-04-21 15:12:38 -07:00
ctx.Set(JwtAuthScopes, []string{})
2025-01-15 19:45:51 +00:00
// 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/documents", wrapper.ListDocumentsByClientId)
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)
2025-04-07 14:10:39 -07:00
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)
2025-01-15 19:45:51 +00:00
}
// Base64 encoded, gzipped, json marshaled Swagger object
var swaggerSpec = []string{
2025-04-21 15:12:38 -07:00
"H4sIAAAAAAAC/+xceW8juXL/KkTnAQF2dUs+gyDxs2d2tJhrbU/eS2xHoLpLEne7SZlk29YM/N0DXn23",
"LkveBWLAf1hqNlksVv2qWPxRPzyfRXNGgUrhnf7wZoAD4PrfSyzhI4mIVB8CED4nc0kY9U71IxSqZ4jQ",
"CeMRVg8Qoch8QLeefvpvj4QG7PHfJYmgaf6/9byGB084mofgnXrdTsc16na8hif8GURYjVjZ5lC1ifDT",
"R6BTOfNO+72GN8dSAldi/e9Np3ly97NrbD79zWt4cjFXHQnJCZ16z8/P6i2OI5B2ruchASqHF+WpXs8A",
"+fopGl60vI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oxiT1+cc6gsOtRoqpJozWIQadEvT4so",
"lxNrunFM0GxPRXboup2lnNGkr9Kh97p9pTsm21Oi+XV7MCeamR7yR5nrdpO/x5r2li0WPN89/18AAAD/",
"/1+CAiY6ZwAA",
2025-01-15 19:45:51 +00:00
}
// 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
}