Skip to content

Commit

Permalink
Merge branch 'main' into natebrennand/add-context-methods-to-SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
childish-sambino authored Nov 8, 2022
2 parents 12c8e79 + ef23fda commit d1fb508
Show file tree
Hide file tree
Showing 74 changed files with 1,530 additions and 351 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: install test generate test-docker

OPENAPI_GENERATOR_VERSION=6.2.0
OPENAPI_GENERATOR_VERSION=6.2.1

install:
wget -N https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/$(OPENAPI_GENERATOR_VERSION)/openapi-generator-cli-$(OPENAPI_GENERATOR_VERSION).jar
Expand All @@ -14,4 +14,4 @@ generate: install
bash scripts/generate.sh

test-docker: generate
SONAR_TOKEN=$(SONAR_TOKEN) bash scripts/prism.sh
bash scripts/prism.sh $(SONAR_TOKEN)
2 changes: 1 addition & 1 deletion examples/csharp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ RUN dotnet build Twilio.sln
CMD ["/bin/bash", "-c", "set -o pipefail && sleep 10 && dotnet test test/Twilio.Test/Twilio.Test.csproj --no-build 2>&1 | tee /local/test-report.out"]

RUN apt-get -y install build-essential
RUN if [ "$SONAR_TOKEN" = "" ] ; then echo Skipping sonar analysis ; else make cover PROJECT_NAME=twilio_twilio-oai-generator-csharp SONAR_SOURCES="/d:sonar.sources=src/Twilio/Rest/**/*.* /d:sonar.tests=test/Twilio.Test/**/*.*" ; fi
CMD if [ "$SONAR_TOKEN" = "" ] ; then echo Skipping sonar analysis ; else make cover PROJECT_NAME=twilio_twilio-oai-generator-csharp SONAR_SOURCES="/d:sonar.inclusions=src/Twilio/Rest/**/* /d:sonar.cs.analyzeGeneratedCode=true /d:sonar.exclusions=test/Twilio.Test/**/*" ; fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* 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.
*/


using System;
using System.Collections.Generic;
using Twilio.Base;
using Twilio.Converters;




namespace Twilio.Rest.FlexApi.V1.Credential.Aws
{
/// <summary> fetch </summary>
public class FetchHistoryOptions : IOptions<HistoryResource>
{


public string PathSid { get; }


public Dictionary<string, object> AddOnsData { get; set; }



/// <summary> Construct a new FetchCredentialHistoryOptions </summary>
/// <param name="pathSid"> </param>
public FetchHistoryOptions(string pathSid)
{
PathSid = pathSid;
}


/// <summary> Generate the necessary parameters </summary>
public List<KeyValuePair<string, string>> GetParams()
{
var p = new List<KeyValuePair<string, string>>();

if (AddOnsData != null)
{
p.AddRange(PrefixedCollapsibleMap.Serialize(AddOnsData, "AddOns"));
}
return p;
}


}


}

Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
/*
* 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.
*/


using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using Twilio.Base;
using Twilio.Clients;
using Twilio.Converters;
using Twilio.Exceptions;
using Twilio.Http;



namespace Twilio.Rest.FlexApi.V1.Credential.Aws
{
public class HistoryResource : Resource
{



private static Request BuildFetchRequest(FetchHistoryOptions options, ITwilioRestClient client)
{

string path = "/v1/Credentials/AWS/{Sid}/History";

string PathSid = options.PathSid;
path = path.Replace("{"+"Sid"+"}", PathSid);


return new Request(
HttpMethod.Get,
Rest.Domain.FlexApi,
path,
queryParams: options.GetParams(),
headerParams: null
);
}

/// <summary> fetch </summary>
/// <param name="options"> Fetch History parameters </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> A single instance of History </returns>
public static HistoryResource Fetch(FetchHistoryOptions options, ITwilioRestClient client = null)
{
client = client ?? TwilioClient.GetRestClient();
var response = client.Request(BuildFetchRequest(options, client));
return FromJson(response.Content);
}

#if !NET35
/// <summary> fetch </summary>
/// <param name="options"> Fetch History parameters </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> Task that resolves to A single instance of History </returns>
public static async System.Threading.Tasks.Task<HistoryResource> FetchAsync(FetchHistoryOptions options,
ITwilioRestClient client = null)
{
client = client ?? TwilioClient.GetRestClient();
var response = await client.RequestAsync(BuildFetchRequest(options, client));
return FromJson(response.Content);
}
#endif
/// <summary> fetch </summary>
/// <param name="pathSid"> </param>
/// <param name="addOnsData"> </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> A single instance of History </returns>
public static HistoryResource Fetch(
string pathSid,
Dictionary<string, object> addOnsData = null,
ITwilioRestClient client = null)
{
var options = new FetchHistoryOptions(pathSid){ AddOnsData = addOnsData };
return Fetch(options, client);
}

#if !NET35
/// <summary> fetch </summary>
/// <param name="pathSid"> </param>
/// <param name="addOnsData"> </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> Task that resolves to A single instance of History </returns>
public static async System.Threading.Tasks.Task<HistoryResource> FetchAsync(string pathSid, Dictionary<string, object> addOnsData = null, ITwilioRestClient client = null)
{
var options = new FetchHistoryOptions(pathSid){ AddOnsData = addOnsData };
return await FetchAsync(options, client);
}
#endif

/// <summary>
/// Converts a JSON string into a HistoryResource object
/// </summary>
/// <param name="json"> Raw JSON string </param>
/// <returns> HistoryResource object represented by the provided JSON </returns>
public static HistoryResource FromJson(string json)
{
try
{
return JsonConvert.DeserializeObject<HistoryResource>(json);
}
catch (JsonException e)
{
throw new ApiException(e.Message, e);
}
}


///<summary> The account_sid </summary>
[JsonProperty("account_sid")]
public string AccountSid { get; private set; }

///<summary> The sid </summary>
[JsonProperty("sid")]
public string Sid { get; private set; }

///<summary> The test_string </summary>
[JsonProperty("test_string")]
public string TestString { get; private set; }

///<summary> The test_integer </summary>
[JsonProperty("test_integer")]
public int? TestInteger { get; private set; }



private HistoryResource() {

}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,23 @@ public class CreateNewCredentialsOptions : IOptions<NewCredentialsResource>

public object TestAnyType { get; set; }


public List<object> TestAnyArray { get; set; }

///<summary> A comma-separated list of the permissions you will request from the users of this ConnectApp. Can include: `get-all` and `post-all`. </summary>
public List<NewCredentialsResource.PermissionsEnum> Permissions { get; set; }


public string SomeA2PThing { get; set; }


/// <summary> Construct a new CreateCredentialAwsOptions </summary>
/// <param name="testString"> </param>
public CreateNewCredentialsOptions(string testString)
{
TestString = testString;
TestObjectArray = new List<object>();
TestAnyArray = new List<object>();
Permissions = new List<NewCredentialsResource.PermissionsEnum>();
}

Expand Down Expand Up @@ -145,10 +152,18 @@ public List<KeyValuePair<string, string>> GetParams()
{
p.Add(new KeyValuePair<string, string>("TestAnyType", Serializers.JsonObject(TestAnyType)));
}
if (TestAnyArray != null)
{
p.AddRange(TestAnyArray.Select(TestAnyArray => new KeyValuePair<string, string>("TestAnyArray", Serializers.JsonObject(TestAnyArray))));
}
if (Permissions != null)
{
p.AddRange(Permissions.Select(Permissions => new KeyValuePair<string, string>("Permissions", Permissions.ToString())));
}
if (SomeA2PThing != null)
{
p.Add(new KeyValuePair<string, string>("SomeA2PThing", SomeA2PThing));
}
return p;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ public static async System.Threading.Tasks.Task<NewCredentialsResource> CreateAs
/// <param name="testEnum"> </param>
/// <param name="testObjectArray"> </param>
/// <param name="testAnyType"> </param>
/// <param name="testAnyArray"> </param>
/// <param name="permissions"> A comma-separated list of the permissions you will request from the users of this ConnectApp. Can include: `get-all` and `post-all`. </param>
/// <param name="someA2PThing"> </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> A single instance of NewCredentials </returns>
public static NewCredentialsResource Create(
Expand All @@ -133,10 +135,12 @@ public static NewCredentialsResource Create(
NewCredentialsResource.StatusEnum testEnum = null,
List<object> testObjectArray = null,
object testAnyType = null,
List<object> testAnyArray = null,
List<NewCredentialsResource.PermissionsEnum> permissions = null,
string someA2PThing = null,
ITwilioRestClient client = null)
{
var options = new CreateNewCredentialsOptions(testString){ TestInteger = testInteger, TestDate = testDate, TestNumberFloat = testNumberFloat, TestObject = testObject, TestBoolean = testBoolean, TestNumber = testNumber, TestNumberDouble = testNumberDouble, TestNumberInt32 = testNumberInt32, TestNumberInt64 = testNumberInt64, TestDateTime = testDateTime, TestEnum = testEnum, TestObjectArray = testObjectArray, TestAnyType = testAnyType, Permissions = permissions };
var options = new CreateNewCredentialsOptions(testString){ TestInteger = testInteger, TestDate = testDate, TestNumberFloat = testNumberFloat, TestObject = testObject, TestBoolean = testBoolean, TestNumber = testNumber, TestNumberDouble = testNumberDouble, TestNumberInt32 = testNumberInt32, TestNumberInt64 = testNumberInt64, TestDateTime = testDateTime, TestEnum = testEnum, TestObjectArray = testObjectArray, TestAnyType = testAnyType, TestAnyArray = testAnyArray, Permissions = permissions, SomeA2PThing = someA2PThing };
return Create(options, client);
}

Expand All @@ -156,7 +160,9 @@ public static NewCredentialsResource Create(
/// <param name="testEnum"> </param>
/// <param name="testObjectArray"> </param>
/// <param name="testAnyType"> </param>
/// <param name="testAnyArray"> </param>
/// <param name="permissions"> A comma-separated list of the permissions you will request from the users of this ConnectApp. Can include: `get-all` and `post-all`. </param>
/// <param name="someA2PThing"> </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> Task that resolves to A single instance of NewCredentials </returns>
public static async System.Threading.Tasks.Task<NewCredentialsResource> CreateAsync(
Expand All @@ -174,10 +180,12 @@ public static async System.Threading.Tasks.Task<NewCredentialsResource> CreateAs
NewCredentialsResource.StatusEnum testEnum = null,
List<object> testObjectArray = null,
object testAnyType = null,
List<object> testAnyArray = null,
List<NewCredentialsResource.PermissionsEnum> permissions = null,
string someA2PThing = null,
ITwilioRestClient client = null)
{
var options = new CreateNewCredentialsOptions(testString){ TestInteger = testInteger, TestDate = testDate, TestNumberFloat = testNumberFloat, TestObject = testObject, TestBoolean = testBoolean, TestNumber = testNumber, TestNumberDouble = testNumberDouble, TestNumberInt32 = testNumberInt32, TestNumberInt64 = testNumberInt64, TestDateTime = testDateTime, TestEnum = testEnum, TestObjectArray = testObjectArray, TestAnyType = testAnyType, Permissions = permissions };
var options = new CreateNewCredentialsOptions(testString){ TestInteger = testInteger, TestDate = testDate, TestNumberFloat = testNumberFloat, TestObject = testObject, TestBoolean = testBoolean, TestNumber = testNumber, TestNumberDouble = testNumberDouble, TestNumberInt32 = testNumberInt32, TestNumberInt64 = testNumberInt64, TestDateTime = testDateTime, TestEnum = testEnum, TestObjectArray = testObjectArray, TestAnyType = testAnyType, TestAnyArray = testAnyArray, Permissions = permissions, SomeA2PThing = someA2PThing };
return await CreateAsync(options, client);
}
#endif
Expand Down
1 change: 1 addition & 0 deletions examples/go/go-client/helper/rest/flex/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Class | Method | HTTP request | Description
*CredentialsAWSApi* | [**FetchCredentialAws**](docs/CredentialsAWSApi.md#fetchcredentialaws) | **Get** /v1/Credentials/AWS/{Sid} |
*CredentialsAWSApi* | [**ListCredentialAws**](docs/CredentialsAWSApi.md#listcredentialaws) | **Get** /v1/Credentials/AWS |
*CredentialsAWSApi* | [**UpdateCredentialAws**](docs/CredentialsAWSApi.md#updatecredentialaws) | **Post** /v1/Credentials/AWS/{Sid} |
*CredentialsAWSHistoryApi* | [**FetchCredentialHistory**](docs/CredentialsAWSHistoryApi.md#fetchcredentialhistory) | **Get** /v1/Credentials/AWS/{Sid}/History |
*VoiceApi* | [**UpdateCall**](docs/VoiceApi.md#updatecall) | **Post** /v1/Voice/{Sid} |


Expand Down
26 changes: 26 additions & 0 deletions examples/go/go-client/helper/rest/flex/v1/credentials_aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ type CreateCredentialAwsParams struct {
TestObjectArray *[]map[string]interface{} `json:"TestObjectArray,omitempty"`
//
TestAnyType *interface{} `json:"TestAnyType,omitempty"`
//
TestAnyArray *[]interface{} `json:"TestAnyArray,omitempty"`
// A comma-separated list of the permissions you will request from the users of this ConnectApp. Can include: `get-all` and `post-all`.
Permissions *[]string `json:"Permissions,omitempty"`
//
SomeA2PThing *string `json:"SomeA2PThing,omitempty"`
}

func (params *CreateCredentialAwsParams) SetTestString(TestString string) *CreateCredentialAwsParams {
Expand Down Expand Up @@ -115,10 +119,18 @@ func (params *CreateCredentialAwsParams) SetTestAnyType(TestAnyType interface{})
params.TestAnyType = &TestAnyType
return params
}
func (params *CreateCredentialAwsParams) SetTestAnyArray(TestAnyArray []interface{}) *CreateCredentialAwsParams {
params.TestAnyArray = &TestAnyArray
return params
}
func (params *CreateCredentialAwsParams) SetPermissions(Permissions []string) *CreateCredentialAwsParams {
params.Permissions = &Permissions
return params
}
func (params *CreateCredentialAwsParams) SetSomeA2PThing(SomeA2PThing string) *CreateCredentialAwsParams {
params.SomeA2PThing = &SomeA2PThing
return params
}

func (c *ApiService) CreateCredentialAws(params *CreateCredentialAwsParams) (*TestResponseObject, error) {
return c.CreateCredentialAwsWithCtx(context.TODO(), params)
Expand Down Expand Up @@ -192,11 +204,25 @@ func (c *ApiService) CreateCredentialAwsWithCtx(ctx context.Context, params *Cre

data.Set("TestAnyType", string(v))
}
if params != nil && params.TestAnyArray != nil {
for _, item := range *params.TestAnyArray {
v, err := json.Marshal(item)

if err != nil {
return nil, err
}

data.Add("TestAnyArray", string(v))
}
}
if params != nil && params.Permissions != nil {
for _, item := range *params.Permissions {
data.Add("Permissions", item)
}
}
if params != nil && params.SomeA2PThing != nil {
data.Set("SomeA2PThing", *params.SomeA2PThing)
}

resp, err := c.requestHandler.Post(ctx, c.baseURL+path, data, headers)
if err != nil {
Expand Down
Loading

0 comments on commit d1fb508

Please sign in to comment.