similapi

package
v0.104.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package similapi provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.16.2 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

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 PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

func RegisterHandlers

func RegisterHandlers(router gin.IRouter, si ServerInterface)

RegisterHandlers creates http.Handler with routing matching OpenAPI spec.

func RegisterHandlersWithOptions

func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions)

RegisterHandlersWithOptions creates http.Handler with additional options

Types

type ConditionFilter added in v0.100.0

type ConditionFilter = string

ConditionFilter defines model for ConditionFilter.

type CreateFormatJSONRequestBody

type CreateFormatJSONRequestBody = Format

CreateFormatJSONRequestBody defines body for CreateFormat for application/json ContentType.

type CreateNodeRecordsJSONRequestBody added in v0.80.0

type CreateNodeRecordsJSONRequestBody = CreateRecordsRequest

CreateNodeRecordsJSONRequestBody defines body for CreateNodeRecords for application/json ContentType.

type CreateNodeRecordsMultipartBody added in v0.80.0

type CreateNodeRecordsMultipartBody struct {
	// File The document binary data in the specified format.
	File *openapi_types.File `json:"file,omitempty"`

	// Meta The object is used for records creation.
	Meta *CreateRecordsRequest `json:"meta,omitempty"`
}

CreateNodeRecordsMultipartBody defines parameters for CreateNodeRecords.

type CreateNodeRecordsMultipartRequestBody added in v0.80.0

type CreateNodeRecordsMultipartRequestBody CreateNodeRecordsMultipartBody

CreateNodeRecordsMultipartRequestBody defines body for CreateNodeRecords for multipart/form-data ContentType.

type CreateRecordsRequest added in v0.80.0

type CreateRecordsRequest struct {
	// Document The binary data for the document of the specified format.
	Document []byte `json:"document"`

	// NodeType The object describes the index node type.
	NodeType NodeType `json:"nodeType"`

	// Parser The parser name (format name) to be used for the document body.
	Parser string `json:"parser"`

	// RankMultiplier The priority coefficient (must be >= 1.0) of the records within a search result set, the value is overridden by the rankMultiplier value specified for an individual record.
	RankMultiplier float32 `json:"rankMultiplier"`

	// Records The list of records that must be added to the node.
	Records []Record `json:"records"`

	// Tags The object describes the node tags.
	Tags Tags `json:"tags"`
}

CreateRecordsRequest The object is used for records creation.

type CreateRecordsResult added in v0.80.0

type CreateRecordsResult struct {
	// NodesCreated The list of nodes created.
	NodesCreated []Node `json:"nodesCreated"`

	// RecordsCreated The number of records created.
	RecordsCreated int `json:"recordsCreated"`
}

CreateRecordsResult The object is used as a response of the records creation request.

type CreatedAfterFilter added in v0.80.0

type CreatedAfterFilter = time.Time

CreatedAfterFilter defines model for CreatedAfterFilter.

type CreatedBeforeFilter added in v0.80.0

type CreatedBeforeFilter = time.Time

CreatedBeforeFilter defines model for CreatedBeforeFilter.

type DeleteNodeParams added in v0.98.0

type DeleteNodeParams struct {
	// Force force flag specifies whether the operation will force the request.
	Force *Force `form:"force,omitempty" json:"force,omitempty"`
}

DeleteNodeParams defines parameters for DeleteNode.

type DeleteNodesJSONRequestBody added in v0.98.0

type DeleteNodesJSONRequestBody = DeleteNodesRequest

DeleteNodesJSONRequestBody defines body for DeleteNodes for application/json ContentType.

type DeleteNodesRequest added in v0.98.0

type DeleteNodesRequest struct {
	// FilterConditions The filter conditions. The filters support `and`, `or` and `not` conditions for `format`, `path` and `tag("name")`, for instance, `tag("public") = "true" and format = "spreadsheetsData" and (path = "/orgs/1234/balance.xlsx" or path like "/orgs/%"))`.
	FilterConditions string `json:"filterConditions"`

	// Force The flag allows to delete children of a matched node, even if they don't meet the filter criteria
	Force bool `json:"force"`
}

DeleteNodesRequest The object is used to delete multiple nodes at a time

type Force added in v0.98.0

type Force = bool

Force defines model for Force.

type Format

type Format struct {
	// Basis The format basis specifies format dimensions.
	Basis []byte `json:"basis"`

	// Name The format name, it is used as the format identifier.
	Name string `json:"name"`
}

Format The object describes a data format.

type FormatFilter added in v0.80.0

type FormatFilter = string

FormatFilter defines model for FormatFilter.

type FormatId

type FormatId = string

FormatId defines model for FormatId.

type Formats

type Formats struct {
	// Formats Contains a list of formats.
	Formats []Format `json:"formats"`
}

Formats The object is used as a response of the formats list request.

type GinServerOptions

type GinServerOptions struct {
	BaseURL      string
	Middlewares  []MiddlewareFunc
	ErrorHandler func(*gin.Context, error, int)
}

GinServerOptions provides options for the Gin server.

type Limit

type Limit = int

Limit defines model for Limit.

type ListNodeRecordsParams added in v0.80.0

type ListNodeRecordsParams struct {
	// Format The format specifies the format to filter the records by.
	Format *FormatFilter `form:"format,omitempty" json:"format,omitempty"`

	// CreatedAfter The createdAfter specifies the lowest creation time (exclusive) the resulting records can have.
	CreatedAfter *CreatedAfterFilter `form:"createdAfter,omitempty" json:"createdAfter,omitempty"`

	// CreatedBefore The createdBefore specifies the greatest creation time (exclusive) the resulting records can have.
	CreatedBefore *CreatedBeforeFilter `form:"createdBefore,omitempty" json:"createdBefore,omitempty"`

	// PageId The pageId specifies from which page to start return results.
	PageId *PageId `form:"pageId,omitempty" json:"pageId,omitempty"`

	// Limit The limit defines the max number of objects returned per page.
	Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"`
}

ListNodeRecordsParams defines parameters for ListNodeRecords.

type ListNodesParams added in v0.80.0

type ListNodesParams struct {
	// Condition The condition contatins the simila QL expression to select nodes by the filter
	Condition *ConditionFilter `form:"condition,omitempty" json:"condition,omitempty"`

	// Offset The offset defines the number of the objects that should be skipped in the result response
	Offset *Offset `form:"offset,omitempty" json:"offset,omitempty"`

	// Limit The limit defines the max number of objects returned per page.
	Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"`
}

ListNodesParams defines parameters for ListNodes.

type ListNodesResult added in v0.80.0

type ListNodesResult struct {
	// Items The list of nodes.
	Items []Node `json:"items"`
}

ListNodesResult The object is used as a response of the nodes list request.

type ListRecordsResult added in v0.80.0

type ListRecordsResult struct {
	// NextPageId The id of the next page for getting the rest of the records.
	NextPageId *string `json:"nextPageId,omitempty"`

	// Records The list of found records.
	Records *[]Record `json:"records,omitempty"`

	// Total The total number of found records.
	Total int `json:"total"`
}

ListRecordsResult The object is used a response to the list records request.

type MiddlewareFunc

type MiddlewareFunc func(c *gin.Context)

type Node added in v0.80.0

type Node struct {
	// Name The node name, must be unique among the siblings in the tree.
	Name string `json:"name"`

	// Path The node path, does not include the name part.
	Path string `json:"path"`

	// Tags The object describes the node tags.
	Tags Tags `json:"tags"`

	// Type The object describes the index node type.
	Type NodeType `json:"type"`
}

Node The object describes the index node.

type NodeType added in v0.80.0

type NodeType string

NodeType The object describes the index node type.

const (
	Document NodeType = "document"
	Folder   NodeType = "folder"
)

Defines values for NodeType.

type Offset added in v0.100.0

type Offset = int

Offset defines model for Offset.

type PageId

type PageId = string

PageId defines model for PageId.

type PatchNodeRecordsJSONRequestBody added in v0.80.0

type PatchNodeRecordsJSONRequestBody = PatchRecordsRequest

PatchNodeRecordsJSONRequestBody defines body for PatchNodeRecords for application/json ContentType.

type PatchRecordsRequest

type PatchRecordsRequest struct {
	// DeleteRecords The records to be deleted for the node.
	DeleteRecords []Record `json:"deleteRecords"`

	// UpsertRecords The records to be upserted for the node.
	UpsertRecords []Record `json:"upsertRecords"`
}

PatchRecordsRequest The object is used to upsert and delete the node records.

type PatchRecordsResult

type PatchRecordsResult struct {
	// Deleted The number of deleted records.
	Deleted int `json:"deleted"`

	// Upserted The number of upserted records.
	Upserted int `json:"upserted"`
}

PatchRecordsResult The object is used as a response to the patch records request.

type Path added in v0.80.0

type Path = string

Path defines model for Path.

type Record

type Record struct {
	// Format The format of the record.
	Format string `json:"format"`

	// Id The record identifier within the node.
	Id string `json:"id"`

	// RankMultiplier The priority coefficient (must be >= 1.0) of the record within a search result set.
	RankMultiplier float32 `json:"rankMultiplier"`

	// Segment The searchable text for the record.
	Segment string `json:"segment"`

	// Vector The vector data for the segment.
	Vector []byte `json:"vector"`
}

Record The object contains information about the index record.

type SearchJSONRequestBody

type SearchJSONRequestBody = SearchRecordsRequest

SearchJSONRequestBody defines body for Search for application/json ContentType.

type SearchRecordsRequest added in v0.80.0

type SearchRecordsRequest struct {
	// FilterConditions The filter conditions. The filters support `and`, `or` and `not` conditions for `format`, `path` and `tag("name")`, for instance, `tag("public") = "true" and format = "spreadsheetsData" and (path = "/orgs/1234/balance.xlsx" or path like "/orgs/%")`.
	FilterConditions string `json:"filterConditions"`

	// GroupByPathOff The flag turns off results grouping by path.
	GroupByPathOff bool `json:"groupByPathOff"`

	// Limit The maximum number of records per page.
	Limit int `json:"limit"`

	// Offset The number of records to skip before start returning results.
	Offset int `json:"offset"`

	// TextQuery The text query. The query must be formed in accordance with the query language of the underlying search engine.
	TextQuery string `json:"textQuery"`
}

SearchRecordsRequest The object is used to perform search across the index records.

type SearchRecordsResult added in v0.80.0

type SearchRecordsResult struct {
	// Items The found index records.
	Items []SearchRecordsResultItem `json:"items"`

	// Total The total number of found records.
	Total int `json:"total"`
}

SearchRecordsResult The object is used as a response to the search records request.

type SearchRecordsResultItem added in v0.80.0

type SearchRecordsResultItem struct {
	// MatchedKeywords The matched keywords within the record.
	MatchedKeywords []string `json:"matchedKeywords"`

	// Path The path of the record.
	Path string `json:"path"`

	// Record The object contains information about the index record.
	Record Record `json:"record"`

	// Score The relevancy score of the record.
	Score float32 `json:"score"`
}

SearchRecordsResultItem The object is used as an item in the search records response.

type ServerInterface

type ServerInterface interface {
	// List formats
	// (GET /formats)
	ListFormats(c *gin.Context)
	// Create new format
	// (POST /formats)
	CreateFormat(c *gin.Context)
	// Delete format
	// (DELETE /formats/{formatId})
	DeleteFormat(c *gin.Context, formatId FormatId)
	// Get format
	// (GET /formats/{formatId})
	GetFormat(c *gin.Context, formatId FormatId)
	// Delete nodes
	// (DELETE /nodes)
	DeleteNodes(c *gin.Context)
	// List nodes
	// (GET /nodes)
	ListNodes(c *gin.Context, params ListNodesParams)
	// Delete node
	// (DELETE /nodes/{path})
	DeleteNode(c *gin.Context, path Path, params DeleteNodeParams)
	// Update node
	// (PUT /nodes/{path})
	UpdateNode(c *gin.Context, path Path)
	// List node records
	// (GET /nodes/{path}/records)
	ListNodeRecords(c *gin.Context, path Path, params ListNodeRecordsParams)
	// Patch node records
	// (PATCH /nodes/{path}/records)
	PatchNodeRecords(c *gin.Context, path Path)
	// Create node records
	// (POST /nodes/{path}/records)
	CreateNodeRecords(c *gin.Context, path Path)
	// Health check
	// (GET /ping)
	Ping(c *gin.Context)

	// (POST /search)
	Search(c *gin.Context)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandler       func(*gin.Context, error, int)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) CreateFormat

func (siw *ServerInterfaceWrapper) CreateFormat(c *gin.Context)

CreateFormat operation middleware

func (*ServerInterfaceWrapper) CreateNodeRecords added in v0.80.0

func (siw *ServerInterfaceWrapper) CreateNodeRecords(c *gin.Context)

CreateNodeRecords operation middleware

func (*ServerInterfaceWrapper) DeleteFormat

func (siw *ServerInterfaceWrapper) DeleteFormat(c *gin.Context)

DeleteFormat operation middleware

func (*ServerInterfaceWrapper) DeleteNode added in v0.80.0

func (siw *ServerInterfaceWrapper) DeleteNode(c *gin.Context)

DeleteNode operation middleware

func (*ServerInterfaceWrapper) DeleteNodes added in v0.98.0

func (siw *ServerInterfaceWrapper) DeleteNodes(c *gin.Context)

DeleteNodes operation middleware

func (*ServerInterfaceWrapper) GetFormat

func (siw *ServerInterfaceWrapper) GetFormat(c *gin.Context)

GetFormat operation middleware

func (*ServerInterfaceWrapper) ListFormats added in v0.80.0

func (siw *ServerInterfaceWrapper) ListFormats(c *gin.Context)

ListFormats operation middleware

func (*ServerInterfaceWrapper) ListNodeRecords added in v0.80.0

func (siw *ServerInterfaceWrapper) ListNodeRecords(c *gin.Context)

ListNodeRecords operation middleware

func (*ServerInterfaceWrapper) ListNodes added in v0.80.0

func (siw *ServerInterfaceWrapper) ListNodes(c *gin.Context)

ListNodes operation middleware

func (*ServerInterfaceWrapper) PatchNodeRecords added in v0.80.0

func (siw *ServerInterfaceWrapper) PatchNodeRecords(c *gin.Context)

PatchNodeRecords operation middleware

func (*ServerInterfaceWrapper) Ping

func (siw *ServerInterfaceWrapper) Ping(c *gin.Context)

Ping operation middleware

func (*ServerInterfaceWrapper) Search

func (siw *ServerInterfaceWrapper) Search(c *gin.Context)

Search operation middleware

func (*ServerInterfaceWrapper) UpdateNode added in v0.80.0

func (siw *ServerInterfaceWrapper) UpdateNode(c *gin.Context)

UpdateNode operation middleware

type Tags added in v0.50.0

type Tags map[string]string

Tags The object describes the node tags.

type TagsFilter added in v0.80.0

type TagsFilter = Tags

TagsFilter The object describes the node tags.

type UpdateNodeJSONRequestBody added in v0.80.0

type UpdateNodeJSONRequestBody = Node

UpdateNodeJSONRequestBody defines body for UpdateNode for application/json ContentType.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL