Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Jess Frazelle <[email protected]>
  • Loading branch information
jessfraz committed Feb 4, 2022
1 parent fafe6a4 commit 779ca6c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 72 deletions.
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.0.6
v0.0.7
25 changes: 11 additions & 14 deletions generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"
"path/filepath"
"sort"
Expand All @@ -22,7 +23,7 @@ import (
var EnumStringTypes map[string][]string = map[string][]string{}

func main() {
/*uri := "https://api.kittycad.io"
uri := "https://api.kittycad.io"
u, err := url.Parse(uri)
if err != nil {
fmt.Printf("error parsing url %q: %v\n", uri, err)
Expand All @@ -34,19 +35,6 @@ func main() {
if err != nil {
fmt.Printf("error loading openAPI spec from %q: %v\n", uri, err)
os.Exit(1)
}*/

// Load the open API spec from the file.
wd, err := os.Getwd()
if err != nil {
fmt.Printf("error getting current working directory: %v\n", err)
os.Exit(1)
}
p := filepath.Join(wd, "spec.json")
doc, err := openapi3.NewLoader().LoadFromFile(p)
if err != nil {
fmt.Printf("error loading openAPI spec from file %q: %v\n", p, err)
os.Exit(1)
}

// Generate the client.go file.
Expand Down Expand Up @@ -87,6 +75,15 @@ if err != nil {
fmt.Printf("error marshalling openAPI spec: %v\n", err)
os.Exit(1)
}

// Load the open API spec from the file.
wd, err := os.Getwd()
if err != nil {
fmt.Printf("error getting current working directory: %v\n", err)
os.Exit(1)
}
p := filepath.Join(wd, "spec.json")

if err := ioutil.WriteFile(p, out, 0644); err != nil {
fmt.Printf("error writing openAPI spec to %s: %v\n", p, err)
os.Exit(1)
Expand Down
61 changes: 8 additions & 53 deletions spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
},
"id": {
"description": "The id of the session.",
"format": "uuid",
"type": "string"
},
"ip_address": {
Expand All @@ -95,6 +96,7 @@
},
"user_id": {
"description": "The user's id.",
"format": "uuid",
"type": "string"
}
},
Expand Down Expand Up @@ -132,11 +134,12 @@
},
"id": {
"description": "The id of the file conversion.",
"format": "uuid",
"type": "string"
},
"output": {
"description": "The converted file, base64 encoded.",
"format": "base64",
"format": "byte",
"type": "string"
},
"output_format": {
Expand Down Expand Up @@ -219,6 +222,7 @@
"type": "object"
},
"ValidOutputFileType": {
"description": "The valid file types. note: obj will ignore any associated materials.",
"enum": [
"obj",
"stl",
Expand All @@ -227,6 +231,7 @@
"type": "string"
},
"ValidSourceFileType": {
"description": "The valid file types. note: obj will ignore any associated materials.",
"enum": [
"obj",
"stl",
Expand Down Expand Up @@ -273,19 +278,6 @@
"200": {
"content": {
"application/json": {
"example": {
"cpu_platform": "Intel Haswell",
"description": "An API server instance.",
"environment": "PRODUCTION",
"git_hash": "d454900",
"hostname": "api-us-central1-0kph.us-central1-f.c.kittycadapi.internal",
"id": "3247495290486004999",
"image": "projects/kittycadapi/global/images/packer-1635462081",
"ip_address": "10.127.15.206",
"machine_type": "projects/199385932268/machineTypes/n1-standard-16",
"name": "api-us-central1-0kph",
"zone": "projects/199385932268/zones/us-central1-f"
},
"schema": {
"$ref": "#/components/schemas/InstanceMetadata"
}
Expand Down Expand Up @@ -329,14 +321,6 @@
"200": {
"content": {
"application/json": {
"example": {
"created_at": "2021-11-02T21:48:05+0000",
"id": "6970d4f2-8979-4461-a9a1-ace62548fb5f",
"ip_address": "203.0.113.0",
"is_valid": true,
"token": "435f9688-365f-4a2d-860b-554798160cfe",
"user_id": "ckv5prd3j000607mlnmwlpyz8"
},
"schema": {
"$ref": "#/components/schemas/AuthSession"
}
Expand Down Expand Up @@ -391,14 +375,6 @@
"200": {
"content": {
"application/json": {
"example": {
"created_at": "2021-11-02T21:48:05+0000",
"id": "6970d4f2-8979-4461-a9a1-ace62548fb5f",
"output_format": "stl",
"src_format": "obj",
"status": "In Progress",
"user_id": "ckv5prd3j000607mlnmwlpyz8"
},
"schema": {
"$ref": "#/components/schemas/FileConversion"
}
Expand Down Expand Up @@ -472,7 +448,7 @@
"content": {
"text/plain": {
"schema": {
"format": "base64",
"format": "byte",
"type": "string"
}
}
Expand All @@ -484,16 +460,6 @@
"200": {
"content": {
"application/json": {
"example": {
"completed_at": "2021-11-02T23:12:05+0000",
"created_at": "2021-11-02T21:48:05+0000",
"id": "6970d4f2-8979-4461-a9a1-ace62548fb5f",
"output": "BASE64_ENCODED_FILE_OUTPUT",
"output_format": "stl",
"src_format": "obj",
"status": "Completed",
"user_id": "ckv5prd3j000607mlnmwlpyz8"
},
"schema": {
"$ref": "#/components/schemas/FileConversion"
}
Expand All @@ -504,14 +470,6 @@
"202": {
"content": {
"application/json": {
"example": {
"created_at": "2021-11-02T21:48:05+0000",
"id": "6970d4f2-8979-4461-a9a1-ace62548fb5f",
"output_format": "stl",
"src_format": "obj",
"status": "Uploaded",
"user_id": "ckv5prd3j000607mlnmwlpyz8"
},
"schema": {
"$ref": "#/components/schemas/FileConversion"
}
Expand Down Expand Up @@ -550,7 +508,7 @@
"libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#FileService.Convert"
},
"x-python": {
"example": "from kittycad.models import FileConversion, ValidFileType\nfrom kittycad.api.file import file_convert_with_base64_helper\nfrom kittycad.types import Response\n\n# Convert a file from STL to OBJ.\n# Read in the contents of the file.\nfile = open(\"example.stl\", \"rb\")\ncontent = file.read()\nfile.close()\n\nfc: FileConversion = file_convert_with_base64_helper.sync(client=client, content=content, source_format=ValidFileType.STL, output_format=ValidFileType.OBJ)\n\n# OR if you need more info (e.g. status_code)\nresponse: Response[FileConversion] = file_convert_with_base64_helper.sync_detailed(client=client, content=content, source_format=ValidFileType.STL, output_format=ValidFileType.OBJ)\n\n# OR run async\nfc: FileConversion = await file_convert_with_base64_helper.asyncio(client=client, content=content, source_format=ValidFileType.STL, output_format=ValidFileType.OBJ)\n\n# OR run async with more info\nresponse: Response[FileConversion] = await file_convert_with_base64_helper.asyncio_detailed(client=client, content=content, source_format=ValidFileType.STL, output_format=ValidFileType.OBJ)\n"
"example": "from kittycad.models import FileConversion, ValidFileType\nfrom kittycad.api.file import file_convert_with_base64_helper\nfrom kittycad.types import Response\n\n# Convert a file from STEP to OBJ.\n# Read in the contents of the file.\nfile = open(\"example.step\", \"rb\")\ncontent = file.read()\nfile.close()\n\nfc: FileConversion = file_convert_with_base64_helper.sync(client=client, content=content, source_format=ValidFileType.STEP, output_format=ValidFileType.OBJ)\n\n# OR if you need more info (e.g. status_code)\nresponse: Response[FileConversion] = file_convert_with_base64_helper.sync_detailed(client=client, content=content, source_format=ValidFileType.STEP, output_format=ValidFileType.OBJ)\n\n# OR run async\nfc: FileConversion = await file_convert_with_base64_helper.asyncio(client=client, content=content, source_format=ValidFileType.STEP, output_format=ValidFileType.OBJ)\n\n# OR run async with more info\nresponse: Response[FileConversion] = await file_convert_with_base64_helper.asyncio_detailed(client=client, content=content, source_format=ValidFileType.STEP, output_format=ValidFileType.OBJ)\n"
}
}
},
Expand All @@ -562,9 +520,6 @@
"200": {
"content": {
"application/json": {
"example": {
"message": "pong"
},
"schema": {
"$ref": "#/components/schemas/Message"
}
Expand Down
10 changes: 6 additions & 4 deletions types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 779ca6c

Please sign in to comment.