similapi

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 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.12.4 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.Engine, si ServerInterface) *gin.Engine

RegisterHandlers creates http.Handler with routing matching OpenAPI spec.

func RegisterHandlersWithOptions

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

RegisterHandlersWithOptions creates http.Handler with additional options

Types

type CreateFormatJSONRequestBody

type CreateFormatJSONRequestBody = Format

CreateFormatJSONRequestBody defines body for CreateFormat for application/json ContentType.

type CreateIndexJSONRequestBody

type CreateIndexJSONRequestBody = CreateIndexRequest

CreateIndexJSONRequestBody defines body for CreateIndex for application/json ContentType.

type CreateIndexMultipartBody

type CreateIndexMultipartBody struct {
	// File contains the binary data for the document of the specified format
	File *openapi_types.File `json:"file,omitempty"`

	// Meta The object describes a new index request.
	Meta *CreateIndexRequest `json:"meta,omitempty"`
}

CreateIndexMultipartBody defines parameters for CreateIndex.

type CreateIndexMultipartRequestBody

type CreateIndexMultipartRequestBody CreateIndexMultipartBody

CreateIndexMultipartRequestBody defines body for CreateIndex for multipart/form-data ContentType.

type CreateIndexRequest

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

	// Format the index format name
	Format string `json:"format"`

	// Id the new index identifier. It must not be more than 64 bytes long
	Id string `json:"id"`

	// Records the list of records that must be added to the new index.
	Records []Record `json:"records"`
	Tags    Tags     `json:"tags"`
}

CreateIndexRequest The object describes a new index request.

type CreatedAfter

type CreatedAfter = time.Time

CreatedAfter defines model for CreatedAfter.

type CreatedBefore

type CreatedBefore = time.Time

CreatedBefore defines model for CreatedBefore.

type Format

type Format struct {
	// Name The format name. It is used as the format identifier
	Name string `json:"name"`
}

Format The object describes a data format.

type FormatId

type FormatId = string

FormatId defines model for FormatId.

type FormatParam added in v0.50.0

type FormatParam = string

FormatParam defines model for FormatParam.

type Formats

type Formats struct {
	// Formats The list of all known formats
	Formats []Format `json:"formats"`
}

Formats The object is used as response of contact objects query request.

type GetIndexRecordsParams

type GetIndexRecordsParams struct {
	// PageId The pageId for the paging request
	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"`
}

GetIndexRecordsParams defines parameters for GetIndexRecords.

type GetIndexesParams

type GetIndexesParams struct {
	// CreatedAfter start of time interval in which items are queried
	CreatedAfter *CreatedAfter `form:"createdAfter,omitempty" json:"createdAfter,omitempty"`

	// CreatedBefore end of time interval in which items are queried
	CreatedBefore *CreatedBefore `form:"createdBefore,omitempty" json:"createdBefore,omitempty"`

	// StartIndexId The indexId for the first record
	StartIndexId *StartIndexId `form:"startIndexId,omitempty" json:"startIndexId,omitempty"`
	Format       *FormatParam  `form:"format,omitempty" json:"format,omitempty"`
	Tags         *TagsParam    `form:"tags,omitempty" json:"tags,omitempty"`

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

GetIndexesParams defines parameters for GetIndexes.

type GinServerOptions

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

GinServerOptions provides options for the Gin server.

type Index

type Index struct {
	CreatedAt time.Time `json:"createdAt"`
	Format    string    `json:"format"`
	Id        string    `json:"id"`
	Tags      Tags      `json:"tags"`
}

Index An index description

type IndexId

type IndexId = string

IndexId defines model for IndexId.

type Indexes

type Indexes struct {
	// Indexes The list of indexes
	Indexes []Index `json:"indexes"`

	// NextPageId the index Id for the next page, if presents
	NextPageId *string `json:"nextPageId,omitempty"`

	// Total total number of indexes that match the initial criteria
	Total int `json:"total"`
}

Indexes The object contains information about an index record.

type Limit

type Limit = int

Limit defines model for Limit.

type MiddlewareFunc

type MiddlewareFunc func(c *gin.Context)

type PageId

type PageId = string

PageId defines model for PageId.

type PatchIndexRecordsJSONRequestBody

type PatchIndexRecordsJSONRequestBody = PatchRecordsRequest

PatchIndexRecordsJSONRequestBody defines body for PatchIndexRecords for application/json ContentType.

type PatchRecordsRequest

type PatchRecordsRequest struct {
	DeleteRecords []Record `json:"deleteRecords"`
	Id            string   `json:"id"`
	UpsertRecords []Record `json:"upsertRecords"`
}

PatchRecordsRequest defines model for PatchRecordsRequest.

type PatchRecordsResult

type PatchRecordsResult struct {
	Deleted  int `json:"deleted"`
	Upserted int `json:"upserted"`
}

PatchRecordsResult defines model for PatchRecordsResult.

type PutIndexJSONRequestBody

type PutIndexJSONRequestBody = Index

PutIndexJSONRequestBody defines body for PutIndex for application/json ContentType.

type Record

type Record struct {
	// Id the record identifier within the index. The value must be unique for the index and it is defined by the format parser.
	Id string `json:"id"`

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

	// Vector contains the vector data for the record in the format basis. The format parser defines the basis and the field structure.
	Vector []byte `json:"vector"`
}

Record The object contains information about an index record.

type RecordsResult

type RecordsResult struct {
	NextPageId *string  `json:"nextPageId,omitempty"`
	Records    []Record `json:"records"`
	Total      int      `json:"total"`
}

RecordsResult defines model for RecordsResult.

type SearchJSONRequestBody

type SearchJSONRequestBody = SearchRequest

SearchJSONRequestBody defines body for Search for application/json ContentType.

type SearchRecord added in v0.50.0

type SearchRecord struct {
	IndexId string `json:"indexId"`

	// IndexRecord The object contains information about an index record.
	IndexRecord     Record   `json:"indexRecord"`
	MatchedKeywords []string `json:"matchedKeywords"`
	Score           float32  `json:"score"`
}

SearchRecord defines model for SearchRecord.

type SearchRequest added in v0.50.0

type SearchRequest struct {
	Distinct     bool     `json:"distinct"`
	IndexIDs     []string `json:"indexIDs"`
	Limit        int      `json:"limit"`
	Offset       int      `json:"offset"`
	OrderByScore bool     `json:"orderByScore"`
	PageId       string   `json:"pageId"`
	Tags         Tags     `json:"tags"`
	Text         string   `json:"text"`
}

SearchRequest defines model for SearchRequest.

type SearchResult added in v0.50.0

type SearchResult struct {
	NextPageId *string        `json:"nextPageId,omitempty"`
	Records    []SearchRecord `json:"records"`
	Total      int            `json:"total"`
}

SearchResult defines model for SearchResult.

type ServerInterface

type ServerInterface interface {
	// Retreive all known formats
	// (GET /formats)
	GetFormats(c *gin.Context)
	// Create new format
	// (POST /formats)
	CreateFormat(c *gin.Context)

	// (DELETE /formats/{formatId})
	DeleteFormat(c *gin.Context, formatId FormatId)

	// (GET /formats/{formatId})
	GetFormat(c *gin.Context, formatId FormatId)
	// Retreive indexes
	// (GET /indexes)
	GetIndexes(c *gin.Context, params GetIndexesParams)
	// Create new index
	// (POST /indexes)
	CreateIndex(c *gin.Context)

	// (DELETE /indexes/{indexId})
	DeleteIndex(c *gin.Context, indexId IndexId)

	// (GET /indexes/{indexId})
	GetIndex(c *gin.Context, indexId IndexId)

	// (PUT /indexes/{indexId})
	PutIndex(c *gin.Context, indexId IndexId)

	// (GET /indexes/{indexId}/records)
	GetIndexRecords(c *gin.Context, indexId IndexId, params GetIndexRecordsParams)

	// (PATCH /indexes/{indexId}/records)
	PatchIndexRecords(c *gin.Context, indexId IndexId)

	// (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) CreateIndex

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

CreateIndex operation middleware

func (*ServerInterfaceWrapper) DeleteFormat

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

DeleteFormat operation middleware

func (*ServerInterfaceWrapper) DeleteIndex

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

DeleteIndex operation middleware

func (*ServerInterfaceWrapper) GetFormat

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

GetFormat operation middleware

func (*ServerInterfaceWrapper) GetFormats

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

GetFormats operation middleware

func (*ServerInterfaceWrapper) GetIndex

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

GetIndex operation middleware

func (*ServerInterfaceWrapper) GetIndexRecords

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

GetIndexRecords operation middleware

func (*ServerInterfaceWrapper) GetIndexes

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

GetIndexes operation middleware

func (*ServerInterfaceWrapper) PatchIndexRecords

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

PatchIndexRecords operation middleware

func (*ServerInterfaceWrapper) Ping

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

Ping operation middleware

func (*ServerInterfaceWrapper) PutIndex

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

PutIndex operation middleware

func (*ServerInterfaceWrapper) Search

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

Search operation middleware

type StartIndexId

type StartIndexId = string

StartIndexId defines model for StartIndexId.

type Tags added in v0.50.0

type Tags map[string]string

Tags defines model for Tags.

type TagsParam added in v0.50.0

type TagsParam = Tags

TagsParam defines model for TagsParam.

Jump to

Keyboard shortcuts

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