// 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/nullable" "github.com/oapi-codegen/runtime" openapi_types "github.com/oapi-codegen/runtime/types" ) const ( CognitoAuthScopes = "cognitoAuth.Scopes" JwtAuthScopes = "jwtAuth.Scopes" ) // Defines values for BatchStatus. const ( BatchStatusCancelled BatchStatus = "cancelled" BatchStatusCompleted BatchStatus = "completed" BatchStatusFailed BatchStatus = "failed" BatchStatusProcessing BatchStatus = "processing" ) // Defines values for ClientStatus. const ( INSYNC ClientStatus = "IN_SYNC" NOTSYNCED ClientStatus = "NOT_SYNCED" NOTSYNCING ClientStatus = "NOT_SYNCING" ) // Defines values for ExportStatus. const ( ExportStatusCompleted ExportStatus = "completed" ExportStatusFailed ExportStatus = "failed" ExportStatusInProgress 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" ) // BatchID The batch upload id. type BatchID = openapi_types.UUID // BatchStatus The status of a batch upload type BatchStatus string // BatchUploadDetails defines model for BatchUploadDetails. type BatchUploadDetails struct { // BatchId The batch upload id. BatchId BatchID `json:"batch_id"` // ClientId The client external id ClientId ClientID `json:"client_id"` // CompletedAt When the batch upload completed processing CompletedAt nullable.Nullable[time.Time] `json:"completed_at,omitempty"` // CreatedAt When the batch upload was created CreatedAt time.Time `json:"created_at"` // FailedDocuments Number of documents that failed processing FailedDocuments int32 `json:"failed_documents"` // FailedFilenames List of filenames that failed processing FailedFilenames *[]string `json:"failed_filenames,omitempty"` // InvalidTypeDocuments Number of non-PDF files found in archive InvalidTypeDocuments int32 `json:"invalid_type_documents"` // OriginalFilename Original filename of the uploaded ZIP archive OriginalFilename string `json:"original_filename"` // ProcessedDocuments Number of documents processed so far ProcessedDocuments int32 `json:"processed_documents"` // ProgressPercent Processing progress percentage ProgressPercent int32 `json:"progress_percent"` // Status The status of a batch upload Status BatchStatus `json:"status"` // TotalDocuments Total number of documents in the batch TotalDocuments int32 `json:"total_documents"` } // BatchUploadList List of batch uploads for a client type BatchUploadList struct { Batches []BatchUploadSummary `json:"batches"` // TotalCount Total number of batches for this client TotalCount int32 `json:"total_count"` } // BatchUploadResponse Response returned when a batch upload is accepted for processing type BatchUploadResponse struct { // BatchId The batch upload id. BatchId BatchID `json:"batch_id"` // Status The status of a batch upload Status BatchStatus `json:"status"` // StatusUrl URL to check batch status StatusUrl string `json:"status_url"` } // BatchUploadSummary Summary information about a batch upload type BatchUploadSummary struct { // BatchId The batch upload id. BatchId BatchID `json:"batch_id"` // ClientId The client external id ClientId ClientID `json:"client_id"` // CompletedAt When the batch upload completed processing CompletedAt nullable.Nullable[time.Time] `json:"completed_at,omitempty"` // CreatedAt When the batch upload was created CreatedAt time.Time `json:"created_at"` // FailedDocuments Number of documents that failed processing FailedDocuments int32 `json:"failed_documents"` // InvalidTypeDocuments Number of non-PDF files found in archive InvalidTypeDocuments int32 `json:"invalid_type_documents"` // OriginalFilename Original filename of the uploaded ZIP archive OriginalFilename string `json:"original_filename"` // ProcessedDocuments Number of documents processed so far ProcessedDocuments int32 `json:"processed_documents"` // ProgressPercent Processing progress percentage ProgressPercent int32 `json:"progress_percent"` // Status The status of a batch upload Status BatchStatus `json:"status"` // TotalDocuments Total number of documents in the batch TotalDocuments int32 `json:"total_documents"` } // 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 // NotFound Description of error type NotFound = 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"` } // ListDocumentBatchesParams defines parameters for ListDocumentBatches. type ListDocumentBatchesParams struct { // Limit Maximum number of items to return Limit *int32 `form:"limit,omitempty" json:"limit,omitempty"` // Offset Number of items to skip Offset *int32 `form:"offset,omitempty" json:"offset,omitempty"` } // UploadDocumentBatchMultipartBody defines parameters for UploadDocumentBatch. type UploadDocumentBatchMultipartBody struct { // Archive The file to be uploaded as a ZIP archive Archive openapi_types.File `json:"archive"` } // 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 // UploadDocumentBatchMultipartRequestBody defines body for UploadDocumentBatch for multipart/form-data ContentType. type UploadDocumentBatchMultipartRequestBody UploadDocumentBatchMultipartBody // 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 // List batch uploads for a client // (GET /client/{id}/document/batch) ListDocumentBatches(ctx echo.Context, id ClientID, params ListDocumentBatchesParams) error // Upload multiple PDF documents as ZIP archive // (POST /client/{id}/document/batch) UploadDocumentBatch(ctx echo.Context, id ClientID) error // Cancel a batch upload // (DELETE /client/{id}/document/batch/{batch_id}) CancelDocumentBatch(ctx echo.Context, id ClientID, batchId BatchID) error // Get batch upload status // (GET /client/{id}/document/batch/{batch_id}) GetDocumentBatch(ctx echo.Context, id ClientID, batchId BatchID) 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 } // ListDocumentBatches converts echo context to params. func (w *ServerInterfaceWrapper) ListDocumentBatches(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{}) // Parameter object where we will unmarshal all parameters from the context var params ListDocumentBatchesParams // ------------- Optional query parameter "limit" ------------- err = runtime.BindQueryParameter("form", true, false, "limit", ctx.QueryParams(), ¶ms.Limit) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err)) } // ------------- Optional query parameter "offset" ------------- err = runtime.BindQueryParameter("form", true, false, "offset", ctx.QueryParams(), ¶ms.Offset) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter offset: %s", err)) } // Invoke the callback with all the unmarshaled arguments err = w.Handler.ListDocumentBatches(ctx, id, params) return err } // UploadDocumentBatch converts echo context to params. func (w *ServerInterfaceWrapper) UploadDocumentBatch(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.UploadDocumentBatch(ctx, id) return err } // CancelDocumentBatch converts echo context to params. func (w *ServerInterfaceWrapper) CancelDocumentBatch(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)) } // ------------- Path parameter "batch_id" ------------- var batchId BatchID err = runtime.BindStyledParameterWithOptions("simple", "batch_id", ctx.Param("batch_id"), &batchId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter batch_id: %s", err)) } ctx.Set(JwtAuthScopes, []string{}) // Invoke the callback with all the unmarshaled arguments err = w.Handler.CancelDocumentBatch(ctx, id, batchId) return err } // GetDocumentBatch converts echo context to params. func (w *ServerInterfaceWrapper) GetDocumentBatch(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)) } // ------------- Path parameter "batch_id" ------------- var batchId BatchID err = runtime.BindStyledParameterWithOptions("simple", "batch_id", ctx.Param("batch_id"), &batchId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter batch_id: %s", err)) } ctx.Set(JwtAuthScopes, []string{}) // Invoke the callback with all the unmarshaled arguments err = w.Handler.GetDocumentBatch(ctx, id, batchId) 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.GET(baseURL+"/client/:id/document/batch", wrapper.ListDocumentBatches) router.POST(baseURL+"/client/:id/document/batch", wrapper.UploadDocumentBatch) router.DELETE(baseURL+"/client/:id/document/batch/:batch_id", wrapper.CancelDocumentBatch) router.GET(baseURL+"/client/:id/document/batch/:batch_id", wrapper.GetDocumentBatch) 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/+xdfW/bOJP/KoTuAQ541u/O++Fwlybtbhbdtpukt889bc6gpbHNrUy6IpXULfLdD3yT", "KImyZddO93AB+kcS8WU4M/zNkJyZfgtCNl8wClTw4OxbMAMcQaJ+vMYCXpM5EfKXCHiYkIUgjAZn6hOK", "5TdE6IQlcyw/IEKR/gV9DNTXf3sgNGIP/y7IHNr6549B0ArgC54vYgjOgn6vZxv1e0Er4OEM5ljO6G1z", "JNvM8ZfXQKdiFpwNB61ggYWARJL1Px967dO7n2xj/dvfglYglgs5EBcJodPg8fFR9krwHIRZ6wsswtnV", "ZXWltzNAY/kRpYuY4QhdXXaCVkDktwUW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x1m/X9CnwKglDc60GjBSOHd3gsoLK0PPH3NphoOpCeHWKoP0JpxugSsjt/jXCkNjepsqZ4no8kLD5KQ", "77CmcnzlKUg31FHlzIX4Pu2NLYHPOrun8BMtQoXzm9jEz7YyT+MIM1OXwC1hp6rGhQkRkBDsD5+25Y32", "HDJtp/GcNM7LK3g+Xu8w8ulzJl+rayoFvHCsbpDArYtObJy//btxD/bxuuSWG9ome/uzQ9tf4KVJZ+Y/", "J24/UeK2lX7NrsggeIusbb1XVidt5xtjT6BrSsXV6dnzVfweUgczwRfyBat4u9E1Zla8Z7NcbQewG6Rq", "7x2nVydq69RqW8c0K0tv6g1l5Z+2yKLQ2v6cuv0EqdsbIWpXmHJz37EZvG7LS1WqUgGyLlCXUv1YWufB", "FOsml4JkgIu9bw23/l7N/igV3NskTqa3D2Lro4pvNY08jZ9zHncVHSNZun57qfGSe//N47uERWmYVZNS", "ZbBSTxGwkM279321vcw81bw7s0GkVx0rVJVOtYps4PlFYDFUonrFWDOMzSp2RypnGjcdzI2+N2NVHsKb", "jpWfosxIBe43HUW/dDqjFJ84mw5TrIuWj+ZeIjzePf5vAAAA//8uQJ8AYocAAA==", } // 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 }