Skip to content

Commit bd87714

Browse files
committed
chore: add deprecated to kotlin
1 parent 2a046a7 commit bd87714

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) {
3030
{%~ endfor %}
3131
* @return [{{ method | returnType(spec, sdk.namespace | caseDot) | raw }}]
3232
*/
33+
{%~ if method.deprecated %}
34+
{% set deprecated_message = "This API is deprecated and uses outdated terminologies." %}
35+
{% if method.replaceWith %}
36+
{% set deprecated_message = deprecated_message ~ ' Please use ' ~ (method.replaceWith | capitalizeFirst) ~ ' instead.' %}
37+
@Deprecated(
38+
"{{ deprecated_message }}",
39+
ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}")
40+
)
41+
{% else %}
42+
@Deprecated("{{ deprecated_message }}")
43+
{% endif %}
44+
{%~ endif %}
3345
{%~ if method.parameters.all | reduce((carry, param) => carry or not param.required) %}
3446
@JvmOverloads
3547
{%~ endif %}
@@ -91,6 +103,18 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) {
91103
{%~ endfor %}
92104
* @return [{{ method | returnType(spec, sdk.namespace | caseDot) | raw }}]
93105
*/
106+
{%~ if method.deprecated %}
107+
{% set deprecated_message = "This API is deprecated and uses outdated terminologies." %}
108+
{% if method.replaceWith %}
109+
{% set deprecated_message = deprecated_message ~ ' Please use ' ~ (method.replaceWith | capitalizeFirst) ~ ' instead.' %}
110+
@Deprecated(
111+
"{{ deprecated_message }}",
112+
ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}")
113+
)
114+
{% else %}
115+
@Deprecated("{{ deprecated_message }}")
116+
{% endif %}
117+
{%~ endif %}
94118
{%~ if method.parameters.all | reduce((carry, param) => carry or not param.required) %}
95119
@JvmOverloads
96120
{%~ endif %}

0 commit comments

Comments
 (0)