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

795 lines
29 KiB
Go
Raw Normal View History

2025-01-15 19:45:51 +00:00
// Package queryservice 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 queryservice
import (
"bytes"
"compress/gzip"
"encoding/base64"
"fmt"
"net/http"
"net/url"
"path"
"strings"
"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
)
// 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 JobStatus.
const (
INSYNC JobStatus = "IN_SYNC"
NOTSYNCED JobStatus = "NOT_SYNCED"
)
2025-01-15 19:45:51 +00:00
// Defines values for QueryType.
const (
CONTEXTFULL QueryType = "CONTEXT_FULL"
JSONEXTRACTOR QueryType = "JSON_EXTRACTOR"
)
2025-01-21 18:24:14 +00:00
// ClientCreate defines model for ClientCreate.
type ClientCreate struct {
// Name The client name
Name string `json:"name"`
}
// ClientUpdate defines model for ClientUpdate.
type ClientUpdate struct {
// CanSync If the client is allowing active syncs
CanSync *bool `json:"can_sync,omitempty"`
// Name The client name
Name *string `json:"name,omitempty"`
}
// Document defines model for Document.
type Document struct {
// Bucket The bucket containing the document
Bucket string `json:"bucket"`
// Id The document id
Id openapi_types.UUID `json:"id"`
// Key The path to the document
Key string `json:"key"`
}
// ExportDetails Payload for export trigger response.
type ExportDetails struct {
// JobId The job id relative to the export.
JobId openapi_types.UUID `json:"job_id"`
// OutputLocation The location in which the export zip file will be found.
OutputLocation *string `json:"output_location,omitempty"`
// Status The possible export job states.
Status ExportStatus `json:"status"`
}
// ExportStatus The possible export job 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 *string `json:"end_date,omitempty"`
// StartDate This first date of ingestion.
StartDate *string `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 name of the field in question.
FieldName string `json:"field_name"`
// Values The values useful to the filter.
Values []string `json:"values"`
}
// FieldFilterCondition The possible field filtering conditions.
type FieldFilterCondition string
2025-01-15 19:45:51 +00:00
// IdMessage defines model for IdMessage.
type IdMessage struct {
// Id Unique identifier for entity.
Id openapi_types.UUID `json:"id"`
}
// Job defines model for Job.
type Job struct {
// CanSync Specifies whether the job is actively syncing
CanSync bool `json:"can_sync"`
// ClientId The client id the job belongs to
ClientId openapi_types.UUID `json:"client_id"`
// Id The job id
Id openapi_types.UUID `json:"id"`
2025-01-15 19:45:51 +00:00
}
2025-01-21 18:24:14 +00:00
// JobClient defines model for JobClient.
type JobClient struct {
// CanSync If the client is allowing active syncs
CanSync bool `json:"can_sync"`
// Id The client id
Id openapi_types.UUID `json:"id"`
2025-01-21 18:24:14 +00:00
// Name The client name
Name string `json:"name"`
}
2025-01-15 19:45:51 +00:00
// JobCollector JobCollector model.
type JobCollector struct {
// ActiveVersion The active version of the collector.
ActiveVersion int32 `json:"active_version"`
// Fields The fields in the job collector.
Fields []JobCollectorField `json:"fields"`
// JobId The ID of the associated job.
JobId openapi_types.UUID `json:"job_id"`
// LatestVersion The latest version of the collector.
LatestVersion int32 `json:"latest_version"`
// MinimumCleanerVersion The minimum version for the document cleaner.
MinimumCleanerVersion int32 `json:"minimum_cleaner_version"`
// MinimumTextVersion The minimum version for the text parser.
MinimumTextVersion int32 `json:"minimum_text_version"`
2025-01-15 19:45:51 +00:00
}
// JobCollectorField The field properties for the job collector.
type JobCollectorField struct {
// Name The output field name.
Name string `json:"name"`
// QueryId The query id that will populate the result.
QueryId openapi_types.UUID `json:"query_id"`
2025-01-15 19:45:51 +00:00
}
// JobCollectorUpdate Payload for updating a JobCollector.
type JobCollectorUpdate struct {
// ActiveVersion The active version of the collector.
ActiveVersion *int32 `json:"active_version,omitempty"`
// Fields The fields in the job collector.
Fields *[]JobCollectorField `json:"fields,omitempty"`
// MinimumCleanerVersion The minimum version for the document cleaner.
MinimumCleanerVersion *int32 `json:"minimum_cleaner_version,omitempty"`
// MinimumTextVersion The minimum version for the text parser.
MinimumTextVersion *int32 `json:"minimum_text_version,omitempty"`
2025-01-15 19:45:51 +00:00
}
// JobCreate defines model for JobCreate.
type JobCreate struct {
// ClientId The client id the job belongs to
ClientId openapi_types.UUID `json:"client_id"`
}
// JobStatus Specifies the status of a job.
type JobStatus string
// JobStatusBody defines model for JobStatusBody.
type JobStatusBody struct {
// JobId The job id
JobId openapi_types.UUID `json:"job_id"`
// Status Specifies the status of a job.
Status JobStatus `json:"status"`
}
// JobUpdate defines model for JobUpdate.
type JobUpdate struct {
// CanSync Specifies whether the job is actively syncing
CanSync *bool `json:"can_sync,omitempty"`
}
// ListDocuments The documents in the job.
type ListDocuments = []Document
2025-01-15 19:45:51 +00:00
// ListQueries defines model for ListQueries.
type ListQueries struct {
// Queries List of queries.
Queries []Query `json:"queries"`
}
// Query defines model for Query.
type Query struct {
// ActiveVersion The active version of the query.
ActiveVersion int32 `json:"active_version"`
// Config Configuration for the query.
Config *string `json:"config,omitempty"`
// Id Unique identifier for the query.
Id openapi_types.UUID `json:"id"`
2025-01-15 19:45:51 +00:00
// LatestVersion The latest version of the query.
LatestVersion int32 `json:"latest_version"`
// RequiredQueries List of required query IDs.
RequiredQueries *[]openapi_types.UUID `json:"required_queries,omitempty"`
2025-01-15 19:45:51 +00:00
// Type Specifies the type of the query.
Type QueryType `json:"type"`
}
// QueryCreate defines model for QueryCreate.
type QueryCreate struct {
// Config Configuration for the new query.
Config *string `json:"config,omitempty"`
// RequiredQueries List of required query IDs.
RequiredQueries *[]openapi_types.UUID `json:"required_queries,omitempty"`
2025-01-15 19:45:51 +00:00
// Type Specifies the type of the query.
Type QueryType `json:"type"`
}
// QueryTestRequest defines model for QueryTestRequest.
type QueryTestRequest struct {
// DocumentId ID of the document to test against.
DocumentId openapi_types.UUID `json:"document_id"`
2025-01-15 19:45:51 +00:00
// QueryVersion Version of the query to use for testing.
QueryVersion int32 `json:"query_version"`
}
// QueryTestResponse defines model for QueryTestResponse.
type QueryTestResponse struct {
// Value Result of the query test.
Value string `json:"value"`
}
// QueryType Specifies the type of the query.
type QueryType string
// QueryUpdate defines model for QueryUpdate.
type QueryUpdate struct {
// ActiveVersion Updated active version.
ActiveVersion *int32 `json:"active_version,omitempty"`
// Config Updated configuration for the query.
Config *string `json:"config,omitempty"`
// RequiredQueries Updated list of required query IDs.
RequiredQueries *[]openapi_types.UUID `json:"required_queries,omitempty"`
2025-01-15 19:45:51 +00:00
}
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
// CreateJobJSONRequestBody defines body for CreateJob for application/json ContentType.
type CreateJobJSONRequestBody = JobCreate
// UpdateJobJSONRequestBody defines body for UpdateJob for application/json ContentType.
type UpdateJobJSONRequestBody = JobUpdate
// UpdateJobCollectorByJobIdJSONRequestBody defines body for UpdateJobCollectorByJobId for application/json ContentType.
type UpdateJobCollectorByJobIdJSONRequestBody = JobCollectorUpdate
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 openapi_types.UUID) error
2025-01-21 18:24:14 +00:00
// Update a client
// (PATCH /client/{id})
UpdateClient(ctx echo.Context, id openapi_types.UUID) error
// Create a new job
// (POST /job)
CreateJob(ctx echo.Context) error
// Get a job by ID
// (GET /job/{id})
GetJob(ctx echo.Context, id openapi_types.UUID) error
// Update a job
// (PATCH /job/{id})
UpdateJob(ctx echo.Context, id openapi_types.UUID) error
2025-01-15 19:45:51 +00:00
// Get a job collector by ID
// (GET /job/{id}/collector)
GetJobCollectorByJobId(ctx echo.Context, id openapi_types.UUID) error
2025-01-15 19:45:51 +00:00
// Update a job collector
// (PATCH /job/{id}/collector)
UpdateJobCollectorByJobId(ctx echo.Context, id openapi_types.UUID) error
// List the documents for a job
// (GET /job/{id}/documents)
ListDocumentsByJobId(ctx echo.Context, id openapi_types.UUID) error
// Check export state.
// (GET /job/{id}/export)
ExportState(ctx echo.Context, id openapi_types.UUID) error
2025-03-05 19:37:06 +00:00
// Trigger an export
// (POST /job/{id}/export)
TriggerExport(ctx echo.Context, id openapi_types.UUID) error
// Get job status by job ID
// (GET /job/{id}/status)
GetJobStatusByJobId(ctx echo.Context, id openapi_types.UUID) 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 openapi_types.UUID) error
2025-01-15 19:45:51 +00:00
// Update a query
// (PATCH /query/{id})
UpdateQuery(ctx echo.Context, id openapi_types.UUID) error
2025-01-15 19:45:51 +00:00
// Test a query
// (POST /query/{id}/test)
TestQuery(ctx echo.Context, id openapi_types.UUID) 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
// 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 openapi_types.UUID
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))
}
// 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 openapi_types.UUID
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))
}
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.UpdateClient(ctx, id)
return err
}
// CreateJob converts echo context to params.
func (w *ServerInterfaceWrapper) CreateJob(ctx echo.Context) error {
var err error
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.CreateJob(ctx)
return err
}
// GetJob converts echo context to params.
func (w *ServerInterfaceWrapper) GetJob(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id openapi_types.UUID
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))
}
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.GetJob(ctx, id)
return err
}
// UpdateJob converts echo context to params.
func (w *ServerInterfaceWrapper) UpdateJob(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id openapi_types.UUID
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))
}
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.UpdateJob(ctx, id)
return err
}
// GetJobCollectorByJobId converts echo context to params.
func (w *ServerInterfaceWrapper) GetJobCollectorByJobId(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id openapi_types.UUID
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))
}
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.GetJobCollectorByJobId(ctx, id)
return err
}
// UpdateJobCollectorByJobId converts echo context to params.
func (w *ServerInterfaceWrapper) UpdateJobCollectorByJobId(ctx echo.Context) error {
2025-01-15 19:45:51 +00:00
var err error
// ------------- Path parameter "id" -------------
var id openapi_types.UUID
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))
}
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.UpdateJobCollectorByJobId(ctx, id)
2025-01-15 19:45:51 +00:00
return err
}
// ListDocumentsByJobId converts echo context to params.
func (w *ServerInterfaceWrapper) ListDocumentsByJobId(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id openapi_types.UUID
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))
}
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.ListDocumentsByJobId(ctx, id)
return err
}
// ExportState converts echo context to params.
func (w *ServerInterfaceWrapper) ExportState(ctx echo.Context) error {
2025-01-15 19:45:51 +00:00
var err error
// ------------- Path parameter "id" -------------
var id openapi_types.UUID
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))
}
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.ExportState(ctx, id)
2025-01-15 19:45:51 +00:00
return err
}
2025-03-05 19:37:06 +00:00
// TriggerExport converts echo context to params.
func (w *ServerInterfaceWrapper) TriggerExport(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id openapi_types.UUID
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))
}
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.TriggerExport(ctx, id)
return err
}
// GetJobStatusByJobId converts echo context to params.
func (w *ServerInterfaceWrapper) GetJobStatusByJobId(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id openapi_types.UUID
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))
}
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.GetJobStatusByJobId(ctx, id)
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
// 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
// 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 openapi_types.UUID
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))
}
// 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 openapi_types.UUID
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))
}
// 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 openapi_types.UUID
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))
}
// 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.POST(baseURL+"/job", wrapper.CreateJob)
router.GET(baseURL+"/job/:id", wrapper.GetJob)
router.PATCH(baseURL+"/job/:id", wrapper.UpdateJob)
router.GET(baseURL+"/job/:id/collector", wrapper.GetJobCollectorByJobId)
router.PATCH(baseURL+"/job/:id/collector", wrapper.UpdateJobCollectorByJobId)
router.GET(baseURL+"/job/:id/documents", wrapper.ListDocumentsByJobId)
router.GET(baseURL+"/job/:id/export", wrapper.ExportState)
2025-03-05 19:37:06 +00:00
router.POST(baseURL+"/job/:id/export", wrapper.TriggerExport)
router.GET(baseURL+"/job/:id/status", wrapper.GetJobStatusByJobId)
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-03-05 19:37:06 +00:00
"H4sIAAAAAAAC/+Rb3W/bOBL/VwjdPRp2ut0nv3WTdOGg1/Sa9LCHRWFQ1NhmKpMKSTn1Bv7fF/zQ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r8i6+vAVt/LrQPniHpG0WffsPaNSaQ8sm6nS",
"v/opJ4V/9d21lro97qyDZ+wLG+vW/wNeS4/KrIkqXjq8msAIgvn1dyC5RXPzpELkzD4QbMN1/4/H9opm",
"kGrwMKm/JOkfK+fm715mBHDo3pjRPW9+UaVsnrh0hp3eA2ITDrBPgic5KYf1IKJRlIs0mkYrpTI5nUxw",
"RsfuL0/HhK8nmzeRjhbHbZ/ebeFvaf+KFhKkuJs4ySpa/YnTbtSPzAOPazRqndojCFTlp0+qUdoeQ7Pq",
"KtVJNvoffUlWlZcj5rm0LxV7e6pR8W9Pu6+7PwMAAP//WyCUh9g/AAA=",
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
}