@@ -11,6 +11,12 @@ from .. import models
11
11
12
12
{% for c in referenced_components -%}
13
13
from ..models import {{ c | to_upper_camel_case }}
14
+ {% endfor -%}
15
+ {% for _ , sub in resource .subresources | items -%}
16
+ from .{{ sub.name | to_snake_case }} import (
17
+ {{ sub.name | to_upper_camel_case }},
18
+ {{ sub.name | to_upper_camel_case }}Async,
19
+ )
14
20
{% endfor %}
15
21
16
22
@@ -65,7 +71,15 @@ class {{ resource_type_name }}{{ op.name | to_upper_camel_case }}Options(BaseOpt
65
71
66
72
{% for is_async in [true , false ] %}
67
73
class {{ resource.name | to_upper_camel_case }}{% if is_async %} Async{% endif %} (ApiBase):
68
- {% - if resource .operations | length != 0 %}
74
+ {% - for name , sub in resource .subresources | items %}
75
+ {% - set sub_type_name %} {{ sub.name | to_upper_camel_case }}{% if is_async %} Async{% endif %}{% endset %}
76
+ @property
77
+ def {{ name | to_snake_case }}(self) -> {{ sub_type_name }}:
78
+ return {{ sub_type_name }}(self._client)
79
+
80
+ {% endfor %}
81
+
82
+ {% - if resource .operations | length > 0 %}
69
83
{% - for op in resource .operations %}
70
84
{% if op .response_body_schema_name is defined -%}
71
85
{% set return_type = op .response_body_schema_name | to_upper_camel_case -%}
@@ -142,8 +156,9 @@ class {{ resource.name | to_upper_camel_case }}{% if is_async %}Async{% endif %}
142
156
143
157
{{ code | indent(4, true) }}
144
158
{% endfor -%}
145
- {% else %}
146
- {# empty class with no functions, so we have a pass here #}
159
+ {% endif %}
160
+ {% if resource .subresources | length == 0 and resource .operations | length == 0 %}
161
+ {# empty class with no members, so we have a pass here -#}
147
162
pass
148
163
{% endif %}
149
164
{% endfor %}
0 commit comments