Skip to content

add deprecation handling in templates #1096

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2a046a7
update API spec URL and add deprecation handling in templates
ChiragAgg5k Jun 24, 2025
bd87714
chore: add deprecated to kotlin
ChiragAgg5k Jun 24, 2025
f458cca
chore: add deprecated to ts
ChiragAgg5k Jun 24, 2025
fe94000
chore: add deprecated to python
ChiragAgg5k Jun 24, 2025
fd182a9
Merge branch 'master' into feat-add-deprecated
ChiragAgg5k Jun 27, 2025
f64266d
fix: lint
ChiragAgg5k Jun 27, 2025
211e3b8
chore: add deprecated to php
ChiragAgg5k Jun 27, 2025
f09f92a
chore: deprecate cli methods
ChiragAgg5k Jun 30, 2025
5af0c01
chore: lint
ChiragAgg5k Jun 30, 2025
567971f
chore: add deprecated to swift and apple
ChiragAgg5k Jun 30, 2025
fcbfdf2
chore: add more deprecations
ChiragAgg5k Jun 30, 2025
1b5e439
chore: remove override
ChiragAgg5k Jun 30, 2025
6b40a01
chore: use deprecatedVersion in kotlin
ChiragAgg5k Jul 1, 2025
e15149f
chore: finish deprecation for all sdks
ChiragAgg5k Jul 1, 2025
86b2092
chore: use since instead
ChiragAgg5k Jul 2, 2025
101f47b
fix: kotlin and android
ChiragAgg5k Jul 2, 2025
85f2215
chore: add conditonal rendering when since and replacwith not present
ChiragAgg5k Jul 2, 2025
f025b1d
chore: remove redundant code
ChiragAgg5k Jul 2, 2025
8d63161
chore: remove comma
ChiragAgg5k Jul 2, 2025
58ae394
chore: update according to new specs
ChiragAgg5k Jul 2, 2025
ad4df0f
chore: fix commands
ChiragAgg5k Jul 3, 2025
452d850
fix: description for cli
ChiragAgg5k Jul 3, 2025
1274c5b
chore: use generic message
ChiragAgg5k Jul 3, 2025
1f02f0d
fix: grammer since mine bad
ChiragAgg5k Jul 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
16 changes: 16 additions & 0 deletions src/SDK/SDK.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,22 @@ public function __construct(Language $language, Spec $spec)
}
return $value;
}));
$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]);
}));
}

/**
Expand Down
6 changes: 6 additions & 0 deletions src/Spec/Swagger2.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [],
Expand All @@ -188,6 +189,11 @@ protected function parseMethod(string $methodName, string $pathName, array $meth
'responseModel' => $responseModel,
];

if ($method['x-appwrite']['deprecated'] ?? false) {
$output['since'] = $method['x-appwrite']['deprecated']['since'] ?? '';
$output['replaceWith'] = $method['x-appwrite']['deprecated']['replaceWith'] ?? '';
}

if ($output['type'] == 'graphql') {
$output['headers']['x-sdk-graphql'] = "true";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) {
* @return [{{ method | returnType(spec, sdk.namespace | caseDot) | raw }}]
{%~ endif %}
*/
{%~ 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.",
replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"),
since = "{{ method.since }}"
)
{%~ else %}
@Deprecated(
message = "This API is deprecated."
)
{%~ endif %}
{%~ endif %}
{%~ if method.parameters.all | reduce((carry, param) => carry or not param.required) %}
@JvmOverloads
{%~ endif %}
Expand Down Expand Up @@ -192,6 +205,19 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) {
* @return [{{ method | returnType(spec, sdk.namespace | caseDot) | raw }}]
{%~ endif %}
*/
{%~ 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.",
replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"),
since = "{{ method.since }}"
)
{%~ else %}
@Deprecated(
message = "This API is deprecated."
)
{%~ endif %}
{%~ endif %}
{%~ if method.parameters.all | reduce((carry, param) => carry or not param.required) %}
@JvmOverloads
{%~ endif %}
Expand Down
14 changes: 14 additions & 0 deletions templates/apple/Sources/Services/Service.swift.twig
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ 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 %}
{%~ 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) %}<T>{% 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 %}
Expand Down Expand Up @@ -87,6 +94,13 @@ 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 %}
{%~ 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 %}
{{ 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 %}
Expand Down
13 changes: 10 additions & 3 deletions templates/cli/lib/commands/command.js.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 }},
Expand All @@ -72,7 +72,13 @@ 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 %}
{% 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;
let apiPath = '{{ method.path }}'{% for parameter in method.parameters.path %}.replace('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | escapeKeyword }}){% endfor %};
Expand All @@ -82,13 +88,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 %}
Expand Down
7 changes: 7 additions & 0 deletions templates/dart/lib/services/service.dart.twig
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ class {{ service.name | caseUcfirst }} extends Service {
{%~ if method.description %}
{{ 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<Uint8List>{% else %}{% if method.responseModel and method.responseModel != 'any' %}Future<models.{{method.responseModel | caseUcfirst | overrideIdentifier}}>{% 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 %};

Expand Down
7 changes: 7 additions & 0 deletions templates/deno/src/services/service.ts.twig
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ export class {{ service.name | caseUcfirst }} extends Service {
{% endfor %}
* @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 %}> {
{% for parameter in method.parameters.all %}
Expand Down
7 changes: 7 additions & 0 deletions templates/dotnet/Package/Services/ServiceTemplate.cs.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ namespace {{ spec.title | caseUcfirst }}.Services
/// </para>
{%~ endif %}
/// </summary>
{%~ 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" %}<String>{% 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 %}
Expand Down
7 changes: 7 additions & 0 deletions templates/flutter/lib/services/service.dart.twig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ class {{ service.name | caseUcfirst }} extends Service {
{%~ if method.description %}
{{ 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<Uint8List>{% else %}{% if method.responseModel and method.responseModel != 'any' %}Future<models.{{method.responseModel | caseUcfirst | overrideIdentifier}}>{% 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 %};

Expand Down
8 changes: 8 additions & 0 deletions templates/go/services/service.go.twig
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ func (srv *{{ service.name | caseUcfirst }}) With{{ method.name | caseUcfirst }}
{% else %}
// {{ 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 %}
r := strings.NewReplacer({% for parameter in method.parameters.path %}"{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}", {{ parameter.name | caseUcfirst }}{% if not loop.last %}, {% endif %}{% endfor %})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) {
{%~ endfor %}
* @return [{{ method | returnType(spec, sdk.namespace | caseDot) | raw }}]
*/
{%~ 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.",
replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"),
since = "{{ method.since }}"
)
{%~ else %}
@Deprecated(
message = "This API is deprecated."
)
{%~ endif %}
{%~ endif %}
{%~ if method.parameters.all | reduce((carry, param) => carry or not param.required) %}
@JvmOverloads
{%~ endif %}
Expand Down Expand Up @@ -91,6 +104,19 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) {
{%~ endfor %}
* @return [{{ method | returnType(spec, sdk.namespace | caseDot) | raw }}]
*/
{%~ 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.",
replaceWith = ReplaceWith("{{ sdk.namespace | caseDot }}.services.{{ method.replaceWith | capitalizeFirst }}"),
since = "{{ method.since }}"
)
{%~ else %}
@Deprecated(
message = "This API is deprecated."
)
{%~ endif %}
{%~ endif %}
{%~ if method.parameters.all | reduce((carry, param) => carry or not param.required) %}
@JvmOverloads
{%~ endif %}
Expand Down
12 changes: 11 additions & 1 deletion templates/node/src/services/template.ts.twig
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,21 @@ 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 %}
* @param {{ '{' }}{{ parameter | getPropertyType(method) | raw }}{{ '}' }} {{ parameter.name | caseCamel | escapeKeyword }}
{%~ endfor %}
* @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 }} {
{%~ for parameter in method.parameters.all %}
Expand Down Expand Up @@ -94,5 +101,8 @@ export class {{ service.name | caseUcfirst }} {
);
{%~ endif %}
}
{% if not loop.last %}

{% endif %}
{%~ endfor %}
}
12 changes: 12 additions & 0 deletions templates/php/src/Services/Service.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class {{ service.name | caseUcfirst }} extends Service
}

{% for method in service.methods %}
{% set deprecated_message = '' %}
/**
{% if method.description %}
{{ method.description|comment1 }}
Expand All @@ -41,6 +42,17 @@ class {{ service.name | caseUcfirst }} extends Service
{% endfor %}
* @throws {{spec.title | caseUcfirst}}Exception
* @return {{ method | getReturn }}
{% 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.
{%~ else %}
* @deprecated This API is deprecated.
{%~ endif %}
{% 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 }}
{
Expand Down
10 changes: 10 additions & 0 deletions templates/python/package/services/service.py.twig
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ 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
----------
{% for parameter in method.parameters.all %}{{ parameter.name | escapeKeyword | caseSnake }} : {{ parameter | getPropertyType(method) | raw }}
Expand Down
Loading