Skip to content

Commit 993a36f

Browse files
Update api spec (#156)
* YOYO NEW API SPEC! * I have generated the latest API! --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent e8d4445 commit 993a36f

File tree

5 files changed

+69
-7
lines changed

5 files changed

+69
-7
lines changed

examples_test.go

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kittycad.go.patch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@
10731073
},
10741074
{
10751075
"value": {
1076-
"example": "// CommandsWs: Open a websocket which accepts modeling commands.\n// \n// Pass those commands to the engine via websocket, and pass responses back to the client. Basically, this is a websocket proxy between the frontend/client and the engine.\n// \n// \n// Parameters\n// \n// \t- `fps`\n// \t- `pool`\n// \t- `postEffect`: Post effect type\n// \t- `showGrid`\n// \t- `unlockedFramerate`\n// \t- `videoResHeight`\n// \t- `videoResWidth`\n// \t- `webrtc`\n// \t- `body`: The websocket messages the server receives.\n// \n// CommandsWs: Open a websocket which accepts modeling commands.\n// Pass those commands to the engine via websocket, and pass responses back to the client. Basically, this is a websocket proxy between the frontend/client and the engine.\n//\n// Parameters\n//\n// - `fps`\n// - `pool`\n// - `postEffect`: Post effect type\n// - `showGrid`\n// - `unlockedFramerate`\n// - `videoResHeight`\n// - `videoResWidth`\n// - `webrtc`\n// - `body`: The websocket messages the server receives.\nfunc ExampleModelingService_CommandsWs() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Create the websocket connection.\n\tws, err := client.Modeling.CommandsWs(123, \"some-string\", kittycad.PostEffectTypePhosphor, true, true, 123, 123, true, \"\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdefer ws.Close()\n\n\tdone := make(chan struct{})\n\n\tgo func() {\n\t\tdefer close(done)\n\t\tfor {\n\t\t\t_, message, err := ws.ReadMessage()\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"read:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Printf(\"recv: %s\", message)\n\t\t}\n\t}()\n\n\tticker := time.NewTicker(time.Second)\n\tdefer ticker.Stop()\n\n\tinterrupt := make(chan os.Signal, 1)\n\tsignal.Notify(interrupt, os.Interrupt)\n\n\tfor {\n\t\tselect {\n\t\tcase \u003c-done:\n\t\t\treturn\n\t\tcase t := \u003c-ticker.C:\n\t\t\terr := ws.WriteMessage(websocket.TextMessage, []byte(t.String()))\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"write:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase \u003c-interrupt:\n\t\t\tlog.Println(\"interrupt\")\n\n\t\t\t// Cleanly close the connection by sending a close message and then\n\t\t\t// waiting (with timeout) for the server to close the connection.\n\t\t\terr := ws.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, \"\"))\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"write close:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tselect {\n\t\t\tcase \u003c-done:\n\t\t\tcase \u003c-time.After(time.Second):\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n\n}\n",
1076+
"example": "// CommandsWs: Open a websocket which accepts modeling commands.\n// \n// Pass those commands to the engine via websocket, and pass responses back to the client. Basically, this is a websocket proxy between the frontend/client and the engine.\n// \n// \n// Parameters\n// \n// \t- `fps`\n// \t- `pool`\n// \t- `postEffect`: Post effect type\n// \t- `replay`\n// \t- `showGrid`\n// \t- `unlockedFramerate`\n// \t- `videoResHeight`\n// \t- `videoResWidth`\n// \t- `webrtc`\n// \t- `body`: The websocket messages the server receives.\n// \n// CommandsWs: Open a websocket which accepts modeling commands.\n// Pass those commands to the engine via websocket, and pass responses back to the client. Basically, this is a websocket proxy between the frontend/client and the engine.\n//\n// Parameters\n//\n// - `fps`\n// - `pool`\n// - `postEffect`: Post effect type\n// - `replay`\n// - `showGrid`\n// - `unlockedFramerate`\n// - `videoResHeight`\n// - `videoResWidth`\n// - `webrtc`\n// - `body`: The websocket messages the server receives.\nfunc ExampleModelingService_CommandsWs() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Create the websocket connection.\n\tws, err := client.Modeling.CommandsWs(123, \"some-string\", kittycad.PostEffectTypePhosphor, \"some-string\", true, true, 123, 123, true, \"\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdefer ws.Close()\n\n\tdone := make(chan struct{})\n\n\tgo func() {\n\t\tdefer close(done)\n\t\tfor {\n\t\t\t_, message, err := ws.ReadMessage()\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"read:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Printf(\"recv: %s\", message)\n\t\t}\n\t}()\n\n\tticker := time.NewTicker(time.Second)\n\tdefer ticker.Stop()\n\n\tinterrupt := make(chan os.Signal, 1)\n\tsignal.Notify(interrupt, os.Interrupt)\n\n\tfor {\n\t\tselect {\n\t\tcase \u003c-done:\n\t\t\treturn\n\t\tcase t := \u003c-ticker.C:\n\t\t\terr := ws.WriteMessage(websocket.TextMessage, []byte(t.String()))\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"write:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase \u003c-interrupt:\n\t\t\tlog.Println(\"interrupt\")\n\n\t\t\t// Cleanly close the connection by sending a close message and then\n\t\t\t// waiting (with timeout) for the server to close the connection.\n\t\t\terr := ws.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, \"\"))\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"write close:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tselect {\n\t\t\tcase \u003c-done:\n\t\t\tcase \u003c-time.After(time.Second):\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n\n}\n",
10771077
"libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#ModelingService.CommandsWs"
10781078
},
10791079
"op": "add",

paths.go

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13838,6 +13838,15 @@
1383813838
"$ref": "#/components/schemas/PostEffectType"
1383913839
}
1384013840
},
13841+
{
13842+
"in": "query",
13843+
"name": "replay",
13844+
"description": "If given, when the session ends, the modeling commands sent during the session will be written out to this filename. For debugging.",
13845+
"schema": {
13846+
"nullable": true,
13847+
"type": "string"
13848+
}
13849+
},
1384113850
{
1384213851
"in": "query",
1384313852
"name": "show_grid",
@@ -23493,6 +23502,19 @@
2349323502
"cmd_id"
2349423503
]
2349523504
},
23505+
"ModelingSessionData": {
23506+
"description": "Successful Websocket response.",
23507+
"type": "object",
23508+
"properties": {
23509+
"api_call_id": {
23510+
"description": "ID of the API call this modeling session is using. Useful for tracing and debugging.",
23511+
"type": "string"
23512+
}
23513+
},
23514+
"required": [
23515+
"api_call_id"
23516+
]
23517+
},
2349623518
"MouseClick": {
2349723519
"description": "The response from the `MouseClick` command.",
2349823520
"type": "object",
@@ -24807,6 +24829,38 @@
2480724829
"type"
2480824830
]
2480924831
},
24832+
{
24833+
"description": "Data about the Modeling Session (application-level).",
24834+
"type": "object",
24835+
"properties": {
24836+
"data": {
24837+
"type": "object",
24838+
"properties": {
24839+
"session": {
24840+
"description": "Data about the Modeling Session (application-level).",
24841+
"allOf": [
24842+
{
24843+
"$ref": "#/components/schemas/ModelingSessionData"
24844+
}
24845+
]
24846+
}
24847+
},
24848+
"required": [
24849+
"session"
24850+
]
24851+
},
24852+
"type": {
24853+
"type": "string",
24854+
"enum": [
24855+
"modeling_session_data"
24856+
]
24857+
}
24858+
},
24859+
"required": [
24860+
"data",
24861+
"type"
24862+
]
24863+
},
2481024864
{
2481124865
"description": "Pong response to a Ping message.",
2481224866
"type": "object",

types.go

Lines changed: 10 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)