Skip to content
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 param setters #74

Merged
merged 3 commits into from
May 7, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 13 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
### Project Status
This project is currently in PILOT and in active development. If you've identified an issue, please open an issue. If you would like to particulate in the pilot, please sign up for Twilio Insiders [twil.io/insider](https://twil.io/insiders).

All the code [here](twilio/rest) was generated by [twilio-oai-generator](https://github.com/twilio/twilio-oai-generator) by leveraging [openapi-generator](https://github.com/OpenAPITools/openapi-generator) and [twilio-oai](https://github.com/twilio/twilio-oai). If you find an issue with the generation or the openapi specs, please go ahead and open an issue or a PR against the relevant repositories.
All the code [here](./rest) was generated by [twilio-oai-generator](https://github.com/twilio/twilio-oai-generator) by leveraging [openapi-generator](https://github.com/OpenAPITools/openapi-generator) and [twilio-oai](https://github.com/twilio/twilio-oai). If you find an issue with the generation or the openapi specs, please go ahead and open an issue or a PR against the relevant repositories.


## Documentation
Expand Down Expand Up @@ -111,7 +111,7 @@ func main() {
client := twilio.NewClient(accountSid, authToken)

params := &openapi.CreateIncomingPhoneNumberParams{}
params.PhoneNumber = &phoneNumber
params.SetPhoneNumber(phoneNumber)

resp, err := client.ApiV2010.CreateIncomingPhoneNumber(accountSid, params)
if err != nil {
Expand Down Expand Up @@ -143,13 +143,10 @@ func main() {

client := twilio.NewClient(accountSid, authToken)

text := "Hello there"

params := &openapi.CreateMessageParams{}
params.To = &to
params.From = &from
params.Body = &text

params.SetTo(to)
params.SetFrom(from)
params.SetBody("Hello there")

resp, err := client.ApiV2010.CreateMessage(accountSid, params)
if err != nil {
Expand Down Expand Up @@ -181,12 +178,10 @@ func main() {

client := twilio.NewClient(accountSid, authToken)

callurl := "http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient"

params := &openapi.CreateCallParams{}
params.To = &to
params.From = &from
params.Url = &callurl
params.SetTo(to)
params.SetFrom(from)
params.SetUrl("http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient")

resp, err := client.ApiV2010.CreateCall(accountSid, params)
if err != nil {
Expand Down Expand Up @@ -249,10 +244,6 @@ func main() {
accountSid := os.Getenv("TWILIO_ACCOUNT_SID")
authToken := os.Getenv("TWILIO_AUTH_TOKEN")

commit := "commit"
friendlyName := "Studio flow from Go"
status := "draft"

var jsonStr = `{
"description":"Twilio Studio flow service",
"initial_state":"Trigger",
Expand All @@ -278,11 +269,11 @@ func main() {

client := twilio.NewClient(accountSid, authToken)
params := &openapi.CreateFlowParams{
CommitMessage: &commit,
Definition: &definition,
FriendlyName: &friendlyName,
Status: &status,
Definition: &definition,
}
params.SetCommitMessage("commit")
params.SetFriendlyName("Studio flow from Go")
params.SetStatus("draft")

resp, err := client.StudioV2.CreateFlow(params)
if err != nil {
Expand Down Expand Up @@ -313,7 +304,7 @@ func main() {
client := twilio.NewClient(accountSid, authToken)

params := &openapi.CreateIncomingPhoneNumberParams{}
params.PhoneNumber = &phoneNumber
params.SetPhoneNumber(phoneNumber)

resp, err := client.ApiV2010.CreateIncomingPhoneNumber(accountSid, params)
if err != nil {
Expand Down
46 changes: 46 additions & 0 deletions rest/accounts/v1/api_default.go

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

Loading