// 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 // 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 } // 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(), ¶ms.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(), ¶ms.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+"/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/eS8aOQHWXJO52kxqSbVsz8HcPePXd", "uix5F4gA/2F18ygWq34sFn/sH57PojmjQKXwzn94M8ABcP3vNZbwnkREqh8BCJ+TuSSMeuf6FQrVO0To", "hPEIqxeIUGR+oDtPv/23R0ID9vjvkkTQNP/feV7DgycczUPwzr1up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+c/cqVzKSwvxV0OwHCPSdf58TCZzg6sNvdzl1zwferpuKncZFcQSH7fUO", "j7q/JfPrbE0T+HPb6jXo9+bK0Mbs+99seLCP06XsZdFtuPffMrL9BU6azL2KA+3+lWj3bvZrvCKB4C04", "98ZXllPuU8fYE+jai/51dnZIxe+B+JlMfI7tWcbbjdKYydXLzZj2GcBeg2i/d5xeTrM3xHj3FZrko4L2", "tmhyeXcLDoyx9gPx/hWI9xshalvajwW8wBkqw5Y3+kMjGpDN5wViag5L6yKY/FevCiQZEHLvrpH9ekKN", "fxQ+l7AJT6azD2HtFw6qpDUyijg8MFZ3xY5RKl3tXro9/lCdefzMWRD7yV1gfYk5rrjC7bOo/dDV7mX7", "KbMmrYOoqDrUqKqCas1sEGkiME+VKKcYa5pxnPBsS0We+LqNJQTftK3SQfi6baW7KNtSTvvrtmJOOjOt", "5I84120mf6s9bS2bRHi+f/6/AAAA//+RS2POSGsAAA==", } // 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 }