-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add the ability to post a JSON payload to the Twilio API's #83
Open
RJPearson94
wants to merge
4
commits into
twilio:main
Choose a base branch
from
RJPearson94:add-support-for-json-post-requests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: add the ability to post a JSON payload to the Twilio API's #83
RJPearson94
wants to merge
4
commits into
twilio:main
from
RJPearson94:add-support-for-json-post-requests
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RJPearson94
added a commit
to RJPearson94/twilio-oai-generator
that referenced
this pull request
Jun 10, 2021
…JSON media type for the request body The Go Generator has been updated to add a vendor extension to set `x-is-json` to true when the consume media type is `application/json` and `x-is-form` when the consumes media type is `application/x-www-form-urlencoded` The `x-is-json` vendor extension is used to generate the code to handle calling the new PostJson function or the corresponding HTTP method function on the request handler. This is designed to only work with Post requests at the moment but could be extended in the future if needed. This PR aids in resolving twilio#49 however once this PR is merged twilio/twilio-oai#36 will need to be finished to fully resolve the issue This change relies on twilio/twilio-go#83 and the tests cannot be updated until this PR is merged and released This change also fixes an issue with JSON struct tags for the Params structs being `html-escaped`. I have disabled the escaping by using `{{{}}}` as this was highlighted during linting the Go SDK repo
This was referenced Jun 10, 2021
thinkingserious
added
status: code review request
requesting a community code review or review from Twilio
type: community enhancement
feature request not on Twilio's roadmap
labels
Jun 11, 2021
RJPearson94
added a commit
to RJPearson94/twilio-oai-generator
that referenced
this pull request
Jul 9, 2021
…JSON media type for the request body The Go Generator has been updated to add a vendor extension to set `x-is-json` to true when the consume media type is `application/json` and `x-is-form` when the consumes media type is `application/x-www-form-urlencoded` The `x-is-json` vendor extension is used to generate the code to handle calling the new PostJson function or the corresponding HTTP method function on the request handler. This is designed to only work with Post requests at the moment but could be extended in the future if needed. This PR aids in resolving twilio#49 however once this PR is merged twilio/twilio-oai#36 will need to be finished to fully resolve the issue This change relies on twilio/twilio-go#83 and the tests cannot be updated until this PR is merged and released This change also fixes an issue with JSON struct tags for the Params structs being `html-escaped`. I have disabled the escaping by using `{{{}}}` as this was highlighted during linting the Go SDK repo
Updating the configuration of a Flex instance requires a POST request to be made with a JSON payload. This change lays the foundations to support this. The PostJson accepts an interface for the request body (data) instead of just a map as this prevents the computational overhead of having to marshal the struct to a slice of bytes then create a string from the bytes. The JSON string would then be unmarshalled to a map and then marshalled again to a slice of bytes
RJPearson94
force-pushed
the
add-support-for-json-post-requests
branch
from
July 9, 2021 01:24
069ac91
to
3d97366
Compare
RJPearson94
added a commit
to RJPearson94/twilio-oai-generator
that referenced
this pull request
Jul 9, 2021
…JSON media type for the request body The Go Generator has been updated to add a vendor extension to set `x-is-json` to true when the consume media type is `application/json` and `x-is-form` when the consumes media type is `application/x-www-form-urlencoded` The `x-is-json` vendor extension is used to generate the code to handle calling the new PostJson function or the corresponding HTTP method function on the request handler. This is designed to only work with Post requests at the moment but could be extended in the future if needed. This PR aids in resolving twilio#49 however once this PR is merged twilio/twilio-oai#36 will need to be finished to fully resolve the issue This change relies on twilio/twilio-go#83 and the tests cannot be updated until this PR is merged and released This change also fixes an issue with JSON struct tags for the Params structs being `html-escaped`. I have disabled the escaping by using `{{{}}}` as this was highlighted during linting the Go SDK repo
the http methods are converted to upper case to because the http method constants i.e. MethodGet, MethodPost values are uppercase
mattcole19
added
status: waiting for feature
feature will be implemented in the future
and removed
status: code review request
requesting a community code review or review from Twilio
labels
Nov 4, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
status: waiting for feature
feature will be implemented in the future
type: community enhancement
feature request not on Twilio's roadmap
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Updating the configuration of a Flex instance requires a POST request to be made with a JSON payload. This change lays the foundations to support this. This is highlighted in twilio/twilio-oai-generator#49
The PostJson accepts an interface for the request body (data) instead of just a map as this prevents the computational overhead of having to marshal the struct to a slice of bytes then create a string from the bytes. The JSON string would then be unmarshalled to a map and then marshalled again to a slice of bytes
This change makes the
Content-Type
header mandatory for POST requestsChecklist
If you have questions, please file a support ticket, or create a GitHub Issue in this repository.