Skip to content

Commit

Permalink
Revert "orgs api changes"
Browse files Browse the repository at this point in the history
This reverts commit 5db63b7.
  • Loading branch information
AsabuHere committed Dec 3, 2024
1 parent 5db63b7 commit 7080338
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion scripts/build_twilio_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
generateForLanguages = {
'twilio_iam_organizations.json' : ['java', 'csharp']
}
dynamic_languages = ['node', 'python']
dynamic_languages = ['node']
CLEANUP_IMPORT_LANGUAGES = ['java', 'php']
REMOVE_DUPLICATE_IMPORT_LANGUAGES = ['node']
CONFIG_FOLDER = 'tmp'
Expand Down
4 changes: 1 addition & 3 deletions src/main/resources/twilio-python/context.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ class {{apiName}}Context(InstanceContext):
{{paramName}}=self._solution['{{paramName}}']{{/instancePathParams}}
)
{{/vendorExtensions.x-is-update-operation}}{{#vendorExtensions.x-is-fetch-operation}}
{{#vendorExtensions.x-twilio.ignoreOperation}}
def {{vendorExtensions.x-name-lower}}(self{{#allParams}}, {{paramName}}: {{#if required}}{{{dataType}}}{{else}}Union[{{{dataType}}}, object]=values.unset{{/if}}{{/allParams}}) -> {{instanceName}}:
"""
Fetch1 the {{instanceName}}
Fetch the {{instanceName}}
{{#allParams}}
:param {{paramName}}: {{{description}}}{{/allParams}}

Expand Down Expand Up @@ -107,7 +106,6 @@ class {{apiName}}Context(InstanceContext):
{{#instancePathParams}}{{paramName}}=self._solution['{{paramName}}'],
{{/instancePathParams}}
)
{{/vendorExtensions.x-twilio.ignoreOperation}}
{{/vendorExtensions.x-is-fetch-operation}}{{#vendorExtensions.x-is-delete-operation}}
def {{vendorExtensions.x-name-lower}}(self{{#allParams}}, {{paramName}}: {{#if required}}{{{dataType}}}{{else}}Union[{{{dataType}}}, object]=values.unset{{/if}}{{/allParams}}) -> bool:
"""
Expand Down
8 changes: 3 additions & 5 deletions src/main/resources/twilio-python/instance.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class {{instanceName}}(InstanceResource):
:returns: The updated {{instanceName}}
"""
return self._proxy.update({{#allParams}}{{paramName}}={{paramName}}, {{/allParams}})

async def {{vendorExtensions.x-name-lower}}_async(self{{#allParams}}, {{paramName}}: {{#if required}}{{{dataType}}}{{else}}Union[{{{dataType}}}, object]=values.unset{{/if}}{{/allParams}}) -> "{{instanceName}}":
"""
Asynchronous coroutine to update the {{instanceName}}
Expand All @@ -48,10 +49,9 @@ class {{instanceName}}(InstanceResource):
"""
return await self._proxy.update_async({{#allParams}}{{paramName}}={{paramName}}, {{/allParams}})
{{/vendorExtensions.x-is-update-operation}}{{#vendorExtensions.x-is-fetch-operation}}
{{#vendorExtensions.x-twilio.ignoreOperation}}
def {{vendorExtensions.x-name-lower}}(self{{#allParams}}, {{paramName}}: {{#if required}}{{{dataType}}}{{else}}Union[{{{dataType}}}, object]=values.unset{{/if}}{{/allParams}}) -> "{{instanceName}}":
"""
Fetch2 the {{instanceName}}
Fetch the {{instanceName}}
{{#allParams}}
:param {{paramName}}: {{{description}}}{{/allParams}}

Expand All @@ -68,7 +68,6 @@ class {{instanceName}}(InstanceResource):
:returns: The fetched {{instanceName}}
"""
return await self._proxy.fetch_async({{#allParams}}{{paramName}}={{paramName}}, {{/allParams}})
{{/vendorExtensions.x-twilio.ignoreOperation}}
{{/vendorExtensions.x-is-fetch-operation}}{{#vendorExtensions.x-is-delete-operation}}
def {{vendorExtensions.x-name-lower}}(self{{#allParams}}, {{paramName}}: {{#if required}}{{{dataType}}}{{else}}Union[{{{dataType}}}, object]=values.unset{{/if}}{{/allParams}}) -> bool:
"""
Expand Down Expand Up @@ -108,8 +107,7 @@ class {{instanceName}}(InstanceResource):
"""
return await self._proxy.create_async({{#allParams}}{{paramName}}{{#if required}}{{else}}={{paramName}}{{/if}}, {{/allParams}})
{{/vendorExtensions.x-is-create-operation}}{{/vendorExtensions.x-is-context-operation}}{{/operations}}{{#dependents}}{{#instanceDependent}}

@property
@property
def {{mountName}}(self) -> {{listName}}:
"""
Access the {{mountName}}
Expand Down
11 changes: 4 additions & 7 deletions src/main/resources/twilio-python/listOperations.handlebars
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{#operations}}
{{#vendorExtensions.x-is-create-operation}}
{{^vendorExtensions.x-twilio.ignoreOperation}}
def create(self{{#allParams}}, {{paramName}}: {{#if required}}{{{dataType}}}{{else}}Union[{{{dataType}}}, object]=values.unset{{/if}}{{/allParams}}) -> {{instanceName}}:
"""
Create the {{instanceName}}
Expand Down Expand Up @@ -52,8 +51,7 @@
payload = await self._version.create_async(method='{{vendorExtensions.x-http-method}}', uri=self._uri, {{#hasParams}}data=data,{{/hasParams}} headers=headers{{#queryParams.0}}, params=params{{/queryParams.0}})

return {{instanceName}}(self._version, payload{{#listPathParams}}, {{paramName}}=self._solution['{{paramName}}']{{/listPathParams}})
{{/vendorExtensions.x-twilio.ignoreOperation}}{{/vendorExtensions.x-is-create-operation}}{{^instancePath}}{{#vendorExtensions.x-is-fetch-operation}}
{{^vendorExtensions.x-twilio.ignoreOperation}}
{{/vendorExtensions.x-is-create-operation}}{{^instancePath}}{{#vendorExtensions.x-is-fetch-operation}}
def fetch(self{{#allParams}}, {{paramName}}: {{#if required}}{{{dataType}}}{{else}}Union[{{{dataType}}}, object]=values.unset{{/if}}{{/allParams}}) -> {{instanceName}}:
"""
Asynchronously fetch the {{instanceName}}
Expand Down Expand Up @@ -94,7 +92,7 @@
{{/queryParams.0}}
payload = await self._version.fetch_async(method='{{vendorExtensions.x-http-method}}', uri=self._uri, headers=headers{{#queryParams.0}}, params=params{{/queryParams.0}})

return {{instanceName}}(self._version, payload{{#listPathParams}}, {{paramName}}=self._solution['{{paramName}}']{{/listPathParams}}){{/vendorExtensions.x-twilio.ignoreOperation}}{{/vendorExtensions.x-is-fetch-operation}}{{#vendorExtensions.x-is-delete-operation}}{{^vendorExtensions.x-twilio.ignoreOperation}}
return {{instanceName}}(self._version, payload{{#listPathParams}}, {{paramName}}=self._solution['{{paramName}}']{{/listPathParams}}){{/vendorExtensions.x-is-fetch-operation}}{{#vendorExtensions.x-is-delete-operation}}
def delete(self{{#allParams}}, {{paramName}}: {{#if required}}{{{dataType}}}{{else}}Union[{{{dataType}}}, object]=values.unset{{/if}}{{/allParams}}) -> bool:
"""
Asynchronously delete the {{instanceName}}
Expand Down Expand Up @@ -129,7 +127,7 @@
{{#queryParams}}'{{{baseName}}}': {{paramName}},
{{/queryParams}}
}){{/queryParams.0}}
return await self._version.delete_async(method='{{vendorExtensions.x-http-method}}', uri=self._uri, headers=headers{{#queryParams.0}}, params=params{{/queryParams.0}}){{/vendorExtensions.x-twilio.ignoreOperation}}{{/vendorExtensions.x-is-delete-operation}}{{#vendorExtensions.x-is-update-operation}}{{^vendorExtensions.x-twilio.ignoreOperation}}
return await self._version.delete_async(method='{{vendorExtensions.x-http-method}}', uri=self._uri, headers=headers{{#queryParams.0}}, params=params{{/queryParams.0}}){{/vendorExtensions.x-is-delete-operation}}{{#vendorExtensions.x-is-update-operation}}

def update(self{{#allParams}}, {{paramName}}: {{#if required}}{{{dataType}}}{{else}}Union[{{{dataType}}}, object]=values.unset{{/if}}{{/allParams}}) -> {{instanceName}}:
"""
Expand Down Expand Up @@ -181,7 +179,7 @@
{{/queryParams.0}}
payload = await self._version.update_async(method='{{vendorExtensions.x-http-method}}', uri=self._uri, {{#hasParams}}data=data,{{/hasParams}} headers=headers{{#queryParams.0}}, params=params{{/queryParams.0}})

return {{instanceName}}(self._version, payload{{#listPathParams}}, {{paramName}}=self._solution['{{paramName}}']{{/listPathParams}}){{/vendorExtensions.x-twilio.ignoreOperation}}{{/vendorExtensions.x-is-update-operation}}{{/instancePath}}{{#vendorExtensions.x-is-read-operation}}{{^vendorExtensions.x-twilio.ignoreOperation}}
return {{instanceName}}(self._version, payload{{#listPathParams}}, {{paramName}}=self._solution['{{paramName}}']{{/listPathParams}}){{/vendorExtensions.x-is-update-operation}}{{/instancePath}}{{#vendorExtensions.x-is-read-operation}}
def stream(self, {{#allParams}}
{{#startsWith paramName text='page_size'}}{{else}}{{paramName}}: Union[{{{dataType}}}, object] = values.unset,{{/startsWith}}{{/allParams}}
limit: Optional[int] = None,
Expand Down Expand Up @@ -375,5 +373,4 @@
target_url
)
return {{apiName}}Page(self._version, response{{#if listPathParams}}, self._solution{{/if}})
{{/vendorExtensions.x-twilio.ignoreOperation}}
{{/vendorExtensions.x-is-read-operation}}{{/operations}}
11 changes: 9 additions & 2 deletions src/test/java/com/twilio/oai/TwilioGeneratorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@
public class TwilioGeneratorTest {
@Parameterized.Parameters
public static Collection<Generator> generators() {
return Arrays.asList(Generator.TWILIO_PYTHON);
return Arrays.asList(Generator.TWILIO_CSHARP,
Generator.TWILIO_GO,
Generator.TWILIO_JAVA,
Generator.TWILIO_NODE,
Generator.TWILIO_PHP,
Generator.TWILIO_PYTHON,
Generator.TWILIO_RUBY,
Generator.TWILIO_TERRAFORM);
}

private final Generator generator;
Expand All @@ -40,7 +47,7 @@ public static void setUp() {

@Test
public void launchGenerator() {
final String pathname = "/Users/asabu/di/codehq2024/PythonOAI/twilio-oai/spec/json/twilio_iam_organization_versionless.json";
final String pathname = "examples/spec/twilio_api_v2010.yaml";
File filesList[] ;
File directoryPath = new File(pathname);
if (directoryPath.isDirectory()) {
Expand Down

0 comments on commit 7080338

Please sign in to comment.