Skip to content

Commit

Permalink
Merge branch 'main' into natebrennand/add-context-methods-to-base-client
Browse files Browse the repository at this point in the history
  • Loading branch information
childish-sambino authored Nov 7, 2022
2 parents 1de5352 + 00173f6 commit 1385df6
Show file tree
Hide file tree
Showing 67 changed files with 573 additions and 79 deletions.
20 changes: 20 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
twilio-go changelog
====================
[2022-10-31] Version 1.1.1
--------------------------
**Library - Miscellaneous**
- [PR #195](https://github.com/twilio/twilio-go/pull/195): move webhook cluster test. Thanks to [@claudiachua](https://github.com/claudiachua)!

**Api**
- Added `contentSid` and `contentVariables` to Message resource with public visibility as Beta
- Add `UserDefinedMessageSubscription` and `UserDefinedMessage` resource

**Proxy**
- Remove FailOnParticipantConflict param from Proxy Session create and update and Proxy Participant create

**Supersim**
- Update SettingsUpdates resource to remove PackageSid

**Taskrouter**
- Add `Ordering` query parameter to Workers and TaskQueues for sorting by
- Add `worker_sid` query param for list reservations endpoint


[2022-10-19] Version 1.1.0
--------------------------
**Library - Docs**
Expand Down
2 changes: 1 addition & 1 deletion client/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
package client

// LibraryVersion specifies the current version of twilio-go.
const LibraryVersion = "1.1.0"
const LibraryVersion = "1.1.1"
5 changes: 3 additions & 2 deletions cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
package twilio

import (
"os"
"testing"

"github.com/stretchr/testify/assert"
Api "github.com/twilio/twilio-go/rest/api/v2010"
ChatV2 "github.com/twilio/twilio-go/rest/chat/v2"
EventsV1 "github.com/twilio/twilio-go/rest/events/v1"
"os"
"testing"
)

var from string
Expand Down
2 changes: 1 addition & 1 deletion rest/accounts/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This is the public Twilio REST API.
## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.

- API version: 1.37.0
- API version: 1.37.1
- Package version: 1.0.0
- Build package: com.twilio.oai.TwilioGoGenerator
For more information, please visit [https://support.twilio.com](https://support.twilio.com)
Expand Down
7 changes: 6 additions & 1 deletion rest/api/v2010/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This is the public Twilio REST API.
## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.

- API version: 1.37.0
- API version: 1.37.1
- Package version: 1.0.0
- Build package: com.twilio.oai.TwilioGoGenerator
For more information, please visit [https://support.twilio.com](https://support.twilio.com)
Expand Down Expand Up @@ -82,6 +82,9 @@ Class | Method | HTTP request | Description
*AccountsCallsSiprecApi* | [**UpdateSiprec**](docs/AccountsCallsSiprecApi.md#updatesiprec) | **Post** /2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Siprec/{Sid}.json |
*AccountsCallsStreamsApi* | [**CreateStream**](docs/AccountsCallsStreamsApi.md#createstream) | **Post** /2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Streams.json |
*AccountsCallsStreamsApi* | [**UpdateStream**](docs/AccountsCallsStreamsApi.md#updatestream) | **Post** /2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Streams/{Sid}.json |
*AccountsCallsUserDefinedMessageSubscriptionsApi* | [**CreateUserDefinedMessageSubscription**](docs/AccountsCallsUserDefinedMessageSubscriptionsApi.md#createuserdefinedmessagesubscription) | **Post** /2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/UserDefinedMessageSubscriptions.json |
*AccountsCallsUserDefinedMessageSubscriptionsApi* | [**DeleteUserDefinedMessageSubscription**](docs/AccountsCallsUserDefinedMessageSubscriptionsApi.md#deleteuserdefinedmessagesubscription) | **Delete** /2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/UserDefinedMessageSubscriptions/{Sid}.json |
*AccountsCallsUserDefinedMessagesApi* | [**CreateUserDefinedMessage**](docs/AccountsCallsUserDefinedMessagesApi.md#createuserdefinedmessage) | **Post** /2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/UserDefinedMessages.json |
*AccountsConferencesApi* | [**FetchConference**](docs/AccountsConferencesApi.md#fetchconference) | **Get** /2010-04-01/Accounts/{AccountSid}/Conferences/{Sid}.json |
*AccountsConferencesApi* | [**ListConference**](docs/AccountsConferencesApi.md#listconference) | **Get** /2010-04-01/Accounts/{AccountSid}/Conferences.json |
*AccountsConferencesApi* | [**UpdateConference**](docs/AccountsConferencesApi.md#updateconference) | **Post** /2010-04-01/Accounts/{AccountSid}/Conferences/{Sid}.json |
Expand Down Expand Up @@ -240,6 +243,7 @@ Class | Method | HTTP request | Description
- [ListApplicationResponse](docs/ListApplicationResponse.md)
- [ApiV2010UsageRecord](docs/ApiV2010UsageRecord.md)
- [ListIncomingPhoneNumberLocalResponse](docs/ListIncomingPhoneNumberLocalResponse.md)
- [ApiV2010UserDefinedMessage](docs/ApiV2010UserDefinedMessage.md)
- [ApiV2010RecordingAddOnResultPayload](docs/ApiV2010RecordingAddOnResultPayload.md)
- [ListMessageResponse](docs/ListMessageResponse.md)
- [ApiV2010Transcription](docs/ApiV2010Transcription.md)
Expand Down Expand Up @@ -319,6 +323,7 @@ Class | Method | HTTP request | Description
- [ApiV2010SipAuthCallsCredentialListMapping](docs/ApiV2010SipAuthCallsCredentialListMapping.md)
- [ListSipIpAddressResponse](docs/ListSipIpAddressResponse.md)
- [ApiV2010NewKey](docs/ApiV2010NewKey.md)
- [ApiV2010UserDefinedMessageSubscription](docs/ApiV2010UserDefinedMessageSubscription.md)
- [ApiV2010NewSigningKey](docs/ApiV2010NewSigningKey.md)
- [ListAvailablePhoneNumberLocalResponse](docs/ListAvailablePhoneNumberLocalResponse.md)
- [ListUsageRecordYesterdayResponse](docs/ListUsageRecordYesterdayResponse.md)
Expand Down
123 changes: 123 additions & 0 deletions rest/api/v2010/accounts_calls_user_defined_message_subscriptions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Api
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

package openapi

import (
"encoding/json"
"net/url"
"strings"
)

// Optional parameters for the method 'CreateUserDefinedMessageSubscription'
type CreateUserDefinedMessageSubscriptionParams struct {
// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that subscribed to the User Defined Messages.
PathAccountSid *string `json:"PathAccountSid,omitempty"`
// The URL we should call using the `method` to send user defined events to your application. URLs must contain a valid hostname (underscores are not permitted).
Callback *string `json:"Callback,omitempty"`
// The HTTP method Twilio will use when requesting the above `Url`. Either `GET` or `POST`.
Method *string `json:"Method,omitempty"`
// A unique string value to identify API call. This should be a unique string value per API call and can be a randomly generated.
IdempotencyKey *string `json:"IdempotencyKey,omitempty"`
}

func (params *CreateUserDefinedMessageSubscriptionParams) SetPathAccountSid(PathAccountSid string) *CreateUserDefinedMessageSubscriptionParams {
params.PathAccountSid = &PathAccountSid
return params
}
func (params *CreateUserDefinedMessageSubscriptionParams) SetCallback(Callback string) *CreateUserDefinedMessageSubscriptionParams {
params.Callback = &Callback
return params
}
func (params *CreateUserDefinedMessageSubscriptionParams) SetMethod(Method string) *CreateUserDefinedMessageSubscriptionParams {
params.Method = &Method
return params
}
func (params *CreateUserDefinedMessageSubscriptionParams) SetIdempotencyKey(IdempotencyKey string) *CreateUserDefinedMessageSubscriptionParams {
params.IdempotencyKey = &IdempotencyKey
return params
}

// Subscribe to User Defined Messages for a given call sid.
func (c *ApiService) CreateUserDefinedMessageSubscription(CallSid string, params *CreateUserDefinedMessageSubscriptionParams) (*ApiV2010UserDefinedMessageSubscription, error) {
path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/UserDefinedMessageSubscriptions.json"
if params != nil && params.PathAccountSid != nil {
path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1)
} else {
path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1)
}
path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1)

data := url.Values{}
headers := make(map[string]interface{})

if params != nil && params.Callback != nil {
data.Set("Callback", *params.Callback)
}
if params != nil && params.Method != nil {
data.Set("Method", *params.Method)
}
if params != nil && params.IdempotencyKey != nil {
data.Set("IdempotencyKey", *params.IdempotencyKey)
}

resp, err := c.requestHandler.Post(c.baseURL+path, data, headers)
if err != nil {
return nil, err
}

defer resp.Body.Close()

ps := &ApiV2010UserDefinedMessageSubscription{}
if err := json.NewDecoder(resp.Body).Decode(ps); err != nil {
return nil, err
}

return ps, err
}

// Optional parameters for the method 'DeleteUserDefinedMessageSubscription'
type DeleteUserDefinedMessageSubscriptionParams struct {
// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that subscribed to the User Defined Messages.
PathAccountSid *string `json:"PathAccountSid,omitempty"`
}

func (params *DeleteUserDefinedMessageSubscriptionParams) SetPathAccountSid(PathAccountSid string) *DeleteUserDefinedMessageSubscriptionParams {
params.PathAccountSid = &PathAccountSid
return params
}

// Delete a specific User Defined Message Subscription.
func (c *ApiService) DeleteUserDefinedMessageSubscription(CallSid string, Sid string, params *DeleteUserDefinedMessageSubscriptionParams) error {
path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/UserDefinedMessageSubscriptions/{Sid}.json"
if params != nil && params.PathAccountSid != nil {
path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1)
} else {
path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1)
}
path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1)
path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1)

data := url.Values{}
headers := make(map[string]interface{})

resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers)
if err != nil {
return err
}

defer resp.Body.Close()

return nil
}
79 changes: 79 additions & 0 deletions rest/api/v2010/accounts_calls_user_defined_messages.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Api
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

package openapi

import (
"encoding/json"
"net/url"
"strings"
)

// Optional parameters for the method 'CreateUserDefinedMessage'
type CreateUserDefinedMessageParams struct {
// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created User Defined Message.
PathAccountSid *string `json:"PathAccountSid,omitempty"`
// A unique string value to identify API call. This should be a unique string value per API call and can be a randomly generated.
Content *string `json:"Content,omitempty"`
// A unique string value to identify API call. This should be a unique string value per API call and can be a randomly generated.
IdempotencyKey *string `json:"IdempotencyKey,omitempty"`
}

func (params *CreateUserDefinedMessageParams) SetPathAccountSid(PathAccountSid string) *CreateUserDefinedMessageParams {
params.PathAccountSid = &PathAccountSid
return params
}
func (params *CreateUserDefinedMessageParams) SetContent(Content string) *CreateUserDefinedMessageParams {
params.Content = &Content
return params
}
func (params *CreateUserDefinedMessageParams) SetIdempotencyKey(IdempotencyKey string) *CreateUserDefinedMessageParams {
params.IdempotencyKey = &IdempotencyKey
return params
}

// Create a new User Defined Message for the given call sid.
func (c *ApiService) CreateUserDefinedMessage(CallSid string, params *CreateUserDefinedMessageParams) (*ApiV2010UserDefinedMessage, error) {
path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/UserDefinedMessages.json"
if params != nil && params.PathAccountSid != nil {
path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1)
} else {
path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1)
}
path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1)

data := url.Values{}
headers := make(map[string]interface{})

if params != nil && params.Content != nil {
data.Set("Content", *params.Content)
}
if params != nil && params.IdempotencyKey != nil {
data.Set("IdempotencyKey", *params.IdempotencyKey)
}

resp, err := c.requestHandler.Post(c.baseURL+path, data, headers)
if err != nil {
return nil, err
}

defer resp.Body.Close()

ps := &ApiV2010UserDefinedMessage{}
if err := json.NewDecoder(resp.Body).Decode(ps); err != nil {
return nil, err
}

return ps, err
}
18 changes: 18 additions & 0 deletions rest/api/v2010/accounts_messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ type CreateMessageParams struct {
SendAt *time.Time `json:"SendAt,omitempty"`
// If set to True, Twilio will deliver the message as a single MMS message, regardless of the presence of media.
SendAsMms *bool `json:"SendAsMms,omitempty"`
// The SID of the Content object returned at Content API content create time (https://www.twilio.com/docs/content-api/create-and-send-your-first-content-api-template#create-a-template). If this parameter is not specified, then the Content API will not be utilized.
ContentSid *string `json:"ContentSid,omitempty"`
// Key-value pairs of variable names to substitution values, used alongside a content_sid. If not specified, Content API will default to the default variables defined at create time.
ContentVariables *string `json:"ContentVariables,omitempty"`
// A Twilio phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, an [alphanumeric sender ID](https://www.twilio.com/docs/sms/send-messages#use-an-alphanumeric-sender-id), or a [Channel Endpoint address](https://www.twilio.com/docs/sms/channels#channel-addresses) that is enabled for the type of message you want to send. Phone numbers or [short codes](https://www.twilio.com/docs/sms/api/short-code) purchased from Twilio also work here. You cannot, for example, spoof messages from a private cell phone number. If you are using `messaging_service_sid`, this parameter must be empty.
From *string `json:"From,omitempty"`
// The SID of the [Messaging Service](https://www.twilio.com/docs/sms/services#send-a-message-with-copilot) you want to associate with the Message. Set this parameter to use the [Messaging Service Settings and Copilot Features](https://www.twilio.com/console/sms/services) you have configured and leave the `from` parameter empty. When only this parameter is set, Twilio will use your enabled Copilot Features to select the `from` phone number for delivery.
Expand Down Expand Up @@ -138,6 +142,14 @@ func (params *CreateMessageParams) SetSendAsMms(SendAsMms bool) *CreateMessagePa
params.SendAsMms = &SendAsMms
return params
}
func (params *CreateMessageParams) SetContentSid(ContentSid string) *CreateMessageParams {
params.ContentSid = &ContentSid
return params
}
func (params *CreateMessageParams) SetContentVariables(ContentVariables string) *CreateMessageParams {
params.ContentVariables = &ContentVariables
return params
}
func (params *CreateMessageParams) SetFrom(From string) *CreateMessageParams {
params.From = &From
return params
Expand Down Expand Up @@ -217,6 +229,12 @@ func (c *ApiService) CreateMessage(params *CreateMessageParams) (*ApiV2010Messag
if params != nil && params.SendAsMms != nil {
data.Set("SendAsMms", fmt.Sprint(*params.SendAsMms))
}
if params != nil && params.ContentSid != nil {
data.Set("ContentSid", *params.ContentSid)
}
if params != nil && params.ContentVariables != nil {
data.Set("ContentVariables", *params.ContentVariables)
}
if params != nil && params.From != nil {
data.Set("From", *params.From)
}
Expand Down
Loading

0 comments on commit 1385df6

Please sign in to comment.