Skip to content

Commit

Permalink
chore: handle versionless orgs api for node, ruby, python, php (#624)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiwarishubham635 authored Dec 12, 2024
1 parent f9896d9 commit c08e45b
Show file tree
Hide file tree
Showing 61 changed files with 2,515 additions and 151 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ tmp
**/execution-result.xml
**/php_coverage.xml
*.iml
generateFiles.py
generateFiles.py
temp_specs/
14 changes: 14 additions & 0 deletions examples/node/src/rest/PreviewIamBase.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Domain from "../base/Domain";
import V1 from "./previewIam/V1";

class PreviewIamBase extends Domain {
constructor(twilio: any) {
super(twilio, "https://preview-iam.twilio.com");
}

get v1(): V1 {
return new V1(this);
}
}

export = PreviewIamBase;
5 changes: 5 additions & 0 deletions examples/node/src/rest/Twilio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Client, ClientOpts } from "../base/BaseTwilio";
import ApiBase from "./ApiBase";
import FlexApiBase from "./FlexApiBase";
import VersionlessBase from "./VersionlessBase";
import PreviewIamBase = require("./PreviewIamBase");

class Twilio extends Client {
constructor(username?: string, password?: string, opts?: ClientOpts) {
Expand All @@ -19,6 +20,10 @@ class Twilio extends Client {
get versionless(): VersionlessBase {
return new VersionlessBase(this);
}

get previewIam(): PreviewIamBase {
return new PreviewIamBase(this);
}
}

export = Twilio;
10 changes: 10 additions & 0 deletions examples/node/src/rest/api/v2010/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,14 @@ export class AccountContextImpl implements AccountContext {
remove(
callback?: (error: Error | null, item?: boolean) => any,
): Promise<boolean> {
const headers: any = {};

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

operationPromise = instance._version.setPromiseCallback(
Expand All @@ -214,11 +217,15 @@ export class AccountContextImpl implements AccountContext {
fetch(
callback?: (error: Error | null, item?: AccountInstance) => any,
): Promise<AccountInstance> {
const headers: any = {};
headers["Accept"] = "application/json";

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

operationPromise = operationPromise.then(
Expand Down Expand Up @@ -254,6 +261,7 @@ export class AccountContextImpl implements AccountContext {

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

const instance = this;
let operationVersion = instance._version,
Expand Down Expand Up @@ -607,6 +615,7 @@ export function AccountListInstance(version: V2010): AccountListInstance {

const headers: any = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
if (params["xTwilioWebhookEnabled"] !== undefined)
headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"];

Expand Down Expand Up @@ -662,6 +671,7 @@ export function AccountListInstance(version: V2010): AccountListInstance {
if (params.pageToken !== undefined) data["PageToken"] = params.pageToken;

const headers: any = {};
headers["Accept"] = "application/json";

let operationVersion = version,
operationPromise = operationVersion.page({
Expand Down
8 changes: 8 additions & 0 deletions examples/node/src/rest/api/v2010/account/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,14 @@ export class CallContextImpl implements CallContext {
remove(
callback?: (error: Error | null, item?: boolean) => any,
): Promise<boolean> {
const headers: any = {};

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

operationPromise = instance._version.setPromiseCallback(
Expand All @@ -123,11 +126,15 @@ export class CallContextImpl implements CallContext {
fetch(
callback?: (error: Error | null, item?: CallInstance) => any,
): Promise<CallInstance> {
const headers: any = {};
headers["Accept"] = "application/json";

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

operationPromise = operationPromise.then(
Expand Down Expand Up @@ -415,6 +422,7 @@ export function CallListInstance(

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

let operationVersion = version,
operationPromise = operationVersion.create({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export class FeedbackCallSummaryContextImpl

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

const instance = this;
let operationVersion = instance._version,
Expand Down
4 changes: 4 additions & 0 deletions examples/node/src/rest/flexApi/v1/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,15 @@ export class CallContextImpl implements CallContext {
update(
callback?: (error: Error | null, item?: CallInstance) => any,
): Promise<CallInstance> {
const headers: any = {};
headers["Accept"] = "application/json";

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

operationPromise = operationPromise.then(
Expand Down
9 changes: 9 additions & 0 deletions examples/node/src/rest/flexApi/v1/credential/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,14 @@ export class AwsContextImpl implements AwsContext {
remove(
callback?: (error: Error | null, item?: boolean) => any,
): Promise<boolean> {
const headers: any = {};

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

operationPromise = instance._version.setPromiseCallback(
Expand All @@ -169,11 +172,15 @@ export class AwsContextImpl implements AwsContext {
fetch(
callback?: (error: Error | null, item?: AwsInstance) => any,
): Promise<AwsInstance> {
const headers: any = {};
headers["Accept"] = "application/json";

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

operationPromise = operationPromise.then(
Expand Down Expand Up @@ -210,6 +217,7 @@ export class AwsContextImpl implements AwsContext {

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

const instance = this;
let operationVersion = instance._version,
Expand Down Expand Up @@ -485,6 +493,7 @@ export function AwsListInstance(version: V1): AwsListInstance {
if (params.pageToken !== undefined) data["PageToken"] = params.pageToken;

const headers: any = {};
headers["Accept"] = "application/json";

let operationVersion = version,
operationPromise = operationVersion.page({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export class HistoryContextImpl implements HistoryContext {
};

const headers: any = {};
headers["Accept"] = "application/json";

const instance = this;
let operationVersion = instance._version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export function NewCredentialsListInstance(

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

let operationVersion = version,
operationPromise = operationVersion.create({
Expand Down
46 changes: 46 additions & 0 deletions examples/node/src/rest/previewIam/V1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Organization Public API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import PreviewIamBase from "../PreviewIamBase";
import Version from "../../base/Version";
import { AuthorizeListInstance } from "./v1/authorize";
import { TokenListInstance } from "./v1/token";

export default class V1 extends Version {
/**
* Initialize the V1 version of PreviewIam
*
* @param domain - The Twilio (Twilio.PreviewIam) domain
*/
constructor(domain: PreviewIamBase) {
super(domain, "v1");
}

/** authorize - { Twilio.PreviewIam.V1.AuthorizeListInstance } resource */
protected _authorize?: AuthorizeListInstance;
/** token - { Twilio.PreviewIam.V1.TokenListInstance } resource */
protected _token?: TokenListInstance;

/** Getter for authorize resource */
get authorize(): AuthorizeListInstance {
this._authorize = this._authorize || AuthorizeListInstance(this);
return this._authorize;
}

/** Getter for token resource */
get token(): TokenListInstance {
this._token = this._token || TokenListInstance(this);
return this._token;
}
}
Loading

0 comments on commit c08e45b

Please sign in to comment.