1
1
from ..service import Service
2
- from typing import List
2
+ from typing import List, Dict, Any
3
3
from ..exception import AppwriteException
4
4
{% set added = [] %}
5
5
{% for method in service .methods %}
@@ -24,12 +24,38 @@ from ..enums.{{ name | caseSnake }} import {{ name | caseUcfirst }};
24
24
25
25
class {{ service .name | caseUcfirst }}(Service):
26
26
27
- def __init__(self, client):
27
+ def __init__(self, client) -> None :
28
28
super({{ service .name | caseUcfirst }}, self).__init__(client)
29
29
{% for method in service .methods %}
30
30
31
- def {{ method .name | caseSnake }}(self{% if method .parameters .all | length > 0 %}, {% endif %}{% for parameter in method .parameters .all %}{{ parameter .name | escapeKeyword | caseSnake }}: {{ parameter | getPropertyType(method ) | raw }}{% if not parameter .required %} = None{% endif %}{% if not loop .last %}, {% endif %}{% endfor %}{% if ' multipart/form-data' in method .consumes %}, on_progress = None{% endif %}):
32
- """{{method .title }}"""
31
+ def {{ method .name | caseSnake }}(self{% if method .parameters .all | length > 0 %}, {% endif %}{% for parameter in method .parameters .all %}{{ parameter .name | escapeKeyword | caseSnake }}: {{ parameter | getPropertyType(method ) | raw }}{% if not parameter .required %} = None{% endif %}{% if not loop .last %}, {% endif %}{% endfor %}{% if ' multipart/form-data' in method .consumes %}, on_progress = None{% endif %}) -> {% if method .type == ' webAuth' %}str{% else %}Dict[str, Any]{% endif %}:
32
+ """
33
+ {% autoescape false %}{{ method .description | replace({" \n" : " \n " }) }}{% endautoescape %}
34
+ {% if method .parameters .all | length > 0 or ' multipart/form-data' in method .consumes %}
35
+
36
+ Parameters
37
+ ----------
38
+ {% for parameter in method .parameters .all %}{{ parameter .name | escapeKeyword | caseSnake }} : {{ parameter | getPropertyType(method ) | raw }}
39
+ {% autoescape false %}{{ parameter .description | replace({" \n" : " \n " }) }}{% endautoescape %}
40
+
41
+ {% endfor %}{% if ' multipart/form-data' in method .consumes %}
42
+ on_progress : callable, optional
43
+ Optional callback for upload progress
44
+ {% endif %}{% endif %}
45
+
46
+ Returns
47
+ -------
48
+ {% if method .type == ' webAuth' %}str
49
+ Authentication response as a string
50
+ {% else %}Dict[str, Any]
51
+ API response as a dictionary
52
+ {% endif %}
53
+
54
+ Raises
55
+ ------
56
+ AppwriteException
57
+ If API request fails
58
+ """
33
59
34
60
api_path = '{{ method .path }}'
35
61
{{ include (' python/base/params.twig' ) }}
0 commit comments