From 2a046a74a1b37c9365747e8638d8ad6fdceda6fd Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 24 Jun 2025 17:25:33 +0530 Subject: [PATCH 01/23] update API spec URL and add deprecation handling in templates --- example.php | 2 +- src/SDK/SDK.php | 3 +++ src/Spec/Swagger2.php | 2 ++ .../java/io/package/services/Service.kt.twig | 24 +++++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/example.php b/example.php index eb1ebd40b..8ac0e5044 100644 --- a/example.php +++ b/example.php @@ -42,7 +42,7 @@ function getSSLPage($url) { $platform = 'console'; // $platform = 'server'; - $spec = getSSLPage("https://raw.githubusercontent.com/appwrite/appwrite/1.7.x/app/config/specs/swagger2-latest-{$platform}.json"); + $spec = getSSLPage("https://raw.githubusercontent.com/appwrite/appwrite/deprecate-old-methods/app/config/specs/swagger2-1.8.x-{$platform}.json"); if(empty($spec)) { throw new Exception('Failed to fetch spec from Appwrite server'); diff --git a/src/SDK/SDK.php b/src/SDK/SDK.php index 6df82ee72..f9ee52d4d 100644 --- a/src/SDK/SDK.php +++ b/src/SDK/SDK.php @@ -207,6 +207,9 @@ public function __construct(Language $language, Spec $spec) } return $value; })); + $this->twig->addFilter(new TwigFilter('capitalizeFirst', function ($value) { + return ucfirst($value); + })); } /** diff --git a/src/Spec/Swagger2.php b/src/Spec/Swagger2.php index dcefa5fbd..652082009 100644 --- a/src/Spec/Swagger2.php +++ b/src/Spec/Swagger2.php @@ -176,6 +176,8 @@ protected function parseMethod(string $methodName, string $pathName, array $meth 'consumes' => $method['consumes'] ?? [], 'cookies' => $method['x-appwrite']['cookies'] ?? false, 'type' => $method['x-appwrite']['type'] ?? false, + 'deprecated' => $method['x-appwrite']['deprecated'] ?? false, + 'replaceWith' => $method['x-appwrite']['replaceWith'] ?? '', 'headers' => [], 'parameters' => [ 'all' => [], diff --git a/templates/android/library/src/main/java/io/package/services/Service.kt.twig b/templates/android/library/src/main/java/io/package/services/Service.kt.twig index 10f4064e5..4148d8659 100644 --- a/templates/android/library/src/main/java/io/package/services/Service.kt.twig +++ b/templates/android/library/src/main/java/io/package/services/Service.kt.twig @@ -38,6 +38,18 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { * @return [{{ method | returnType(spec, sdk.namespace | caseDot) | raw }}] {%~ endif %} */ + {%~ if method.deprecated %} +{% set deprecated_message = "This API is deprecated and uses outdated terminologies." %} +{% if method.replaceWith %} +{% set deprecated_message = deprecated_message ~ ' Please use ' ~ (method.replaceWith | capitalizeFirst) ~ ' instead.' %} + @Deprecated( + "{{ deprecated_message }}", + ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}") + ) +{% else %} + @Deprecated("{{ deprecated_message }}") +{% endif %} +{%~ endif %} {%~ if method.parameters.all | reduce((carry, param) => carry or not param.required) %} @JvmOverloads {%~ endif %} @@ -192,6 +204,18 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { * @return [{{ method | returnType(spec, sdk.namespace | caseDot) | raw }}] {%~ endif %} */ + {%~ if method.deprecated %} +{% set deprecated_message = "This API is deprecated and uses outdated terminologies." %} +{% if method.replaceWith %} +{% set deprecated_message = deprecated_message ~ ' Please use ' ~ (method.replaceWith | capitalizeFirst) ~ ' instead.' %} + @Deprecated( + "{{ deprecated_message }}", + ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}") + ) +{% else %} + @Deprecated("{{ deprecated_message }}") +{% endif %} +{%~ endif %} {%~ if method.parameters.all | reduce((carry, param) => carry or not param.required) %} @JvmOverloads {%~ endif %} From bd87714030cc91b4f84d2a129ace30171f158253 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 24 Jun 2025 17:29:48 +0530 Subject: [PATCH 02/23] chore: add deprecated to kotlin --- .../appwrite/services/ServiceTemplate.kt.twig | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig b/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig index a95ca7c82..636bb49ec 100644 --- a/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig +++ b/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig @@ -30,6 +30,18 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { {%~ endfor %} * @return [{{ method | returnType(spec, sdk.namespace | caseDot) | raw }}] */ + {%~ if method.deprecated %} +{% set deprecated_message = "This API is deprecated and uses outdated terminologies." %} +{% if method.replaceWith %} +{% set deprecated_message = deprecated_message ~ ' Please use ' ~ (method.replaceWith | capitalizeFirst) ~ ' instead.' %} + @Deprecated( + "{{ deprecated_message }}", + ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}") + ) +{% else %} + @Deprecated("{{ deprecated_message }}") +{% endif %} +{%~ endif %} {%~ if method.parameters.all | reduce((carry, param) => carry or not param.required) %} @JvmOverloads {%~ endif %} @@ -91,6 +103,18 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { {%~ endfor %} * @return [{{ method | returnType(spec, sdk.namespace | caseDot) | raw }}] */ + {%~ if method.deprecated %} +{% set deprecated_message = "This API is deprecated and uses outdated terminologies." %} +{% if method.replaceWith %} +{% set deprecated_message = deprecated_message ~ ' Please use ' ~ (method.replaceWith | capitalizeFirst) ~ ' instead.' %} + @Deprecated( + "{{ deprecated_message }}", + ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}") + ) +{% else %} + @Deprecated("{{ deprecated_message }}") +{% endif %} +{%~ endif %} {%~ if method.parameters.all | reduce((carry, param) => carry or not param.required) %} @JvmOverloads {%~ endif %} From f458ccad985f53beb5b6672c96c03412b348c3c9 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 24 Jun 2025 18:29:59 +0530 Subject: [PATCH 03/23] chore: add deprecated to ts --- templates/node/src/services/template.ts.twig | 8 +++++++- templates/react-native/src/services/template.ts.twig | 8 +++++++- templates/web/src/services/template.ts.twig | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/templates/node/src/services/template.ts.twig b/templates/node/src/services/template.ts.twig index 52c79cb81..f4aafa5e0 100644 --- a/templates/node/src/services/template.ts.twig +++ b/templates/node/src/services/template.ts.twig @@ -27,7 +27,7 @@ export class {{ service.name | caseUcfirst }} { {%~ for method in service.methods %} /** {%~ if method.description %} - * {{ method.description }} + * {{ method.description | replace({'\n': '\n * '}) }} {%~ endif %} * {%~ for parameter in method.parameters.all %} @@ -35,6 +35,9 @@ export class {{ service.name | caseUcfirst }} { {%~ endfor %} * @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception} * @returns {{ '{' }}{{ method | getReturn(spec) | raw }}{{ '}' }} + {%~ if method.deprecated %} + * @deprecated This API is deprecated and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + {%~ endif %} */ {{ method.name | caseCamel }}{{ method.responseModel | getGenerics(spec) | raw }}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): {{ method | getReturn(spec) | raw }} { {%~ for parameter in method.parameters.all %} @@ -94,5 +97,8 @@ export class {{ service.name | caseUcfirst }} { ); {%~ endif %} } +{% if not loop.last %} + +{% endif %} {%~ endfor %} } diff --git a/templates/react-native/src/services/template.ts.twig b/templates/react-native/src/services/template.ts.twig index 890d19d5c..22248b451 100644 --- a/templates/react-native/src/services/template.ts.twig +++ b/templates/react-native/src/services/template.ts.twig @@ -41,7 +41,10 @@ export class {{ service.name | caseUcfirst }} extends Service { * @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception} * @returns {% if method.type == 'webAuth' %}{void|string}{% elseif method.type == 'location' %}{ArrayBuffer}{% else %}{Promise}{% endif %} - */ + {%~ if method.deprecated %} + * @deprecated This API is deprecated and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + {%~ endif %} + */ {% if method.type == 'upload'%}async {% endif %}{{ method.name | caseCamel }}{{ method.responseModel | getGenerics(spec) | raw }}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): {{ method | getReturn(spec) | raw }} { {% for parameter in method.parameters.all %} {% if parameter.required %} @@ -187,6 +190,9 @@ export class {{ service.name | caseUcfirst }} extends Service { {% endfor %} * @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception} * @returns {{ '{' }}URL{{ '}' }} + {%~ if method.deprecated %} + * @deprecated This API is deprecated and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + {%~ endif %} */ {{ method.name | caseCamel }}URL({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): URL { const apiPath = '{{ method.path }}'{% for parameter in method.parameters.path %}.replace('{{ '{' }}{{ parameter.name | caseCamel | escapeKeyword }}{{ '}' }}', {{ parameter.name | caseCamel | escapeKeyword }}){% endfor %}; diff --git a/templates/web/src/services/template.ts.twig b/templates/web/src/services/template.ts.twig index 397b3175e..7dc7819ce 100644 --- a/templates/web/src/services/template.ts.twig +++ b/templates/web/src/services/template.ts.twig @@ -28,7 +28,7 @@ export class {{ service.name | caseUcfirst }} { {%~ for method in service.methods %} /** {%~ if method.description %} - * {{ method.description }} + * {{ method.description | replace({'\n': '\n * '}) }} {%~ endif %} * {%~ for parameter in method.parameters.all %} @@ -36,6 +36,9 @@ export class {{ service.name | caseUcfirst }} { {%~ endfor %} * @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception} * @returns {{ '{' }}{{ method | getReturn(spec) | raw }}{{ '}' }} + {%~ if method.deprecated %} + * @deprecated This API is deprecated and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + {%~ endif %} */ {{ method.name | caseCamel }}{{ method.responseModel | getGenerics(spec) | raw }}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): {{ method | getReturn(spec) | raw }} { {%~ for parameter in method.parameters.all %} @@ -108,5 +111,8 @@ export class {{ service.name | caseUcfirst }} { ); {%~ endif %} } +{% if not loop.last %} + +{% endif %} {%~ endfor %} } From fe940006a2c5e3a457f43c0c3b9e7cdb55b3ba3c Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 24 Jun 2025 19:24:04 +0530 Subject: [PATCH 04/23] chore: add deprecated to python --- src/SDK/SDK.php | 11 +++++++++++ templates/python/package/services/service.py.twig | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/src/SDK/SDK.php b/src/SDK/SDK.php index f9ee52d4d..46a26a143 100644 --- a/src/SDK/SDK.php +++ b/src/SDK/SDK.php @@ -210,6 +210,17 @@ public function __construct(Language $language, Spec $spec) $this->twig->addFilter(new TwigFilter('capitalizeFirst', function ($value) { return ucfirst($value); })); + $this->twig->addFilter(new TwigFilter('caseSnakeExceptFirstDot', function ($value) { + $parts = explode('.', $value, 2); + $toSnake = function ($str) { + preg_match_all('!([A-Za-z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $str, $matches); + return implode('_', array_map(function ($m) { + return $m === strtoupper($m) ? strtolower($m) : lcfirst($m); + }, $matches[0])); + }; + if (count($parts) < 2) return $toSnake($value); + return $parts[0] . '.' . $toSnake($parts[1]); + })); } /** diff --git a/templates/python/package/services/service.py.twig b/templates/python/package/services/service.py.twig index 2eca9a794..adf4024f5 100644 --- a/templates/python/package/services/service.py.twig +++ b/templates/python/package/services/service.py.twig @@ -34,6 +34,11 @@ class {{ service.name | caseUcfirst }}(Service): {% if method.parameters.all|length > 0 or 'multipart/form-data' in method.consumes %} +{% if method.deprecated %} + .. deprecated:: + This API is deprecated and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | caseSnakeExceptFirstDot }}` instead.{% endif %} +{% endif %} + Parameters ---------- {% for parameter in method.parameters.all %}{{ parameter.name | escapeKeyword | caseSnake }} : {{ parameter | getPropertyType(method) | raw }} From f64266d56355dd14fcbc1cfcc27d07b5de22c2dc Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 27 Jun 2025 16:22:18 +0530 Subject: [PATCH 05/23] fix: lint --- src/SDK/SDK.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/SDK/SDK.php b/src/SDK/SDK.php index 46a26a143..985ab273a 100644 --- a/src/SDK/SDK.php +++ b/src/SDK/SDK.php @@ -218,7 +218,9 @@ public function __construct(Language $language, Spec $spec) return $m === strtoupper($m) ? strtolower($m) : lcfirst($m); }, $matches[0])); }; - if (count($parts) < 2) return $toSnake($value); + if (count($parts) < 2) { + return $toSnake($value); + } return $parts[0] . '.' . $toSnake($parts[1]); })); } From 211e3b8a7c67152acb1dafb212539d3df425d957 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 27 Jun 2025 16:52:54 +0530 Subject: [PATCH 06/23] chore: add deprecated to php --- src/SDK/SDK.php | 12 +++++++++++- templates/php/src/Services/Service.php.twig | 10 ++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/SDK/SDK.php b/src/SDK/SDK.php index 985ab273a..d82de400e 100644 --- a/src/SDK/SDK.php +++ b/src/SDK/SDK.php @@ -164,8 +164,18 @@ public function __construct(Language $language, Spec $spec) }, ['is_safe' => ['html']])); $this->twig->addFilter(new TwigFilter('comment1', function ($value) { $value = explode("\n", $value); + $prefix = " * "; + $prefixLength = strlen($prefix); + $maxLineLength = 75 - $prefixLength; + foreach ($value as $key => $line) { - $value[$key] = " * " . wordwrap($line, 75, "\n * "); + if (empty(trim($line))) { + $value[$key] = $prefix; + continue; + } + + $wrapped = wordwrap($line, $maxLineLength, "\n" . $prefix, true); + $value[$key] = $prefix . $wrapped; } return implode("\n", $value); }, ['is_safe' => ['html']])); diff --git a/templates/php/src/Services/Service.php.twig b/templates/php/src/Services/Service.php.twig index 0061fd2e6..7c7b99f5d 100644 --- a/templates/php/src/Services/Service.php.twig +++ b/templates/php/src/Services/Service.php.twig @@ -31,6 +31,7 @@ class {{ service.name | caseUcfirst }} extends Service } {% for method in service.methods %} +{% set deprecated_message = '' %} /** {% if method.description %} {{ method.description|comment1 }} @@ -41,6 +42,15 @@ class {{ service.name | caseUcfirst }} extends Service {% endfor %} * @throws {{spec.title | caseUcfirst}}Exception * @return {{ method | getReturn }} +{% if method.deprecated %} + * +{% set method_name = method.replaceWith | split('.') | last | caseCamel %} +{% set deprecated_message = deprecated_message ~ 'Please use ' ~ method_name ~ '() instead.' %} + * @deprecated {{ deprecated_message }} +{% if method.replaceWith %} + * @see {{ method.replaceWith | replace({'.': '::'}) | capitalizeFirst }} +{% endif %} +{% endif %} */ public function {{ method.name | caseCamel }}({% for parameter in method.parameters.all %}{% if not parameter.required or parameter.nullable %}?{% endif %}{{ parameter | typeName }} ${{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required %} = null{% endif %}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, callable $onProgress = null{% endif %}): {{ method | getReturn }} { From f09f92a6ee2119c2a24c64883e352e55d218b779 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 30 Jun 2025 09:32:30 +0530 Subject: [PATCH 07/23] chore: deprecate cli methods --- templates/cli/lib/commands/command.js.twig | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/templates/cli/lib/commands/command.js.twig b/templates/cli/lib/commands/command.js.twig index 51536b24d..25048e71a 100644 --- a/templates/cli/lib/commands/command.js.twig +++ b/templates/cli/lib/commands/command.js.twig @@ -59,7 +59,7 @@ const {{ service.name | caseLower }} = new Command("{{ service.name | caseLower /** * @param {{ "{" }}{{ service.name | caseUcfirst }}{{ method.name | caseUcfirst }}RequestParams{{ "}" }} params */ -{%~ block decleration -%} +{% block decleration %} const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {%- for parameter in method.parameters.all -%} {{ parameter.name | caseCamel | escapeKeyword }}, @@ -72,7 +72,9 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {%- if method.type == 'location' -%}, destination{%- endif -%} {% if hasConsolePreview(method.name,service.name) %}, console{%- endif -%} }) => { -{%~ endblock %} +{% if method.deprecated %} + console.warn('Warning: This command is deprecated.{% if method.replaceWith %} Please use "{{ method.replaceWith | replace({'.': ' '}) }}" instead.{% endif %}'); +{% endif %} let client = !sdk ? await {% if service.name == "projects" %}sdkForConsole(){% else %}sdkForProject(){% endif %} : sdk; let apiPath = '{{ method.path }}'{% for parameter in method.parameters.path %}.replace('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | escapeKeyword }}){% endfor %}; @@ -82,13 +84,14 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {{ include('cli/base/requests/api.twig') }} {% endif %} } +{% endblock %} {% endfor %} {% for method in service.methods %} {{service.name | caseLower }} .command(`{{ method.name | caseKebab }}`) {% autoescape false %} - .description(`{{ method.description | replace({'`':'\''}) | replace({'\n':' '}) | replace({'\n \n':' '}) }}`) + .description(`{% if method.deprecated %}[DEPRECATED] This command is deprecated.{% if method.replaceWith %} Please use '{{ method.replaceWith | replace({'.': ' '}) }}' instead.{% endif %} {% endif %}{{ method.description | replace({'`':'\''}) | replace({'\n':' '}) | replace({'\n \n':' '}) }}`) {% for parameter in method.parameters.all %} .{% if parameter.required and not parameter.nullable %}requiredOption{% else %}option{% endif %}(`--{{ parameter.name | escapeKeyword | caseKebab }}{% if parameter | typeName == 'boolean' %} [value]{% else %} {% if parameter.array.type|length > 0 %}[{% else %}<{% endif %}{{ parameter.name | escapeKeyword | caseKebab }}{% if parameter.array.type|length > 0 %}...{% endif %}{% if parameter.array.type|length > 0 %}]{% else %}>{% endif %}{% endif %}`, `{{ parameter.description | replace({'`':'\''}) | replace({'\n':' '}) | replace({'\n \n':' '}) }}`{% if parameter | typeName == 'boolean' %}, (value) => value === undefined ? true : parseBool(value){% elseif parameter | typeName == 'number' %}, parseInteger{% endif %}) {% endfor %} From 5af0c01027b27e3f48dbe5224343d870a8855e14 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 30 Jun 2025 11:16:47 +0530 Subject: [PATCH 08/23] chore: lint --- src/SDK/SDK.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SDK/SDK.php b/src/SDK/SDK.php index d82de400e..23f41fc45 100644 --- a/src/SDK/SDK.php +++ b/src/SDK/SDK.php @@ -167,13 +167,13 @@ public function __construct(Language $language, Spec $spec) $prefix = " * "; $prefixLength = strlen($prefix); $maxLineLength = 75 - $prefixLength; - + foreach ($value as $key => $line) { if (empty(trim($line))) { $value[$key] = $prefix; continue; } - + $wrapped = wordwrap($line, $maxLineLength, "\n" . $prefix, true); $value[$key] = $prefix . $wrapped; } From 567971f5cf9dcacad81a0238ec7e26328b1512b1 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 30 Jun 2025 16:44:08 +0530 Subject: [PATCH 09/23] chore: add deprecated to swift and apple --- templates/apple/Sources/Services/Service.swift.twig | 6 ++++++ templates/swift/Sources/Services/Service.swift.twig | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/templates/apple/Sources/Services/Service.swift.twig b/templates/apple/Sources/Services/Service.swift.twig index d3226c144..f4787b76d 100644 --- a/templates/apple/Sources/Services/Service.swift.twig +++ b/templates/apple/Sources/Services/Service.swift.twig @@ -23,6 +23,9 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { {%~ if method.type == "webAuth" %} @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) {%~ endif %} + {%~ if method.deprecated %} + @available(*, deprecated, message: "This API is deprecated and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + {%~ endif %} open func {{ method.name | caseCamel | overrideIdentifier }}{% if method.responseModel | hasGenericType(spec) %}{% endif %}( {%~ for parameter in method.parameters.all %} {{ parameter.name | caseCamel | escapeSwiftKeyword }}: {{ parameter | typeName(spec) | raw }}{% if not parameter.required or parameter.nullable %}? = nil{% endif %}{% if not loop.last or 'multipart/form-data' in method.consumes or method.responseModel | hasGenericType(spec) %},{% endif %} @@ -87,6 +90,9 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { {%~ if method.type == "webAuth" %} @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) {%~ endif %} + {%~ if method.deprecated %} + @available(*, deprecated, message: "This API is deprecated and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + {%~ endif %} open func {{ method.name | caseCamel }}( {%~ for parameter in method.parameters.all %} {{ parameter.name | caseCamel | escapeSwiftKeyword }}: {{ parameter | typeName(spec) | raw }}{% if not parameter.required or parameter.nullable %}? = nil{% endif %}{% if not loop.last or 'multipart/form-data' in method.consumes %},{% endif %} diff --git a/templates/swift/Sources/Services/Service.swift.twig b/templates/swift/Sources/Services/Service.swift.twig index 6d74ee44b..919e09715 100644 --- a/templates/swift/Sources/Services/Service.swift.twig +++ b/templates/swift/Sources/Services/Service.swift.twig @@ -20,6 +20,9 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { /// @throws Exception /// @return array /// + {%~ if method.deprecated %} + @available(*, deprecated, message: "This API is deprecated and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + {%~ endif %} open func {{ method.name | caseCamel | overrideIdentifier }}{% if method.responseModel | hasGenericType(spec) %}{% endif %}( {%~ for parameter in method.parameters.all %} {{ parameter.name | caseCamel | escapeSwiftKeyword }}: {{ parameter | typeName(spec) | raw }}{% if not parameter.required or parameter.nullable %}? = nil{% endif %}{% if not loop.last or 'multipart/form-data' in method.consumes or method.responseModel | hasGenericType(spec) %},{% endif %} @@ -81,6 +84,9 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { /// @throws Exception /// @return array /// + {%~ if method.deprecated %} + @available(*, deprecated, message: "This API is deprecated and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + {%~ endif %} open func {{ method.name | caseCamel }}( {%~ for parameter in method.parameters.all %} {{ parameter.name | caseCamel | escapeSwiftKeyword }}: {{ parameter | typeName(spec) | raw }}{% if not parameter.required or parameter.nullable %}? = nil{% endif %}{% if not loop.last or 'multipart/form-data' in method.consumes %},{% endif %} From fcbfdf22504912c776e4743529a686f8eead68a7 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 30 Jun 2025 17:18:26 +0530 Subject: [PATCH 10/23] chore: add more deprecations --- templates/dart/lib/services/service.dart.twig | 4 ++++ templates/deno/src/services/service.ts.twig | 3 +++ templates/flutter/lib/services/service.dart.twig | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/templates/dart/lib/services/service.dart.twig b/templates/dart/lib/services/service.dart.twig index b7ea9048f..74cfa79eb 100644 --- a/templates/dart/lib/services/service.dart.twig +++ b/templates/dart/lib/services/service.dart.twig @@ -17,6 +17,10 @@ class {{ service.name | caseUcfirst }} extends Service { {%~ if method.description %} {{ method.description | dartComment }} {% endif %} +{%~ if method.deprecated %} + @override + @Deprecated('This API is deprecated and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') +{%~ endif %} {% if method.type == 'location' %}Future{% else %}{% if method.responseModel and method.responseModel != 'any' %}Future{% else %}Future{% endif %}{% endif %} {{ method.name | caseCamel | overrideIdentifier }}({{ _self.method_parameters(method.parameters.all, method.consumes) }}) async { final String apiPath = '{{ method.path }}'{% for parameter in method.parameters.path %}.replaceAll('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | overrideIdentifier }}{% if parameter.enumValues | length > 0 %}.value{% endif %}){% endfor %}; diff --git a/templates/deno/src/services/service.ts.twig b/templates/deno/src/services/service.ts.twig index fedf272a5..0eef0c475 100644 --- a/templates/deno/src/services/service.ts.twig +++ b/templates/deno/src/services/service.ts.twig @@ -77,6 +77,9 @@ export class {{ service.name | caseUcfirst }} extends Service { {% endfor %} * @throws {AppwriteException} * @returns {Promise} + {%~ if method.deprecated %} + * @deprecated This API is deprecated and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + {%~ endif %} */ async {{ method.name | caseCamel }}{% if generics %}<{{generics}}>{% endif %}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | typeName }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): Promise<{% if method.type == 'webAuth' %}string{% elseif method.type == 'location' %}ArrayBuffer{% else %}{% if method.responseModel and method.responseModel != 'any' %}{% if not spec.definitions[method.responseModel].additionalProperties %}Models.{% endif %}{{method.responseModel | caseUcfirst}}{% if generics_return %}<{{generics_return}}>{% endif %}{% else %}Response{% endif %}{% endif %}> { {% for parameter in method.parameters.all %} diff --git a/templates/flutter/lib/services/service.dart.twig b/templates/flutter/lib/services/service.dart.twig index 829c312bb..15e77a6ac 100644 --- a/templates/flutter/lib/services/service.dart.twig +++ b/templates/flutter/lib/services/service.dart.twig @@ -18,6 +18,10 @@ class {{ service.name | caseUcfirst }} extends Service { {%~ if method.description %} {{ method.description|dartComment }} {% endif %} +{%~ if method.deprecated %} + @override + @Deprecated('This API is deprecated and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') +{%~ endif %} {% if method.type == 'webAuth' %}Future{% elseif method.type == 'location' %}Future{% else %}{% if method.responseModel and method.responseModel != 'any' %}Future{% else %}Future{% endif %}{% endif %} {{ method.name | caseCamel | overrideIdentifier }}({{ _self.method_parameters(method.parameters.all, method.consumes) }}) async { {% if method.parameters.path | length > 0 %}final{% else %}const{% endif %} String apiPath = '{{ method.path }}'{% for parameter in method.parameters.path %}.replaceAll('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | overrideIdentifier }}{% if parameter.enumValues | length > 0 %}.value{% endif %}){% endfor %}; From 1b5e439cda11608f7f82808900be640f5b82f253 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 30 Jun 2025 17:33:30 +0530 Subject: [PATCH 11/23] chore: remove override --- templates/dart/lib/services/service.dart.twig | 1 - templates/flutter/lib/services/service.dart.twig | 1 - 2 files changed, 2 deletions(-) diff --git a/templates/dart/lib/services/service.dart.twig b/templates/dart/lib/services/service.dart.twig index 74cfa79eb..77521a8cd 100644 --- a/templates/dart/lib/services/service.dart.twig +++ b/templates/dart/lib/services/service.dart.twig @@ -18,7 +18,6 @@ class {{ service.name | caseUcfirst }} extends Service { {{ method.description | dartComment }} {% endif %} {%~ if method.deprecated %} - @override @Deprecated('This API is deprecated and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') {%~ endif %} {% if method.type == 'location' %}Future{% else %}{% if method.responseModel and method.responseModel != 'any' %}Future{% else %}Future{% endif %}{% endif %} {{ method.name | caseCamel | overrideIdentifier }}({{ _self.method_parameters(method.parameters.all, method.consumes) }}) async { diff --git a/templates/flutter/lib/services/service.dart.twig b/templates/flutter/lib/services/service.dart.twig index 15e77a6ac..334145f14 100644 --- a/templates/flutter/lib/services/service.dart.twig +++ b/templates/flutter/lib/services/service.dart.twig @@ -19,7 +19,6 @@ class {{ service.name | caseUcfirst }} extends Service { {{ method.description|dartComment }} {% endif %} {%~ if method.deprecated %} - @override @Deprecated('This API is deprecated and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') {%~ endif %} {% if method.type == 'webAuth' %}Future{% elseif method.type == 'location' %}Future{% else %}{% if method.responseModel and method.responseModel != 'any' %}Future{% else %}Future{% endif %}{% endif %} {{ method.name | caseCamel | overrideIdentifier }}({{ _self.method_parameters(method.parameters.all, method.consumes) }}) async { From 6b40a01b385a44556a6cc265868a64febe2b1036 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 1 Jul 2025 11:26:55 +0530 Subject: [PATCH 12/23] chore: use deprecatedVersion in kotlin --- src/Spec/Swagger2.php | 2 ++ .../java/io/package/services/Service.kt.twig | 18 ++++++++++-------- .../appwrite/services/ServiceTemplate.kt.twig | 18 ++++++++++-------- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/Spec/Swagger2.php b/src/Spec/Swagger2.php index 652082009..d78023e25 100644 --- a/src/Spec/Swagger2.php +++ b/src/Spec/Swagger2.php @@ -177,6 +177,8 @@ protected function parseMethod(string $methodName, string $pathName, array $meth 'cookies' => $method['x-appwrite']['cookies'] ?? false, 'type' => $method['x-appwrite']['type'] ?? false, 'deprecated' => $method['x-appwrite']['deprecated'] ?? false, + 'deprecatedMessage' => $method['x-appwrite']['deprecatedMessage'] ?? '', + 'deprecatedVersion' => $method['x-appwrite']['deprecatedVersion'] ?? '', 'replaceWith' => $method['x-appwrite']['replaceWith'] ?? '', 'headers' => [], 'parameters' => [ diff --git a/templates/android/library/src/main/java/io/package/services/Service.kt.twig b/templates/android/library/src/main/java/io/package/services/Service.kt.twig index 4148d8659..7c7e731f1 100644 --- a/templates/android/library/src/main/java/io/package/services/Service.kt.twig +++ b/templates/android/library/src/main/java/io/package/services/Service.kt.twig @@ -39,12 +39,13 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { {%~ endif %} */ {%~ if method.deprecated %} -{% set deprecated_message = "This API is deprecated and uses outdated terminologies." %} +{% set deprecated_message = "This API is deprecated since " ~ method.deprecatedVersion ~ " and uses outdated terminologies." %} {% if method.replaceWith %} -{% set deprecated_message = deprecated_message ~ ' Please use ' ~ (method.replaceWith | capitalizeFirst) ~ ' instead.' %} +{% set deprecated_message = deprecated_message ~ ' Please use `' ~ (method.replaceWith | capitalizeFirst) ~ '` instead.' %} @Deprecated( - "{{ deprecated_message }}", - ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}") + message = "{{ deprecated_message }}", + replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"), + since = "{{ method.deprecatedVersion }}" ) {% else %} @Deprecated("{{ deprecated_message }}") @@ -205,12 +206,13 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { {%~ endif %} */ {%~ if method.deprecated %} -{% set deprecated_message = "This API is deprecated and uses outdated terminologies." %} +{% set deprecated_message = "This API is deprecated since " ~ method.deprecatedVersion ~ " and uses outdated terminologies." %} {% if method.replaceWith %} -{% set deprecated_message = deprecated_message ~ ' Please use ' ~ (method.replaceWith | capitalizeFirst) ~ ' instead.' %} +{% set deprecated_message = deprecated_message ~ ' Please use `' ~ (method.replaceWith | capitalizeFirst) ~ '` instead.' %} @Deprecated( - "{{ deprecated_message }}", - ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}") + message = "{{ deprecated_message }}", + replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"), + since = "{{ method.deprecatedVersion }}" ) {% else %} @Deprecated("{{ deprecated_message }}") diff --git a/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig b/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig index 636bb49ec..c174feab1 100644 --- a/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig +++ b/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig @@ -31,12 +31,13 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { * @return [{{ method | returnType(spec, sdk.namespace | caseDot) | raw }}] */ {%~ if method.deprecated %} -{% set deprecated_message = "This API is deprecated and uses outdated terminologies." %} +{% set deprecated_message = "This API is deprecated since " ~ method.deprecatedVersion ~ " and uses outdated terminologies." %} {% if method.replaceWith %} -{% set deprecated_message = deprecated_message ~ ' Please use ' ~ (method.replaceWith | capitalizeFirst) ~ ' instead.' %} +{% set deprecated_message = deprecated_message ~ ' Please use `' ~ (method.replaceWith | capitalizeFirst) ~ '` instead.' %} @Deprecated( - "{{ deprecated_message }}", - ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}") + message = "{{ deprecated_message }}", + replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"), + since = "{{ method.deprecatedVersion }}" ) {% else %} @Deprecated("{{ deprecated_message }}") @@ -104,12 +105,13 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { * @return [{{ method | returnType(spec, sdk.namespace | caseDot) | raw }}] */ {%~ if method.deprecated %} -{% set deprecated_message = "This API is deprecated and uses outdated terminologies." %} +{% set deprecated_message = "This API is deprecated since " ~ method.deprecatedVersion ~ " and uses outdated terminologies." %} {% if method.replaceWith %} -{% set deprecated_message = deprecated_message ~ ' Please use ' ~ (method.replaceWith | capitalizeFirst) ~ ' instead.' %} +{% set deprecated_message = deprecated_message ~ ' Please use `' ~ (method.replaceWith | capitalizeFirst) ~ '` instead.' %} @Deprecated( - "{{ deprecated_message }}", - ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}") + message = "{{ deprecated_message }}", + replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"), + since = "{{ method.deprecatedVersion }}" ) {% else %} @Deprecated("{{ deprecated_message }}") From e15149f05718f74a7777985ddcd10f4a54f6b745 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 1 Jul 2025 11:37:36 +0530 Subject: [PATCH 13/23] chore: finish deprecation for all sdks --- templates/apple/Sources/Services/Service.swift.twig | 4 ++-- templates/cli/lib/commands/command.js.twig | 2 +- templates/dart/lib/services/service.dart.twig | 2 +- templates/deno/src/services/service.ts.twig | 2 +- templates/dotnet/Package/Services/ServiceTemplate.cs.twig | 3 +++ templates/flutter/lib/services/service.dart.twig | 2 +- templates/go/services/service.go.twig | 4 ++++ templates/node/src/services/template.ts.twig | 2 +- templates/php/src/Services/Service.php.twig | 2 +- templates/python/package/services/service.py.twig | 4 ++-- templates/react-native/src/services/template.ts.twig | 4 ++-- templates/ruby/lib/container/services/service.rb.twig | 5 +++++ templates/swift/Sources/Services/Service.swift.twig | 4 ++-- templates/web/src/services/template.ts.twig | 2 +- 14 files changed, 27 insertions(+), 15 deletions(-) diff --git a/templates/apple/Sources/Services/Service.swift.twig b/templates/apple/Sources/Services/Service.swift.twig index f4787b76d..20dd10811 100644 --- a/templates/apple/Sources/Services/Service.swift.twig +++ b/templates/apple/Sources/Services/Service.swift.twig @@ -24,7 +24,7 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) {%~ endif %} {%~ if method.deprecated %} - @available(*, deprecated, message: "This API is deprecated and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + @available(*, deprecated, message: "This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") {%~ endif %} open func {{ method.name | caseCamel | overrideIdentifier }}{% if method.responseModel | hasGenericType(spec) %}{% endif %}( {%~ for parameter in method.parameters.all %} @@ -91,7 +91,7 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) {%~ endif %} {%~ if method.deprecated %} - @available(*, deprecated, message: "This API is deprecated and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + @available(*, deprecated, message: "This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") {%~ endif %} open func {{ method.name | caseCamel }}( {%~ for parameter in method.parameters.all %} diff --git a/templates/cli/lib/commands/command.js.twig b/templates/cli/lib/commands/command.js.twig index 25048e71a..1743c48f4 100644 --- a/templates/cli/lib/commands/command.js.twig +++ b/templates/cli/lib/commands/command.js.twig @@ -73,7 +73,7 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {% if hasConsolePreview(method.name,service.name) %}, console{%- endif -%} }) => { {% if method.deprecated %} - console.warn('Warning: This command is deprecated.{% if method.replaceWith %} Please use "{{ method.replaceWith | replace({'.': ' '}) }}" instead.{% endif %}'); + console.warn('Warning: This command is deprecated since {{ method.deprecatedVersion }}.{% if method.replaceWith %} Please use "{{ method.replaceWith | replace({'.': ' '}) }}" instead.{% endif %}'); {% endif %} let client = !sdk ? await {% if service.name == "projects" %}sdkForConsole(){% else %}sdkForProject(){% endif %} : sdk; diff --git a/templates/dart/lib/services/service.dart.twig b/templates/dart/lib/services/service.dart.twig index 77521a8cd..4f04ab072 100644 --- a/templates/dart/lib/services/service.dart.twig +++ b/templates/dart/lib/services/service.dart.twig @@ -18,7 +18,7 @@ class {{ service.name | caseUcfirst }} extends Service { {{ method.description | dartComment }} {% endif %} {%~ if method.deprecated %} - @Deprecated('This API is deprecated and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') + @Deprecated('This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') {%~ endif %} {% if method.type == 'location' %}Future{% else %}{% if method.responseModel and method.responseModel != 'any' %}Future{% else %}Future{% endif %}{% endif %} {{ method.name | caseCamel | overrideIdentifier }}({{ _self.method_parameters(method.parameters.all, method.consumes) }}) async { final String apiPath = '{{ method.path }}'{% for parameter in method.parameters.path %}.replaceAll('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | overrideIdentifier }}{% if parameter.enumValues | length > 0 %}.value{% endif %}){% endfor %}; diff --git a/templates/deno/src/services/service.ts.twig b/templates/deno/src/services/service.ts.twig index 0eef0c475..f9295f032 100644 --- a/templates/deno/src/services/service.ts.twig +++ b/templates/deno/src/services/service.ts.twig @@ -78,7 +78,7 @@ export class {{ service.name | caseUcfirst }} extends Service { * @throws {AppwriteException} * @returns {Promise} {%~ if method.deprecated %} - * @deprecated This API is deprecated and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + * @deprecated This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} {%~ endif %} */ async {{ method.name | caseCamel }}{% if generics %}<{{generics}}>{% endif %}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | typeName }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): Promise<{% if method.type == 'webAuth' %}string{% elseif method.type == 'location' %}ArrayBuffer{% else %}{% if method.responseModel and method.responseModel != 'any' %}{% if not spec.definitions[method.responseModel].additionalProperties %}Models.{% endif %}{{method.responseModel | caseUcfirst}}{% if generics_return %}<{{generics_return}}>{% endif %}{% else %}Response{% endif %}{% endif %}> { diff --git a/templates/dotnet/Package/Services/ServiceTemplate.cs.twig b/templates/dotnet/Package/Services/ServiceTemplate.cs.twig index 1fb9321c1..83d22601e 100644 --- a/templates/dotnet/Package/Services/ServiceTemplate.cs.twig +++ b/templates/dotnet/Package/Services/ServiceTemplate.cs.twig @@ -26,6 +26,9 @@ namespace {{ spec.title | caseUcfirst }}.Services /// {%~ endif %} /// + {%~ if method.deprecated %} + [Obsolete("This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.")] + {%~ endif %} public Task{% if method.type == "webAuth" %}{% else %}<{{ utils.resultType(spec.title, method) }}>{% endif %} {{ method.name | caseUcfirst }}({{ utils.method_parameters(method.parameters, method.consumes) }}) { var apiPath = "{{ method.path }}"{% if method.parameters.path | length == 0 %};{% endif %} diff --git a/templates/flutter/lib/services/service.dart.twig b/templates/flutter/lib/services/service.dart.twig index 334145f14..1eb54fce9 100644 --- a/templates/flutter/lib/services/service.dart.twig +++ b/templates/flutter/lib/services/service.dart.twig @@ -19,7 +19,7 @@ class {{ service.name | caseUcfirst }} extends Service { {{ method.description|dartComment }} {% endif %} {%~ if method.deprecated %} - @Deprecated('This API is deprecated and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') + @Deprecated('This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') {%~ endif %} {% if method.type == 'webAuth' %}Future{% elseif method.type == 'location' %}Future{% else %}{% if method.responseModel and method.responseModel != 'any' %}Future{% else %}Future{% endif %}{% endif %} {{ method.name | caseCamel | overrideIdentifier }}({{ _self.method_parameters(method.parameters.all, method.consumes) }}) async { {% if method.parameters.path | length > 0 %}final{% else %}const{% endif %} String apiPath = '{{ method.path }}'{% for parameter in method.parameters.path %}.replaceAll('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | overrideIdentifier }}{% if parameter.enumValues | length > 0 %}.value{% endif %}){% endfor %}; diff --git a/templates/go/services/service.go.twig b/templates/go/services/service.go.twig index e5a76818a..0e7e61ef4 100644 --- a/templates/go/services/service.go.twig +++ b/templates/go/services/service.go.twig @@ -87,6 +87,10 @@ func (srv *{{ service.name | caseUcfirst }}) With{{ method.name | caseUcfirst }} {% else %} // {{ method.name | caseUcfirst }} {% endif %} +{% if method.deprecated %} +// +// Deprecated: This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. +{% endif %} func (srv *{{ service.name | caseUcfirst }}) {{ method.name | caseUcfirst }}({{ params }})(*{{ method | returnType(spec, spec.title | caseLower) }}, error) { {% if method.parameters.path|length > 0 %} r := strings.NewReplacer({% for parameter in method.parameters.path %}"{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}", {{ parameter.name | caseUcfirst }}{% if not loop.last %}, {% endif %}{% endfor %}) diff --git a/templates/node/src/services/template.ts.twig b/templates/node/src/services/template.ts.twig index f4aafa5e0..8e30296db 100644 --- a/templates/node/src/services/template.ts.twig +++ b/templates/node/src/services/template.ts.twig @@ -36,7 +36,7 @@ export class {{ service.name | caseUcfirst }} { * @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception} * @returns {{ '{' }}{{ method | getReturn(spec) | raw }}{{ '}' }} {%~ if method.deprecated %} - * @deprecated This API is deprecated and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + * @deprecated This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} {%~ endif %} */ {{ method.name | caseCamel }}{{ method.responseModel | getGenerics(spec) | raw }}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): {{ method | getReturn(spec) | raw }} { diff --git a/templates/php/src/Services/Service.php.twig b/templates/php/src/Services/Service.php.twig index 7c7b99f5d..8c723185f 100644 --- a/templates/php/src/Services/Service.php.twig +++ b/templates/php/src/Services/Service.php.twig @@ -45,7 +45,7 @@ class {{ service.name | caseUcfirst }} extends Service {% if method.deprecated %} * {% set method_name = method.replaceWith | split('.') | last | caseCamel %} -{% set deprecated_message = deprecated_message ~ 'Please use ' ~ method_name ~ '() instead.' %} +{% set deprecated_message = deprecated_message ~ 'This API is deprecated since ' ~ method.deprecatedVersion ~ ' and uses outdated terminologies. Please use `' ~ method_name ~ '()` instead.' %} * @deprecated {{ deprecated_message }} {% if method.replaceWith %} * @see {{ method.replaceWith | replace({'.': '::'}) | capitalizeFirst }} diff --git a/templates/python/package/services/service.py.twig b/templates/python/package/services/service.py.twig index adf4024f5..1f72b387e 100644 --- a/templates/python/package/services/service.py.twig +++ b/templates/python/package/services/service.py.twig @@ -35,8 +35,8 @@ class {{ service.name | caseUcfirst }}(Service): {% if method.parameters.all|length > 0 or 'multipart/form-data' in method.consumes %} {% if method.deprecated %} - .. deprecated:: - This API is deprecated and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | caseSnakeExceptFirstDot }}` instead.{% endif %} + .. deprecated::{{ method.deprecatedVersion }} + This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | caseSnakeExceptFirstDot }}` instead.{% endif %} {% endif %} Parameters diff --git a/templates/react-native/src/services/template.ts.twig b/templates/react-native/src/services/template.ts.twig index 22248b451..106179f70 100644 --- a/templates/react-native/src/services/template.ts.twig +++ b/templates/react-native/src/services/template.ts.twig @@ -42,7 +42,7 @@ export class {{ service.name | caseUcfirst }} extends Service { * @returns {% if method.type == 'webAuth' %}{void|string}{% elseif method.type == 'location' %}{ArrayBuffer}{% else %}{Promise}{% endif %} {%~ if method.deprecated %} - * @deprecated This API is deprecated and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + * @deprecated This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} {%~ endif %} */ {% if method.type == 'upload'%}async {% endif %}{{ method.name | caseCamel }}{{ method.responseModel | getGenerics(spec) | raw }}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): {{ method | getReturn(spec) | raw }} { @@ -191,7 +191,7 @@ export class {{ service.name | caseUcfirst }} extends Service { * @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception} * @returns {{ '{' }}URL{{ '}' }} {%~ if method.deprecated %} - * @deprecated This API is deprecated and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + * @deprecated This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} {%~ endif %} */ {{ method.name | caseCamel }}URL({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): URL { diff --git a/templates/ruby/lib/container/services/service.rb.twig b/templates/ruby/lib/container/services/service.rb.twig index dbfc91d67..6bbc3e077 100644 --- a/templates/ruby/lib/container/services/service.rb.twig +++ b/templates/ruby/lib/container/services/service.rb.twig @@ -8,6 +8,11 @@ module {{spec.title | caseUcfirst}} end {% for method in service.methods %} +{% if method.deprecated %} + # + # @deprecated This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + # +{% endif %} {{ method.description | rubyComment }} # {% for parameter in method.parameters.all %} diff --git a/templates/swift/Sources/Services/Service.swift.twig b/templates/swift/Sources/Services/Service.swift.twig index 919e09715..fe2a84e1a 100644 --- a/templates/swift/Sources/Services/Service.swift.twig +++ b/templates/swift/Sources/Services/Service.swift.twig @@ -21,7 +21,7 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { /// @return array /// {%~ if method.deprecated %} - @available(*, deprecated, message: "This API is deprecated and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + @available(*, deprecated, message: "This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") {%~ endif %} open func {{ method.name | caseCamel | overrideIdentifier }}{% if method.responseModel | hasGenericType(spec) %}{% endif %}( {%~ for parameter in method.parameters.all %} @@ -85,7 +85,7 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { /// @return array /// {%~ if method.deprecated %} - @available(*, deprecated, message: "This API is deprecated and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + @available(*, deprecated, message: "This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") {%~ endif %} open func {{ method.name | caseCamel }}( {%~ for parameter in method.parameters.all %} diff --git a/templates/web/src/services/template.ts.twig b/templates/web/src/services/template.ts.twig index 7dc7819ce..59962b27a 100644 --- a/templates/web/src/services/template.ts.twig +++ b/templates/web/src/services/template.ts.twig @@ -37,7 +37,7 @@ export class {{ service.name | caseUcfirst }} { * @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception} * @returns {{ '{' }}{{ method | getReturn(spec) | raw }}{{ '}' }} {%~ if method.deprecated %} - * @deprecated This API is deprecated and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + * @deprecated This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} {%~ endif %} */ {{ method.name | caseCamel }}{{ method.responseModel | getGenerics(spec) | raw }}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): {{ method | getReturn(spec) | raw }} { From 86b2092d967416d511150a84cf4bcd803be1a645 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 2 Jul 2025 12:49:18 +0530 Subject: [PATCH 14/23] chore: use since instead --- src/SDK/SDK.php | 12 +----------- src/Spec/Swagger2.php | 15 +++++++++++---- .../main/java/io/package/services/Service.kt.twig | 8 ++++---- .../apple/Sources/Services/Service.swift.twig | 4 ++-- templates/cli/lib/commands/command.js.twig | 2 +- templates/dart/lib/services/service.dart.twig | 2 +- templates/deno/src/services/service.ts.twig | 2 +- .../Package/Services/ServiceTemplate.cs.twig | 2 +- templates/flutter/lib/services/service.dart.twig | 2 +- templates/go/services/service.go.twig | 2 +- .../io/appwrite/services/ServiceTemplate.kt.twig | 8 ++++---- templates/node/src/services/template.ts.twig | 2 +- templates/php/src/Services/Service.php.twig | 2 +- templates/python/package/services/service.py.twig | 4 ++-- .../react-native/src/services/template.ts.twig | 4 ++-- .../ruby/lib/container/services/service.rb.twig | 2 +- .../swift/Sources/Services/Service.swift.twig | 4 ++-- templates/web/src/services/template.ts.twig | 2 +- 18 files changed, 38 insertions(+), 41 deletions(-) diff --git a/src/SDK/SDK.php b/src/SDK/SDK.php index 23f41fc45..985ab273a 100644 --- a/src/SDK/SDK.php +++ b/src/SDK/SDK.php @@ -164,18 +164,8 @@ public function __construct(Language $language, Spec $spec) }, ['is_safe' => ['html']])); $this->twig->addFilter(new TwigFilter('comment1', function ($value) { $value = explode("\n", $value); - $prefix = " * "; - $prefixLength = strlen($prefix); - $maxLineLength = 75 - $prefixLength; - foreach ($value as $key => $line) { - if (empty(trim($line))) { - $value[$key] = $prefix; - continue; - } - - $wrapped = wordwrap($line, $maxLineLength, "\n" . $prefix, true); - $value[$key] = $prefix . $wrapped; + $value[$key] = " * " . wordwrap($line, 75, "\n * "); } return implode("\n", $value); }, ['is_safe' => ['html']])); diff --git a/src/Spec/Swagger2.php b/src/Spec/Swagger2.php index d78023e25..572b412c1 100644 --- a/src/Spec/Swagger2.php +++ b/src/Spec/Swagger2.php @@ -176,10 +176,6 @@ protected function parseMethod(string $methodName, string $pathName, array $meth 'consumes' => $method['consumes'] ?? [], 'cookies' => $method['x-appwrite']['cookies'] ?? false, 'type' => $method['x-appwrite']['type'] ?? false, - 'deprecated' => $method['x-appwrite']['deprecated'] ?? false, - 'deprecatedMessage' => $method['x-appwrite']['deprecatedMessage'] ?? '', - 'deprecatedVersion' => $method['x-appwrite']['deprecatedVersion'] ?? '', - 'replaceWith' => $method['x-appwrite']['replaceWith'] ?? '', 'headers' => [], 'parameters' => [ 'all' => [], @@ -192,6 +188,17 @@ protected function parseMethod(string $methodName, string $pathName, array $meth 'responseModel' => $responseModel, ]; + if (($method['x-appwrite']['deprecated'] ?? false) !== false) { + $output['deprecated'] = true; + if (is_array($method['x-appwrite']['deprecated'])) { + $output['since'] = $method['x-appwrite']['deprecated']['since'] ?? ''; + $output['replaceWith'] = $method['x-appwrite']['deprecated']['replaceWith'] ?? ''; + } else { + $output['since'] = ''; + $output['replaceWith'] = ''; + } + } + if ($output['type'] == 'graphql') { $output['headers']['x-sdk-graphql'] = "true"; } diff --git a/templates/android/library/src/main/java/io/package/services/Service.kt.twig b/templates/android/library/src/main/java/io/package/services/Service.kt.twig index 7c7e731f1..abbddfa35 100644 --- a/templates/android/library/src/main/java/io/package/services/Service.kt.twig +++ b/templates/android/library/src/main/java/io/package/services/Service.kt.twig @@ -39,13 +39,13 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { {%~ endif %} */ {%~ if method.deprecated %} -{% set deprecated_message = "This API is deprecated since " ~ method.deprecatedVersion ~ " and uses outdated terminologies." %} +{% set deprecated_message = "This API is deprecated since " ~ method.since ~ " and uses outdated terminologies." %} {% if method.replaceWith %} {% set deprecated_message = deprecated_message ~ ' Please use `' ~ (method.replaceWith | capitalizeFirst) ~ '` instead.' %} @Deprecated( message = "{{ deprecated_message }}", replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"), - since = "{{ method.deprecatedVersion }}" + since = "{{ method.since }}" ) {% else %} @Deprecated("{{ deprecated_message }}") @@ -206,13 +206,13 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { {%~ endif %} */ {%~ if method.deprecated %} -{% set deprecated_message = "This API is deprecated since " ~ method.deprecatedVersion ~ " and uses outdated terminologies." %} +{% set deprecated_message = "This API is deprecated since " ~ method.since ~ " and uses outdated terminologies." %} {% if method.replaceWith %} {% set deprecated_message = deprecated_message ~ ' Please use `' ~ (method.replaceWith | capitalizeFirst) ~ '` instead.' %} @Deprecated( message = "{{ deprecated_message }}", replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"), - since = "{{ method.deprecatedVersion }}" + since = "{{ method.since }}" ) {% else %} @Deprecated("{{ deprecated_message }}") diff --git a/templates/apple/Sources/Services/Service.swift.twig b/templates/apple/Sources/Services/Service.swift.twig index 20dd10811..de9a35693 100644 --- a/templates/apple/Sources/Services/Service.swift.twig +++ b/templates/apple/Sources/Services/Service.swift.twig @@ -24,7 +24,7 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) {%~ endif %} {%~ if method.deprecated %} - @available(*, deprecated, message: "This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + @available(*, deprecated, message: "This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") {%~ endif %} open func {{ method.name | caseCamel | overrideIdentifier }}{% if method.responseModel | hasGenericType(spec) %}{% endif %}( {%~ for parameter in method.parameters.all %} @@ -91,7 +91,7 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) {%~ endif %} {%~ if method.deprecated %} - @available(*, deprecated, message: "This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + @available(*, deprecated, message: "This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") {%~ endif %} open func {{ method.name | caseCamel }}( {%~ for parameter in method.parameters.all %} diff --git a/templates/cli/lib/commands/command.js.twig b/templates/cli/lib/commands/command.js.twig index 1743c48f4..d5f18aa5d 100644 --- a/templates/cli/lib/commands/command.js.twig +++ b/templates/cli/lib/commands/command.js.twig @@ -73,7 +73,7 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {% if hasConsolePreview(method.name,service.name) %}, console{%- endif -%} }) => { {% if method.deprecated %} - console.warn('Warning: This command is deprecated since {{ method.deprecatedVersion }}.{% if method.replaceWith %} Please use "{{ method.replaceWith | replace({'.': ' '}) }}" instead.{% endif %}'); + console.warn('Warning: This command is deprecated since {{ method.since }}.{% if method.replaceWith %} Please use "{{ method.replaceWith | replace({'.': ' '}) }}" instead.{% endif %}'); {% endif %} let client = !sdk ? await {% if service.name == "projects" %}sdkForConsole(){% else %}sdkForProject(){% endif %} : sdk; diff --git a/templates/dart/lib/services/service.dart.twig b/templates/dart/lib/services/service.dart.twig index 4f04ab072..5cad53e17 100644 --- a/templates/dart/lib/services/service.dart.twig +++ b/templates/dart/lib/services/service.dart.twig @@ -18,7 +18,7 @@ class {{ service.name | caseUcfirst }} extends Service { {{ method.description | dartComment }} {% endif %} {%~ if method.deprecated %} - @Deprecated('This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') + @Deprecated('This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') {%~ endif %} {% if method.type == 'location' %}Future{% else %}{% if method.responseModel and method.responseModel != 'any' %}Future{% else %}Future{% endif %}{% endif %} {{ method.name | caseCamel | overrideIdentifier }}({{ _self.method_parameters(method.parameters.all, method.consumes) }}) async { final String apiPath = '{{ method.path }}'{% for parameter in method.parameters.path %}.replaceAll('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | overrideIdentifier }}{% if parameter.enumValues | length > 0 %}.value{% endif %}){% endfor %}; diff --git a/templates/deno/src/services/service.ts.twig b/templates/deno/src/services/service.ts.twig index f9295f032..bbdec672f 100644 --- a/templates/deno/src/services/service.ts.twig +++ b/templates/deno/src/services/service.ts.twig @@ -78,7 +78,7 @@ export class {{ service.name | caseUcfirst }} extends Service { * @throws {AppwriteException} * @returns {Promise} {%~ if method.deprecated %} - * @deprecated This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + * @deprecated This API is deprecated since {{ method.since }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} {%~ endif %} */ async {{ method.name | caseCamel }}{% if generics %}<{{generics}}>{% endif %}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | typeName }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): Promise<{% if method.type == 'webAuth' %}string{% elseif method.type == 'location' %}ArrayBuffer{% else %}{% if method.responseModel and method.responseModel != 'any' %}{% if not spec.definitions[method.responseModel].additionalProperties %}Models.{% endif %}{{method.responseModel | caseUcfirst}}{% if generics_return %}<{{generics_return}}>{% endif %}{% else %}Response{% endif %}{% endif %}> { diff --git a/templates/dotnet/Package/Services/ServiceTemplate.cs.twig b/templates/dotnet/Package/Services/ServiceTemplate.cs.twig index 83d22601e..273a6957d 100644 --- a/templates/dotnet/Package/Services/ServiceTemplate.cs.twig +++ b/templates/dotnet/Package/Services/ServiceTemplate.cs.twig @@ -27,7 +27,7 @@ namespace {{ spec.title | caseUcfirst }}.Services {%~ endif %} /// {%~ if method.deprecated %} - [Obsolete("This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.")] + [Obsolete("This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.")] {%~ endif %} public Task{% if method.type == "webAuth" %}{% else %}<{{ utils.resultType(spec.title, method) }}>{% endif %} {{ method.name | caseUcfirst }}({{ utils.method_parameters(method.parameters, method.consumes) }}) { diff --git a/templates/flutter/lib/services/service.dart.twig b/templates/flutter/lib/services/service.dart.twig index 1eb54fce9..a5037874b 100644 --- a/templates/flutter/lib/services/service.dart.twig +++ b/templates/flutter/lib/services/service.dart.twig @@ -19,7 +19,7 @@ class {{ service.name | caseUcfirst }} extends Service { {{ method.description|dartComment }} {% endif %} {%~ if method.deprecated %} - @Deprecated('This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') + @Deprecated('This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') {%~ endif %} {% if method.type == 'webAuth' %}Future{% elseif method.type == 'location' %}Future{% else %}{% if method.responseModel and method.responseModel != 'any' %}Future{% else %}Future{% endif %}{% endif %} {{ method.name | caseCamel | overrideIdentifier }}({{ _self.method_parameters(method.parameters.all, method.consumes) }}) async { {% if method.parameters.path | length > 0 %}final{% else %}const{% endif %} String apiPath = '{{ method.path }}'{% for parameter in method.parameters.path %}.replaceAll('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | overrideIdentifier }}{% if parameter.enumValues | length > 0 %}.value{% endif %}){% endfor %}; diff --git a/templates/go/services/service.go.twig b/templates/go/services/service.go.twig index 0e7e61ef4..a5e8475ef 100644 --- a/templates/go/services/service.go.twig +++ b/templates/go/services/service.go.twig @@ -89,7 +89,7 @@ func (srv *{{ service.name | caseUcfirst }}) With{{ method.name | caseUcfirst }} {% endif %} {% if method.deprecated %} // -// Deprecated: This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. +// Deprecated: This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. {% endif %} func (srv *{{ service.name | caseUcfirst }}) {{ method.name | caseUcfirst }}({{ params }})(*{{ method | returnType(spec, spec.title | caseLower) }}, error) { {% if method.parameters.path|length > 0 %} diff --git a/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig b/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig index c174feab1..0a3e5f514 100644 --- a/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig +++ b/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig @@ -31,13 +31,13 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { * @return [{{ method | returnType(spec, sdk.namespace | caseDot) | raw }}] */ {%~ if method.deprecated %} -{% set deprecated_message = "This API is deprecated since " ~ method.deprecatedVersion ~ " and uses outdated terminologies." %} +{% set deprecated_message = "This API is deprecated since " ~ method.since ~ " and uses outdated terminologies." %} {% if method.replaceWith %} {% set deprecated_message = deprecated_message ~ ' Please use `' ~ (method.replaceWith | capitalizeFirst) ~ '` instead.' %} @Deprecated( message = "{{ deprecated_message }}", replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"), - since = "{{ method.deprecatedVersion }}" + since = "{{ method.since }}" ) {% else %} @Deprecated("{{ deprecated_message }}") @@ -105,13 +105,13 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { * @return [{{ method | returnType(spec, sdk.namespace | caseDot) | raw }}] */ {%~ if method.deprecated %} -{% set deprecated_message = "This API is deprecated since " ~ method.deprecatedVersion ~ " and uses outdated terminologies." %} +{% set deprecated_message = "This API is deprecated since " ~ method.since ~ " and uses outdated terminologies." %} {% if method.replaceWith %} {% set deprecated_message = deprecated_message ~ ' Please use `' ~ (method.replaceWith | capitalizeFirst) ~ '` instead.' %} @Deprecated( message = "{{ deprecated_message }}", replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"), - since = "{{ method.deprecatedVersion }}" + since = "{{ method.since }}" ) {% else %} @Deprecated("{{ deprecated_message }}") diff --git a/templates/node/src/services/template.ts.twig b/templates/node/src/services/template.ts.twig index 8e30296db..34845d904 100644 --- a/templates/node/src/services/template.ts.twig +++ b/templates/node/src/services/template.ts.twig @@ -36,7 +36,7 @@ export class {{ service.name | caseUcfirst }} { * @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception} * @returns {{ '{' }}{{ method | getReturn(spec) | raw }}{{ '}' }} {%~ if method.deprecated %} - * @deprecated This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + * @deprecated This API is deprecated since {{ method.since }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} {%~ endif %} */ {{ method.name | caseCamel }}{{ method.responseModel | getGenerics(spec) | raw }}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): {{ method | getReturn(spec) | raw }} { diff --git a/templates/php/src/Services/Service.php.twig b/templates/php/src/Services/Service.php.twig index 8c723185f..981b7c52f 100644 --- a/templates/php/src/Services/Service.php.twig +++ b/templates/php/src/Services/Service.php.twig @@ -45,7 +45,7 @@ class {{ service.name | caseUcfirst }} extends Service {% if method.deprecated %} * {% set method_name = method.replaceWith | split('.') | last | caseCamel %} -{% set deprecated_message = deprecated_message ~ 'This API is deprecated since ' ~ method.deprecatedVersion ~ ' and uses outdated terminologies. Please use `' ~ method_name ~ '()` instead.' %} +{% set deprecated_message = deprecated_message ~ 'This API is deprecated since ' ~ method.since ~ ' and uses outdated terminologies. Please use `' ~ method_name ~ '()` instead.' %} * @deprecated {{ deprecated_message }} {% if method.replaceWith %} * @see {{ method.replaceWith | replace({'.': '::'}) | capitalizeFirst }} diff --git a/templates/python/package/services/service.py.twig b/templates/python/package/services/service.py.twig index 1f72b387e..1df069723 100644 --- a/templates/python/package/services/service.py.twig +++ b/templates/python/package/services/service.py.twig @@ -35,8 +35,8 @@ class {{ service.name | caseUcfirst }}(Service): {% if method.parameters.all|length > 0 or 'multipart/form-data' in method.consumes %} {% if method.deprecated %} - .. deprecated::{{ method.deprecatedVersion }} - This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | caseSnakeExceptFirstDot }}` instead.{% endif %} + .. deprecated::{{ method.since }} + This API is deprecated since {{ method.since }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | caseSnakeExceptFirstDot }}` instead.{% endif %} {% endif %} Parameters diff --git a/templates/react-native/src/services/template.ts.twig b/templates/react-native/src/services/template.ts.twig index 106179f70..fc0e14010 100644 --- a/templates/react-native/src/services/template.ts.twig +++ b/templates/react-native/src/services/template.ts.twig @@ -42,7 +42,7 @@ export class {{ service.name | caseUcfirst }} extends Service { * @returns {% if method.type == 'webAuth' %}{void|string}{% elseif method.type == 'location' %}{ArrayBuffer}{% else %}{Promise}{% endif %} {%~ if method.deprecated %} - * @deprecated This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + * @deprecated This API is deprecated since {{ method.since }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} {%~ endif %} */ {% if method.type == 'upload'%}async {% endif %}{{ method.name | caseCamel }}{{ method.responseModel | getGenerics(spec) | raw }}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): {{ method | getReturn(spec) | raw }} { @@ -191,7 +191,7 @@ export class {{ service.name | caseUcfirst }} extends Service { * @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception} * @returns {{ '{' }}URL{{ '}' }} {%~ if method.deprecated %} - * @deprecated This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + * @deprecated This API is deprecated since {{ method.since }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} {%~ endif %} */ {{ method.name | caseCamel }}URL({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): URL { diff --git a/templates/ruby/lib/container/services/service.rb.twig b/templates/ruby/lib/container/services/service.rb.twig index 6bbc3e077..8ede64e17 100644 --- a/templates/ruby/lib/container/services/service.rb.twig +++ b/templates/ruby/lib/container/services/service.rb.twig @@ -10,7 +10,7 @@ module {{spec.title | caseUcfirst}} {% for method in service.methods %} {% if method.deprecated %} # - # @deprecated This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + # @deprecated This API is deprecated since {{ method.since }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} # {% endif %} {{ method.description | rubyComment }} diff --git a/templates/swift/Sources/Services/Service.swift.twig b/templates/swift/Sources/Services/Service.swift.twig index fe2a84e1a..e531d5821 100644 --- a/templates/swift/Sources/Services/Service.swift.twig +++ b/templates/swift/Sources/Services/Service.swift.twig @@ -21,7 +21,7 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { /// @return array /// {%~ if method.deprecated %} - @available(*, deprecated, message: "This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + @available(*, deprecated, message: "This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") {%~ endif %} open func {{ method.name | caseCamel | overrideIdentifier }}{% if method.responseModel | hasGenericType(spec) %}{% endif %}( {%~ for parameter in method.parameters.all %} @@ -85,7 +85,7 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { /// @return array /// {%~ if method.deprecated %} - @available(*, deprecated, message: "This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + @available(*, deprecated, message: "This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") {%~ endif %} open func {{ method.name | caseCamel }}( {%~ for parameter in method.parameters.all %} diff --git a/templates/web/src/services/template.ts.twig b/templates/web/src/services/template.ts.twig index 59962b27a..7e00623e8 100644 --- a/templates/web/src/services/template.ts.twig +++ b/templates/web/src/services/template.ts.twig @@ -37,7 +37,7 @@ export class {{ service.name | caseUcfirst }} { * @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception} * @returns {{ '{' }}{{ method | getReturn(spec) | raw }}{{ '}' }} {%~ if method.deprecated %} - * @deprecated This API is deprecated since {{ method.deprecatedVersion }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + * @deprecated This API is deprecated since {{ method.since }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} {%~ endif %} */ {{ method.name | caseCamel }}{{ method.responseModel | getGenerics(spec) | raw }}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): {{ method | getReturn(spec) | raw }} { From 101f47b64b34db9cb8341b02a302e5ff75007ca4 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 2 Jul 2025 12:59:39 +0530 Subject: [PATCH 15/23] fix: kotlin and android --- .../java/io/package/services/Service.kt.twig | 32 +++++++++---------- .../appwrite/services/ServiceTemplate.kt.twig | 32 +++++++++---------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/templates/android/library/src/main/java/io/package/services/Service.kt.twig b/templates/android/library/src/main/java/io/package/services/Service.kt.twig index abbddfa35..4d5389f9f 100644 --- a/templates/android/library/src/main/java/io/package/services/Service.kt.twig +++ b/templates/android/library/src/main/java/io/package/services/Service.kt.twig @@ -39,18 +39,18 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { {%~ endif %} */ {%~ if method.deprecated %} -{% set deprecated_message = "This API is deprecated since " ~ method.since ~ " and uses outdated terminologies." %} -{% if method.replaceWith %} -{% set deprecated_message = deprecated_message ~ ' Please use `' ~ (method.replaceWith | capitalizeFirst) ~ '` instead.' %} + {%~ if method.since and method.replaceWith %} @Deprecated( - message = "{{ deprecated_message }}", + message = "This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.", replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"), since = "{{ method.since }}" ) -{% else %} - @Deprecated("{{ deprecated_message }}") -{% endif %} -{%~ endif %} + {%~ else %} + @Deprecated( + message = "This API is deprecated and uses outdated terminologies.", + ) + {%~ endif %} + {%~ endif %} {%~ if method.parameters.all | reduce((carry, param) => carry or not param.required) %} @JvmOverloads {%~ endif %} @@ -206,18 +206,18 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { {%~ endif %} */ {%~ if method.deprecated %} -{% set deprecated_message = "This API is deprecated since " ~ method.since ~ " and uses outdated terminologies." %} -{% if method.replaceWith %} -{% set deprecated_message = deprecated_message ~ ' Please use `' ~ (method.replaceWith | capitalizeFirst) ~ '` instead.' %} + {%~ if method.since and method.replaceWith %} @Deprecated( - message = "{{ deprecated_message }}", + message = "This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.", replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"), since = "{{ method.since }}" ) -{% else %} - @Deprecated("{{ deprecated_message }}") -{% endif %} -{%~ endif %} + {%~ else %} + @Deprecated( + message = "This API is deprecated and uses outdated terminologies." + ) + {%~ endif %} + {%~ endif %} {%~ if method.parameters.all | reduce((carry, param) => carry or not param.required) %} @JvmOverloads {%~ endif %} diff --git a/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig b/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig index 0a3e5f514..9a1519c98 100644 --- a/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig +++ b/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig @@ -31,18 +31,18 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { * @return [{{ method | returnType(spec, sdk.namespace | caseDot) | raw }}] */ {%~ if method.deprecated %} -{% set deprecated_message = "This API is deprecated since " ~ method.since ~ " and uses outdated terminologies." %} -{% if method.replaceWith %} -{% set deprecated_message = deprecated_message ~ ' Please use `' ~ (method.replaceWith | capitalizeFirst) ~ '` instead.' %} + {%~ if method.since and method.replaceWith %} @Deprecated( - message = "{{ deprecated_message }}", + message = "This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.", replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"), since = "{{ method.since }}" ) -{% else %} - @Deprecated("{{ deprecated_message }}") -{% endif %} -{%~ endif %} + {%~ else %} + @Deprecated( + message = "This API is deprecated and uses outdated terminologies." + ) + {%~ endif %} + {%~ endif %} {%~ if method.parameters.all | reduce((carry, param) => carry or not param.required) %} @JvmOverloads {%~ endif %} @@ -105,18 +105,18 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { * @return [{{ method | returnType(spec, sdk.namespace | caseDot) | raw }}] */ {%~ if method.deprecated %} -{% set deprecated_message = "This API is deprecated since " ~ method.since ~ " and uses outdated terminologies." %} -{% if method.replaceWith %} -{% set deprecated_message = deprecated_message ~ ' Please use `' ~ (method.replaceWith | capitalizeFirst) ~ '` instead.' %} + {%~ if method.since and method.replaceWith %} @Deprecated( - message = "{{ deprecated_message }}", + message = "This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.", replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"), since = "{{ method.since }}" ) -{% else %} - @Deprecated("{{ deprecated_message }}") -{% endif %} -{%~ endif %} + {%~ else %} + @Deprecated( + message = "This API is deprecated and uses outdated terminologies." + ) + {%~ endif %} + {%~ endif %} {%~ if method.parameters.all | reduce((carry, param) => carry or not param.required) %} @JvmOverloads {%~ endif %} From 85f2215be71930903e652c9d03b1138f461de221 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 2 Jul 2025 13:10:55 +0530 Subject: [PATCH 16/23] chore: add conditonal rendering when since and replacwith not present --- .../src/main/java/io/package/services/Service.kt.twig | 4 ++-- templates/apple/Sources/Services/Service.swift.twig | 8 ++++++++ templates/cli/lib/commands/command.js.twig | 4 ++++ templates/dart/lib/services/service.dart.twig | 4 ++++ templates/deno/src/services/service.ts.twig | 4 ++++ templates/dotnet/Package/Services/ServiceTemplate.cs.twig | 4 ++++ templates/flutter/lib/services/service.dart.twig | 4 ++++ templates/go/services/service.go.twig | 4 ++++ .../kotlin/io/appwrite/services/ServiceTemplate.kt.twig | 4 ++-- templates/node/src/services/template.ts.twig | 4 ++++ templates/php/src/Services/Service.php.twig | 8 +++++--- templates/python/package/services/service.py.twig | 5 +++++ templates/react-native/src/services/template.ts.twig | 4 ++++ templates/ruby/lib/container/services/service.rb.twig | 4 ++++ templates/swift/Sources/Services/Service.swift.twig | 8 ++++++++ templates/web/src/services/template.ts.twig | 4 ++++ 16 files changed, 70 insertions(+), 7 deletions(-) diff --git a/templates/android/library/src/main/java/io/package/services/Service.kt.twig b/templates/android/library/src/main/java/io/package/services/Service.kt.twig index 4d5389f9f..adca41af0 100644 --- a/templates/android/library/src/main/java/io/package/services/Service.kt.twig +++ b/templates/android/library/src/main/java/io/package/services/Service.kt.twig @@ -47,7 +47,7 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { ) {%~ else %} @Deprecated( - message = "This API is deprecated and uses outdated terminologies.", + message = "This API is deprecated.", ) {%~ endif %} {%~ endif %} @@ -214,7 +214,7 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { ) {%~ else %} @Deprecated( - message = "This API is deprecated and uses outdated terminologies." + message = "This API is deprecated." ) {%~ endif %} {%~ endif %} diff --git a/templates/apple/Sources/Services/Service.swift.twig b/templates/apple/Sources/Services/Service.swift.twig index de9a35693..299dbb889 100644 --- a/templates/apple/Sources/Services/Service.swift.twig +++ b/templates/apple/Sources/Services/Service.swift.twig @@ -24,7 +24,11 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) {%~ endif %} {%~ if method.deprecated %} + {%~ if method.since and method.replaceWith %} @available(*, deprecated, message: "This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + {%~ else %} + @available(*, deprecated, message: "This API is deprecated.") + {%~ endif %} {%~ endif %} open func {{ method.name | caseCamel | overrideIdentifier }}{% if method.responseModel | hasGenericType(spec) %}{% endif %}( {%~ for parameter in method.parameters.all %} @@ -91,7 +95,11 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { @available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *) {%~ endif %} {%~ if method.deprecated %} + {%~ if method.since and method.replaceWith %} @available(*, deprecated, message: "This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + {%~ else %} + @available(*, deprecated, message: "This API is deprecated.") + {%~ endif %} {%~ endif %} open func {{ method.name | caseCamel }}( {%~ for parameter in method.parameters.all %} diff --git a/templates/cli/lib/commands/command.js.twig b/templates/cli/lib/commands/command.js.twig index d5f18aa5d..8b6f65b97 100644 --- a/templates/cli/lib/commands/command.js.twig +++ b/templates/cli/lib/commands/command.js.twig @@ -73,7 +73,11 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {% if hasConsolePreview(method.name,service.name) %}, console{%- endif -%} }) => { {% if method.deprecated %} +{% if method.since and method.replaceWith %} console.warn('Warning: This command is deprecated since {{ method.since }}.{% if method.replaceWith %} Please use "{{ method.replaceWith | replace({'.': ' '}) }}" instead.{% endif %}'); +{% else %} + console.warn('Warning: This command is deprecated.'); +{% endif %} {% endif %} let client = !sdk ? await {% if service.name == "projects" %}sdkForConsole(){% else %}sdkForProject(){% endif %} : sdk; diff --git a/templates/dart/lib/services/service.dart.twig b/templates/dart/lib/services/service.dart.twig index 5cad53e17..12b62b2a2 100644 --- a/templates/dart/lib/services/service.dart.twig +++ b/templates/dart/lib/services/service.dart.twig @@ -18,7 +18,11 @@ class {{ service.name | caseUcfirst }} extends Service { {{ method.description | dartComment }} {% endif %} {%~ if method.deprecated %} +{%~ if method.since and method.replaceWith %} @Deprecated('This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') +{%~ else %} + @Deprecated('This API is deprecated.') +{%~ endif %} {%~ endif %} {% if method.type == 'location' %}Future{% else %}{% if method.responseModel and method.responseModel != 'any' %}Future{% else %}Future{% endif %}{% endif %} {{ method.name | caseCamel | overrideIdentifier }}({{ _self.method_parameters(method.parameters.all, method.consumes) }}) async { final String apiPath = '{{ method.path }}'{% for parameter in method.parameters.path %}.replaceAll('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | overrideIdentifier }}{% if parameter.enumValues | length > 0 %}.value{% endif %}){% endfor %}; diff --git a/templates/deno/src/services/service.ts.twig b/templates/deno/src/services/service.ts.twig index bbdec672f..fc3b0a3d2 100644 --- a/templates/deno/src/services/service.ts.twig +++ b/templates/deno/src/services/service.ts.twig @@ -78,7 +78,11 @@ export class {{ service.name | caseUcfirst }} extends Service { * @throws {AppwriteException} * @returns {Promise} {%~ if method.deprecated %} + {%~ if method.since and method.replaceWith %} * @deprecated This API is deprecated since {{ method.since }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + {%~ else %} + * @deprecated This API is deprecated. + {%~ endif %} {%~ endif %} */ async {{ method.name | caseCamel }}{% if generics %}<{{generics}}>{% endif %}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | typeName }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): Promise<{% if method.type == 'webAuth' %}string{% elseif method.type == 'location' %}ArrayBuffer{% else %}{% if method.responseModel and method.responseModel != 'any' %}{% if not spec.definitions[method.responseModel].additionalProperties %}Models.{% endif %}{{method.responseModel | caseUcfirst}}{% if generics_return %}<{{generics_return}}>{% endif %}{% else %}Response{% endif %}{% endif %}> { diff --git a/templates/dotnet/Package/Services/ServiceTemplate.cs.twig b/templates/dotnet/Package/Services/ServiceTemplate.cs.twig index 273a6957d..69a964d9d 100644 --- a/templates/dotnet/Package/Services/ServiceTemplate.cs.twig +++ b/templates/dotnet/Package/Services/ServiceTemplate.cs.twig @@ -27,7 +27,11 @@ namespace {{ spec.title | caseUcfirst }}.Services {%~ endif %} /// {%~ if method.deprecated %} + {%~ if method.since and method.replaceWith %} [Obsolete("This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.")] + {%~ else %} + [Obsolete("This API is deprecated.")] + {%~ endif %} {%~ endif %} public Task{% if method.type == "webAuth" %}{% else %}<{{ utils.resultType(spec.title, method) }}>{% endif %} {{ method.name | caseUcfirst }}({{ utils.method_parameters(method.parameters, method.consumes) }}) { diff --git a/templates/flutter/lib/services/service.dart.twig b/templates/flutter/lib/services/service.dart.twig index a5037874b..a8f09a952 100644 --- a/templates/flutter/lib/services/service.dart.twig +++ b/templates/flutter/lib/services/service.dart.twig @@ -19,7 +19,11 @@ class {{ service.name | caseUcfirst }} extends Service { {{ method.description|dartComment }} {% endif %} {%~ if method.deprecated %} +{%~ if method.since and method.replaceWith %} @Deprecated('This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') +{%~ else %} + @Deprecated('This API is deprecated.') +{%~ endif %} {%~ endif %} {% if method.type == 'webAuth' %}Future{% elseif method.type == 'location' %}Future{% else %}{% if method.responseModel and method.responseModel != 'any' %}Future{% else %}Future{% endif %}{% endif %} {{ method.name | caseCamel | overrideIdentifier }}({{ _self.method_parameters(method.parameters.all, method.consumes) }}) async { {% if method.parameters.path | length > 0 %}final{% else %}const{% endif %} String apiPath = '{{ method.path }}'{% for parameter in method.parameters.path %}.replaceAll('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | overrideIdentifier }}{% if parameter.enumValues | length > 0 %}.value{% endif %}){% endfor %}; diff --git a/templates/go/services/service.go.twig b/templates/go/services/service.go.twig index a5e8475ef..8a33f58b6 100644 --- a/templates/go/services/service.go.twig +++ b/templates/go/services/service.go.twig @@ -89,7 +89,11 @@ func (srv *{{ service.name | caseUcfirst }}) With{{ method.name | caseUcfirst }} {% endif %} {% if method.deprecated %} // +{%~ if method.since and method.replaceWith %} // Deprecated: This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. +{%~ else %} +// Deprecated: This API is deprecated. +{%~ endif %} {% endif %} func (srv *{{ service.name | caseUcfirst }}) {{ method.name | caseUcfirst }}({{ params }})(*{{ method | returnType(spec, spec.title | caseLower) }}, error) { {% if method.parameters.path|length > 0 %} diff --git a/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig b/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig index 9a1519c98..9978eccf2 100644 --- a/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig +++ b/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig @@ -39,7 +39,7 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { ) {%~ else %} @Deprecated( - message = "This API is deprecated and uses outdated terminologies." + message = "This API is deprecated." ) {%~ endif %} {%~ endif %} @@ -113,7 +113,7 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { ) {%~ else %} @Deprecated( - message = "This API is deprecated and uses outdated terminologies." + message = "This API is deprecated." ) {%~ endif %} {%~ endif %} diff --git a/templates/node/src/services/template.ts.twig b/templates/node/src/services/template.ts.twig index 34845d904..cb4e9e643 100644 --- a/templates/node/src/services/template.ts.twig +++ b/templates/node/src/services/template.ts.twig @@ -36,7 +36,11 @@ export class {{ service.name | caseUcfirst }} { * @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception} * @returns {{ '{' }}{{ method | getReturn(spec) | raw }}{{ '}' }} {%~ if method.deprecated %} + {%~ if method.since and method.replaceWith %} * @deprecated This API is deprecated since {{ method.since }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + {%~ else %} + * @deprecated This API is deprecated. + {%~ endif %} {%~ endif %} */ {{ method.name | caseCamel }}{{ method.responseModel | getGenerics(spec) | raw }}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): {{ method | getReturn(spec) | raw }} { diff --git a/templates/php/src/Services/Service.php.twig b/templates/php/src/Services/Service.php.twig index 981b7c52f..97af5af8b 100644 --- a/templates/php/src/Services/Service.php.twig +++ b/templates/php/src/Services/Service.php.twig @@ -44,9 +44,11 @@ class {{ service.name | caseUcfirst }} extends Service * @return {{ method | getReturn }} {% if method.deprecated %} * -{% set method_name = method.replaceWith | split('.') | last | caseCamel %} -{% set deprecated_message = deprecated_message ~ 'This API is deprecated since ' ~ method.since ~ ' and uses outdated terminologies. Please use `' ~ method_name ~ '()` instead.' %} - * @deprecated {{ deprecated_message }} +{%~ if method.since and method.replaceWith %} + * @deprecated This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | split('.') | last | caseCamel }}` instead. +{%~ else %} + * @deprecated This API is deprecated. +{%~ endif %} {% if method.replaceWith %} * @see {{ method.replaceWith | replace({'.': '::'}) | capitalizeFirst }} {% endif %} diff --git a/templates/python/package/services/service.py.twig b/templates/python/package/services/service.py.twig index 1df069723..3cbcd8c2c 100644 --- a/templates/python/package/services/service.py.twig +++ b/templates/python/package/services/service.py.twig @@ -35,8 +35,13 @@ class {{ service.name | caseUcfirst }}(Service): {% if method.parameters.all|length > 0 or 'multipart/form-data' in method.consumes %} {% if method.deprecated %} +{%~ if method.since and method.replaceWith %} .. deprecated::{{ method.since }} This API is deprecated since {{ method.since }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | caseSnakeExceptFirstDot }}` instead.{% endif %} +{%~ else %} + .. deprecated:: + This API is deprecated. +{%~ endif %} {% endif %} Parameters diff --git a/templates/react-native/src/services/template.ts.twig b/templates/react-native/src/services/template.ts.twig index fc0e14010..c357eca2b 100644 --- a/templates/react-native/src/services/template.ts.twig +++ b/templates/react-native/src/services/template.ts.twig @@ -42,7 +42,11 @@ export class {{ service.name | caseUcfirst }} extends Service { * @returns {% if method.type == 'webAuth' %}{void|string}{% elseif method.type == 'location' %}{ArrayBuffer}{% else %}{Promise}{% endif %} {%~ if method.deprecated %} + {%~ if method.since and method.replaceWith %} * @deprecated This API is deprecated since {{ method.since }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + {%~ else %} + * @deprecated This API is deprecated. + {%~ endif %} {%~ endif %} */ {% if method.type == 'upload'%}async {% endif %}{{ method.name | caseCamel }}{{ method.responseModel | getGenerics(spec) | raw }}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): {{ method | getReturn(spec) | raw }} { diff --git a/templates/ruby/lib/container/services/service.rb.twig b/templates/ruby/lib/container/services/service.rb.twig index 8ede64e17..866a64636 100644 --- a/templates/ruby/lib/container/services/service.rb.twig +++ b/templates/ruby/lib/container/services/service.rb.twig @@ -10,7 +10,11 @@ module {{spec.title | caseUcfirst}} {% for method in service.methods %} {% if method.deprecated %} # +{%~ if method.since and method.replaceWith %} # @deprecated This API is deprecated since {{ method.since }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} +{%~ else %} + # @deprecated This API is deprecated. +{%~ endif %} # {% endif %} {{ method.description | rubyComment }} diff --git a/templates/swift/Sources/Services/Service.swift.twig b/templates/swift/Sources/Services/Service.swift.twig index e531d5821..f5b4058bf 100644 --- a/templates/swift/Sources/Services/Service.swift.twig +++ b/templates/swift/Sources/Services/Service.swift.twig @@ -21,7 +21,11 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { /// @return array /// {%~ if method.deprecated %} + {%~ if method.since and method.replaceWith %} @available(*, deprecated, message: "This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + {%~ else %} + @available(*, deprecated, message: "This API is deprecated.") + {%~ endif %} {%~ endif %} open func {{ method.name | caseCamel | overrideIdentifier }}{% if method.responseModel | hasGenericType(spec) %}{% endif %}( {%~ for parameter in method.parameters.all %} @@ -85,7 +89,11 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { /// @return array /// {%~ if method.deprecated %} + {%~ if method.since and method.replaceWith %} @available(*, deprecated, message: "This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + {%~ else %} + @available(*, deprecated, message: "This API is deprecated.") + {%~ endif %} {%~ endif %} open func {{ method.name | caseCamel }}( {%~ for parameter in method.parameters.all %} diff --git a/templates/web/src/services/template.ts.twig b/templates/web/src/services/template.ts.twig index 7e00623e8..794cdd7ea 100644 --- a/templates/web/src/services/template.ts.twig +++ b/templates/web/src/services/template.ts.twig @@ -37,7 +37,11 @@ export class {{ service.name | caseUcfirst }} { * @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception} * @returns {{ '{' }}{{ method | getReturn(spec) | raw }}{{ '}' }} {%~ if method.deprecated %} + {%~ if method.since and method.replaceWith %} * @deprecated This API is deprecated since {{ method.since }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + {%~ else %} + * @deprecated This API is deprecated. + {%~ endif %} {%~ endif %} */ {{ method.name | caseCamel }}{{ method.responseModel | getGenerics(spec) | raw }}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): {{ method | getReturn(spec) | raw }} { From f025b1d8311a61b5c34353bc2f84732452d92c3d Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 2 Jul 2025 13:12:37 +0530 Subject: [PATCH 17/23] chore: remove redundant code --- src/Spec/Swagger2.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Spec/Swagger2.php b/src/Spec/Swagger2.php index 572b412c1..27cc5b3a4 100644 --- a/src/Spec/Swagger2.php +++ b/src/Spec/Swagger2.php @@ -193,9 +193,6 @@ protected function parseMethod(string $methodName, string $pathName, array $meth if (is_array($method['x-appwrite']['deprecated'])) { $output['since'] = $method['x-appwrite']['deprecated']['since'] ?? ''; $output['replaceWith'] = $method['x-appwrite']['deprecated']['replaceWith'] ?? ''; - } else { - $output['since'] = ''; - $output['replaceWith'] = ''; } } From 8d631612ffec050b1e5c5172e1bf9a8b56a5c8a0 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 2 Jul 2025 13:14:28 +0530 Subject: [PATCH 18/23] chore: remove comma --- .../library/src/main/java/io/package/services/Service.kt.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/android/library/src/main/java/io/package/services/Service.kt.twig b/templates/android/library/src/main/java/io/package/services/Service.kt.twig index adca41af0..c0ffc2ccf 100644 --- a/templates/android/library/src/main/java/io/package/services/Service.kt.twig +++ b/templates/android/library/src/main/java/io/package/services/Service.kt.twig @@ -47,7 +47,7 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { ) {%~ else %} @Deprecated( - message = "This API is deprecated.", + message = "This API is deprecated." ) {%~ endif %} {%~ endif %} From 58ae3947d5a37872b3a8029e7b0b3ace70236f5c Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 2 Jul 2025 13:24:53 +0530 Subject: [PATCH 19/23] chore: update according to new specs --- src/Spec/Swagger2.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Spec/Swagger2.php b/src/Spec/Swagger2.php index 27cc5b3a4..e1e22b07e 100644 --- a/src/Spec/Swagger2.php +++ b/src/Spec/Swagger2.php @@ -176,6 +176,7 @@ protected function parseMethod(string $methodName, string $pathName, array $meth 'consumes' => $method['consumes'] ?? [], 'cookies' => $method['x-appwrite']['cookies'] ?? false, 'type' => $method['x-appwrite']['type'] ?? false, + 'deprecated' => $method['deprecated'] ?? false, 'headers' => [], 'parameters' => [ 'all' => [], @@ -188,12 +189,9 @@ protected function parseMethod(string $methodName, string $pathName, array $meth 'responseModel' => $responseModel, ]; - if (($method['x-appwrite']['deprecated'] ?? false) !== false) { - $output['deprecated'] = true; - if (is_array($method['x-appwrite']['deprecated'])) { - $output['since'] = $method['x-appwrite']['deprecated']['since'] ?? ''; - $output['replaceWith'] = $method['x-appwrite']['deprecated']['replaceWith'] ?? ''; - } + if ($method['x-appwrite']['deprecated'] ?? false) { + $output['since'] = $method['x-appwrite']['deprecated']['since'] ?? ''; + $output['replaceWith'] = $method['x-appwrite']['deprecated']['replaceWith'] ?? ''; } if ($output['type'] == 'graphql') { From ad4df0f4a49a061a9d5acc33264bd65dc1ebf9f8 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 3 Jul 2025 11:01:21 +0530 Subject: [PATCH 20/23] chore: fix commands --- src/SDK/Language/CLI.php | 2 +- templates/cli/lib/commands/command.js.twig | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/SDK/Language/CLI.php b/src/SDK/Language/CLI.php index dc1038ce7..f331a6a31 100644 --- a/src/SDK/Language/CLI.php +++ b/src/SDK/Language/CLI.php @@ -433,7 +433,7 @@ public function getFilters(): array { return array_merge(parent::getFilters(), [ new TwigFilter('caseKebab', function ($value) { - return strtolower(preg_replace('/(? { {% if method.deprecated %} {% if method.since and method.replaceWith %} - console.warn('Warning: This command is deprecated since {{ method.since }}.{% if method.replaceWith %} Please use "{{ method.replaceWith | replace({'.': ' '}) }}" instead.{% endif %}'); + console.warn('Warning: This command is deprecated since {{ method.since }}.{% if method.replaceWith %} Please use "{{ method.replaceWith | replace({'.': ' '}) | caseKebab }}" instead.{% endif %}'); {% else %} console.warn('Warning: This command is deprecated.'); {% endif %} @@ -88,14 +88,14 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {{ include('cli/base/requests/api.twig') }} {% endif %} } -{% endblock %} +{% endblock declaration %} {% endfor %} {% for method in service.methods %} {{service.name | caseLower }} .command(`{{ method.name | caseKebab }}`) {% autoescape false %} - .description(`{% if method.deprecated %}[DEPRECATED] This command is deprecated.{% if method.replaceWith %} Please use '{{ method.replaceWith | replace({'.': ' '}) }}' instead.{% endif %} {% endif %}{{ method.description | replace({'`':'\''}) | replace({'\n':' '}) | replace({'\n \n':' '}) }}`) + .description(`{% if method.deprecated %}[DEPRECATED] This command is deprecated.{% if method.replaceWith %} Please use '{{ method.replaceWith | replace({'.': ' '}) | caseKebab }}' instead.{% endif %} {% endif %}{{ method.description | replace({'`':'\''}) | replace({'\n':' '}) | replace({'\n \n':' '}) }}`) {% for parameter in method.parameters.all %} .{% if parameter.required and not parameter.nullable %}requiredOption{% else %}option{% endif %}(`--{{ parameter.name | escapeKeyword | caseKebab }}{% if parameter | typeName == 'boolean' %} [value]{% else %} {% if parameter.array.type|length > 0 %}[{% else %}<{% endif %}{{ parameter.name | escapeKeyword | caseKebab }}{% if parameter.array.type|length > 0 %}...{% endif %}{% if parameter.array.type|length > 0 %}]{% else %}>{% endif %}{% endif %}`, `{{ parameter.description | replace({'`':'\''}) | replace({'\n':' '}) | replace({'\n \n':' '}) }}`{% if parameter | typeName == 'boolean' %}, (value) => value === undefined ? true : parseBool(value){% elseif parameter | typeName == 'number' %}, parseInteger{% endif %}) {% endfor %} From 452d85088b7edf88c9cbaa7802d7c8d2d6daf7bf Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 3 Jul 2025 11:06:28 +0530 Subject: [PATCH 21/23] fix: description for cli --- templates/cli/lib/commands/command.js.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/cli/lib/commands/command.js.twig b/templates/cli/lib/commands/command.js.twig index c80c23252..2b10c2f64 100644 --- a/templates/cli/lib/commands/command.js.twig +++ b/templates/cli/lib/commands/command.js.twig @@ -95,7 +95,7 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {{service.name | caseLower }} .command(`{{ method.name | caseKebab }}`) {% autoescape false %} - .description(`{% if method.deprecated %}[DEPRECATED] This command is deprecated.{% if method.replaceWith %} Please use '{{ method.replaceWith | replace({'.': ' '}) | caseKebab }}' instead.{% endif %} {% endif %}{{ method.description | replace({'`':'\''}) | replace({'\n':' '}) | replace({'\n \n':' '}) }}`) + .description(`{% if method.deprecated %}[**DEPRECATED** - This command is deprecated.{% if method.replaceWith %} Please use '{{ method.replaceWith | replace({'.': ' '}) | caseKebab }}' instead{% endif %}] {% endif %}{{ method.description | replace({'`':'\''}) | replace({'\n':' '}) | replace({'\n \n':' '}) }}`) {% for parameter in method.parameters.all %} .{% if parameter.required and not parameter.nullable %}requiredOption{% else %}option{% endif %}(`--{{ parameter.name | escapeKeyword | caseKebab }}{% if parameter | typeName == 'boolean' %} [value]{% else %} {% if parameter.array.type|length > 0 %}[{% else %}<{% endif %}{{ parameter.name | escapeKeyword | caseKebab }}{% if parameter.array.type|length > 0 %}...{% endif %}{% if parameter.array.type|length > 0 %}]{% else %}>{% endif %}{% endif %}`, `{{ parameter.description | replace({'`':'\''}) | replace({'\n':' '}) | replace({'\n \n':' '}) }}`{% if parameter | typeName == 'boolean' %}, (value) => value === undefined ? true : parseBool(value){% elseif parameter | typeName == 'number' %}, parseInteger{% endif %}) {% endfor %} From 1274c5b498428a12271a3d6947700cfab089d596 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 3 Jul 2025 11:17:03 +0530 Subject: [PATCH 22/23] chore: use generic message --- .../library/src/main/java/io/package/services/Service.kt.twig | 4 ++-- templates/apple/Sources/Services/Service.swift.twig | 4 ++-- templates/dart/lib/services/service.dart.twig | 2 +- templates/deno/src/services/service.ts.twig | 2 +- templates/dotnet/Package/Services/ServiceTemplate.cs.twig | 2 +- templates/flutter/lib/services/service.dart.twig | 2 +- templates/go/services/service.go.twig | 2 +- .../main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig | 4 ++-- templates/node/src/services/template.ts.twig | 2 +- templates/php/src/Services/Service.php.twig | 2 +- templates/python/package/services/service.py.twig | 2 +- templates/react-native/src/services/template.ts.twig | 4 ++-- templates/ruby/lib/container/services/service.rb.twig | 2 +- templates/swift/Sources/Services/Service.swift.twig | 4 ++-- templates/web/src/services/template.ts.twig | 2 +- 15 files changed, 20 insertions(+), 20 deletions(-) diff --git a/templates/android/library/src/main/java/io/package/services/Service.kt.twig b/templates/android/library/src/main/java/io/package/services/Service.kt.twig index c0ffc2ccf..db8d3d726 100644 --- a/templates/android/library/src/main/java/io/package/services/Service.kt.twig +++ b/templates/android/library/src/main/java/io/package/services/Service.kt.twig @@ -41,7 +41,7 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} @Deprecated( - message = "This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.", + message = "This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.", replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"), since = "{{ method.since }}" ) @@ -208,7 +208,7 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} @Deprecated( - message = "This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.", + message = "This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.", replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"), since = "{{ method.since }}" ) diff --git a/templates/apple/Sources/Services/Service.swift.twig b/templates/apple/Sources/Services/Service.swift.twig index 299dbb889..3769d02dc 100644 --- a/templates/apple/Sources/Services/Service.swift.twig +++ b/templates/apple/Sources/Services/Service.swift.twig @@ -25,7 +25,7 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { {%~ endif %} {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - @available(*, deprecated, message: "This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + @available(*, deprecated, message: "This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") {%~ else %} @available(*, deprecated, message: "This API is deprecated.") {%~ endif %} @@ -96,7 +96,7 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { {%~ endif %} {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - @available(*, deprecated, message: "This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + @available(*, deprecated, message: "This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") {%~ else %} @available(*, deprecated, message: "This API is deprecated.") {%~ endif %} diff --git a/templates/dart/lib/services/service.dart.twig b/templates/dart/lib/services/service.dart.twig index 12b62b2a2..db67dd4ec 100644 --- a/templates/dart/lib/services/service.dart.twig +++ b/templates/dart/lib/services/service.dart.twig @@ -19,7 +19,7 @@ class {{ service.name | caseUcfirst }} extends Service { {% endif %} {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - @Deprecated('This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') + @Deprecated('This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') {%~ else %} @Deprecated('This API is deprecated.') {%~ endif %} diff --git a/templates/deno/src/services/service.ts.twig b/templates/deno/src/services/service.ts.twig index fc3b0a3d2..e5455a3ef 100644 --- a/templates/deno/src/services/service.ts.twig +++ b/templates/deno/src/services/service.ts.twig @@ -79,7 +79,7 @@ export class {{ service.name | caseUcfirst }} extends Service { * @returns {Promise} {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - * @deprecated This API is deprecated since {{ method.since }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + * @deprecated This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. {%~ else %} * @deprecated This API is deprecated. {%~ endif %} diff --git a/templates/dotnet/Package/Services/ServiceTemplate.cs.twig b/templates/dotnet/Package/Services/ServiceTemplate.cs.twig index 69a964d9d..53fc2db31 100644 --- a/templates/dotnet/Package/Services/ServiceTemplate.cs.twig +++ b/templates/dotnet/Package/Services/ServiceTemplate.cs.twig @@ -28,7 +28,7 @@ namespace {{ spec.title | caseUcfirst }}.Services /// {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - [Obsolete("This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.")] + [Obsolete("This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.")] {%~ else %} [Obsolete("This API is deprecated.")] {%~ endif %} diff --git a/templates/flutter/lib/services/service.dart.twig b/templates/flutter/lib/services/service.dart.twig index a8f09a952..01b89b76e 100644 --- a/templates/flutter/lib/services/service.dart.twig +++ b/templates/flutter/lib/services/service.dart.twig @@ -20,7 +20,7 @@ class {{ service.name | caseUcfirst }} extends Service { {% endif %} {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - @Deprecated('This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') + @Deprecated('This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') {%~ else %} @Deprecated('This API is deprecated.') {%~ endif %} diff --git a/templates/go/services/service.go.twig b/templates/go/services/service.go.twig index 8a33f58b6..3aa4c260c 100644 --- a/templates/go/services/service.go.twig +++ b/templates/go/services/service.go.twig @@ -90,7 +90,7 @@ func (srv *{{ service.name | caseUcfirst }}) With{{ method.name | caseUcfirst }} {% if method.deprecated %} // {%~ if method.since and method.replaceWith %} -// Deprecated: This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. +// Deprecated: This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. {%~ else %} // Deprecated: This API is deprecated. {%~ endif %} diff --git a/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig b/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig index 9978eccf2..a50dde43d 100644 --- a/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig +++ b/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig @@ -33,7 +33,7 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} @Deprecated( - message = "This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.", + message = "This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.", replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"), since = "{{ method.since }}" ) @@ -107,7 +107,7 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} @Deprecated( - message = "This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.", + message = "This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.", replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"), since = "{{ method.since }}" ) diff --git a/templates/node/src/services/template.ts.twig b/templates/node/src/services/template.ts.twig index cb4e9e643..4b5769e88 100644 --- a/templates/node/src/services/template.ts.twig +++ b/templates/node/src/services/template.ts.twig @@ -37,7 +37,7 @@ export class {{ service.name | caseUcfirst }} { * @returns {{ '{' }}{{ method | getReturn(spec) | raw }}{{ '}' }} {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - * @deprecated This API is deprecated since {{ method.since }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + * @deprecated This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. {%~ else %} * @deprecated This API is deprecated. {%~ endif %} diff --git a/templates/php/src/Services/Service.php.twig b/templates/php/src/Services/Service.php.twig index 97af5af8b..25c08d028 100644 --- a/templates/php/src/Services/Service.php.twig +++ b/templates/php/src/Services/Service.php.twig @@ -45,7 +45,7 @@ class {{ service.name | caseUcfirst }} extends Service {% if method.deprecated %} * {%~ if method.since and method.replaceWith %} - * @deprecated This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | split('.') | last | caseCamel }}` instead. + * @deprecated This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | split('.') | last | caseCamel }}` instead. {%~ else %} * @deprecated This API is deprecated. {%~ endif %} diff --git a/templates/python/package/services/service.py.twig b/templates/python/package/services/service.py.twig index 3cbcd8c2c..fb8262fad 100644 --- a/templates/python/package/services/service.py.twig +++ b/templates/python/package/services/service.py.twig @@ -37,7 +37,7 @@ class {{ service.name | caseUcfirst }}(Service): {% if method.deprecated %} {%~ if method.since and method.replaceWith %} .. deprecated::{{ method.since }} - This API is deprecated since {{ method.since }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | caseSnakeExceptFirstDot }}` instead.{% endif %} + This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | caseSnakeExceptFirstDot }}` instead. {%~ else %} .. deprecated:: This API is deprecated. diff --git a/templates/react-native/src/services/template.ts.twig b/templates/react-native/src/services/template.ts.twig index c357eca2b..6b1dd16a9 100644 --- a/templates/react-native/src/services/template.ts.twig +++ b/templates/react-native/src/services/template.ts.twig @@ -43,7 +43,7 @@ export class {{ service.name | caseUcfirst }} extends Service { {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - * @deprecated This API is deprecated since {{ method.since }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + * @deprecated This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. {%~ else %} * @deprecated This API is deprecated. {%~ endif %} @@ -195,7 +195,7 @@ export class {{ service.name | caseUcfirst }} extends Service { * @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception} * @returns {{ '{' }}URL{{ '}' }} {%~ if method.deprecated %} - * @deprecated This API is deprecated since {{ method.since }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + * @deprecated This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. {%~ endif %} */ {{ method.name | caseCamel }}URL({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): URL { diff --git a/templates/ruby/lib/container/services/service.rb.twig b/templates/ruby/lib/container/services/service.rb.twig index 866a64636..12ffca4b1 100644 --- a/templates/ruby/lib/container/services/service.rb.twig +++ b/templates/ruby/lib/container/services/service.rb.twig @@ -11,7 +11,7 @@ module {{spec.title | caseUcfirst}} {% if method.deprecated %} # {%~ if method.since and method.replaceWith %} - # @deprecated This API is deprecated since {{ method.since }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + # @deprecated This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. {%~ else %} # @deprecated This API is deprecated. {%~ endif %} diff --git a/templates/swift/Sources/Services/Service.swift.twig b/templates/swift/Sources/Services/Service.swift.twig index f5b4058bf..9078b2740 100644 --- a/templates/swift/Sources/Services/Service.swift.twig +++ b/templates/swift/Sources/Services/Service.swift.twig @@ -22,7 +22,7 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { /// {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - @available(*, deprecated, message: "This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + @available(*, deprecated, message: "This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") {%~ else %} @available(*, deprecated, message: "This API is deprecated.") {%~ endif %} @@ -90,7 +90,7 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { /// {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - @available(*, deprecated, message: "This API is deprecated since {{ method.since }} and uses outdated terminologies. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + @available(*, deprecated, message: "This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") {%~ else %} @available(*, deprecated, message: "This API is deprecated.") {%~ endif %} diff --git a/templates/web/src/services/template.ts.twig b/templates/web/src/services/template.ts.twig index 794cdd7ea..e283298ad 100644 --- a/templates/web/src/services/template.ts.twig +++ b/templates/web/src/services/template.ts.twig @@ -38,7 +38,7 @@ export class {{ service.name | caseUcfirst }} { * @returns {{ '{' }}{{ method | getReturn(spec) | raw }}{{ '}' }} {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - * @deprecated This API is deprecated since {{ method.since }} and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %} + * @deprecated This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. {%~ else %} * @deprecated This API is deprecated. {%~ endif %} From 1f02f0d9fc66d6d9888c02c9ee2a76edc2c8610e Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 3 Jul 2025 11:30:21 +0530 Subject: [PATCH 23/23] fix: grammer since mine bad --- .../src/main/java/io/package/services/Service.kt.twig | 8 ++++---- templates/apple/Sources/Services/Service.swift.twig | 8 ++++---- templates/dart/lib/services/service.dart.twig | 4 ++-- templates/deno/src/services/service.ts.twig | 4 ++-- templates/dotnet/Package/Services/ServiceTemplate.cs.twig | 4 ++-- templates/flutter/lib/services/service.dart.twig | 4 ++-- templates/go/services/service.go.twig | 4 ++-- .../kotlin/io/appwrite/services/ServiceTemplate.kt.twig | 8 ++++---- templates/node/src/services/template.ts.twig | 4 ++-- templates/php/src/Services/Service.php.twig | 4 ++-- templates/python/package/services/service.py.twig | 4 ++-- templates/react-native/src/services/template.ts.twig | 6 +++--- templates/ruby/lib/container/services/service.rb.twig | 4 ++-- templates/swift/Sources/Services/Service.swift.twig | 8 ++++---- templates/web/src/services/template.ts.twig | 4 ++-- 15 files changed, 39 insertions(+), 39 deletions(-) diff --git a/templates/android/library/src/main/java/io/package/services/Service.kt.twig b/templates/android/library/src/main/java/io/package/services/Service.kt.twig index db8d3d726..86ca774de 100644 --- a/templates/android/library/src/main/java/io/package/services/Service.kt.twig +++ b/templates/android/library/src/main/java/io/package/services/Service.kt.twig @@ -41,13 +41,13 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} @Deprecated( - message = "This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.", + message = "This API has been deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.", replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"), since = "{{ method.since }}" ) {%~ else %} @Deprecated( - message = "This API is deprecated." + message = "This API has been deprecated." ) {%~ endif %} {%~ endif %} @@ -208,13 +208,13 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} @Deprecated( - message = "This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.", + message = "This API has been deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.", replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"), since = "{{ method.since }}" ) {%~ else %} @Deprecated( - message = "This API is deprecated." + message = "This API has been deprecated." ) {%~ endif %} {%~ endif %} diff --git a/templates/apple/Sources/Services/Service.swift.twig b/templates/apple/Sources/Services/Service.swift.twig index 3769d02dc..66ff009af 100644 --- a/templates/apple/Sources/Services/Service.swift.twig +++ b/templates/apple/Sources/Services/Service.swift.twig @@ -25,9 +25,9 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { {%~ endif %} {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - @available(*, deprecated, message: "This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + @available(*, deprecated, message: "This API has been deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") {%~ else %} - @available(*, deprecated, message: "This API is deprecated.") + @available(*, deprecated, message: "This API has been deprecated.") {%~ endif %} {%~ endif %} open func {{ method.name | caseCamel | overrideIdentifier }}{% if method.responseModel | hasGenericType(spec) %}{% endif %}( @@ -96,9 +96,9 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { {%~ endif %} {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - @available(*, deprecated, message: "This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + @available(*, deprecated, message: "This API has been deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") {%~ else %} - @available(*, deprecated, message: "This API is deprecated.") + @available(*, deprecated, message: "This API has been deprecated.") {%~ endif %} {%~ endif %} open func {{ method.name | caseCamel }}( diff --git a/templates/dart/lib/services/service.dart.twig b/templates/dart/lib/services/service.dart.twig index db67dd4ec..836d10b5d 100644 --- a/templates/dart/lib/services/service.dart.twig +++ b/templates/dart/lib/services/service.dart.twig @@ -19,9 +19,9 @@ class {{ service.name | caseUcfirst }} extends Service { {% endif %} {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - @Deprecated('This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') + @Deprecated('This API has been deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') {%~ else %} - @Deprecated('This API is deprecated.') + @Deprecated('This API has been deprecated.') {%~ endif %} {%~ endif %} {% if method.type == 'location' %}Future{% else %}{% if method.responseModel and method.responseModel != 'any' %}Future{% else %}Future{% endif %}{% endif %} {{ method.name | caseCamel | overrideIdentifier }}({{ _self.method_parameters(method.parameters.all, method.consumes) }}) async { diff --git a/templates/deno/src/services/service.ts.twig b/templates/deno/src/services/service.ts.twig index e5455a3ef..2eeca149b 100644 --- a/templates/deno/src/services/service.ts.twig +++ b/templates/deno/src/services/service.ts.twig @@ -79,9 +79,9 @@ export class {{ service.name | caseUcfirst }} extends Service { * @returns {Promise} {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - * @deprecated This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. + * @deprecated This API has been deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. {%~ else %} - * @deprecated This API is deprecated. + * @deprecated This API has been deprecated. {%~ endif %} {%~ endif %} */ diff --git a/templates/dotnet/Package/Services/ServiceTemplate.cs.twig b/templates/dotnet/Package/Services/ServiceTemplate.cs.twig index 53fc2db31..99cf15653 100644 --- a/templates/dotnet/Package/Services/ServiceTemplate.cs.twig +++ b/templates/dotnet/Package/Services/ServiceTemplate.cs.twig @@ -28,9 +28,9 @@ namespace {{ spec.title | caseUcfirst }}.Services /// {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - [Obsolete("This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.")] + [Obsolete("This API has been deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.")] {%~ else %} - [Obsolete("This API is deprecated.")] + [Obsolete("This API has been deprecated.")] {%~ endif %} {%~ endif %} public Task{% if method.type == "webAuth" %}{% else %}<{{ utils.resultType(spec.title, method) }}>{% endif %} {{ method.name | caseUcfirst }}({{ utils.method_parameters(method.parameters, method.consumes) }}) diff --git a/templates/flutter/lib/services/service.dart.twig b/templates/flutter/lib/services/service.dart.twig index 01b89b76e..f3aa80056 100644 --- a/templates/flutter/lib/services/service.dart.twig +++ b/templates/flutter/lib/services/service.dart.twig @@ -20,9 +20,9 @@ class {{ service.name | caseUcfirst }} extends Service { {% endif %} {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - @Deprecated('This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') + @Deprecated('This API has been deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.') {%~ else %} - @Deprecated('This API is deprecated.') + @Deprecated('This API has been deprecated.') {%~ endif %} {%~ endif %} {% if method.type == 'webAuth' %}Future{% elseif method.type == 'location' %}Future{% else %}{% if method.responseModel and method.responseModel != 'any' %}Future{% else %}Future{% endif %}{% endif %} {{ method.name | caseCamel | overrideIdentifier }}({{ _self.method_parameters(method.parameters.all, method.consumes) }}) async { diff --git a/templates/go/services/service.go.twig b/templates/go/services/service.go.twig index 3aa4c260c..0c065a15c 100644 --- a/templates/go/services/service.go.twig +++ b/templates/go/services/service.go.twig @@ -90,9 +90,9 @@ func (srv *{{ service.name | caseUcfirst }}) With{{ method.name | caseUcfirst }} {% if method.deprecated %} // {%~ if method.since and method.replaceWith %} -// Deprecated: This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. +// Deprecated: This API has been deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. {%~ else %} -// Deprecated: This API is deprecated. +// Deprecated: This API has been deprecated. {%~ endif %} {% endif %} func (srv *{{ service.name | caseUcfirst }}) {{ method.name | caseUcfirst }}({{ params }})(*{{ method | returnType(spec, spec.title | caseLower) }}, error) { diff --git a/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig b/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig index a50dde43d..98821575b 100644 --- a/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig +++ b/templates/kotlin/src/main/kotlin/io/appwrite/services/ServiceTemplate.kt.twig @@ -33,13 +33,13 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} @Deprecated( - message = "This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.", + message = "This API has been deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.", replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"), since = "{{ method.since }}" ) {%~ else %} @Deprecated( - message = "This API is deprecated." + message = "This API has been deprecated." ) {%~ endif %} {%~ endif %} @@ -107,13 +107,13 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) { {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} @Deprecated( - message = "This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.", + message = "This API has been deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.", replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"), since = "{{ method.since }}" ) {%~ else %} @Deprecated( - message = "This API is deprecated." + message = "This API has been deprecated." ) {%~ endif %} {%~ endif %} diff --git a/templates/node/src/services/template.ts.twig b/templates/node/src/services/template.ts.twig index 4b5769e88..05759bd5e 100644 --- a/templates/node/src/services/template.ts.twig +++ b/templates/node/src/services/template.ts.twig @@ -37,9 +37,9 @@ export class {{ service.name | caseUcfirst }} { * @returns {{ '{' }}{{ method | getReturn(spec) | raw }}{{ '}' }} {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - * @deprecated This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. + * @deprecated This API has been deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. {%~ else %} - * @deprecated This API is deprecated. + * @deprecated This API has been deprecated. {%~ endif %} {%~ endif %} */ diff --git a/templates/php/src/Services/Service.php.twig b/templates/php/src/Services/Service.php.twig index 25c08d028..32338d2d5 100644 --- a/templates/php/src/Services/Service.php.twig +++ b/templates/php/src/Services/Service.php.twig @@ -45,9 +45,9 @@ class {{ service.name | caseUcfirst }} extends Service {% if method.deprecated %} * {%~ if method.since and method.replaceWith %} - * @deprecated This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | split('.') | last | caseCamel }}` instead. + * @deprecated This API has been deprecated since {{ method.since }}. Please use `{{ method.replaceWith | split('.') | last | caseCamel }}` instead. {%~ else %} - * @deprecated This API is deprecated. + * @deprecated This API has been deprecated. {%~ endif %} {% if method.replaceWith %} * @see {{ method.replaceWith | replace({'.': '::'}) | capitalizeFirst }} diff --git a/templates/python/package/services/service.py.twig b/templates/python/package/services/service.py.twig index fb8262fad..97c96b527 100644 --- a/templates/python/package/services/service.py.twig +++ b/templates/python/package/services/service.py.twig @@ -37,10 +37,10 @@ class {{ service.name | caseUcfirst }}(Service): {% if method.deprecated %} {%~ if method.since and method.replaceWith %} .. deprecated::{{ method.since }} - This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | caseSnakeExceptFirstDot }}` instead. + This API has been deprecated since {{ method.since }}. Please use `{{ method.replaceWith | caseSnakeExceptFirstDot }}` instead. {%~ else %} .. deprecated:: - This API is deprecated. + This API has been deprecated. {%~ endif %} {% endif %} diff --git a/templates/react-native/src/services/template.ts.twig b/templates/react-native/src/services/template.ts.twig index 6b1dd16a9..7ebcaf03f 100644 --- a/templates/react-native/src/services/template.ts.twig +++ b/templates/react-native/src/services/template.ts.twig @@ -43,9 +43,9 @@ export class {{ service.name | caseUcfirst }} extends Service { {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - * @deprecated This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. + * @deprecated This API has been deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. {%~ else %} - * @deprecated This API is deprecated. + * @deprecated This API has been deprecated. {%~ endif %} {%~ endif %} */ @@ -195,7 +195,7 @@ export class {{ service.name | caseUcfirst }} extends Service { * @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception} * @returns {{ '{' }}URL{{ '}' }} {%~ if method.deprecated %} - * @deprecated This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. + * @deprecated This API has been deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. {%~ endif %} */ {{ method.name | caseCamel }}URL({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): URL { diff --git a/templates/ruby/lib/container/services/service.rb.twig b/templates/ruby/lib/container/services/service.rb.twig index 12ffca4b1..393b6fd16 100644 --- a/templates/ruby/lib/container/services/service.rb.twig +++ b/templates/ruby/lib/container/services/service.rb.twig @@ -11,9 +11,9 @@ module {{spec.title | caseUcfirst}} {% if method.deprecated %} # {%~ if method.since and method.replaceWith %} - # @deprecated This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. + # @deprecated This API has been deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. {%~ else %} - # @deprecated This API is deprecated. + # @deprecated This API has been deprecated. {%~ endif %} # {% endif %} diff --git a/templates/swift/Sources/Services/Service.swift.twig b/templates/swift/Sources/Services/Service.swift.twig index 9078b2740..597037fbd 100644 --- a/templates/swift/Sources/Services/Service.swift.twig +++ b/templates/swift/Sources/Services/Service.swift.twig @@ -22,9 +22,9 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { /// {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - @available(*, deprecated, message: "This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + @available(*, deprecated, message: "This API has been deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") {%~ else %} - @available(*, deprecated, message: "This API is deprecated.") + @available(*, deprecated, message: "This API has been deprecated.") {%~ endif %} {%~ endif %} open func {{ method.name | caseCamel | overrideIdentifier }}{% if method.responseModel | hasGenericType(spec) %}{% endif %}( @@ -90,9 +90,9 @@ open class {{ service.name | caseUcfirst | overrideIdentifier }}: Service { /// {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - @available(*, deprecated, message: "This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") + @available(*, deprecated, message: "This API has been deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead.") {%~ else %} - @available(*, deprecated, message: "This API is deprecated.") + @available(*, deprecated, message: "This API has been deprecated.") {%~ endif %} {%~ endif %} open func {{ method.name | caseCamel }}( diff --git a/templates/web/src/services/template.ts.twig b/templates/web/src/services/template.ts.twig index e283298ad..259d6b1e3 100644 --- a/templates/web/src/services/template.ts.twig +++ b/templates/web/src/services/template.ts.twig @@ -38,9 +38,9 @@ export class {{ service.name | caseUcfirst }} { * @returns {{ '{' }}{{ method | getReturn(spec) | raw }}{{ '}' }} {%~ if method.deprecated %} {%~ if method.since and method.replaceWith %} - * @deprecated This API is deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. + * @deprecated This API has been deprecated since {{ method.since }}. Please use `{{ method.replaceWith | capitalizeFirst }}` instead. {%~ else %} - * @deprecated This API is deprecated. + * @deprecated This API has been deprecated. {%~ endif %} {%~ endif %} */