2025-01-15 19:45:51 +00:00
|
|
|
// Package queryservice provides primitives to interact with the openapi HTTP API.
|
|
|
|
|
//
|
|
|
|
|
// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version 2.4.1 DO NOT EDIT.
|
|
|
|
|
package queryservice
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"bytes"
|
|
|
|
|
"compress/gzip"
|
|
|
|
|
"encoding/base64"
|
|
|
|
|
"fmt"
|
|
|
|
|
"net/http"
|
|
|
|
|
"net/url"
|
|
|
|
|
"path"
|
|
|
|
|
"strings"
|
2025-03-12 00:59:58 +00:00
|
|
|
"time"
|
2025-01-15 19:45:51 +00:00
|
|
|
|
|
|
|
|
"github.com/getkin/kin-openapi/openapi3"
|
|
|
|
|
"github.com/labstack/echo/v4"
|
|
|
|
|
"github.com/oapi-codegen/runtime"
|
2025-01-24 14:52:56 +00:00
|
|
|
openapi_types "github.com/oapi-codegen/runtime/types"
|
2025-01-15 19:45:51 +00:00
|
|
|
)
|
|
|
|
|
|
2025-03-12 00:59:58 +00:00
|
|
|
const (
|
|
|
|
|
PlaceholderAuthScopes = "placeholderAuth.Scopes"
|
|
|
|
|
)
|
|
|
|
|
|
2025-03-10 11:03:00 +00:00
|
|
|
// Defines values for ClientStatus.
|
|
|
|
|
const (
|
|
|
|
|
INSYNC ClientStatus = "IN_SYNC"
|
|
|
|
|
NOTSYNCED ClientStatus = "NOT_SYNCED"
|
|
|
|
|
NOTSYNCING ClientStatus = "NOT_SYNCING"
|
|
|
|
|
)
|
|
|
|
|
|
2025-01-16 13:49:07 +00:00
|
|
|
// Defines values for ExportStatus.
|
|
|
|
|
const (
|
|
|
|
|
Completed ExportStatus = "completed"
|
|
|
|
|
Failed ExportStatus = "failed"
|
|
|
|
|
InProgress ExportStatus = "in_progress"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Defines values for FieldFilterCondition.
|
|
|
|
|
const (
|
|
|
|
|
ClosedInterval FieldFilterCondition = "closed_interval"
|
|
|
|
|
Exclude FieldFilterCondition = "exclude"
|
|
|
|
|
GreaterThan FieldFilterCondition = "greater_than"
|
|
|
|
|
Include FieldFilterCondition = "include"
|
|
|
|
|
LeftClosedInterval FieldFilterCondition = "left_closed_interval"
|
|
|
|
|
LessThan FieldFilterCondition = "less_than"
|
|
|
|
|
OpenInterval FieldFilterCondition = "open_interval"
|
|
|
|
|
RightClosedInterval FieldFilterCondition = "right_closed_interval"
|
|
|
|
|
)
|
|
|
|
|
|
2025-01-15 19:45:51 +00:00
|
|
|
// Defines values for QueryType.
|
|
|
|
|
const (
|
|
|
|
|
CONTEXTFULL QueryType = "CONTEXT_FULL"
|
|
|
|
|
JSONEXTRACTOR QueryType = "JSON_EXTRACTOR"
|
|
|
|
|
)
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// ClientCanSync If the client is allowing active syncs
|
|
|
|
|
type ClientCanSync = bool
|
|
|
|
|
|
|
|
|
|
// ClientCreate The properties for creation.
|
2025-01-21 18:24:14 +00:00
|
|
|
type ClientCreate struct {
|
2025-03-11 16:31:06 +00:00
|
|
|
// Id The client external id
|
|
|
|
|
Id ClientID `json:"id"`
|
|
|
|
|
|
2025-01-21 18:24:14 +00:00
|
|
|
// Name The client name
|
2025-03-11 16:31:06 +00:00
|
|
|
Name ClientName `json:"name"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ClientID The client external id
|
|
|
|
|
type ClientID = string
|
|
|
|
|
|
|
|
|
|
// ClientIDBody The client id.
|
|
|
|
|
type ClientIDBody struct {
|
|
|
|
|
// Id The client external id
|
|
|
|
|
Id ClientID `json:"id"`
|
2025-01-21 18:24:14 +00:00
|
|
|
}
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// ClientName The client name
|
|
|
|
|
type ClientName = string
|
|
|
|
|
|
2025-03-10 11:03:00 +00:00
|
|
|
// ClientStatus Specifies the status of a client.
|
|
|
|
|
type ClientStatus string
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// ClientStatusBody A client status information object.
|
2025-03-10 11:03:00 +00:00
|
|
|
type ClientStatusBody struct {
|
|
|
|
|
// Status Specifies the status of a client.
|
|
|
|
|
Status ClientStatus `json:"status"`
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// ClientUID The client internal unique id
|
|
|
|
|
type ClientUID = openapi_types.UUID
|
|
|
|
|
|
|
|
|
|
// ClientUpdate The properties that may be updated.
|
2025-01-21 18:24:14 +00:00
|
|
|
type ClientUpdate struct {
|
|
|
|
|
// CanSync If the client is allowing active syncs
|
2025-03-11 16:31:06 +00:00
|
|
|
CanSync *ClientCanSync `json:"can_sync,omitempty"`
|
2025-01-21 18:24:14 +00:00
|
|
|
|
|
|
|
|
// Name The client name
|
2025-03-11 16:31:06 +00:00
|
|
|
Name *ClientName `json:"name,omitempty"`
|
2025-01-21 18:24:14 +00:00
|
|
|
}
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// CodeVersion The desired code version.
|
2025-03-11 18:15:49 +00:00
|
|
|
type CodeVersion = int64
|
2025-03-11 16:31:06 +00:00
|
|
|
|
2025-03-10 11:03:00 +00:00
|
|
|
// Collector Collector model.
|
|
|
|
|
type Collector struct {
|
2025-03-11 16:31:06 +00:00
|
|
|
// ActiveVersion The desired version.
|
|
|
|
|
ActiveVersion Version `json:"active_version"`
|
2025-03-10 11:03:00 +00:00
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// ClientId The client external id
|
|
|
|
|
ClientId ClientID `json:"client_id"`
|
2025-03-10 11:03:00 +00:00
|
|
|
|
|
|
|
|
// Fields The fields in the collector.
|
2025-03-11 16:31:06 +00:00
|
|
|
Fields CollectorFields `json:"fields"`
|
2025-03-10 11:03:00 +00:00
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// LatestVersion The desired version.
|
|
|
|
|
LatestVersion Version `json:"latest_version"`
|
2025-03-10 11:03:00 +00:00
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// MinimumCleanerVersion The desired code version.
|
|
|
|
|
MinimumCleanerVersion CodeVersion `json:"minimum_cleaner_version"`
|
2025-03-10 11:03:00 +00:00
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// MinimumTextVersion The desired code version.
|
|
|
|
|
MinimumTextVersion CodeVersion `json:"minimum_text_version"`
|
2025-03-10 11:03:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CollectorField The field properties for the collector.
|
|
|
|
|
type CollectorField struct {
|
|
|
|
|
// Name The output field name.
|
2025-03-11 16:31:06 +00:00
|
|
|
Name CollectorFieldName `json:"name"`
|
2025-03-10 11:03:00 +00:00
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// QueryId The query id.
|
|
|
|
|
QueryId QueryID `json:"query_id"`
|
2025-03-10 11:03:00 +00:00
|
|
|
}
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// CollectorFieldName The output field name.
|
|
|
|
|
type CollectorFieldName = string
|
|
|
|
|
|
|
|
|
|
// CollectorFields The fields in the collector.
|
|
|
|
|
type CollectorFields = []CollectorField
|
|
|
|
|
|
2025-03-10 13:00:57 +00:00
|
|
|
// CollectorSet Payload for updating a Collector.
|
|
|
|
|
type CollectorSet struct {
|
2025-03-11 16:31:06 +00:00
|
|
|
// ActiveVersion The desired version.
|
|
|
|
|
ActiveVersion *Version `json:"active_version,omitempty"`
|
2025-03-10 11:03:00 +00:00
|
|
|
|
|
|
|
|
// Fields The fields in the collector.
|
2025-03-11 16:31:06 +00:00
|
|
|
Fields *CollectorFields `json:"fields,omitempty"`
|
2025-03-10 11:03:00 +00:00
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// MinimumCleanerVersion The desired code version.
|
|
|
|
|
MinimumCleanerVersion *CodeVersion `json:"minimum_cleaner_version,omitempty"`
|
2025-03-10 11:03:00 +00:00
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// MinimumTextVersion The desired code version.
|
|
|
|
|
MinimumTextVersion *CodeVersion `json:"minimum_text_version,omitempty"`
|
2025-03-10 11:03:00 +00:00
|
|
|
}
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// DocClient The properties of a client.
|
2025-03-10 11:03:00 +00:00
|
|
|
type DocClient struct {
|
|
|
|
|
// CanSync If the client is allowing active syncs
|
2025-03-11 16:31:06 +00:00
|
|
|
CanSync ClientCanSync `json:"can_sync"`
|
2025-03-10 11:03:00 +00:00
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// Id The client external id
|
|
|
|
|
Id ClientID `json:"id"`
|
2025-03-10 11:03:00 +00:00
|
|
|
|
|
|
|
|
// Name The client name
|
2025-03-11 16:31:06 +00:00
|
|
|
Name ClientName `json:"name"`
|
|
|
|
|
|
|
|
|
|
// Uid The client internal unique id
|
|
|
|
|
Uid ClientUID `json:"uid"`
|
2025-03-10 11:03:00 +00:00
|
|
|
}
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// Document The document properties.
|
2025-02-21 17:05:37 +00:00
|
|
|
type Document struct {
|
|
|
|
|
// Bucket The bucket containing the document
|
|
|
|
|
Bucket string `json:"bucket"`
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// Id The document id.
|
|
|
|
|
Id DocumentID `json:"id"`
|
2025-02-21 17:05:37 +00:00
|
|
|
|
|
|
|
|
// Key The path to the document
|
|
|
|
|
Key string `json:"key"`
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// DocumentID The document id.
|
|
|
|
|
type DocumentID = openapi_types.UUID
|
|
|
|
|
|
2025-01-16 13:49:07 +00:00
|
|
|
// ExportDetails Payload for export trigger response.
|
|
|
|
|
type ExportDetails struct {
|
2025-03-11 16:31:06 +00:00
|
|
|
// ClientId The client external id
|
|
|
|
|
ClientId ClientID `json:"client_id"`
|
2025-01-16 13:49:07 +00:00
|
|
|
|
|
|
|
|
// OutputLocation The location in which the export zip file will be found.
|
|
|
|
|
OutputLocation *string `json:"output_location,omitempty"`
|
|
|
|
|
|
2025-03-10 11:03:00 +00:00
|
|
|
// Status The possible export states.
|
2025-01-16 13:49:07 +00:00
|
|
|
Status ExportStatus `json:"status"`
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// ExportID The export id.
|
|
|
|
|
type ExportID = openapi_types.UUID
|
|
|
|
|
|
2025-03-10 11:03:00 +00:00
|
|
|
// ExportStatus The possible export states.
|
2025-01-16 13:49:07 +00:00
|
|
|
type ExportStatus string
|
|
|
|
|
|
2025-01-15 19:45:51 +00:00
|
|
|
// ExportTrigger Payload for triggering an export.
|
|
|
|
|
type ExportTrigger struct {
|
2025-01-16 13:49:07 +00:00
|
|
|
// 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.
|
2025-03-12 00:59:58 +00:00
|
|
|
EndDate *time.Time `json:"end_date,omitempty"`
|
2025-01-16 13:49:07 +00:00
|
|
|
|
|
|
|
|
// StartDate This first date of ingestion.
|
2025-03-12 00:59:58 +00:00
|
|
|
StartDate *time.Time `json:"start_date,omitempty"`
|
2025-01-16 13:49:07 +00:00
|
|
|
} `json:"ingestion_filters,omitempty"`
|
2025-01-15 19:45:51 +00:00
|
|
|
}
|
|
|
|
|
|
2025-01-16 13:49:07 +00:00
|
|
|
// FieldFilter Filtering a column
|
|
|
|
|
type FieldFilter struct {
|
|
|
|
|
// Condition The possible field filtering conditions.
|
|
|
|
|
Condition FieldFilterCondition `json:"condition"`
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// FieldName The output field name.
|
|
|
|
|
FieldName CollectorFieldName `json:"field_name"`
|
2025-01-16 13:49:07 +00:00
|
|
|
|
|
|
|
|
// Values The values useful to the filter.
|
|
|
|
|
Values []string `json:"values"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FieldFilterCondition The possible field filtering conditions.
|
|
|
|
|
type FieldFilterCondition string
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// IdMessage A single uuid.
|
2025-01-15 19:45:51 +00:00
|
|
|
type IdMessage struct {
|
2025-01-16 13:49:07 +00:00
|
|
|
// Id Unique identifier for entity.
|
2025-01-24 14:52:56 +00:00
|
|
|
Id openapi_types.UUID `json:"id"`
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-10 11:03:00 +00:00
|
|
|
// ListDocuments The documents in the client.
|
2025-02-21 17:05:37 +00:00
|
|
|
type ListDocuments = []Document
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// ListQueries A set of queries.
|
2025-01-15 19:45:51 +00:00
|
|
|
type ListQueries struct {
|
|
|
|
|
// Queries List of queries.
|
|
|
|
|
Queries []Query `json:"queries"`
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// Query A logic unit of execution.
|
2025-01-15 19:45:51 +00:00
|
|
|
type Query struct {
|
2025-03-11 16:31:06 +00:00
|
|
|
// ActiveVersion The desired version.
|
|
|
|
|
ActiveVersion Version `json:"active_version"`
|
2025-01-15 19:45:51 +00:00
|
|
|
|
|
|
|
|
// Config Configuration for the query.
|
2025-03-11 16:31:06 +00:00
|
|
|
Config *QueryConfig `json:"config,omitempty"`
|
2025-01-15 19:45:51 +00:00
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// Id The query id.
|
|
|
|
|
Id QueryID `json:"id"`
|
2025-01-15 19:45:51 +00:00
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// LatestVersion The desired version.
|
|
|
|
|
LatestVersion Version `json:"latest_version"`
|
2025-01-15 19:45:51 +00:00
|
|
|
|
|
|
|
|
// RequiredQueries List of required query IDs.
|
2025-03-11 16:31:06 +00:00
|
|
|
RequiredQueries *RequiredQueryIDs `json:"required_queries,omitempty"`
|
2025-01-15 19:45:51 +00:00
|
|
|
|
|
|
|
|
// Type Specifies the type of the query.
|
|
|
|
|
Type QueryType `json:"type"`
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// QueryConfig Configuration for the query.
|
|
|
|
|
type QueryConfig = string
|
|
|
|
|
|
|
|
|
|
// QueryCreate The parameters required to create a query.
|
2025-01-15 19:45:51 +00:00
|
|
|
type QueryCreate struct {
|
2025-03-11 16:31:06 +00:00
|
|
|
// Config Configuration for the query.
|
|
|
|
|
Config *QueryConfig `json:"config,omitempty"`
|
2025-01-15 19:45:51 +00:00
|
|
|
|
|
|
|
|
// RequiredQueries List of required query IDs.
|
2025-03-11 16:31:06 +00:00
|
|
|
RequiredQueries *RequiredQueryIDs `json:"required_queries,omitempty"`
|
2025-01-15 19:45:51 +00:00
|
|
|
|
|
|
|
|
// Type Specifies the type of the query.
|
|
|
|
|
Type QueryType `json:"type"`
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// QueryID The query id.
|
|
|
|
|
type QueryID = openapi_types.UUID
|
|
|
|
|
|
|
|
|
|
// QueryTestRequest The properties for a query test request.
|
2025-01-15 19:45:51 +00:00
|
|
|
type QueryTestRequest struct {
|
2025-03-11 16:31:06 +00:00
|
|
|
// DocumentId The document id.
|
|
|
|
|
DocumentId DocumentID `json:"document_id"`
|
2025-01-15 19:45:51 +00:00
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// QueryVersion The desired version.
|
|
|
|
|
QueryVersion Version `json:"query_version"`
|
2025-01-15 19:45:51 +00:00
|
|
|
}
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// QueryTestResponse The response from a query test.
|
2025-01-15 19:45:51 +00:00
|
|
|
type QueryTestResponse struct {
|
|
|
|
|
// Value Result of the query test.
|
|
|
|
|
Value string `json:"value"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// QueryType Specifies the type of the query.
|
|
|
|
|
type QueryType string
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// QueryUpdate The properties that may be updated for a query.
|
2025-01-15 19:45:51 +00:00
|
|
|
type QueryUpdate struct {
|
2025-03-11 16:31:06 +00:00
|
|
|
// ActiveVersion The desired version.
|
|
|
|
|
ActiveVersion *Version `json:"active_version,omitempty"`
|
2025-01-15 19:45:51 +00:00
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// Config Configuration for the query.
|
|
|
|
|
Config *QueryConfig `json:"config,omitempty"`
|
2025-01-15 19:45:51 +00:00
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// RequiredQueries List of required query IDs.
|
|
|
|
|
RequiredQueries *RequiredQueryIDs `json:"required_queries,omitempty"`
|
2025-01-15 19:45:51 +00:00
|
|
|
}
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// RequiredQueryIDs List of required query IDs.
|
|
|
|
|
type RequiredQueryIDs = []QueryID
|
|
|
|
|
|
|
|
|
|
// Version The desired version.
|
|
|
|
|
type Version = int32
|
|
|
|
|
|
2025-01-21 18:24:14 +00:00
|
|
|
// CreateClientJSONRequestBody defines body for CreateClient for application/json ContentType.
|
|
|
|
|
type CreateClientJSONRequestBody = ClientCreate
|
|
|
|
|
|
|
|
|
|
// UpdateClientJSONRequestBody defines body for UpdateClient for application/json ContentType.
|
|
|
|
|
type UpdateClientJSONRequestBody = ClientUpdate
|
|
|
|
|
|
2025-03-10 13:00:57 +00:00
|
|
|
// SetCollectorByClientIdJSONRequestBody defines body for SetCollectorByClientId for application/json ContentType.
|
|
|
|
|
type SetCollectorByClientIdJSONRequestBody = CollectorSet
|
2025-01-15 19:45:51 +00:00
|
|
|
|
2025-03-05 19:37:06 +00:00
|
|
|
// TriggerExportJSONRequestBody defines body for TriggerExport for application/json ContentType.
|
|
|
|
|
type TriggerExportJSONRequestBody = ExportTrigger
|
|
|
|
|
|
2025-01-15 19:45:51 +00:00
|
|
|
// CreateQueryJSONRequestBody defines body for CreateQuery for application/json ContentType.
|
|
|
|
|
type CreateQueryJSONRequestBody = QueryCreate
|
|
|
|
|
|
|
|
|
|
// UpdateQueryJSONRequestBody defines body for UpdateQuery for application/json ContentType.
|
|
|
|
|
type UpdateQueryJSONRequestBody = QueryUpdate
|
|
|
|
|
|
|
|
|
|
// TestQueryJSONRequestBody defines body for TestQuery for application/json ContentType.
|
|
|
|
|
type TestQueryJSONRequestBody = QueryTestRequest
|
|
|
|
|
|
|
|
|
|
// ServerInterface represents all server handlers.
|
|
|
|
|
type ServerInterface interface {
|
2025-01-21 18:24:14 +00:00
|
|
|
// Create a new client
|
2025-01-24 14:52:56 +00:00
|
|
|
// (POST /client)
|
2025-01-21 18:24:14 +00:00
|
|
|
CreateClient(ctx echo.Context) error
|
|
|
|
|
// Get a client by ID
|
2025-01-24 14:52:56 +00:00
|
|
|
// (GET /client/{id})
|
2025-03-11 16:31:06 +00:00
|
|
|
GetClient(ctx echo.Context, id ClientID) error
|
2025-01-21 18:24:14 +00:00
|
|
|
// Update a client
|
2025-01-24 14:52:56 +00:00
|
|
|
// (PATCH /client/{id})
|
2025-03-11 16:31:06 +00:00
|
|
|
UpdateClient(ctx echo.Context, id ClientID) error
|
2025-03-10 11:03:00 +00:00
|
|
|
// Get a collector by client ID
|
|
|
|
|
// (GET /client/{id}/collector)
|
2025-03-11 16:31:06 +00:00
|
|
|
GetCollectorByClientId(ctx echo.Context, id ClientID) error
|
2025-03-10 13:00:57 +00:00
|
|
|
// Set a collector
|
2025-03-10 11:03:00 +00:00
|
|
|
// (PATCH /client/{id}/collector)
|
2025-03-11 16:31:06 +00:00
|
|
|
SetCollectorByClientId(ctx echo.Context, id ClientID) error
|
2025-03-10 11:03:00 +00:00
|
|
|
// List the documents for a client
|
|
|
|
|
// (GET /client/{id}/documents)
|
2025-03-11 16:31:06 +00:00
|
|
|
ListDocumentsByClientId(ctx echo.Context, id ClientID) error
|
2025-03-05 19:37:06 +00:00
|
|
|
// Trigger an export
|
2025-03-10 11:03:00 +00:00
|
|
|
// (POST /client/{id}/export)
|
2025-03-11 16:31:06 +00:00
|
|
|
TriggerExport(ctx echo.Context, id ClientID) error
|
2025-03-10 11:03:00 +00:00
|
|
|
// Get client sync status
|
|
|
|
|
// (GET /client/{id}/status)
|
2025-03-11 16:31:06 +00:00
|
|
|
GetStatusByClientId(ctx echo.Context, id ClientID) error
|
|
|
|
|
// Check export state.
|
|
|
|
|
// (GET /export/{id})
|
|
|
|
|
ExportState(ctx echo.Context, id ExportID) error
|
2025-01-15 19:45:51 +00:00
|
|
|
// List queries
|
2025-01-24 14:52:56 +00:00
|
|
|
// (GET /query)
|
2025-01-15 19:45:51 +00:00
|
|
|
ListQueries(ctx echo.Context) error
|
|
|
|
|
// Create a new query
|
2025-01-24 14:52:56 +00:00
|
|
|
// (POST /query)
|
2025-01-15 19:45:51 +00:00
|
|
|
CreateQuery(ctx echo.Context) error
|
|
|
|
|
// Get a query by ID
|
2025-01-24 14:52:56 +00:00
|
|
|
// (GET /query/{id})
|
2025-03-11 16:31:06 +00:00
|
|
|
GetQuery(ctx echo.Context, id QueryID) error
|
2025-01-15 19:45:51 +00:00
|
|
|
// Update a query
|
2025-01-24 14:52:56 +00:00
|
|
|
// (PATCH /query/{id})
|
2025-03-11 16:31:06 +00:00
|
|
|
UpdateQuery(ctx echo.Context, id QueryID) error
|
2025-01-15 19:45:51 +00:00
|
|
|
// Test a query
|
2025-01-24 14:52:56 +00:00
|
|
|
// (POST /query/{id}/test)
|
2025-03-11 16:31:06 +00:00
|
|
|
TestQuery(ctx echo.Context, id QueryID) error
|
2025-01-15 19:45:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ServerInterfaceWrapper converts echo contexts to parameters.
|
|
|
|
|
type ServerInterfaceWrapper struct {
|
|
|
|
|
Handler ServerInterface
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-21 18:24:14 +00:00
|
|
|
// CreateClient converts echo context to params.
|
|
|
|
|
func (w *ServerInterfaceWrapper) CreateClient(ctx echo.Context) error {
|
|
|
|
|
var err error
|
|
|
|
|
|
2025-03-12 00:59:58 +00:00
|
|
|
ctx.Set(PlaceholderAuthScopes, []string{})
|
|
|
|
|
|
2025-01-21 18:24:14 +00:00
|
|
|
// Invoke the callback with all the unmarshaled arguments
|
|
|
|
|
err = w.Handler.CreateClient(ctx)
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GetClient converts echo context to params.
|
|
|
|
|
func (w *ServerInterfaceWrapper) GetClient(ctx echo.Context) error {
|
|
|
|
|
var err error
|
|
|
|
|
// ------------- Path parameter "id" -------------
|
2025-03-11 16:31:06 +00:00
|
|
|
var id ClientID
|
2025-01-21 18:24:14 +00:00
|
|
|
|
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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" -------------
|
2025-03-11 16:31:06 +00:00
|
|
|
var id ClientID
|
2025-01-21 18:24:14 +00:00
|
|
|
|
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-12 00:59:58 +00:00
|
|
|
ctx.Set(PlaceholderAuthScopes, []string{})
|
|
|
|
|
|
2025-01-21 18:24:14 +00:00
|
|
|
// Invoke the callback with all the unmarshaled arguments
|
|
|
|
|
err = w.Handler.UpdateClient(ctx, id)
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-10 11:03:00 +00:00
|
|
|
// GetCollectorByClientId converts echo context to params.
|
|
|
|
|
func (w *ServerInterfaceWrapper) GetCollectorByClientId(ctx echo.Context) error {
|
2025-01-24 14:52:56 +00:00
|
|
|
var err error
|
|
|
|
|
// ------------- Path parameter "id" -------------
|
2025-03-11 16:31:06 +00:00
|
|
|
var id ClientID
|
2025-01-24 14:52:56 +00:00
|
|
|
|
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-12 00:59:58 +00:00
|
|
|
ctx.Set(PlaceholderAuthScopes, []string{})
|
|
|
|
|
|
2025-01-24 14:52:56 +00:00
|
|
|
// Invoke the callback with all the unmarshaled arguments
|
2025-03-10 11:03:00 +00:00
|
|
|
err = w.Handler.GetCollectorByClientId(ctx, id)
|
2025-01-24 14:52:56 +00:00
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-10 13:00:57 +00:00
|
|
|
// SetCollectorByClientId converts echo context to params.
|
|
|
|
|
func (w *ServerInterfaceWrapper) SetCollectorByClientId(ctx echo.Context) error {
|
2025-01-15 19:45:51 +00:00
|
|
|
var err error
|
|
|
|
|
// ------------- Path parameter "id" -------------
|
2025-03-11 16:31:06 +00:00
|
|
|
var id ClientID
|
2025-01-15 19:45:51 +00:00
|
|
|
|
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-12 00:59:58 +00:00
|
|
|
ctx.Set(PlaceholderAuthScopes, []string{})
|
|
|
|
|
|
2025-01-15 19:45:51 +00:00
|
|
|
// Invoke the callback with all the unmarshaled arguments
|
2025-03-10 13:00:57 +00:00
|
|
|
err = w.Handler.SetCollectorByClientId(ctx, id)
|
2025-01-15 19:45:51 +00:00
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-10 11:03:00 +00:00
|
|
|
// ListDocumentsByClientId converts echo context to params.
|
|
|
|
|
func (w *ServerInterfaceWrapper) ListDocumentsByClientId(ctx echo.Context) error {
|
2025-02-21 17:05:37 +00:00
|
|
|
var err error
|
|
|
|
|
// ------------- Path parameter "id" -------------
|
2025-03-11 16:31:06 +00:00
|
|
|
var id ClientID
|
2025-02-21 17:05:37 +00:00
|
|
|
|
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-12 00:59:58 +00:00
|
|
|
ctx.Set(PlaceholderAuthScopes, []string{})
|
|
|
|
|
|
2025-02-21 17:05:37 +00:00
|
|
|
// Invoke the callback with all the unmarshaled arguments
|
2025-03-10 11:03:00 +00:00
|
|
|
err = w.Handler.ListDocumentsByClientId(ctx, id)
|
2025-02-21 17:05:37 +00:00
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// TriggerExport converts echo context to params.
|
|
|
|
|
func (w *ServerInterfaceWrapper) TriggerExport(ctx echo.Context) error {
|
2025-01-15 19:45:51 +00:00
|
|
|
var err error
|
|
|
|
|
// ------------- Path parameter "id" -------------
|
2025-03-11 16:31:06 +00:00
|
|
|
var id ClientID
|
2025-01-15 19:45:51 +00:00
|
|
|
|
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-12 00:59:58 +00:00
|
|
|
ctx.Set(PlaceholderAuthScopes, []string{})
|
|
|
|
|
|
2025-01-15 19:45:51 +00:00
|
|
|
// Invoke the callback with all the unmarshaled arguments
|
2025-03-11 16:31:06 +00:00
|
|
|
err = w.Handler.TriggerExport(ctx, id)
|
2025-01-15 19:45:51 +00:00
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// GetStatusByClientId converts echo context to params.
|
|
|
|
|
func (w *ServerInterfaceWrapper) GetStatusByClientId(ctx echo.Context) error {
|
2025-03-05 19:37:06 +00:00
|
|
|
var err error
|
|
|
|
|
// ------------- Path parameter "id" -------------
|
2025-03-11 16:31:06 +00:00
|
|
|
var id ClientID
|
2025-03-05 19:37:06 +00:00
|
|
|
|
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-12 00:59:58 +00:00
|
|
|
ctx.Set(PlaceholderAuthScopes, []string{})
|
|
|
|
|
|
2025-03-05 19:37:06 +00:00
|
|
|
// Invoke the callback with all the unmarshaled arguments
|
2025-03-11 16:31:06 +00:00
|
|
|
err = w.Handler.GetStatusByClientId(ctx, id)
|
2025-03-05 19:37:06 +00:00
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-11 16:31:06 +00:00
|
|
|
// ExportState converts echo context to params.
|
|
|
|
|
func (w *ServerInterfaceWrapper) ExportState(ctx echo.Context) error {
|
2025-03-04 16:20:54 +00:00
|
|
|
var err error
|
|
|
|
|
// ------------- Path parameter "id" -------------
|
2025-03-11 16:31:06 +00:00
|
|
|
var id ExportID
|
2025-03-04 16:20:54 +00:00
|
|
|
|
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-12 00:59:58 +00:00
|
|
|
ctx.Set(PlaceholderAuthScopes, []string{})
|
|
|
|
|
|
2025-03-04 16:20:54 +00:00
|
|
|
// Invoke the callback with all the unmarshaled arguments
|
2025-03-11 16:31:06 +00:00
|
|
|
err = w.Handler.ExportState(ctx, id)
|
2025-03-04 16:20:54 +00:00
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-15 19:45:51 +00:00
|
|
|
// ListQueries converts echo context to params.
|
|
|
|
|
func (w *ServerInterfaceWrapper) ListQueries(ctx echo.Context) error {
|
|
|
|
|
var err error
|
|
|
|
|
|
2025-03-12 00:59:58 +00:00
|
|
|
ctx.Set(PlaceholderAuthScopes, []string{})
|
|
|
|
|
|
2025-01-15 19:45:51 +00:00
|
|
|
// Invoke the callback with all the unmarshaled arguments
|
|
|
|
|
err = w.Handler.ListQueries(ctx)
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CreateQuery converts echo context to params.
|
|
|
|
|
func (w *ServerInterfaceWrapper) CreateQuery(ctx echo.Context) error {
|
|
|
|
|
var err error
|
|
|
|
|
|
2025-03-12 00:59:58 +00:00
|
|
|
ctx.Set(PlaceholderAuthScopes, []string{})
|
|
|
|
|
|
2025-01-15 19:45:51 +00:00
|
|
|
// Invoke the callback with all the unmarshaled arguments
|
|
|
|
|
err = w.Handler.CreateQuery(ctx)
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-21 18:24:14 +00:00
|
|
|
// GetQuery converts echo context to params.
|
|
|
|
|
func (w *ServerInterfaceWrapper) GetQuery(ctx echo.Context) error {
|
2025-01-15 19:45:51 +00:00
|
|
|
var err error
|
|
|
|
|
// ------------- Path parameter "id" -------------
|
2025-03-11 16:31:06 +00:00
|
|
|
var id QueryID
|
2025-01-15 19:45:51 +00:00
|
|
|
|
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-12 00:59:58 +00:00
|
|
|
ctx.Set(PlaceholderAuthScopes, []string{})
|
|
|
|
|
|
2025-01-15 19:45:51 +00:00
|
|
|
// Invoke the callback with all the unmarshaled arguments
|
2025-01-21 18:24:14 +00:00
|
|
|
err = w.Handler.GetQuery(ctx, id)
|
2025-01-15 19:45:51 +00:00
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// UpdateQuery converts echo context to params.
|
|
|
|
|
func (w *ServerInterfaceWrapper) UpdateQuery(ctx echo.Context) error {
|
|
|
|
|
var err error
|
|
|
|
|
// ------------- Path parameter "id" -------------
|
2025-03-11 16:31:06 +00:00
|
|
|
var id QueryID
|
2025-01-15 19:45:51 +00:00
|
|
|
|
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-12 00:59:58 +00:00
|
|
|
ctx.Set(PlaceholderAuthScopes, []string{})
|
|
|
|
|
|
2025-01-15 19:45:51 +00:00
|
|
|
// Invoke the callback with all the unmarshaled arguments
|
|
|
|
|
err = w.Handler.UpdateQuery(ctx, id)
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TestQuery converts echo context to params.
|
|
|
|
|
func (w *ServerInterfaceWrapper) TestQuery(ctx echo.Context) error {
|
|
|
|
|
var err error
|
|
|
|
|
// ------------- Path parameter "id" -------------
|
2025-03-11 16:31:06 +00:00
|
|
|
var id QueryID
|
2025-01-15 19:45:51 +00:00
|
|
|
|
|
|
|
|
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-12 00:59:58 +00:00
|
|
|
ctx.Set(PlaceholderAuthScopes, []string{})
|
|
|
|
|
|
2025-01-15 19:45:51 +00:00
|
|
|
// Invoke the callback with all the unmarshaled arguments
|
|
|
|
|
err = w.Handler.TestQuery(ctx, id)
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This is a simple interface which specifies echo.Route addition functions which
|
|
|
|
|
// are present on both echo.Echo and echo.Group, since we want to allow using
|
|
|
|
|
// either of them for path registration
|
|
|
|
|
type EchoRouter interface {
|
|
|
|
|
CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
|
|
|
|
|
DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
|
|
|
|
|
GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
|
|
|
|
|
HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
|
|
|
|
|
OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
|
|
|
|
|
PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
|
|
|
|
|
POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
|
|
|
|
|
PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
|
|
|
|
|
TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RegisterHandlers adds each server route to the EchoRouter.
|
|
|
|
|
func RegisterHandlers(router EchoRouter, si ServerInterface) {
|
|
|
|
|
RegisterHandlersWithBaseURL(router, si, "")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Registers handlers, and prepends BaseURL to the paths, so that the paths
|
|
|
|
|
// can be served under a prefix.
|
|
|
|
|
func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {
|
|
|
|
|
|
|
|
|
|
wrapper := ServerInterfaceWrapper{
|
|
|
|
|
Handler: si,
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-24 14:52:56 +00:00
|
|
|
router.POST(baseURL+"/client", wrapper.CreateClient)
|
|
|
|
|
router.GET(baseURL+"/client/:id", wrapper.GetClient)
|
|
|
|
|
router.PATCH(baseURL+"/client/:id", wrapper.UpdateClient)
|
2025-03-10 11:03:00 +00:00
|
|
|
router.GET(baseURL+"/client/:id/collector", wrapper.GetCollectorByClientId)
|
2025-03-10 13:00:57 +00:00
|
|
|
router.PATCH(baseURL+"/client/:id/collector", wrapper.SetCollectorByClientId)
|
2025-03-10 11:03:00 +00:00
|
|
|
router.GET(baseURL+"/client/:id/documents", wrapper.ListDocumentsByClientId)
|
|
|
|
|
router.POST(baseURL+"/client/:id/export", wrapper.TriggerExport)
|
|
|
|
|
router.GET(baseURL+"/client/:id/status", wrapper.GetStatusByClientId)
|
2025-03-11 16:31:06 +00:00
|
|
|
router.GET(baseURL+"/export/:id", wrapper.ExportState)
|
2025-01-24 14:52:56 +00:00
|
|
|
router.GET(baseURL+"/query", wrapper.ListQueries)
|
|
|
|
|
router.POST(baseURL+"/query", wrapper.CreateQuery)
|
|
|
|
|
router.GET(baseURL+"/query/:id", wrapper.GetQuery)
|
|
|
|
|
router.PATCH(baseURL+"/query/:id", wrapper.UpdateQuery)
|
|
|
|
|
router.POST(baseURL+"/query/:id/test", wrapper.TestQuery)
|
2025-01-15 19:45:51 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Base64 encoded, gzipped, json marshaled Swagger object
|
|
|
|
|
var swaggerSpec = []string{
|
|
|
|
|
|
2025-03-12 00:59:58 +00:00
|
|
|
"H4sIAAAAAAAC/+xbaXMjt9H+Kyi8/mbeh0jprXyQpbWLyUa7WWlTTnYVFjjTJGEPZygAI4ne4n9P4ZoT",
|
|
|
|
|
"Qw654tou5ZsoXI3uBw8a3T1fsBet1lEIoeD44gteAvGBqT8/EAFv6YoK+cMH7jG6FjQK8YVqQoFsQzSc",
|
|
|
|
|
"R2xFZAOiIdI/0GesWv//iYZ+9PQXQVfQ1H9/xriB4Zms1gHgC9ztdGynsw5uYO4tYUXkiivy/BbChVji",
|
|
|
|
|
"i36vgddECGBy8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ATYjriNi/hvHu0H+K2RNRlanLqoLAawu3JTbJxdjKLHXQRZck",
|
|
|
|
|
"sQ/LCmRorkZS4OTstjsloIP4ttbWxtRs3j0pgzgiS6CB+NqTBAfxUFuYiqivwKnzHn6jqikVjekaqjjU",
|
|
|
|
|
"H6tVXcn5svtC1AO4ODlqsyViFdAt1IQdEvjonEJYU8blklbLyOPgNYQJ1W73I1/Nyx4txgvFNizyYy+p",
|
|
|
|
|
"Y1GlMzEL8AVeCrHmF+22H3m/bVpetGo/dhXyzTrFmd5Z7EoPLlBcJB049R7maUFO/oG9bdScxgbJszMV",
|
|
|
|
|
"A+d1J0vD6clcpThq3blSj93MlNN+3Vn0CzIzS/7puL3f/jcAAP//x4FEowZKAAA=",
|
2025-01-15 19:45:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GetSwagger returns the content of the embedded swagger specification file
|
|
|
|
|
// or error if failed to decode
|
|
|
|
|
func decodeSpec() ([]byte, error) {
|
|
|
|
|
zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, ""))
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, fmt.Errorf("error base64 decoding spec: %w", err)
|
|
|
|
|
}
|
|
|
|
|
zr, err := gzip.NewReader(bytes.NewReader(zipped))
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, fmt.Errorf("error decompressing spec: %w", err)
|
|
|
|
|
}
|
|
|
|
|
var buf bytes.Buffer
|
|
|
|
|
_, err = buf.ReadFrom(zr)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, fmt.Errorf("error decompressing spec: %w", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return buf.Bytes(), nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var rawSpec = decodeSpecCached()
|
|
|
|
|
|
|
|
|
|
// a naive cached of a decoded swagger spec
|
|
|
|
|
func decodeSpecCached() func() ([]byte, error) {
|
|
|
|
|
data, err := decodeSpec()
|
|
|
|
|
return func() ([]byte, error) {
|
|
|
|
|
return data, err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
|
|
|
|
|
func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
|
|
|
|
|
res := make(map[string]func() ([]byte, error))
|
|
|
|
|
if len(pathToFile) > 0 {
|
|
|
|
|
res[pathToFile] = rawSpec
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return res
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GetSwagger returns the Swagger specification corresponding to the generated code
|
|
|
|
|
// in this file. The external references of Swagger specification are resolved.
|
|
|
|
|
// The logic of resolving external references is tightly connected to "import-mapping" feature.
|
|
|
|
|
// Externally referenced files must be embedded in the corresponding golang packages.
|
|
|
|
|
// Urls can be supported but this task was out of the scope.
|
|
|
|
|
func GetSwagger() (swagger *openapi3.T, err error) {
|
|
|
|
|
resolvePath := PathToRawSpec("")
|
|
|
|
|
|
|
|
|
|
loader := openapi3.NewLoader()
|
|
|
|
|
loader.IsExternalRefsAllowed = true
|
|
|
|
|
loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
|
|
|
|
|
pathToFile := url.String()
|
|
|
|
|
pathToFile = path.Clean(pathToFile)
|
|
|
|
|
getSpec, ok := resolvePath[pathToFile]
|
|
|
|
|
if !ok {
|
|
|
|
|
err1 := fmt.Errorf("path not found: %s", pathToFile)
|
|
|
|
|
return nil, err1
|
|
|
|
|
}
|
|
|
|
|
return getSpec()
|
|
|
|
|
}
|
|
|
|
|
var specData []byte
|
|
|
|
|
specData, err = rawSpec()
|
|
|
|
|
if err != nil {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
swagger, err = loader.LoadFromData(specData)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
return
|
|
|
|
|
}
|