Skip to content

Commit

Permalink
Generator changes for go json ingress support
Browse files Browse the repository at this point in the history
  • Loading branch information
AsabuHere committed Nov 9, 2023
1 parent 7d2378f commit 2cbd8fc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 10 additions & 1 deletion src/main/resources/twilio-go/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,17 @@ func (c *ApiService) {{{nickname}}}({{#allParams}}{{#required}}{{paramName}} {{{
}
{{/headerParams}}
{{/hasHeaderParams}}

{{#vendorExtensions.x-is-create-operation}}
{{#vendorExtensions.x-is-json-type}}
resp, err := c.requestHandler.{{httpMethod}}(c.baseURL+path, data, headers, body...)
{{/vendorExtensions.x-is-json-type}}
{{^vendorExtensions.x-is-json-type}}
resp, err := c.requestHandler.{{httpMethod}}(c.baseURL+path, data, headers)
{{/vendorExtensions.x-is-json-type}}
{{/vendorExtensions.x-is-create-operation}}
{{^vendorExtensions.x-is-create-operation}}
resp, err := c.requestHandler.{{httpMethod}}(c.baseURL+path, data, headers)
{{/vendorExtensions.x-is-create-operation}}
{{#returnType}}
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/twilio-go/partial_serialization.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ if params != nil && params.PathAccountSid != nil {
{{#hasOptionalParams}}
{{#optionalParams}}
{{#vendorExtensions.x-is-body-param}}
body := []byte{}
if params != nil && params.{{paramName}} != nil {
v, err := json.Marshal(*params.{{paramName}})
b, err := json.Marshal(*params.{{paramName}})
if err != nil {
return nil, err
}
urlEncodedData := url.QueryEscape(string(v))
data.Set("{{baseName}}", urlEncodedData)
body = b
}
{{/vendorExtensions.x-is-body-param}}
{{^vendorExtensions.x-is-body-param}}
Expand Down

0 comments on commit 2cbd8fc

Please sign in to comment.