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
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 @@ -35,6 +35,7 @@ Class | Method | HTTP request | Description
*CredentialsAWSApi* | [**DeleteCredentialAws**](docs/CredentialsAWSApi.md#deletecredentialaws) | **Delete** /v1/Credentials/AWS/{Sid} |
*CredentialsAWSApi* | [**FetchCredentialAws**](docs/CredentialsAWSApi.md#fetchcredentialaws) | **Get** /v1/Credentials/AWS/{Sid} |
*CredentialsAWSApi* | [**ListCredentialAws**](docs/CredentialsAWSApi.md#listcredentialaws) | **Get** /v1/Credentials/AWS |
*CredentialsAWSApi* | [**PatchCredentialAws**](docs/CredentialsAWSApi.md#patchcredentialaws) | **Patch** /v1/Credentials/AWS/{Sid} |
*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
48 changes: 48 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 @@ -417,6 +417,54 @@ func (c *ApiService) getNextListCredentialAwsResponse(nextPageUrl string) (inter
return ps, nil
}

// Optional parameters for the method 'PatchCredentialAws'
type PatchCredentialAwsParams struct {
//
TestString *string `json:"TestString,omitempty"`
//
TestBoolean *bool `json:"TestBoolean,omitempty"`
}

func (params *PatchCredentialAwsParams) SetTestString(TestString string) *PatchCredentialAwsParams {
params.TestString = &TestString
return params
}
func (params *PatchCredentialAwsParams) SetTestBoolean(TestBoolean bool) *PatchCredentialAwsParams {
params.TestBoolean = &TestBoolean
return params
}

func (c *ApiService) PatchCredentialAws(Sid string, params *PatchCredentialAwsParams) (*TestResponseObject, error) {
path := "/v1/Credentials/AWS/{Sid}"
path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1)

data := url.Values{}
headers := map[string]interface{}{
"Content-Type": "application/x-www-form-urlencoded",
}

if params != nil && params.TestString != nil {
data.Set("TestString", *params.TestString)
}
if params != nil && params.TestBoolean != nil {
data.Set("TestBoolean", fmt.Sprint(*params.TestBoolean))
}

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

defer resp.Body.Close()

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

return ps, err
}

// Optional parameters for the method 'UpdateCredentialAws'
type UpdateCredentialAwsParams struct {
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ public static AwsReader reader() {










public static AwsUpdater updater(final String pathSid) {
return new AwsUpdater(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/*
* 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 com.twilio.rest.flexapi.v1.credential;

import com.twilio.base.Patcher;
import com.twilio.constant.EnumConstants;
import com.twilio.constant.EnumConstants.ParameterType;
import com.twilio.converter.Serializer;
import com.twilio.exception.ApiConnectionException;
import com.twilio.exception.ApiException;
import com.twilio.exception.RestException;
import com.twilio.http.HttpMethod;
import com.twilio.http.Request;
import com.twilio.http.Response;
import com.twilio.http.TwilioRestClient;
import com.twilio.rest.Domains;

import com.twilio.type.*;


public class AwsPatcher extends Patcher<Aws> {
private String pathSid;
private String testString;
private Boolean testBoolean;

public AwsPatcher(final String pathSid) {
this.pathSid = pathSid;
}


public AwsPatcher setTestString(final String testString){
this.testString = testString;
return this;
}


public AwsPatcher setTestBoolean(final Boolean testBoolean){
this.testBoolean = testBoolean;
return this;
}


@Override
public Aws patch(final TwilioRestClient client) {

String path = "/v1/Credentials/AWS/{Sid}";

path = path.replace("{"+"Sid"+"}", this.pathSid.toString());


Request request = new Request(
HttpMethod.PATCH,
Domains.FLEXAPI.toString(),
path
);
request.setContentType(EnumConstants.ContentType.FORM_URLENCODED);
addPostParams(request);

Response response = client.request(request);

if (response == null) {
throw new ApiConnectionException("Aws patch failed: Unable to connect to server");
} else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) {
RestException restException = RestException.fromJson(
response.getStream(),
client.getObjectMapper()
);
if (restException == null) {
throw new ApiException("Server Error, no content", response.getStatusCode());
}
throw new ApiException(restException);
}

return Aws.fromJson(response.getStream(), client.getObjectMapper());
}

private void addPostParams(final Request request) {

if (testString != null) {
Serializer.toString(request, "TestString", testString, ParameterType.URLENCODED);
}



if (testBoolean != null) {
Serializer.toString(request, "TestBoolean", testBoolean, ParameterType.URLENCODED);
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ export interface FeedbackCallSummaryContextSolution {
sid: string;
}

export class FeedbackCallSummaryContextImpl
implements FeedbackCallSummaryContext
{
export class FeedbackCallSummaryContextImpl implements FeedbackCallSummaryContext {
protected _solution: FeedbackCallSummaryContextSolution;
protected _uri: string;

Expand Down
108 changes: 108 additions & 0 deletions examples/node/src/rest/flexApi/v1/credential/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ const serialize = require("../../../../base/serialize");
import { isValidPathParam } from "../../../../base/utility";
import { HistoryListInstance } from "./aws/history";

/**
* Options to pass to patch a AwsInstance
*/
export interface AwsContextPatchOptions {
/** */
testString?: string;
/** */
testBoolean?: boolean;
}

/**
* Options to pass to update a AwsInstance
*/
Expand Down Expand Up @@ -91,6 +101,29 @@ export interface AwsContext {
callback?: (error: Error | null, item?: AwsInstance) => any,
): Promise<AwsInstance>;

/**
* Patch a AwsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AwsInstance
*/
patch(
callback?: (error: Error | null, item?: AwsInstance) => any,
): Promise<AwsInstance>;
/**
* Patch a AwsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AwsInstance
*/
patch(
params: AwsContextPatchOptions,
callback?: (error: Error | null, item?: AwsInstance) => any,
): Promise<AwsInstance>;

/**
* Update a AwsInstance
*
Expand Down Expand Up @@ -195,6 +228,51 @@ export class AwsContextImpl implements AwsContext {
return operationPromise;
}

patch(
params?:
| AwsContextPatchOptions
| ((error: Error | null, item?: AwsInstance) => any),
callback?: (error: Error | null, item?: AwsInstance) => any,
): Promise<AwsInstance> {
if (params instanceof Function) {
callback = params;
params = {};
} else {
params = params || {};
}

let data: any = {};

if (params["testString"] !== undefined)
data["TestString"] = params["testString"];
if (params["testBoolean"] !== undefined)
data["TestBoolean"] = serialize.bool(params["testBoolean"]);

const headers: any = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";

const instance = this;
let operationVersion = instance._version,
operationPromise = operationVersion.patch({
uri: instance._uri,
method: "patch",
data,
headers,
});

operationPromise = operationPromise.then(
(payload) =>
new AwsInstance(operationVersion, payload, instance._solution.sid),
);

operationPromise = instance._version.setPromiseCallback(
operationPromise,
callback,
);
return operationPromise;
}

update(
params?:
| AwsContextUpdateOptions
Expand Down Expand Up @@ -319,6 +397,36 @@ export class AwsInstance {
return this._proxy.fetch(callback);
}

/**
* Patch a AwsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AwsInstance
*/
patch(
callback?: (error: Error | null, item?: AwsInstance) => any,
): Promise<AwsInstance>;
/**
* Patch a AwsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AwsInstance
*/
patch(
params: AwsContextPatchOptions,
callback?: (error: Error | null, item?: AwsInstance) => any,
): Promise<AwsInstance>;

patch(
params?: any,
callback?: (error: Error | null, item?: AwsInstance) => any,
): Promise<AwsInstance> {
return this._proxy.patch(params, callback);
}

/**
* Update a AwsInstance
*
Expand Down
30 changes: 30 additions & 0 deletions examples/php/src/Twilio/Rest/FlexApi/V1/Credential/AwsContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,36 @@ public function fetch(): AwsInstance
}


/**
* Patch the AwsInstance
*
* @param array|Options $options Optional Arguments
* @return AwsInstance Patchd AwsInstance
* @throws TwilioException When an HTTP error occurs.
*/
public function patch(array $options = []): AwsInstance
{

$options = new Values($options);

$data = Values::of([
'TestString' =>
$options['testString'],
'TestBoolean' =>
Serialize::booleanToString($options['testBoolean']),
]);

$headers = Values::of(['Content-Type' => 'application/x-www-form-urlencoded', 'Accept' => 'application/json' ]);
$payload = $this->version->patch('PATCH', $this->uri, [], $data, $headers);

return new AwsInstance(
$this->version,
$payload,
$this->solution['sid']
);
}


/**
* Update the AwsInstance
*
Expand Down
13 changes: 13 additions & 0 deletions examples/php/src/Twilio/Rest/FlexApi/V1/Credential/AwsInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,19 @@ public function fetch(): AwsInstance
return $this->proxy()->fetch();
}

/**
* Patch the AwsInstance
*
* @param array|Options $options Optional Arguments
* @return AwsInstance Patchd AwsInstance
* @throws TwilioException When an HTTP error occurs.
*/
public function patch(array $options = []): AwsInstance
{

return $this->proxy()->patch($options);
}

/**
* Update the AwsInstance
*
Expand Down
Loading
Loading