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

chore: added versions information file #219

Open
wants to merge 8 commits into
base: 2.0.0-rc
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
63 changes: 63 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,68 @@
twilio-go changelog
====================
[2023-12-07] Version 2.0.0-rc.1
-------------------------------
**Library - Feature**
- [PR #213](https://github.com/twilio/twilio-go/pull/213): Support JSON payload in HTTP requests. Thanks to [@AsabuHere](https://github.com/AsabuHere)!

**Accounts**
- Updated Safelist metadata to correct the docs.
- Add Global SafeList API changes

**Api**
- Updated service base url for connect apps and authorized connect apps APIs **(breaking change)**
- Update documentation to reflect RiskCheck GA
- Added optional parameter `CallToken` for create participant api

**Events**
- Marked as GA

**Flex**
- Adding `provisioning_status` for Email Manager
- Adding `offline_config` to Flex Configuration

**Insights**
- decommission voice-qualitystats-endpoint role

**Intelligence**
- Add text-generation operator (for example conversation summary) results to existing OperatorResults collection.
- Deleted `redacted` parameter from fetching transcript in v2 **(breaking change)**

**Lookups**
- Add new `phone_number_quality_score` package to the lookup response
- Remove `disposable_phone_number_risk` package **(breaking change)**

**Messaging**
- Add tollfree edit_allowed and edit_reason fields
- Update Phone Number, Short Code, Alpha Sender, US A2P and Channel Sender documentation
- Add DELETE support to Tollfree Verification resource
- Update US App To Person documentation with current `message_samples` requirements

**Serverless**
- Add node18 as a valid Build runtime

**Taskrouter**
- Add container attribute to task_queue_bulk_real_time_statistics endpoint
- Remove beta_feature check on task_queue_bulk_real_time_statistics endpoint
- Add `virtual_start_time` property to tasks
- Updating `task_queue_data` format from `map` to `array` in the response of bulk get endpoint of TaskQueue Real Time Statistics API **(breaking change)**

**Trusthub**
- Add additional optional fields in compliance_tollfree_inquiry.json
- Rename did to tollfree_phone_number in compliance_tollfree_inquiry.json
- Add new optional field notification_email to compliance_tollfree_inquiry.json

**Verify**
- Remove `Tags` from Public Docs **(breaking change)**
- Add `VerifyEventSubscriptionEnabled` parameter to service create and update endpoints.
- Add `Tags` optional parameter on Verification creation.
- Update Verify TOTP maturity to GA.


[2023-11-22] Version 2.0.0-rc.0
---------------------------
- Release Candidate preparation

[2023-10-05] Version 1.14.1
---------------------------
**Library - Chore**
Expand Down
7 changes: 7 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

_All `MAJOR` version bumps will have upgrade notes posted here._

## [2023-11-22] 1.x.x to 2.x.x-rc.x
### Overview

#### Twilio Go Helper Library’s major version 2.0.0-rc.x is now available. We ensured that you can upgrade to Go helper Library 2.0.0-rc.x version without any breaking changes

Support for JSON payloads has been added in the request body

[2022-10-05] 0.26.x to 1.x.x
-----------------------------
### NEW FEATURE - Added Support for Twiml Building
Expand Down
35 changes: 35 additions & 0 deletions VERSIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Versioning Strategy

`twilio-go` uses a modified version of [Semantic Versioning][semver] for
all changes to the helper library. It is strongly encouraged that you pin at
least the major version and potentially the minor version to avoid pulling in
breaking changes.

Semantic Versions take the form of `MAJOR.MINOR.PATCH`

When bugs are fixed in the library in a backwards-compatible way, the `PATCH`
level will be incremented by one. When new features are added to the library
in a backwards-compatible way, the `PATCH` level will be incremented by one.
`PATCH` changes should _not_ break your code and are generally safe for upgrade.

When a new large feature set comes online or a small breaking change is
introduced, the `MINOR` version will be incremented by one and the `PATCH`
version reset to zero. `MINOR` changes _may_ require some amount of manual code
change for upgrade. These backwards-incompatible changes will generally be
limited to a small number of function signature changes.

The `MAJOR` version is used to indicate the family of technology represented by
the helper library. Breaking changes that require extensive reworking of code
will cause the `MAJOR` version to be incremented by one, and the `MINOR` and
`PATCH` versions will be reset to zero. Twilio understands that this can be very
disruptive, so we will only introduce this type of breaking change when
absolutely necessary. New `MAJOR` versions will be communicated in advance with
`Release Candidates` and a schedule.

## Supported Versions

Only the current `MAJOR` version of `twilio-go` is supported. New
features, functionality, bug fixes, and security updates will only be added to
the current `MAJOR` version.

[semver]: https://semver.org
2 changes: 1 addition & 1 deletion client/base_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ type BaseClient interface {
AccountSid() string
SetTimeout(timeout time.Duration)
SendRequest(method string, rawURL string, data url.Values,
headers map[string]interface{}) (*http.Response, error)
headers map[string]interface{}, body ...byte) (*http.Response, error)
}
59 changes: 44 additions & 15 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package client

import (
"bytes"
"encoding/json"
"fmt"
"net/http"
Expand Down Expand Up @@ -56,10 +57,20 @@ func (c *Client) SetTimeout(timeout time.Duration) {
c.HTTPClient.Timeout = timeout
}

func extractContentTypeHeader(headers map[string]interface{}) (cType string) {
headerType, ok := headers["Content-Type"]
if !ok {
return urlEncodedContentType
}
return headerType.(string)
}

const (
keepZeros = true
delimiter = '.'
escapee = '\\'
urlEncodedContentType = "application/x-www-form-urlencoded"
jsonContentType = "application/json"
keepZeros = true
delimiter = '.'
escapee = '\\'
)

func (c *Client) doWithErr(req *http.Request) (*http.Response, error) {
Expand Down Expand Up @@ -89,16 +100,24 @@ func (c *Client) doWithErr(req *http.Request) (*http.Response, error) {

// SendRequest verifies, constructs, and authorizes an HTTP request.
func (c *Client) SendRequest(method string, rawURL string, data url.Values,
headers map[string]interface{}) (*http.Response, error) {
headers map[string]interface{}, body ...byte) (*http.Response, error) {

contentType := extractContentTypeHeader(headers)

u, err := url.Parse(rawURL)
if err != nil {
return nil, err
}

valueReader := &strings.Reader{}
goVersion := runtime.Version()
var req *http.Request

if method == http.MethodGet {
//For HTTP GET Method there are no body parameters. All other parameters like query, path etc
// are added as information in the url itself. Also while Content-Type is json, we are sending
// json body. In that case, data variable conatins all other parameters than body, which is the
//same case as GET method. In that case as well all parameters will be added to url
if method == http.MethodGet || contentType == jsonContentType {
if data != nil {
v, _ := form.EncodeToStringWith(data, delimiter, escapee, keepZeros)
regex := regexp.MustCompile(`\.\d+`)
Expand All @@ -108,13 +127,28 @@ func (c *Client) SendRequest(method string, rawURL string, data url.Values,
}
}

if method == http.MethodPost {
valueReader = strings.NewReader(data.Encode())
//data is already processed and information will be added to u(the url) in the
//previous step. Now body will solely contain json payload
if contentType == jsonContentType {
req, err = http.NewRequest(method, u.String(), bytes.NewBuffer(body))
if err != nil {
return nil, err
}
} else {
//Here the HTTP POST methods which is not having json content type are processed
//All the values will be added in data and encoded (all body, query, path parameters)
if method == http.MethodPost {
valueReader = strings.NewReader(data.Encode())
}
req, err = http.NewRequest(method, u.String(), valueReader)
if err != nil {
return nil, err
}

}

req, err := http.NewRequest(method, u.String(), valueReader)
if err != nil {
return nil, err
if contentType == urlEncodedContentType {
req.Header.Add("Content-Type", urlEncodedContentType)
}

req.SetBasicAuth(c.basicAuth())
Expand All @@ -128,14 +162,9 @@ func (c *Client) SendRequest(method string, rawURL string, data url.Values,

req.Header.Add("User-Agent", userAgent)

if method == http.MethodPost {
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
}

for k, v := range headers {
req.Header.Add(k, fmt.Sprint(v))
}

return c.doWithErr(req)
}

Expand Down
2 changes: 1 addition & 1 deletion client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func TestClient_SetAccountSid(t *testing.T) {
func TestClient_DefaultUserAgentHeaders(t *testing.T) {
headerServer := httptest.NewServer(http.HandlerFunc(
func(writer http.ResponseWriter, request *http.Request) {
assert.Regexp(t, regexp.MustCompile(`^twilio-go/[0-9.]+\s\(\w+\s\w+\)\sgo/\S+$`), request.Header.Get("User-Agent"))
assert.Regexp(t, regexp.MustCompile(`^twilio-go/[0-9.]+(-rc.[0-9])*\s\(\w+\s\w+\)\sgo/\S+$`), request.Header.Get("User-Agent"))
}))

resp, _ := testClient.SendRequest("GET", headerServer.URL, nil, nil)
Expand Down
9 changes: 4 additions & 5 deletions client/request_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ func NewRequestHandler(client BaseClient) *RequestHandler {
}

func (c *RequestHandler) sendRequest(method string, rawURL string, data url.Values,
headers map[string]interface{}) (*http.Response, error) {
headers map[string]interface{}, body ...byte) (*http.Response, error) {
parsedURL, err := c.BuildUrl(rawURL)
if err != nil {
return nil, err
}

return c.Client.SendRequest(method, parsedURL, data, headers)
return c.Client.SendRequest(method, parsedURL, data, headers, body...)
}

// BuildUrl builds the target host string taking into account region and edge configurations.
Expand Down Expand Up @@ -83,8 +82,8 @@ func (c *RequestHandler) BuildUrl(rawURL string) (string, error) {
return u.String(), nil
}

func (c *RequestHandler) Post(path string, bodyData url.Values, headers map[string]interface{}) (*http.Response, error) {
return c.sendRequest(http.MethodPost, path, bodyData, headers)
func (c *RequestHandler) Post(path string, bodyData url.Values, headers map[string]interface{}, body ...byte) (*http.Response, error) {
return c.sendRequest(http.MethodPost, path, bodyData, headers, body...)
}

func (c *RequestHandler) Get(path string, queryData url.Values, headers map[string]interface{}) (*http.Response, error) {
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.14.1"
const LibraryVersion = "2.0.0-rc.1"
6 changes: 5 additions & 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.50.1
- API version: 1.0.0
- 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 @@ -44,6 +44,9 @@ Class | Method | HTTP request | Description
*CredentialsPublicKeysApi* | [**FetchCredentialPublicKey**](docs/CredentialsPublicKeysApi.md#fetchcredentialpublickey) | **Get** /v1/Credentials/PublicKeys/{Sid} |
*CredentialsPublicKeysApi* | [**ListCredentialPublicKey**](docs/CredentialsPublicKeysApi.md#listcredentialpublickey) | **Get** /v1/Credentials/PublicKeys |
*CredentialsPublicKeysApi* | [**UpdateCredentialPublicKey**](docs/CredentialsPublicKeysApi.md#updatecredentialpublickey) | **Post** /v1/Credentials/PublicKeys/{Sid} |
*SafeListNumbersApi* | [**CreateSafelist**](docs/SafeListNumbersApi.md#createsafelist) | **Post** /v1/SafeList/Numbers |
*SafeListNumbersApi* | [**DeleteSafelist**](docs/SafeListNumbersApi.md#deletesafelist) | **Delete** /v1/SafeList/Numbers |
*SafeListNumbersApi* | [**FetchSafelist**](docs/SafeListNumbersApi.md#fetchsafelist) | **Get** /v1/SafeList/Numbers |


## Documentation For Models
Expand All @@ -54,6 +57,7 @@ Class | Method | HTTP request | Description
- [AccountsV1AuthTokenPromotion](docs/AccountsV1AuthTokenPromotion.md)
- [AccountsV1CredentialAws](docs/AccountsV1CredentialAws.md)
- [AccountsV1CredentialPublicKey](docs/AccountsV1CredentialPublicKey.md)
- [AccountsV1Safelist](docs/AccountsV1Safelist.md)
- [ListCredentialAwsResponseMeta](docs/ListCredentialAwsResponseMeta.md)


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ApiV2010Safelist
# AccountsV1Safelist

## Properties

Expand Down
2 changes: 1 addition & 1 deletion rest/accounts/v1/docs/ListCredentialAwsResponseMeta.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**FirstPageUrl** | **string** | |[optional]
**Key** | **string** | |[optional]
**NextPageUrl** | Pointer to **string** | |
**Page** | **int** | |[optional]
**PageSize** | **int** | |[optional]
**PreviousPageUrl** | Pointer to **string** | |
**Url** | **string** | |[optional]
**Key** | **string** | |[optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# SafeListNumbersApi

All URIs are relative to *https://api.twilio.com*
All URIs are relative to *https://accounts.twilio.com*

Method | HTTP request | Description
------------- | ------------- | -------------
[**CreateSafelist**](SafeListNumbersApi.md#CreateSafelist) | **Post** /2010-04-01/SafeList/Numbers.json |
[**DeleteSafelist**](SafeListNumbersApi.md#DeleteSafelist) | **Delete** /2010-04-01/SafeList/Numbers.json |
[**FetchSafelist**](SafeListNumbersApi.md#FetchSafelist) | **Get** /2010-04-01/SafeList/Numbers.json |
[**CreateSafelist**](SafeListNumbersApi.md#CreateSafelist) | **Post** /v1/SafeList/Numbers |
[**DeleteSafelist**](SafeListNumbersApi.md#DeleteSafelist) | **Delete** /v1/SafeList/Numbers |
[**FetchSafelist**](SafeListNumbersApi.md#FetchSafelist) | **Get** /v1/SafeList/Numbers |



## CreateSafelist

> ApiV2010Safelist CreateSafelist(ctx, optional)
> AccountsV1Safelist CreateSafelist(ctx, optional)



Expand All @@ -33,7 +33,7 @@ Name | Type | Description

### Return type

[**ApiV2010Safelist**](ApiV2010Safelist.md)
[**AccountsV1Safelist**](AccountsV1Safelist.md)

### Authorization

Expand Down Expand Up @@ -90,7 +90,7 @@ Name | Type | Description

## FetchSafelist

> ApiV2010Safelist FetchSafelist(ctx, optional)
> AccountsV1Safelist FetchSafelist(ctx, optional)



Expand All @@ -111,7 +111,7 @@ Name | Type | Description

### Return type

[**ApiV2010Safelist**](ApiV2010Safelist.md)
[**AccountsV1Safelist**](AccountsV1Safelist.md)

### Authorization

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Api
* Twilio - Accounts
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
Expand All @@ -14,8 +14,8 @@

package openapi

// ApiV2010Safelist struct for ApiV2010Safelist
type ApiV2010Safelist struct {
// AccountsV1Safelist struct for AccountsV1Safelist
type AccountsV1Safelist struct {
// The unique string that we created to identify the SafeList resource.
Sid *string `json:"sid,omitempty"`
// The phone number in SafeList.
Expand Down
Loading