Skip to content

Commit

Permalink
Merge branch 'main' into fix-hashmap-serialization-in-json
Browse files Browse the repository at this point in the history
  • Loading branch information
sbansla authored Nov 14, 2023
2 parents 4234091 + d463d8f commit 600d2d5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
1 change: 0 additions & 1 deletion examples/go/go-client/helper/rest/api/v2010/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ func (c *ApiService) CreateAccount(params *CreateAccountParams) (*TestResponseOb
if params != nil && params.XTwilioWebhookEnabled != nil {
headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled
}

resp, err := c.requestHandler.Post(c.baseURL+path, data, headers)
if err != nil {
return nil, err
Expand Down
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 600d2d5

Please sign in to comment.