Skip to content

Commit 7b582ad

Browse files
fix: path var naming collision
1 parent ee12cb1 commit 7b582ad

File tree

41 files changed

+63
-63
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+63
-63
lines changed

templates/android/library/src/main/java/io/appwrite/services/ServiceTemplate.kt.twig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class {{ service.name | caseUcfirst }} : Service {
5353
onProgress: ((UploadProgress) -> Unit)? = null
5454
{%~ endif %}
5555
){% if method.type != "webAuth" %}: {{ method | returnType(spec, sdk.namespace | caseDot) | raw }}{% endif %} {
56-
val path = "{{ method.path }}"
56+
val apiPath = "{{ method.path }}"
5757
{%~ for parameter in method.parameters.path %}
5858
.replace("{{ '{' ~ parameter.name | caseCamel ~ '}' }}", {{ parameter.name | caseCamel }})
5959
{%~ endfor %}
@@ -88,7 +88,7 @@ class {{ service.name | caseUcfirst }} : Service {
8888
}
8989
}
9090

91-
val url = Uri.parse("${client.endPoint}${path}?${query.joinToString("&")}")
91+
val url = Uri.parse("${client.endPoint}${apiPath}?${query.joinToString("&")}")
9292
val callbackUrlScheme = "{{ spec.title | caseLower }}-callback-${client.config["project"]}"
9393

9494
WebAuthComponent.authenticate(activity, url, callbackUrlScheme) {
@@ -118,7 +118,7 @@ class {{ service.name | caseUcfirst }} : Service {
118118
{%~ elseif method.type == 'location' %}
119119
return client.call(
120120
"{{ method.method | caseUpper }}",
121-
path,
121+
apiPath,
122122
params = params,
123123
responseType = {{ method | returnType(spec, sdk.namespace | caseDot) | raw }}::class.java
124124
)
@@ -146,7 +146,7 @@ class {{ service.name | caseUcfirst }} : Service {
146146
{%~ endif %}
147147
{%~ endfor %}
148148
return client.chunkedUpload(
149-
path,
149+
apiPath,
150150
headers,
151151
params,
152152
responseType = {{ method | returnType(spec, sdk.namespace | caseDot) | raw }}::class.java,
@@ -160,7 +160,7 @@ class {{ service.name | caseUcfirst }} : Service {
160160
{%~ else %}
161161
return client.call(
162162
"{{ method.method | caseUpper }}",
163-
path,
163+
apiPath,
164164
headers,
165165
params,
166166
{%~ if method.responseModel | hasGenericType(spec) %}

templates/cli/lib/commands/command.js.twig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {
2121
{% endfor %}
2222

2323
let client = !sdk ? await {% if service.name == "projects" %}sdkForConsole(){% else %}sdkForProject(){% endif %} : sdk;
24-
let path = '{{ method.path }}'{% for parameter in method.parameters.path %}.replace('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | escapeKeyword }}){% endfor %};
24+
let apiPath = '{{ method.path }}'{% for parameter in method.parameters.path %}.replace('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | escapeKeyword }}){% endfor %};
2525
let payload = {};
2626
{% if method.parameters.query|length > 0 %}
2727

@@ -95,9 +95,9 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {
9595
payload['project'] = localConfig.getProject().projectId
9696
payload['key'] = globalConfig.getKey();
9797
const queryParams = new URLSearchParams(payload);
98-
path = `${globalConfig.getEndpoint()}${path}?${queryParams.toString()}`;
98+
apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
9999

100-
const response = await client.call('{{ method.method | caseLower }}', path, {
100+
const response = await client.call('{{ method.method | caseLower }}', apiPath, {
101101
{% for parameter in method.parameters.header %}
102102
'{{ parameter.name }}': ${{ parameter.name | caseCamel | escapeKeyword }},
103103
{% endfor %}
@@ -122,7 +122,7 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {
122122
if (size <= libClient.CHUNK_SIZE) {
123123
payload['{{ parameter.name }}'] = fs.createReadStream(payload['{{ parameter.name }}']);
124124

125-
response = await client.call('{{ method.method | caseLower }}', path, {
125+
response = await client.call('{{ method.method | caseLower }}', apiPath, {
126126
{% for parameter in method.parameters.header %}
127127
'{{ parameter.name }}': ${{ parameter.name | caseCamel | escapeKeyword }},
128128
{% endfor %}
@@ -154,7 +154,7 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {
154154
{% if parameter.isUploadID %}
155155
if({{ parameter.name | caseCamel | escapeKeyword }} != 'unique()') {
156156
try {
157-
response = await client.call('get', path + '/' + {{ parameter.name }}, headers);
157+
response = await client.call('get', apiPath + '/' + {{ parameter.name }}, headers);
158158
counter = response.chunksUploaded;
159159
} catch(e) {
160160
}
@@ -178,7 +178,7 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {
178178
});
179179
payload['{{ parameter.name }}'] = stream;
180180

181-
response = await client.call('{{ method.method | caseLower }}', path, headers, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %});
181+
response = await client.call('{{ method.method | caseLower }}', apiPath, headers, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %});
182182

183183
if (!id) {
184184
id = response['$id'];
@@ -198,7 +198,7 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {
198198
{% endif %}
199199
{% endfor %}
200200
{% else %}
201-
response = await client.call('{{ method.method | caseLower }}', path, {
201+
response = await client.call('{{ method.method | caseLower }}', apiPath, {
202202
{% for parameter in method.parameters.header %}
203203
'{{ parameter.name }}': ${{ parameter.name | caseCamel | escapeKeyword }},
204204
{% endfor %}

templates/dart/base/requests/api.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
{{ utils.map_headers(method.headers) }}
99
};
1010

11-
final res = await client.call(HttpMethod.{{ method.method | caseLower }}, path: path, params: params, headers: headers);
11+
final res = await client.call(HttpMethod.{{ method.method | caseLower }}, path: apiPath, params: params, headers: headers);
1212

1313
return {% if method.responseModel and method.responseModel != 'any' %}models.{{method.responseModel | caseUcfirst | overrideIdentifier}}.fromMap(res.data){% else %} res.data{% endif %};

templates/dart/base/requests/file.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
{% endif %}
2020
{% endfor %}
2121
final res = await client.chunkedUpload(
22-
path: path,
22+
path: apiPath,
2323
params: params,
2424
paramName: paramName,
2525
idParamName: idParamName,

templates/dart/base/requests/location.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
{% endif %}
1111
};
1212

13-
final res = await client.call(HttpMethod.{{ method.method | caseLower }}, path: path, params: params, responseType: ResponseType.bytes);
13+
final res = await client.call(HttpMethod.{{ method.method | caseLower }}, path: apiPath, params: params, responseType: ResponseType.bytes);
1414
return res.data;

templates/dart/base/requests/oauth.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
Uri url = Uri(scheme: endpoint.scheme,
2828
host: endpoint.host,
2929
port: endpoint.port,
30-
path: endpoint.path + path,
30+
path: endpoint.path + apiPath,
3131
query: query.join('&')
3232
);
3333

templates/dart/lib/services/service.dart.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class {{ service.name | caseUcfirst }} extends Service {
2020
{{ method.description | dartComment }}
2121
{% endif %}
2222
{% 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 }}({{ _self.method_parameters(method.parameters.all, method.consumes) }}) async {
23-
final String path = '{{ method.path }}'{% for parameter in method.parameters.path %}.replaceAll('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | overrideIdentifier }}){% endfor %};
23+
final String apiPath = '{{ method.path }}'{% for parameter in method.parameters.path %}.replaceAll('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | overrideIdentifier }}){% endfor %};
2424

2525
{% if 'multipart/form-data' in method.consumes %}
2626
{{ include('dart/base/requests/file.twig') }}

templates/deno/src/services/service.ts.twig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ export class {{ service.name | caseUcfirst }} extends Service {
7272

7373
{% endif %}
7474
{% endfor %}
75-
let path = '{{ method.path }}'{% for parameter in method.parameters.path %}.replace('{{ '{' }}{{ parameter.name }}{{ '}' }}', {{ parameter.name | caseCamel | escapeKeyword }}){% endfor %};
76-
let payload: Payload = {};
75+
const apiPath = '{{ method.path }}'{% for parameter in method.parameters.path %}.replace('{{ '{' }}{{ parameter.name }}{{ '}' }}', {{ parameter.name | caseCamel | escapeKeyword }}){% endfor %};
76+
const payload: Payload = {};
7777

7878
{% for parameter in method.parameters.query %}
7979
if (typeof {{ parameter.name | caseCamel | escapeKeyword }} !== 'undefined') {
@@ -110,7 +110,7 @@ export class {{ service.name | caseUcfirst }} extends Service {
110110
{% if parameter.isUploadID %}
111111
if({{ parameter.name | caseCamel | escapeKeyword }} != 'unique()') {
112112
try {
113-
response = await this.client.call('get', path + '/' + {{ parameter.name }}, headers);
113+
response = await this.client.call('get', apiPath + '/' + {{ parameter.name }}, headers);
114114
chunksUploaded = response.chunksUploaded;
115115
} catch(e) {
116116
}
@@ -151,7 +151,7 @@ export class {{ service.name | caseUcfirst }} extends Service {
151151

152152
payload['{{ parameter.name }}'] = { type: 'file', file: new File([uploadableChunkTrimmed], {{ parameter.name | caseCamel | escapeKeyword }}.filename), filename: {{ parameter.name | caseCamel | escapeKeyword }}.filename };
153153

154-
response = await this.client.call('{{ method.method | caseLower }}', path, headers, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %});
154+
response = await this.client.call('{{ method.method | caseLower }}', apiPath, headers, payload{% if method.type == 'location' %}, 'arraybuffer'{% endif %});
155155

156156
if (!id) {
157157
id = response['$id'];
@@ -193,7 +193,7 @@ export class {{ service.name | caseUcfirst }} extends Service {
193193
{% endif %}
194194
{% endfor %}
195195
{% else %}
196-
return await this.client.call('{{ method.method | caseLower }}', path, {
196+
return await this.client.call('{{ method.method | caseLower }}', apiPath, {
197197
{% for parameter in method.parameters.header %}
198198
'{{ parameter.name }}': ${{ parameter.name | caseCamel | escapeKeyword }},
199199
{% endfor %}

templates/dotnet/base/requests/api.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% import 'dotnet/base/utils.twig' as utils %}
22
return _client.Call{% if method.type != 'webAuth' %}<{{ utils.resultType(spec.title, method) }}>{% endif %}(
33
method: "{{ method.method | caseUpper }}",
4-
path: path,
4+
path: apiPath,
55
headers: headers,
66
{%~ if not method.responseModel %}
77
parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!);

templates/dotnet/base/requests/file.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{%~ endfor %}
88

99
return _client.ChunkedUpload(
10-
path,
10+
apiPath,
1111
headers,
1212
parameters,
1313
{%~ if method.responseModel %}

0 commit comments

Comments
 (0)