Skip to content

Commit

Permalink
Merge pull request #13 from KittyCAD/update-spec
Browse files Browse the repository at this point in the history
Update api spec docs
  • Loading branch information
jessfraz authored Jun 11, 2022
2 parents 450411e + 5fe370a commit 566a9d8
Show file tree
Hide file tree
Showing 9 changed files with 5,114 additions and 1,537 deletions.
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.1.3
v0.1.4
4 changes: 2 additions & 2 deletions base64helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// This function will automatically base64 decode the contents of the result output.
//
// This function is a wrapper around the GetConversion function.
func (c *FileService) GetConversionWithBase64Helper(id string) (*FileConversionWithOutput, []byte, error) {
func (c *FileService) GetConversionWithBase64Helper(id string) (*AsyncAPICallOutput, []byte, error) {
resp, err := c.GetConversion(id)
if err != nil {
return nil, nil, err
Expand All @@ -34,7 +34,7 @@ func (c *FileService) GetConversionWithBase64Helper(id string) (*FileConversionW
// src file and output file.
//
// This function is a wrapper around the CreateConversion function.
func (c *FileService) CreateConversionWithBase64Helper(srcFormat FileConversionSourceFormat, outputFormat FileConversionOutputFormat, body []byte) (*FileConversionWithOutput, []byte, error) {
func (c *FileService) CreateConversionWithBase64Helper(srcFormat FileSourceFormat, outputFormat FileOutputFormat, body []byte) (*FileConversion, []byte, error) {
var b bytes.Buffer
encoder := base64.NewEncoder(base64.StdEncoding, &b)
// Encode the body as base64.
Expand Down
10 changes: 10 additions & 0 deletions client.go

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

10 changes: 6 additions & 4 deletions generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,6 @@ func writePath(doc *openapi3.T, f *os.File, path string, p *openapi3.PathItem) {
if p.Head != nil {
writeMethod(doc, f, http.MethodHead, path, p.Head, false)
}

if p.Options != nil {
writeMethod(doc, f, http.MethodOptions, path, p.Options, false)
}
}

func writeMethod(doc *openapi3.T, f *os.File, method string, path string, o *openapi3.Operation, isGetAllPages bool) {
Expand Down Expand Up @@ -690,6 +686,8 @@ func writeMethod(doc *openapi3.T, f *os.File, method string, path string, o *ope
fmt.Fprintf(f, " %q: %s,\n", name, n)
} else if t == "int" {
fmt.Fprintf(f, " %q: strconv.Itoa(%s),\n", name, n)
} else if t == "float64" {
fmt.Fprintf(f, " %q: fmt.Sprintf(\"%%f\", %s),\n", name, n)
} else {
fmt.Fprintf(f, " %q: string(%s),\n", name, n)
}
Expand Down Expand Up @@ -798,6 +796,10 @@ func getSuccessResponseType(o *openapi3.Operation, isGetAllPages bool) (string,
return getReferenceSchema(content.Schema), getAllPagesType
}

if content.Schema.Value.Title == "Null" {
return "", ""
}

if content.Schema.Value.Type == "array" {
return printType("", content.Schema), getAllPagesType
}
Expand Down
1 change: 1 addition & 0 deletions lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func NewClient(token, userAgent string) (*Client, error) {
client.Meta = &MetaService{client: client}
client.User = &UserService{client: client}
client.APICall = &APICallService{client: client}
client.Payment = &PaymentService{client: client}
client.APIToken = &APITokenService{client: client}
client.Session = &SessionService{client: client}

Expand Down
2 changes: 1 addition & 1 deletion lib_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestFileConversion(t *testing.T) {
t.Fatalf("reading the test file %q failed: %v", file, err)
}

fc, output, err := client.File.CreateConversionWithBase64Helper(FileConversionSourceFormatStl, FileConversionOutputFormatObj, body)
fc, output, err := client.File.CreateConversionWithBase64Helper(FileSourceFormatStl, FileOutputFormatObj, body)
if err != nil {
t.Fatalf("getting the file conversion failed: %v", err)
}
Expand Down
Loading

0 comments on commit 566a9d8

Please sign in to comment.