// 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/KoTuAQ541u92Xg+HOzdpd73ott0kvX3uaXMGLdE2tzLpklRSt8h3P/BN", "oiTKll073cMZ6B9JxJfhzPA3Q3Jm+i0I6WJJCSKCB5ffgjmCEWLqxxso0Gu8wEL+EiEeMrwUmJLgUn0C", "sfwGMJlStoDyA8AE6F/Ax0B9/bdHTCL6+O8CL1BT//wxCBoB+gIXyxgFl0G307GNup2gEfBwjhZQzuht", "cyrbLOCX14jMxDy47PcawRIKgZgk638+dJoX9z/Zxvq3vwWNQKyWciAuGCaz4OnpSfZicIGEWesLKML5", "6Lq80rs5AhP5ESTLmMIIjK5bQSPA8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hTw5Qihsd", "kWhJce7d3gsoNKkOPH1NZxoOpCcHaKIP0Jpxuiqsjt/jXCkNiapsqZ4npckLD5KQ77CmcnzlKUg31FHl", "1IX4Pu2NLYFHnT1Q+IkWocL5bWziZ1usp3aEmSlV4Fa1U4XkQoYFYhj6w6dtxaMDh0zbaTwnjWFxBcfj", "9R4jnz6n8rW6plLAc8fqGgncug7F1vnbvxv34BCvS24Fol2ytz87tP0FXpp0Zv4xcfuZEret9Ct2RQrB", "O2Rt672yPmk72xgHAl1TPa5Kz45X8QdIHUwFn8sXLOPtVteYaT2f7XK1HcCukap9cJxen6itU6ttadO0", "Ur0pQZRWhNohi0Jr+zF1+xlSt7dC1LYwFei+YzN43ZaXqnqlAmRdsy4h+rG0yoPJl1IuBMkgLg6+NdyS", "fBX7o1CDb5s4mc4hiK2OKr7TNPIkPuY87is6RrJ08/ZS47EH/83jO0ajJEyrS6nKWImnLlhIF+2Hrtpe", "Zp5y3p3ZINKrjhWqSqdaRTbw7CIwHypRvmKsGMZmFbsjFTON6w7mRt+bsUoP4XXHyk5RZqQc9+uOol86", "nVHyT5x1h8mXSnOqkzmXCE/3T/8bAAD//69cLjR1hwAA", } // 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 }