Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: ['java' ]
language: [ 'csharp', 'go', 'java', 'node', 'php', 'python', 'ruby' ]
runs-on: ubuntu-latest
timeout-minutes: 20
env:
Expand All @@ -28,7 +28,7 @@ jobs:
- name: Set up Java 11
uses: actions/setup-java@v4
with:
distribution: 'zulu'
distribution: 'temurin'
java-version: '11'

- name: Login to Docker Hub
Expand Down
10 changes: 5 additions & 5 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ A short description of what this PR does.
### Checklist
- [x] I acknowledge that all my contributions will be made under the project's license
- [ ] Run `make test-docker`
- [ ] Verify affected language:
- [ ] Generate [twilio-go](https://github.com/twilio/twilio-go) from our [OpenAPI specification](https://github.com/twilio/twilio-oai) using the [build_twilio_go.py](./examples/build_twilio_go.py) using `python examples/build_twilio_go.py path/to/twilio-oai/spec/yaml path/to/twilio-go` and inspect the diff
- [ ] Run `make test` in `twilio-go`
- [ ] Create a pull request in `twilio-go`
- [ ] Provide a link below to the pull request
- [ ] Verify affected language according to the code change:
- [ ] Generate [twilio-java](https://github.com/twilio/twilio-java) from our [OpenAPI specification](https://github.com/twilio/twilio-oai) using the [scripts/build_twilio_library.py](./scripts/build_twilio_library.py) using `python scripts/build_twilio_library.py path/to/twilio-oai/spec/yaml path/to/twilio-java -l java` and inspect the diff
- [ ] Run `make test` in `twilio-java`
- [ ] Create a pull request in `twilio-java`
- [ ] Provide a link below to the pull request, this ensures that the generated code has been verified
- [ ] I have made a material change to the repo (functionality, testing, spelling, grammar)
- [ ] I have read the [Contribution Guidelines](https://github.com/twilio/twilio-oai-generator/blob/main/CONTRIBUTING.md) and my PR follows them
- [ ] I have titled the PR appropriately
Expand Down
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ java -cp /path/to/openapi-generator-cli.jar:/path/to/your.jar org.openapitools.c

(Do not forget to replace the values `/path/to/openapi-generator-cli.jar`, `/path/to/your.jar` and `/path/to/openapi.yaml` in the previous command)

Here is an example script to generate [twilio-go](https://github.com/twilio/twilio-go) from our [OpenAPI specification](https://github.com/twilio/twilio-oai): [build_twilio_go.py](./examples/build_twilio_go.py).

### For Windows
You will need to use `;` instead of `:` in the classpath, e.g.
```
Expand Down Expand Up @@ -109,8 +107,8 @@ To generate [`twilio-go`](https://github.com/twilio/twilio-go) from [`twilio-oai

Update `<path to>` and execute the following from the root of this repo:

* To generate the entire suite, run `make install && python3 examples/build_twilio_go.py <path to>/twilio-oai/spec/yaml <path to>/twilio-go`
* To generate the provider for a single domain such as studio, run `make install && python3 examples/build_twilio_go.py <path to>/twilio-oai/spec/yaml/twilio_studio_v2.yaml <path to>/twilio-go`
* To generate the entire suite, run `make install && python3 scripts/build_twilio_library.py <path to>/twilio-oai/spec/yaml <path to>/twilio-go`
* To generate the provider for a single domain such as studio, run `make install && python3 scripts/build_twilio_library.py <path to>/twilio-oai/spec/yaml/twilio_studio_v2.yaml <path to>/twilio-go`

## Generating terraform-provider-twilio

Expand All @@ -125,6 +123,5 @@ Update `<path to>` and execute the following from the root of this repo:

Update `<path to>` and execute the following from the root of this repo:

* To generate the entire suite, run `make install && python3 examples/build_twilio_go.py <path to>/twilio-oai/spec/yaml <path to>/terraform-provider-twilio -l terraform`
* To generate the provider for a single domain such as studio, run `make install && python3 examples/build_twilio_go.py <path to>/twilio-oai/spec/yaml/twilio_studio_v2.yaml <path to>/terraform-provider-twilio -l terraform`
* Run `python3 examples/build_twilio_go.py -h` to see more details
* To generate the entire suite, run `make install && python3 scripts/build_twilio_library.py <path to oai spec file>/twilio-oai/spec/yaml/abc.yaml <path to language repo>/github/twilio/twilio-java/<language> -l java`
* Run ` python3 scripts/build_twilio_library.py -h` to see more details
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public class CreateNewCredentialsOptions : IOptions<NewCredentialsResource>
public decimal? TestNumber { get; set; }


public float TestNumberFloat { get; set; }
public float? TestNumberFloat { get; set; }


public double TestNumberDouble { get; set; }
public double? TestNumberDouble { get; set; }


public decimal? TestNumberInt32 { get; set; }
Expand Down Expand Up @@ -114,11 +114,11 @@ public List<KeyValuePair<string, string>> GetParams()
}
if (TestNumberFloat != null)
{
p.Add(new KeyValuePair<string, string>("TestNumberFloat", TestNumberFloat.ToString()));
p.Add(new KeyValuePair<string, string>("TestNumberFloat", TestNumberFloat.Value.ToString()));
}
if (TestNumberDouble != null)
{
p.Add(new KeyValuePair<string, string>("TestNumberDouble", TestNumberDouble.ToString()));
p.Add(new KeyValuePair<string, string>("TestNumberDouble", TestNumberDouble.Value.ToString()));
}
if (TestNumberInt32 != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ public static NewCredentialsResource Create(
string testString,
int? testInteger = null,
DateTime? testDate = null,
float testNumberFloat = null,
float? testNumberFloat = null,
object testObject = null,
bool? testBoolean = null,
decimal? testNumber = null,
double testNumberDouble = null,
double? testNumberDouble = null,
decimal? testNumberInt32 = null,
long? testNumberInt64 = null,
DateTime? testDateTime = null,
Expand Down Expand Up @@ -171,11 +171,11 @@ public static async System.Threading.Tasks.Task<NewCredentialsResource> CreateAs
string testString,
int? testInteger = null,
DateTime? testDate = null,
float testNumberFloat = null,
float? testNumberFloat = null,
object testObject = null,
bool? testBoolean = null,
decimal? testNumber = null,
double testNumberDouble = null,
double? testNumberDouble = null,
decimal? testNumberInt32 = null,
long? testNumberInt64 = null,
DateTime? testDateTime = null,
Expand Down
1 change: 1 addition & 0 deletions examples/csharp/src/Twilio/Rest/Oauth/V2/TokenOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,6 @@ public List<KeyValuePair<string, string>> GetParams()


}

}

1 change: 1 addition & 0 deletions examples/csharp/src/Twilio/Rest/Oauth/V2/TokenResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public static async System.Threading.Tasks.Task<TokenResource> CreateAsync(
return await CreateAsync(options, client);
}
#endif


/// <summary>
/// Converts a JSON string into a TokenResource object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,35 @@ namespace Twilio.Rest.Versionless.DeployedDevices
public class FleetResource : Resource
{

public class VersionlessFleetTestNestedObjectValue
{
[JsonProperty("param1")]
private string Param1 {get; set;}
[JsonProperty("param2")]
private int Param2 {get; set;}
public VersionlessFleetTestNestedObjectValue() { }
public class Builder
{
private VersionlessFleetTestNestedObjectValue _versionlessFleetTestNestedObjectValue = new VersionlessFleetTestNestedObjectValue();
public Builder()
{
}
public Builder WithParam1(string param1)
{
_versionlessFleetTestNestedObjectValue.Param1= param1;
return this;
}
public Builder WithParam2(int param2)
{
_versionlessFleetTestNestedObjectValue.Param2= param2;
return this;
}
public VersionlessFleetTestNestedObjectValue Build()
{
return _versionlessFleetTestNestedObjectValue;
}
}
}



Expand Down Expand Up @@ -207,6 +236,18 @@ public static string ToJson(object model)
[JsonProperty("test_int_map")]
public Dictionary<string, int> TestIntMap { get; private set; }

///<summary> The test_nested_object </summary>
[JsonProperty("test_nested_object")]
public Dictionary<string, VersionlessFleetTestNestedObjectValue> TestNestedObject { get; private set; }

///<summary> The test_nested_array </summary>
[JsonProperty("test_nested_array")]
public List<Dictionary<string, int>> TestNestedArray { get; private set; }

///<summary> The test_nested_array_of_objects </summary>
[JsonProperty("test_nested_array_of_objects")]
public List<Dictionary<string, VersionlessFleetTestNestedObjectValue>> TestNestedArrayOfObjects { get; private set; }

///<summary> A string that uniquely identifies this Fleet. </summary>
[JsonProperty("sid")]
public string Sid { get; private set; }
Expand Down
9 changes: 6 additions & 3 deletions examples/go/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
FROM golang:1.20
FROM golang:1.21

ENV GOPATH /go

WORKDIR /go/src/twilio-go
COPY go-client .

RUN go get -u github.com/twilio/twilio-go@main
RUN go get -u github.com/twilio/terraform-provider-twilio@main
# Initialize Go modules and download dependencies
RUN go mod download && go mod verify

# Install test dependencies
RUN go get github.com/stretchr/[email protected]

# pipefail prevents errors in a pipeline from being masked.
CMD ["/bin/bash", "-c", "sleep 25 && set -o pipefail && go test -race ./... -coverprofile /local/coverage.out -json | tee /local/test-report.out"]
29 changes: 2 additions & 27 deletions examples/go/go-client/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,14 @@ go 1.21

require (
github.com/golang/mock v1.6.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.1
github.com/stretchr/testify v1.7.0
github.com/twilio/terraform-provider-twilio v0.13.1
github.com/twilio/twilio-go v0.25.0
)

require (
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.7 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-uuid v1.0.2 // indirect
github.com/hashicorp/go-version v1.4.0 // indirect
github.com/hashicorp/hcl/v2 v2.11.1 // indirect
github.com/hashicorp/terraform-plugin-go v0.7.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
github.com/vmihailenco/tagparser v0.1.2 // indirect
github.com/zclconf/go-cty v1.10.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/text v0.7.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
53 changes: 53 additions & 0 deletions examples/go/go-client/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/twilio/twilio-go v0.25.0 h1:Vk3OjsIcm//WTpywp3y+HD+Goiyf1SIiLQR+sxw+/gM=
github.com/twilio/twilio-go v0.25.0/go.mod h1:lz62Hopu4vicpQ056H5TJ0JE4AP0rS3sQ35/ejmgOwE=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Accounts
* 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"

"github.com/twilio/twilio-go/client"
)

// TestResponseObjectTestArrayOfObjectsInner struct for TestResponseObjectTestArrayOfObjectsInner
type TestResponseObjectTestArrayOfObjectsInner struct {
Count float32 `json:"count,omitempty"`
Description string `json:"description,omitempty"`
}

func (response *TestResponseObjectTestArrayOfObjectsInner) UnmarshalJSON(bytes []byte) (err error) {
raw := struct {
Count interface{} `json:"count"`
Description string `json:"description"`
}{}

if err = json.Unmarshal(bytes, &raw); err != nil {
return err
}

*response = TestResponseObjectTestArrayOfObjectsInner{
Description: raw.Description,
}

responseCount, err := client.UnmarshalFloat32(&raw.Count)
if err != nil {
return err
}
response.Count = *responseCount

return
}
1 change: 1 addition & 0 deletions examples/go/go-client/helper/rest/api/v2010/unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func TestAddingHeader(t *testing.T) {
params.RecordingStatusCallback = &testUri

expectedHeader := make(map[string]interface{})
expectedHeader["Content-Type"] = "application/x-www-form-urlencoded"
expectedHeader["X-Twilio-Webhook-Enabled"] = "true"

mockCtrl := gomock.NewController(t)
Expand Down
Loading
Loading