Documentation ¶
Index ¶
- Constants
- func CreateCollectionHandler(appState *models.AppState) http.HandlerFunc
- func CreateCollectionIndexHandler(appState *models.AppState) http.HandlerFunc
- func CreateDocumentsHandler(appState *models.AppState) http.HandlerFunc
- func CreateSessionHandler(appState *models.AppState) http.HandlerFunc
- func CreateUserHandler(appState *models.AppState) http.HandlerFunc
- func DeleteCollectionHandler(appState *models.AppState) http.HandlerFunc
- func DeleteDocumentHandler(appState *models.AppState) http.HandlerFunc
- func DeleteDocumentListHandler(appState *models.AppState) http.HandlerFunc
- func DeleteMemoryHandler(appState *models.AppState) http.HandlerFunc
- func DeleteUserHandler(appState *models.AppState) http.HandlerFunc
- func GetCollectionHandler(appState *models.AppState) http.HandlerFunc
- func GetCollectionListHandler(appState *models.AppState) http.HandlerFunc
- func GetDocumentHandler(appState *models.AppState) http.HandlerFunc
- func GetDocumentListHandler(appState *models.AppState) http.HandlerFunc
- func GetMemoryHandler(appState *models.AppState) http.HandlerFunc
- func GetMessageHandler(appState *models.AppState) http.HandlerFunc
- func GetMessagesForSessionHandler(appState *models.AppState) http.HandlerFunc
- func GetSessionHandler(appState *models.AppState) http.HandlerFunc
- func GetSessionListHandler(appState *models.AppState) http.HandlerFunc
- func GetUserHandler(appState *models.AppState) http.HandlerFunc
- func ListAllUsersHandler(appState *models.AppState) http.HandlerFunc
- func ListUserSessionsHandler(appState *models.AppState) http.HandlerFunc
- func PostMemoryHandler(appState *models.AppState) http.HandlerFunc
- func SearchDocumentsHandler(appState *models.AppState) http.HandlerFunc
- func SearchMemoryHandler(appState *models.AppState) http.HandlerFunc
- func UpdateCollectionHandler(appState *models.AppState) http.HandlerFunc
- func UpdateDocumentHandler(appState *models.AppState) http.HandlerFunc
- func UpdateDocumentListHandler(appState *models.AppState) http.HandlerFunc
- func UpdateMessageMetadataHandler(appState *models.AppState) http.HandlerFunc
- func UpdateSessionHandler(appState *models.AppState) http.HandlerFunc
- func UpdateUserHandler(appState *models.AppState) http.HandlerFunc
- type APIError
Constants ¶
const DefaultMessageLimit = 100
const OKResponse = "OK"
Variables ¶
This section is empty.
Functions ¶
func CreateCollectionHandler ¶
func CreateCollectionHandler(appState *models.AppState) http.HandlerFunc
CreateCollectionHandler godoc
@Summary Creates a new DocumentCollection @Description If a collection with the same name already exists, an error will be returned. @Tags collection @Accept json @Produce json @Param collectionName path string true "Name of the Document Collection" @Param collection body models.CreateDocumentCollectionRequest true "Document Collection" @Success 200 {object} string "OK" @Failure 400 {object} APIError "Bad Request" @Failure 401 {object} APIError "Unauthorized" @Failure 404 {object} APIError "Not Found" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/collection/{collectionName} [post]
func CreateCollectionIndexHandler ¶
func CreateCollectionIndexHandler(appState *models.AppState) http.HandlerFunc
CreateCollectionIndexHandler godoc
@Summary Creates an index for a DocumentCollection @Description Creates an index for the specified DocumentCollection to improve query performance. @Tags collection @Accept json @Produce json @Param collectionName path string true "Name of the Document Collection" @Param force query bool false "Force index creation, even if there are too few documents to index" @Success 200 {object} string "OK" @Failure 400 {object} APIError "Bad Request" @Failure 401 {object} APIError "Unauthorized" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/collection/{collectionName}/index/create [post]
func CreateDocumentsHandler ¶
func CreateDocumentsHandler(appState *models.AppState) http.HandlerFunc
CreateDocumentsHandler godoc
@Summary Creates Multiple Documents in a DocumentCollection @Description Creates Documents in a specified DocumentCollection and returns their UUIDs. @Tags document @Accept json @Produce json @Param collectionName path string true "Name of the Document Collection" @Param documents body []models.CreateDocumentRequest true "Array of Documents to be created" @Success 200 {array} uuid.UUID "OK" @Failure 400 {object} APIError "Bad Request" @Failure 401 {object} APIError "Unauthorized" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/collection/{collectionName}/document [post]
func CreateSessionHandler ¶
func CreateSessionHandler(appState *models.AppState) http.HandlerFunc
CreateSessionHandler godoc
@Summary Add a session @Description add session by id @Tags session @Accept json @Produce json @Param session body models.CreateSessionRequest true "Session" @Success 201 {object} models.Session @Failure 400 {object} APIError "Bad Request" @failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/sessions [post]
func CreateUserHandler ¶
func CreateUserHandler(appState *models.AppState) http.HandlerFunc
CreateUserHandler godoc
@Summary Add a user @Description add user by id @Tags user @Accept json @Produce json @Param user body models.CreateUserRequest true "User" @Success 201 {object} models.User @Failure 400 {object} APIError "Bad Request" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/user [post]
func DeleteCollectionHandler ¶
func DeleteCollectionHandler(appState *models.AppState) http.HandlerFunc
DeleteCollectionHandler godoc
@Summary Deletes a DocumentCollection @Description If a collection with the same name already exists, it will be overwritten. @Tags collection @Accept json @Produce json @Param collectionName path string true "Name of the Document Collection" @Success 200 {object} string "OK" @Failure 400 {object} APIError "Bad Request" @Failure 401 {object} APIError "Unauthorized" @Failure 404 {object} APIError "Not Found" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/collection/{collectionName} [delete]
func DeleteDocumentHandler ¶
func DeleteDocumentHandler(appState *models.AppState) http.HandlerFunc
DeleteDocumentHandler godoc
@Summary Delete Document from a DocumentCollection by UUID @Description Delete specified Document from a DocumentCollection. @Tags document @Accept json @Produce json @Param collectionName path string true "Name of the Document Collection" @Param documentUUID path string true "UUID of the Document to be deleted" @Success 200 {object} string "OK" @Failure 400 {object} APIError "Bad Request" @Failure 401 {object} APIError "Unauthorized" @Failure 404 {object} APIError "Document Not Found" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/collection/{collectionName}/document/uuid/{documentUUID} [delete]
func DeleteDocumentListHandler ¶
func DeleteDocumentListHandler(appState *models.AppState) http.HandlerFunc
DeleteDocumentListHandler godoc
@Summary Batch Deletes Documents from a DocumentCollection by UUID @Description Deletes specified Documents from a DocumentCollection. @Tags document @Accept json @Produce json @Param collectionName path string true "Name of the Document Collection" @Param documentUUIDs body []uuid.UUID true "UUIDs of the Documents to be deleted" @Success 200 {object} string "OK" @Failure 400 {object} APIError "Bad Request" @Failure 401 {object} APIError "Unauthorized" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/collection/{collectionName}/document/batchDelete [post]
func DeleteMemoryHandler ¶
func DeleteMemoryHandler(appState *models.AppState) http.HandlerFunc
DeleteMemoryHandler godoc
@Summary Delete memory messages for a given session @Description delete memory messages by session id @Tags memory @Accept json @Produce json @Param sessionId path string true "Session ID" @Success 200 {string} string "OK" @Failure 404 {object} APIError "Not Found" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/sessions/{sessionId}/memory [delete]
func DeleteUserHandler ¶
func DeleteUserHandler(appState *models.AppState) http.HandlerFunc
DeleteUserHandler godoc
@Summary Delete a user @Description delete user by id @Tags user @Accept json @Produce json @Param userId path string true "User ID" @Success 200 {string} string "OK" @Failure 404 {object} APIError "Not Found" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/user/{userId} [delete]
func GetCollectionHandler ¶
func GetCollectionHandler(appState *models.AppState) http.HandlerFunc
GetCollectionHandler godoc
@Summary Gets a DocumentCollection @Description Returns a DocumentCollection if it exists. @Tags collection @Accept json @Produce json @Param collectionName path string true "Name of the Document Collection" @Success 200 {object} models.DocumentCollectionResponse "OK" @Failure 400 {object} APIError "Bad Request" @Failure 401 {object} APIError "Unauthorized" @Failure 404 {object} APIError "Not Found" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/collection/{collectionName} [get]
func GetCollectionListHandler ¶
func GetCollectionListHandler(appState *models.AppState) http.HandlerFunc
GetCollectionListHandler godoc
@Summary Gets a list of DocumentCollections @Description Returns a list of all DocumentCollections. @Tags collection @Accept json @Produce json @Success 200 {array} []models.DocumentCollectionResponse "OK" @Failure 401 {object} APIError "Unauthorized" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/collection [get]
func GetDocumentHandler ¶
func GetDocumentHandler(appState *models.AppState) http.HandlerFunc
GetDocumentHandler godoc
@Summary Gets a Document from a DocumentCollection by UUID @Description Returns specified Document from a DocumentCollection. @Tags document @Accept json @Produce json @Param collectionName path string true "Name of the Document Collection" @Param documentUUID path string true "UUID of the Document to be updated" @Success 200 {object} models.DocumentResponse "OK" @Failure 400 {object} APIError "Bad Request" @Failure 401 {object} APIError "Unauthorized" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/collection/{collectionName}/document/uuid/{documentUUID} [get]
func GetDocumentListHandler ¶
func GetDocumentListHandler(appState *models.AppState) http.HandlerFunc
GetDocumentListHandler godoc
@Summary Batch Gets Documents from a DocumentCollection @Description Returns Documents from a DocumentCollection specified by UUID or ID. @Tags document @Accept json @Produce json @Param collectionName path string true "Name of the Document Collection" @Param documentRequest body models.GetDocumentListRequest true "UUIDs and IDs of the Documents to be fetched" @Success 200 {array} []models.DocumentResponse "OK" @Failure 400 {object} APIError "Bad Request" @Failure 401 {object} APIError "Unauthorized" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/collection/{collectionName}/document/batchGet [post]
func GetMemoryHandler ¶
func GetMemoryHandler(appState *models.AppState) http.HandlerFunc
GetMemoryHandler godoc
@Summary Returns a memory (latest summary and list of messages) for a given session @Description get memory by session id @Tags memory @Accept json @Produce json @Param sessionId path string true "Session ID" @Param lastn query integer false "Last N messages. Overrides memory_window configuration" @Success 200 {object} []models.Memory @Failure 404 {object} APIError "Not Found" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/sessions/{sessionId}/memory [get]
func GetMessageHandler ¶ added in v0.21.0
func GetMessageHandler(appState *models.AppState) http.HandlerFunc
GetMessageHandler retrieves a specific message.
This function handles HTTP GET requests at the /api/v1/session/{sessionId}/message/{messageId} endpoint. It uses the session ID and message ID provided in the URL to find the specific message.
The function responds with the found message as a JSON object. If the session ID or message ID does not exist, the function responds with a 404 Not Found status code. If there is an error while fetching the message, the function responds with a 500 Internal Server Error status code.
@Summary Retrieves a specific message @Description get message by session id and message id @Tags messages @Accept json @Produce json @Param sessionId path string true "Session ID" @Param messageId path string true "Message ID" @Success 200 {object} models.Message @Failure 404 {object} APIError "Not Found" @Failure 500 {object} APIError "Internal Server Error" @Router /api/v1/session/{sessionId}/message/{messageId} [get]
func GetMessagesForSessionHandler ¶ added in v0.21.0
func GetMessagesForSessionHandler(appState *models.AppState) http.HandlerFunc
GetMessagesForSessionHandler retrieves all messages for a specific session.
This function handles HTTP GET requests at the /api/v1/session/{sessionId}/messages endpoint. It uses the session ID provided in the URL to fetch all messages associated with that session.
The function responds with a JSON array of messages. Each message in the array includes its ID, content, and metadata. If the session ID does not exist, the function responds with a 404 Not Found status code. If there is an error while fetching the messages, the function responds with a 500 Internal Server Error status code.
@Summary Retrieves all messages for a specific session @Description get messages by session id @Tags messages @Accept json @Produce json @Param sessionId path string true "Session ID" @Success 200 {array} models.Message @Failure 404 {object} APIError "Not Found" @Failure 500 {object} APIError "Internal Server Error" @Router /api/v1/session/{sessionId}/messages [get]
func GetSessionHandler ¶
func GetSessionHandler(appState *models.AppState) http.HandlerFunc
GetSessionHandler godoc
@Summary Returns a session by ID @Description get session by id @Tags session @Accept json @Produce json @Param sessionId path string true "Session ID" @Success 200 {object} models.Session @Failure 404 {object} APIError "Not Found" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/sessions/{sessionId} [get]
func GetSessionListHandler ¶
func GetSessionListHandler(appState *models.AppState) http.HandlerFunc
GetSessionListHandler godoc
@Summary Returns all sessions @Description get all sessions with optional limit and cursor for pagination @Tags session @Accept json @Produce json @Param limit query integer false "Limit the number of results returned" @Param cursor query int64 false "Cursor for pagination" @Success 200 {array} []models.Session @Failure 400 {object} APIError "Bad Request" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/sessions [get]
func GetUserHandler ¶
func GetUserHandler(appState *models.AppState) http.HandlerFunc
GetUserHandler godoc
@Summary Returns a user by ID @Description get user by id @Tags user @Accept json @Produce json @Param userId path string true "User ID" @Success 200 {object} models.User @Failure 404 {object} APIError "Not Found" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/user/{userId} [get]
func ListAllUsersHandler ¶
func ListAllUsersHandler(appState *models.AppState) http.HandlerFunc
ListAllUsersHandler godoc
@Summary List all users @Description list all users with pagination @Tags user @Accept json @Produce json @Param limit query int false "Limit" @Param cursor query int64 false "Cursor" @Success 200 {array} []models.User "Successfully retrieved list of users" @Failure 400 {object} APIError "Bad Request" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/user [get]
func ListUserSessionsHandler ¶
func ListUserSessionsHandler(appState *models.AppState) http.HandlerFunc
ListUserSessionsHandler godoc
@Summary List all sessions for a user @Description list all sessions for a user by user id @Tags user @Accept json @Produce json @Param userId path string true "User ID" @Success 200 {array} models.Session @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/user/{userId}/sessions [get]
func PostMemoryHandler ¶
func PostMemoryHandler(appState *models.AppState) http.HandlerFunc
PostMemoryHandler godoc
@Summary Add memory messages to a given session @Description add memory messages by session id @Tags memory @Accept json @Produce json @Param sessionId path string true "Session ID" @Param memoryMessages body models.Memory true "Memory messages" @Success 200 {string} string "OK" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/sessions/{sessionId}/memory [post]
func SearchDocumentsHandler ¶
func SearchDocumentsHandler(appState *models.AppState) http.HandlerFunc
SearchDocumentsHandler godoc
@Summary Searches Documents in a DocumentCollection @Description Searches Documents in a DocumentCollection based on provided search criteria. @Tags document @Accept json @Produce json @Param collectionName path string true "Name of the Document Collection" @Param limit query int false "Limit the number of returned documents" @Param searchPayload body models.DocumentSearchPayload true "Search criteria" @Success 200 {object} []models.Document "OK" @Failure 400 {object} APIError "Bad Request" @Failure 401 {object} APIError "Unauthorized" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/collection/{collectionName}/search [post]
func SearchMemoryHandler ¶
func SearchMemoryHandler(appState *models.AppState) http.HandlerFunc
SearchMemoryHandler godoc
@Summary Search memory messages for a given session @Description search memory messages by session id and query @Tags search @Accept json @Produce json @Param sessionId path string true "Session ID" @Param limit query integer false "Limit the number of results returned" @Param searchPayload body models.MemorySearchPayload true "Search query" @Success 200 {object} []models.MemorySearchResult @Failure 404 {object} APIError "Not Found" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/sessions/{sessionId}/search [post]
func UpdateCollectionHandler ¶
func UpdateCollectionHandler(appState *models.AppState) http.HandlerFunc
UpdateCollectionHandler godoc
@Summary Updates a DocumentCollection @Tags collection @Accept json @Produce json @Param collectionName path string true "Name of the Document Collection" @Param collection body models.UpdateDocumentCollectionRequest true "Document Collection" @Success 200 {object} string "OK" @Failure 400 {object} APIError "Bad Request" @Failure 401 {object} APIError "Unauthorized" @Failure 404 {object} APIError "Not Found" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/collection/{collectionName} [patch]
func UpdateDocumentHandler ¶
func UpdateDocumentHandler(appState *models.AppState) http.HandlerFunc
UpdateDocumentHandler godoc
@Summary Updates a Document in a DocumentCollection by UUID @Tags document @Accept json @Produce json @Param collectionName path string true "Name of the Document Collection" @Param documentUUID path string true "UUID of the Document to be updated" @Param document body models.UpdateDocumentRequest true "Document to be updated" @Success 200 {object} string "OK" @Failure 400 {object} APIError "Bad Request" @Failure 401 {object} APIError "Unauthorized" @Failure 404 {object} APIError "Not Found" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/collection/{collectionName}/document/uuid/{documentUUID} [patch]
func UpdateDocumentListHandler ¶
func UpdateDocumentListHandler(appState *models.AppState) http.HandlerFunc
UpdateDocumentListHandler godoc
@Summary Batch Updates Documents in a DocumentCollection @Description Updates Documents in a specified DocumentCollection. @Tags document @Accept json @Produce json @Param collectionName path string true "Name of the Document Collection" @Param documents body []models.UpdateDocumentListRequest true "Array of Documents to be updated" @Success 200 {object} string "OK" @Failure 400 {object} APIError "Bad Request" @Failure 401 {object} APIError "Unauthorized" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/collection/{collectionName}/document/batchUpdate [patch]
func UpdateMessageMetadataHandler ¶ added in v0.21.0
func UpdateMessageMetadataHandler(appState *models.AppState) http.HandlerFunc
UpdateMessageMetadataHandler updates the metadata of a specific message.
This function handles HTTP PATCH requests at the /api/v1/session/{sessionId}/message/{messageId} endpoint. It uses the session ID and message ID provided in the URL to find the specific message. The new metadata is provided in the request body as a JSON object.
The function updates the message's metadata with the new metadata and saves the updated message back to the database. It then responds with the updated message as a JSON object.
@Summary Updates the metadata of a specific message @Description update message metadata by session id and message id @Tags messages @Accept json @Produce json @Param sessionId path string true "Session ID" @Param messageId path string true "Message ID" @Param body body models.Message true "New Metadata" @Success 200 {object} models.Message @Failure 404 {object} APIError "Not Found" @Failure 500 {object} APIError "Internal Server Error" @Router /api/v1/session/{sessionId}/message/{messageId} [patch]
func UpdateSessionHandler ¶
func UpdateSessionHandler(appState *models.AppState) http.HandlerFunc
UpdateSessionHandler godoc
@Summary Add a session @Description add session by id @Tags session @Accept json @Produce json @Param sessionId path string true "Session ID" @Param session body models.UpdateSessionRequest true "Session" @Success 200 {object} models.Session @Failure 400 {object} APIError "Bad Request" @Failure 404 {object} APIError "Not Found" @failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/sessions/{sessionId} [patch]
func UpdateUserHandler ¶
func UpdateUserHandler(appState *models.AppState) http.HandlerFunc
UpdateUserHandler godoc
@Summary Update a user @Description update user by id @Tags user @Accept json @Produce json @Param userId path string true "User ID" @Param user body models.UpdateUserRequest true "User" @Success 200 {object} models.User @Failure 400 {object} APIError "Bad Request" @Failure 404 {object} APIError "Not Found" @Failure 500 {object} APIError "Internal Server Error" @Security Bearer @Router /api/v1/user/{userId} [patch]