Skip to content

Commit ba8a8ce

Browse files
committed
docs: update api
1 parent ff7ad8a commit ba8a8ce

File tree

4 files changed

+269
-0
lines changed

4 files changed

+269
-0
lines changed

docs/api-reference/openapi.json

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,47 @@
734734
} ]
735735
}
736736
},
737+
"/session/{session_id}/get_learning_status" : {
738+
"get" : {
739+
"description" : "Get learning status for a session. Returns the count of space digested tasks and not space digested tasks. If the session is not connected to a space, returns 0 and 0.",
740+
"parameters" : [ {
741+
"description" : "Session ID",
742+
"in" : "path",
743+
"name" : "session_id",
744+
"required" : true,
745+
"schema" : {
746+
"format" : "uuid",
747+
"type" : "string"
748+
}
749+
} ],
750+
"responses" : {
751+
"200" : {
752+
"content" : {
753+
"application/json" : {
754+
"schema" : {
755+
"$ref" : "#/components/schemas/_session__session_id__get_learning_status_get_200_response"
756+
}
757+
}
758+
},
759+
"description" : "OK"
760+
}
761+
},
762+
"security" : [ {
763+
"BearerAuth" : [ ]
764+
} ],
765+
"summary" : "Get learning status",
766+
"tags" : [ "session" ],
767+
"x-code-samples" : [ {
768+
"label" : "Python",
769+
"lang" : "python",
770+
"source" : "from acontext import AcontextClient\n\nclient = AcontextClient(api_key='sk_project_token')\n\n# Get learning status\nresult = client.sessions.get_learning_status(session_id='session-uuid')\nprint(f\"Space digested: {result.space_digested_count}, Not digested: {result.not_space_digested_count}\")\n"
771+
}, {
772+
"label" : "JavaScript",
773+
"lang" : "javascript",
774+
"source" : "import { AcontextClient } from '@acontext/acontext';\n\nconst client = new AcontextClient({ apiKey: 'sk_project_token' });\n\n// Get learning status\nconst result = await client.sessions.getLearningStatus('session-uuid');\nconsole.log(`Space digested: ${result.space_digested_count}, Not digested: ${result.not_space_digested_count}`);\n"
775+
} ]
776+
}
777+
},
737778
"/session/{session_id}/messages" : {
738779
"get" : {
739780
"description" : "Get messages from session. Default format is openai. Can convert to acontext (original) or anthropic format.",
@@ -2059,6 +2100,17 @@
20592100
},
20602101
"type" : "object"
20612102
},
2103+
"httpclient.LearningStatusResponse" : {
2104+
"properties" : {
2105+
"not_space_digested_count" : {
2106+
"type" : "integer"
2107+
},
2108+
"space_digested_count" : {
2109+
"type" : "integer"
2110+
}
2111+
},
2112+
"type" : "object"
2113+
},
20622114
"httpclient.SearchResultBlockItem" : {
20632115
"properties" : {
20642116
"block_id" : {
@@ -2544,6 +2596,18 @@
25442596
"type" : "object"
25452597
} ]
25462598
},
2599+
"_session__session_id__get_learning_status_get_200_response" : {
2600+
"allOf" : [ {
2601+
"$ref" : "#/components/schemas/serializer.Response"
2602+
}, {
2603+
"properties" : {
2604+
"data" : {
2605+
"$ref" : "#/components/schemas/httpclient.LearningStatusResponse"
2606+
}
2607+
},
2608+
"type" : "object"
2609+
} ]
2610+
},
25472611
"_session__session_id__messages_get_200_response" : {
25482612
"allOf" : [ {
25492613
"$ref" : "#/components/schemas/serializer.Response"

src/server/api/go/docs/docs.go

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,68 @@ const docTemplate = `{
989989
]
990990
}
991991
},
992+
"/session/{session_id}/get_learning_status": {
993+
"get": {
994+
"security": [
995+
{
996+
"BearerAuth": []
997+
}
998+
],
999+
"description": "Get learning status for a session. Returns the count of space digested tasks and not space digested tasks. If the session is not connected to a space, returns 0 and 0.",
1000+
"consumes": [
1001+
"application/json"
1002+
],
1003+
"produces": [
1004+
"application/json"
1005+
],
1006+
"tags": [
1007+
"session"
1008+
],
1009+
"summary": "Get learning status",
1010+
"parameters": [
1011+
{
1012+
"type": "string",
1013+
"format": "uuid",
1014+
"description": "Session ID",
1015+
"name": "session_id",
1016+
"in": "path",
1017+
"required": true
1018+
}
1019+
],
1020+
"responses": {
1021+
"200": {
1022+
"description": "OK",
1023+
"schema": {
1024+
"allOf": [
1025+
{
1026+
"$ref": "#/definitions/serializer.Response"
1027+
},
1028+
{
1029+
"type": "object",
1030+
"properties": {
1031+
"data": {
1032+
"$ref": "#/definitions/httpclient.LearningStatusResponse"
1033+
}
1034+
}
1035+
}
1036+
]
1037+
}
1038+
}
1039+
},
1040+
"x-code-samples": [
1041+
{
1042+
"label": "Python",
1043+
"lang": "python",
1044+
"source": "from acontext import AcontextClient\n\nclient = AcontextClient(api_key='sk_project_token')\n\n# Get learning status\nresult = client.sessions.get_learning_status(session_id='session-uuid')\nprint(f\"Space digested: {result.space_digested_count}, Not digested: {result.not_space_digested_count}\")\n"
1045+
},
1046+
{
1047+
"label": "JavaScript",
1048+
"lang": "javascript",
1049+
"source": "import { AcontextClient } from '@acontext/acontext';\n\nconst client = new AcontextClient({ apiKey: 'sk_project_token' });\n\n// Get learning status\nconst result = await client.sessions.getLearningStatus('session-uuid');\nconsole.log(` + "`" + `Space digested: ${result.space_digested_count}, Not digested: ${result.not_space_digested_count}` + "`" + `);\n"
1050+
}
1051+
]
1052+
}
1053+
},
9921054
"/session/{session_id}/messages": {
9931055
"get": {
9941056
"security": [
@@ -2665,6 +2727,17 @@ const docTemplate = `{
26652727
}
26662728
}
26672729
},
2730+
"httpclient.LearningStatusResponse": {
2731+
"type": "object",
2732+
"properties": {
2733+
"not_space_digested_count": {
2734+
"type": "integer"
2735+
},
2736+
"space_digested_count": {
2737+
"type": "integer"
2738+
}
2739+
}
2740+
},
26682741
"httpclient.SearchResultBlockItem": {
26692742
"type": "object",
26702743
"properties": {

src/server/api/go/docs/swagger.json

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,68 @@
986986
]
987987
}
988988
},
989+
"/session/{session_id}/get_learning_status": {
990+
"get": {
991+
"security": [
992+
{
993+
"BearerAuth": []
994+
}
995+
],
996+
"description": "Get learning status for a session. Returns the count of space digested tasks and not space digested tasks. If the session is not connected to a space, returns 0 and 0.",
997+
"consumes": [
998+
"application/json"
999+
],
1000+
"produces": [
1001+
"application/json"
1002+
],
1003+
"tags": [
1004+
"session"
1005+
],
1006+
"summary": "Get learning status",
1007+
"parameters": [
1008+
{
1009+
"type": "string",
1010+
"format": "uuid",
1011+
"description": "Session ID",
1012+
"name": "session_id",
1013+
"in": "path",
1014+
"required": true
1015+
}
1016+
],
1017+
"responses": {
1018+
"200": {
1019+
"description": "OK",
1020+
"schema": {
1021+
"allOf": [
1022+
{
1023+
"$ref": "#/definitions/serializer.Response"
1024+
},
1025+
{
1026+
"type": "object",
1027+
"properties": {
1028+
"data": {
1029+
"$ref": "#/definitions/httpclient.LearningStatusResponse"
1030+
}
1031+
}
1032+
}
1033+
]
1034+
}
1035+
}
1036+
},
1037+
"x-code-samples": [
1038+
{
1039+
"label": "Python",
1040+
"lang": "python",
1041+
"source": "from acontext import AcontextClient\n\nclient = AcontextClient(api_key='sk_project_token')\n\n# Get learning status\nresult = client.sessions.get_learning_status(session_id='session-uuid')\nprint(f\"Space digested: {result.space_digested_count}, Not digested: {result.not_space_digested_count}\")\n"
1042+
},
1043+
{
1044+
"label": "JavaScript",
1045+
"lang": "javascript",
1046+
"source": "import { AcontextClient } from '@acontext/acontext';\n\nconst client = new AcontextClient({ apiKey: 'sk_project_token' });\n\n// Get learning status\nconst result = await client.sessions.getLearningStatus('session-uuid');\nconsole.log(`Space digested: ${result.space_digested_count}, Not digested: ${result.not_space_digested_count}`);\n"
1047+
}
1048+
]
1049+
}
1050+
},
9891051
"/session/{session_id}/messages": {
9901052
"get": {
9911053
"security": [
@@ -2662,6 +2724,17 @@
26622724
}
26632725
}
26642726
},
2727+
"httpclient.LearningStatusResponse": {
2728+
"type": "object",
2729+
"properties": {
2730+
"not_space_digested_count": {
2731+
"type": "integer"
2732+
},
2733+
"space_digested_count": {
2734+
"type": "integer"
2735+
}
2736+
}
2737+
},
26652738
"httpclient.SearchResultBlockItem": {
26662739
"type": "object",
26672740
"properties": {

src/server/api/go/docs/swagger.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,13 @@ definitions:
165165
id:
166166
type: string
167167
type: object
168+
httpclient.LearningStatusResponse:
169+
properties:
170+
not_space_digested_count:
171+
type: integer
172+
space_digested_count:
173+
type: integer
174+
type: object
168175
httpclient.SearchResultBlockItem:
169176
properties:
170177
block_id:
@@ -1283,6 +1290,58 @@ paths:
12831290
// Flush session buffer
12841291
const result = await client.sessions.flush('session-uuid');
12851292
console.log(result.status);
1293+
/session/{session_id}/get_learning_status:
1294+
get:
1295+
consumes:
1296+
- application/json
1297+
description: Get learning status for a session. Returns the count of space digested
1298+
tasks and not space digested tasks. If the session is not connected to a space,
1299+
returns 0 and 0.
1300+
parameters:
1301+
- description: Session ID
1302+
format: uuid
1303+
in: path
1304+
name: session_id
1305+
required: true
1306+
type: string
1307+
produces:
1308+
- application/json
1309+
responses:
1310+
"200":
1311+
description: OK
1312+
schema:
1313+
allOf:
1314+
- $ref: '#/definitions/serializer.Response'
1315+
- properties:
1316+
data:
1317+
$ref: '#/definitions/httpclient.LearningStatusResponse'
1318+
type: object
1319+
security:
1320+
- BearerAuth: []
1321+
summary: Get learning status
1322+
tags:
1323+
- session
1324+
x-code-samples:
1325+
- label: Python
1326+
lang: python
1327+
source: |
1328+
from acontext import AcontextClient
1329+
1330+
client = AcontextClient(api_key='sk_project_token')
1331+
1332+
# Get learning status
1333+
result = client.sessions.get_learning_status(session_id='session-uuid')
1334+
print(f"Space digested: {result.space_digested_count}, Not digested: {result.not_space_digested_count}")
1335+
- label: JavaScript
1336+
lang: javascript
1337+
source: |
1338+
import { AcontextClient } from '@acontext/acontext';
1339+
1340+
const client = new AcontextClient({ apiKey: 'sk_project_token' });
1341+
1342+
// Get learning status
1343+
const result = await client.sessions.getLearningStatus('session-uuid');
1344+
console.log(`Space digested: ${result.space_digested_count}, Not digested: ${result.not_space_digested_count}`);
12861345
/session/{session_id}/messages:
12871346
get:
12881347
consumes:

0 commit comments

Comments
 (0)