Skip to content

Commit 64e6376

Browse files
Merge branch '1.4.x' into fix-chunked-upload
2 parents 0add3b6 + ccddb97 commit 64e6376

File tree

148 files changed

+4728
-1354
lines changed

Some content is hidden

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

148 files changed

+4728
-1354
lines changed

.travis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ env:
2929
- SDK=DartStable
3030
- SDK=Deno1193
3131
- SDK=Deno1303
32+
- SDK=DotNet60
33+
- SDK=DotNet70
3234
- SDK=FlutterStable
3335
- SDK=FlutterBeta
3436
- SDK=Go112

composer.lock

+73-87
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/SDK/Language/CLI.php

+6
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ public function getFiles(): array
7171
'destination' => 'package.json',
7272
'template' => 'cli/package.json.twig',
7373
],
74+
[
75+
'scope' => 'default',
76+
'destination' => 'scoop/appwrite.json',
77+
'template' => 'cli/scoop/appwrite.json.twig',
78+
'minify' => false,
79+
],
7480
[
7581
'scope' => 'default',
7682
'destination' => 'LICENSE.md',

src/SDK/Language/Dart.php

+55
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,61 @@ public function getFiles(): array
401401
'destination' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}.md',
402402
'template' => 'dart/docs/example.md.twig',
403403
],
404+
[
405+
'scope' => 'service',
406+
'destination' => '/test/services/{{service.name | caseDash}}_test.dart',
407+
'template' => 'dart/test/services/service_test.dart.twig',
408+
],
409+
[
410+
'scope' => 'definition',
411+
'destination' => '/test/src/models/{{definition.name | caseSnake }}_test.dart',
412+
'template' => 'dart/test/src/models/model_test.dart.twig',
413+
],
414+
[
415+
'scope' => 'default',
416+
'destination' => '/test/id_test.dart',
417+
'template' => 'dart/test/id_test.dart.twig',
418+
],
419+
[
420+
'scope' => 'default',
421+
'destination' => '/test/permission_test.dart',
422+
'template' => 'dart/test/permission_test.dart.twig',
423+
],
424+
[
425+
'scope' => 'default',
426+
'destination' => '/test/query_test.dart',
427+
'template' => 'dart/test/query_test.dart.twig',
428+
],
429+
[
430+
'scope' => 'default',
431+
'destination' => '/test/role_test.dart',
432+
'template' => 'dart/test/role_test.dart.twig',
433+
],
434+
[
435+
'scope' => 'default',
436+
'destination' => '/test/src/enums_test.dart',
437+
'template' => 'dart/test/src/enums_test.dart.twig',
438+
],
439+
[
440+
'scope' => 'default',
441+
'destination' => '/test/src/upload_progress_test.dart',
442+
'template' => 'dart/test/src/upload_progress_test.dart.twig',
443+
],
444+
[
445+
'scope' => 'default',
446+
'destination' => '/test/src/exception_test.dart',
447+
'template' => 'dart/test/src/exception_test.dart.twig',
448+
],
449+
[
450+
'scope' => 'default',
451+
'destination' => '/test/src/input_file_test.dart',
452+
'template' => 'dart/test/src/input_file_test.dart.twig',
453+
],
454+
[
455+
'scope' => 'default',
456+
'destination' => '/test/src/response_test.dart',
457+
'template' => 'dart/test/src/response_test.dart.twig',
458+
],
404459
[
405460
'scope' => 'default',
406461
'destination' => '.travis.yml',

src/SDK/Language/DotNet.php

+66-27
Original file line numberDiff line numberDiff line change
@@ -139,23 +139,26 @@ public function getKeywords(): array
139139
public function getIdentifierOverrides(): array
140140
{
141141
return [
142-
'Jwt' => 'JWT'
142+
'Jwt' => 'JWT',
143+
'Domain' => 'XDomain',
143144
];
144145
}
145146

146147
/**
147-
* @param $type
148+
* @param array $parameter
148149
* @return string
149150
*/
150151
public function getTypeName(array $parameter): string
151152
{
152153
switch ($parameter['type']) {
153154
case self::TYPE_INTEGER:
154-
return 'int';
155+
return 'long';
156+
case self::TYPE_NUMBER:
157+
return 'double';
155158
case self::TYPE_STRING:
156159
return 'string';
157160
case self::TYPE_FILE:
158-
return 'FileInfo';
161+
return 'InputFile';
159162
case self::TYPE_BOOLEAN:
160163
return 'bool';
161164
case self::TYPE_ARRAY:
@@ -233,7 +236,7 @@ public function getParamExample(array $param): string
233236
if (empty($example) && $example !== 0 && $example !== false) {
234237
switch ($type) {
235238
case self::TYPE_FILE:
236-
$output .= 'new File("./path-to-files/image.jpg")';
239+
$output .= 'InputFile.FromPath("./path-to-files/image.jpg")';
237240
break;
238241
case self::TYPE_NUMBER:
239242
case self::TYPE_INTEGER:
@@ -249,7 +252,13 @@ public function getParamExample(array $param): string
249252
$output .= '[object]';
250253
break;
251254
case self::TYPE_ARRAY:
252-
$output .= '[List<object>]';
255+
if (\str_starts_with($example, '[')) {
256+
$example = \substr($example, 1);
257+
}
258+
if (\str_ends_with($example, ']')) {
259+
$example = \substr($example, 0, -1);
260+
}
261+
$output .= 'new List<' . $this->getTypeName($param['array']) . '> {' . $example . '}';
253262
break;
254263
}
255264
} else {
@@ -283,23 +292,28 @@ public function getFiles(): array
283292
return [
284293
[
285294
'scope' => 'default',
286-
'destination' => 'README.md',
287-
'template' => 'dotnet/README.md.twig',
295+
'destination' => '.travis.yml',
296+
'template' => 'dotnet/.travis.yml.twig',
288297
],
289298
[
290299
'scope' => 'default',
291300
'destination' => 'CHANGELOG.md',
292301
'template' => 'dotnet/CHANGELOG.md.twig',
293302
],
303+
[
304+
'scope' => 'copy',
305+
'destination' => '/icon.png',
306+
'template' => 'dotnet/icon.png',
307+
],
294308
[
295309
'scope' => 'default',
296310
'destination' => 'LICENSE',
297311
'template' => 'dotnet/LICENSE.twig',
298312
],
299313
[
300314
'scope' => 'default',
301-
'destination' => '.travis.yml',
302-
'template' => 'dotnet/.travis.yml.twig',
315+
'destination' => 'README.md',
316+
'template' => 'dotnet/README.md.twig',
303317
],
304318
[
305319
'scope' => 'method',
@@ -308,53 +322,78 @@ public function getFiles(): array
308322
],
309323
[
310324
'scope' => 'default',
311-
'destination' => '/src/Appwrite.sln',
325+
'destination' => '/src/{{ spec.title | caseUcfirst }}.sln',
312326
'template' => 'dotnet/src/Appwrite.sln',
313327
],
314-
[
315-
'scope' => 'copy',
316-
'destination' => '/icon.png',
317-
'template' => 'dotnet/icon.png',
318-
],
319328
[
320329
'scope' => 'default',
321-
'destination' => '/src/Appwrite/Appwrite.csproj',
330+
'destination' => '/src/{{ spec.title | caseUcfirst }}/{{ spec.title | caseUcfirst }}.csproj',
322331
'template' => 'dotnet/src/Appwrite/Appwrite.csproj.twig',
323332
],
324333
[
325334
'scope' => 'default',
326-
'destination' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/Client.cs',
335+
'destination' => '/src/{{ spec.title | caseUcfirst }}/Client.cs',
327336
'template' => 'dotnet/src/Appwrite/Client.cs.twig',
328337
],
329338
[
330339
'scope' => 'default',
331-
'destination' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/Helpers/ExtensionMethods.cs',
332-
'template' => 'dotnet/src/Appwrite/Helpers/ExtensionMethods.cs',
340+
'destination' => '/src/{{ spec.title | caseUcfirst }}/{{ spec.title | caseUcfirst }}Exception.cs',
341+
'template' => 'dotnet/src/Appwrite/Exception.cs.twig',
333342
],
334343
[
335344
'scope' => 'default',
336-
'destination' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/Models/OrderType.cs',
345+
'destination' => '/src/{{ spec.title | caseUcfirst }}/ID.cs',
346+
'template' => 'dotnet/src/Appwrite/ID.cs.twig',
347+
],
348+
[
349+
'scope' => 'default',
350+
'destination' => '/src/{{ spec.title | caseUcfirst }}/Permission.cs',
351+
'template' => 'dotnet/src/Appwrite/Permission.cs.twig',
352+
],
353+
[
354+
'scope' => 'default',
355+
'destination' => '/src/{{ spec.title | caseUcfirst }}/Query.cs',
356+
'template' => 'dotnet/src/Appwrite/Query.cs.twig',
357+
],
358+
[
359+
'scope' => 'default',
360+
'destination' => '/src/{{ spec.title | caseUcfirst }}/Role.cs',
361+
'template' => 'dotnet/src/Appwrite/Role.cs.twig',
362+
],
363+
[
364+
'scope' => 'default',
365+
'destination' => '/src/{{ spec.title | caseUcfirst }}/Extensions/Extensions.cs',
366+
'template' => 'dotnet/src/Appwrite/Extensions/Extensions.cs.twig',
367+
],
368+
[
369+
'scope' => 'default',
370+
'destination' => '/src/{{ spec.title | caseUcfirst }}/Models/OrderType.cs',
337371
'template' => 'dotnet/src/Appwrite/Models/OrderType.cs.twig',
338372
],
339373
[
340374
'scope' => 'default',
341-
'destination' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/Models/Rule.cs',
342-
'template' => 'dotnet/src/Appwrite/Models/Rule.cs.twig',
375+
'destination' => '/src/{{ spec.title | caseUcfirst }}/Models/UploadProgress.cs',
376+
'template' => 'dotnet/src/Appwrite/Models/UploadProgress.cs.twig',
343377
],
344378
[
345379
'scope' => 'default',
346-
'destination' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/Models/Exception.cs',
347-
'template' => 'dotnet/src/Appwrite/Models/Exception.cs.twig',
380+
'destination' => '/src/{{ spec.title | caseUcfirst }}/Models/InputFile.cs',
381+
'template' => 'dotnet/src/Appwrite/Models/InputFile.cs.twig',
348382
],
349383
[
350384
'scope' => 'default',
351-
'destination' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/Services/Service.cs',
385+
'destination' => '/src/{{ spec.title | caseUcfirst }}/Services/Service.cs',
352386
'template' => 'dotnet/src/Appwrite/Services/Service.cs.twig',
353387
],
354388
[
355389
'scope' => 'service',
356-
'destination' => '/{{ sdk.namespace | caseSlash }}/src/Appwrite/Services/{{service.name | caseUcfirst}}.cs',
390+
'destination' => '/src/{{ spec.title | caseUcfirst }}/Services/{{service.name | caseUcfirst}}.cs',
357391
'template' => 'dotnet/src/Appwrite/Services/ServiceTemplate.cs.twig',
392+
],
393+
[
394+
'scope' => 'definition',
395+
'destination' => '/src/{{ spec.title | caseUcfirst }}/Models/{{ definition.name | caseUcfirst | overrideIdentifier }}.cs',
396+
'template' => 'dotnet/src/Appwrite/Models/Model.cs.twig',
358397
]
359398
];
360399
}

src/SDK/Language/Flutter.php

+80
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,86 @@ public function getFiles(): array
240240
'destination' => '/lib/services/{{service.name | caseDash}}.dart',
241241
'template' => 'flutter/lib/services/service.dart.twig',
242242
],
243+
[
244+
'scope' => 'service',
245+
'destination' => '/test/services/{{service.name | caseDash}}_test.dart',
246+
'template' => 'dart/test/services/service_test.dart.twig',
247+
],
248+
[
249+
'scope' => 'definition',
250+
'destination' => '/test/src/models/{{definition.name | caseSnake }}_test.dart',
251+
'template' => 'dart/test/src/models/model_test.dart.twig',
252+
],
253+
[
254+
'scope' => 'default',
255+
'destination' => '/test/id_test.dart',
256+
'template' => 'dart/test/id_test.dart.twig',
257+
],
258+
[
259+
'scope' => 'default',
260+
'destination' => '/test/permission_test.dart',
261+
'template' => 'dart/test/permission_test.dart.twig',
262+
],
263+
[
264+
'scope' => 'default',
265+
'destination' => '/test/query_test.dart',
266+
'template' => 'dart/test/query_test.dart.twig',
267+
],
268+
[
269+
'scope' => 'default',
270+
'destination' => '/test/role_test.dart',
271+
'template' => 'dart/test/role_test.dart.twig',
272+
],
273+
[
274+
'scope' => 'default',
275+
'destination' => '/test/src/cookie_manager_test.dart',
276+
'template' => 'flutter/test/src/cookie_manager_test.dart.twig',
277+
],
278+
[
279+
'scope' => 'default',
280+
'destination' => '/test/src/interceptor_test.dart',
281+
'template' => 'flutter/test/src/interceptor_test.dart.twig',
282+
],
283+
[
284+
'scope' => 'default',
285+
'destination' => '/test/src/realtime_response_test.dart',
286+
'template' => 'flutter/test/src/realtime_response_test.dart.twig',
287+
],
288+
[
289+
'scope' => 'default',
290+
'destination' => '/test/src/realtime_response_connected_test.dart',
291+
'template' => 'flutter/test/src/realtime_response_connected_test.dart.twig',
292+
],
293+
[
294+
'scope' => 'default',
295+
'destination' => '/test/src/realtime_subscription_test.dart',
296+
'template' => 'flutter/test/src/realtime_subscription_test.dart.twig',
297+
],
298+
[
299+
'scope' => 'default',
300+
'destination' => '/test/src/enums_test.dart',
301+
'template' => 'dart/test/src/enums_test.dart.twig',
302+
],
303+
[
304+
'scope' => 'default',
305+
'destination' => '/test/src/upload_progress_test.dart',
306+
'template' => 'dart/test/src/upload_progress_test.dart.twig',
307+
],
308+
[
309+
'scope' => 'default',
310+
'destination' => '/test/src/input_file_test.dart',
311+
'template' => 'dart/test/src/input_file_test.dart.twig',
312+
],
313+
[
314+
'scope' => 'default',
315+
'destination' => '/test/src/exception_test.dart',
316+
'template' => 'dart/test/src/exception_test.dart.twig',
317+
],
318+
[
319+
'scope' => 'default',
320+
'destination' => '/test/src/response_test.dart',
321+
'template' => 'dart/test/src/response_test.dart.twig',
322+
],
243323
[
244324
'scope' => 'method',
245325
'destination' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}.md',

src/SDK/Language/PHP.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,10 @@ public function getFilters(): array
384384
return [
385385
new TwigFilter('getReturn', function ($value) {
386386
return $this->getReturn($value);
387-
})
387+
}),
388+
new TwigFilter('deviceInfo', function ($value) {
389+
return php_uname('s') . '; ' . php_uname('v') . '; ' . php_uname('m');
390+
}),
388391
];
389392
}
390393
}

src/Spec/Swagger2.php

+3
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ public function getMethods($service)
207207
'class' => $parameter['x-class'] ?? null,
208208
'description' => $parameter['description'] ?? '',
209209
'required' => $parameter['required'] ?? false,
210+
'nullable' => $parameter['x-nullable'] ?? false,
210211
'default' => $parameter['default'] ?? null,
211212
'example' => $parameter['x-example'] ?? null,
212213
'isUploadID' => $parameter['x-upload-id'] ?? false,
@@ -245,6 +246,7 @@ public function getMethods($service)
245246
$param['required'] = (in_array($key, $bodyRequired));
246247
$param['example'] = $value['x-example'] ?? null;
247248
$param['isUploadID'] = $value['x-upload-id'] ?? false;
249+
$param['nullable'] = $value['x-nullable'] ?? false;
248250
$param['array'] = [
249251
'type' => $value['items']['type'] ?? '',
250252
];
@@ -317,6 +319,7 @@ public function getDefinitions()
317319
foreach ($sch['properties'] as $name => $def) {
318320
$sch['properties'][$name]['name'] = $name;
319321
$sch['properties'][$name]['description'] = $def['description'];
322+
$sch['properties'][$name]['example'] = $def['x-example'];
320323
$sch['properties'][$name]['required'] = in_array($name, $sch['required']);
321324
if (isset($def['items']['$ref'])) {
322325
//nested model

templates/android/docs/java/example.md.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {{ sdk.namespace | caseDot }}.services.{{ service.name | caseUcfirst }};
77

88
Client client = new Client(context)
99
{% if method.auth|length > 0 %}
10-
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
10+
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
1111
{% for node in method.auth %}
1212
{% for key,header in node|keys %}
1313
.set{{header | caseUcfirst}}("{{node[header]['x-appwrite']['demo']}}"){% if loop.last %};{% endif %} // {{node[header].description}}

0 commit comments

Comments
 (0)