Skip to content

Commit 7583db3

Browse files
committed
Merge remote-tracking branch 'origin/feat-multiple-accounts-and-instances' into feat-cli-local-development
2 parents 93ea80a + 3621c3c commit 7583db3

File tree

72 files changed

+2514
-978
lines changed

Some content is hidden

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

72 files changed

+2514
-978
lines changed

.github/workflows/tests.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,40 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
php-version: ['8.2']
16-
sdk: [Android5Java17, Android14Java17, CLINode16, CLINode18, DartBeta, DartStable, Deno1193, Deno1303, DotNet60, DotNet70, FlutterStable, FlutterBeta, Go112, Go118, KotlinJava8, KotlinJava11, KotlinJava17, Node16, Node18, Node20, PHP74, PHP80, Python38, Python39, Python310, Ruby27, Ruby30, Ruby31, AppleSwift56, Swift56, WebChromium, WebNode]
16+
sdk: [
17+
Android5Java17,
18+
Android14Java17,
19+
CLINode16,
20+
CLINode18,
21+
DartBeta,
22+
DartStable,
23+
Deno1193,
24+
Deno1303,
25+
DotNet60,
26+
DotNet80,
27+
FlutterStable,
28+
FlutterBeta,
29+
Go112,
30+
Go118,
31+
KotlinJava8,
32+
KotlinJava11,
33+
KotlinJava17,
34+
Node16,
35+
Node18,
36+
Node20,
37+
PHP74,
38+
PHP80,
39+
Python38,
40+
Python39,
41+
Python310,
42+
Ruby27,
43+
Ruby30,
44+
Ruby31,
45+
AppleSwift56,
46+
Swift56,
47+
WebChromium,
48+
WebNode
49+
]
1750

1851
steps:
1952
- name: Checkout repository

mock-server/docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3'
2-
31
services:
42
mockapi:
53
container_name: mockapi

src/SDK/Language.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ public function getFilters(): array
8484
return [];
8585
}
8686

87+
/**
88+
* Language specific functions.
89+
* @return array
90+
*/
91+
public function getFunctions(): array
92+
{
93+
return [];
94+
}
95+
8796
protected function toPascalCase(string $value): string
8897
{
8998
return \ucfirst($this->toCamelCase($value));

src/SDK/Language/CLI.php

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,66 @@
22

33
namespace Appwrite\SDK\Language;
44

5+
use Twig\TwigFunction;
6+
57
class CLI extends Node
68
{
9+
/**
10+
* List of functions to ignore for console preview.
11+
* @var array
12+
*/
13+
private $consoleIgnoreFunctions = [
14+
'listidentities',
15+
'listmfafactors',
16+
'getprefs',
17+
'getsession',
18+
'getattribute',
19+
'listdocumentlogs',
20+
'getindex',
21+
'listcollectionlogs',
22+
'getcollectionusage',
23+
'listlogs',
24+
'listruntimes',
25+
'getusage',
26+
'getusage',
27+
'listvariables',
28+
'getvariable',
29+
'listproviderlogs',
30+
'listsubscriberlogs',
31+
'getsubscriber',
32+
'listtopiclogs',
33+
'getemailtemplate',
34+
'getsmstemplate',
35+
'getfiledownload',
36+
'getfilepreview',
37+
'getfileview',
38+
'getusage',
39+
'listlogs',
40+
'getprefs',
41+
'getusage',
42+
'listlogs',
43+
'getmembership',
44+
'listmemberships',
45+
'listmfafactors',
46+
'getmfarecoverycodes',
47+
'getprefs',
48+
'listtargets',
49+
'gettarget',
50+
];
51+
52+
/**
53+
* List of SDK services to ignore for console preview.
54+
* @var array
55+
*/
56+
private $consoleIgnoreServices = [
57+
'health',
58+
'migrations',
59+
'locale',
60+
'avatars',
61+
'project',
62+
'proxy',
63+
'vcs'
64+
];
765
/**
866
* @var array
967
*/
@@ -172,6 +230,11 @@ public function getFiles(): array
172230
'destination' => 'lib/utils.js',
173231
'template' => 'cli/lib/utils.js.twig',
174232
],
233+
[
234+
'scope' => 'default',
235+
'destination' => 'lib/commands/init.js',
236+
'template' => 'cli/lib/commands/init.js.twig',
237+
],
175238
[
176239
'scope' => 'default',
177240
'destination' => 'lib/commands/pull.js',
@@ -290,4 +353,18 @@ public function getParamExample(array $param): string
290353

291354
return $output;
292355
}
356+
357+
/**
358+
* Language specific filters.
359+
* @return array
360+
*/
361+
public function getFunctions(): array
362+
{
363+
return [
364+
/** Return true if the entered service->method is enabled for a console preview link */
365+
new TwigFunction('methodHaveConsolePreview', fn($method, $service) => preg_match('/^([Gg]et|[Ll]ist)/', $method)
366+
&& !in_array(strtolower($method), $this->consoleIgnoreFunctions)
367+
&& !in_array($service, $this->consoleIgnoreServices)),
368+
];
369+
}
293370
}

src/SDK/Language/Dart.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,13 @@ public function getFiles(): array
475475
],
476476
[
477477
'scope' => 'default',
478-
'destination' => '.travis.yml',
479-
'template' => 'dart/.travis.yml.twig',
478+
'destination' => '.github/workflows/publish.yml',
479+
'template' => 'dart/.github/workflows/publish.yml.twig',
480+
],
481+
[
482+
'scope' => 'default',
483+
'destination' => '.github/workflows/format.yml',
484+
'template' => 'dart/.github/workflows/format.yml.twig',
480485
],
481486
[
482487
'scope' => 'default',

src/SDK/Language/DotNet.php

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ public function getFiles(): array
303303
return [
304304
[
305305
'scope' => 'default',
306-
'destination' => '.travis.yml',
307-
'template' => 'dotnet/.travis.yml.twig',
306+
'destination' => '.github/workflows/publish.yml',
307+
'template' => 'dotnet/.github/workflows/publish.yml.twig',
308308
],
309309
[
310310
'scope' => 'default',
@@ -333,93 +333,93 @@ public function getFiles(): array
333333
],
334334
[
335335
'scope' => 'default',
336-
'destination' => '/src/{{ spec.title | caseUcfirst }}.sln',
337-
'template' => 'dotnet/src/Appwrite.sln',
336+
'destination' => '{{ spec.title | caseUcfirst }}.sln',
337+
'template' => 'dotnet/Package.sln',
338338
],
339339
[
340340
'scope' => 'default',
341-
'destination' => '/src/{{ spec.title | caseUcfirst }}/{{ spec.title | caseUcfirst }}.csproj',
342-
'template' => 'dotnet/src/Appwrite/Appwrite.csproj.twig',
341+
'destination' => '{{ spec.title | caseUcfirst }}/{{ spec.title | caseUcfirst }}.csproj',
342+
'template' => 'dotnet/Package/Package.csproj.twig',
343343
],
344344
[
345345
'scope' => 'default',
346-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Client.cs',
347-
'template' => 'dotnet/src/Appwrite/Client.cs.twig',
346+
'destination' => '{{ spec.title | caseUcfirst }}/Client.cs',
347+
'template' => 'dotnet/Package/Client.cs.twig',
348348
],
349349
[
350350
'scope' => 'default',
351-
'destination' => '/src/{{ spec.title | caseUcfirst }}/{{ spec.title | caseUcfirst }}Exception.cs',
352-
'template' => 'dotnet/src/Appwrite/Exception.cs.twig',
351+
'destination' => '{{ spec.title | caseUcfirst }}/{{ spec.title | caseUcfirst }}Exception.cs',
352+
'template' => 'dotnet/Package/Exception.cs.twig',
353353
],
354354
[
355355
'scope' => 'default',
356-
'destination' => '/src/{{ spec.title | caseUcfirst }}/ID.cs',
357-
'template' => 'dotnet/src/Appwrite/ID.cs.twig',
356+
'destination' => '{{ spec.title | caseUcfirst }}/ID.cs',
357+
'template' => 'dotnet/Package/ID.cs.twig',
358358
],
359359
[
360360
'scope' => 'default',
361-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Permission.cs',
362-
'template' => 'dotnet/src/Appwrite/Permission.cs.twig',
361+
'destination' => '{{ spec.title | caseUcfirst }}/Permission.cs',
362+
'template' => 'dotnet/Package/Permission.cs.twig',
363363
],
364364
[
365365
'scope' => 'default',
366-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Query.cs',
367-
'template' => 'dotnet/src/Appwrite/Query.cs.twig',
366+
'destination' => '{{ spec.title | caseUcfirst }}/Query.cs',
367+
'template' => 'dotnet/Package/Query.cs.twig',
368368
],
369369
[
370370
'scope' => 'default',
371-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Role.cs',
372-
'template' => 'dotnet/src/Appwrite/Role.cs.twig',
371+
'destination' => '{{ spec.title | caseUcfirst }}/Role.cs',
372+
'template' => 'dotnet/Package/Role.cs.twig',
373373
],
374374
[
375375
'scope' => 'default',
376-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Converters/ValueClassConverter.cs',
377-
'template' => 'dotnet/src/Appwrite/Converters/ValueClassConverter.cs.twig',
376+
'destination' => '{{ spec.title | caseUcfirst }}/Converters/ValueClassConverter.cs',
377+
'template' => 'dotnet/Package/Converters/ValueClassConverter.cs.twig',
378378
],
379379
[
380380
'scope' => 'default',
381-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Extensions/Extensions.cs',
382-
'template' => 'dotnet/src/Appwrite/Extensions/Extensions.cs.twig',
381+
'destination' => '{{ spec.title | caseUcfirst }}/Extensions/Extensions.cs',
382+
'template' => 'dotnet/Package/Extensions/Extensions.cs.twig',
383383
],
384384
[
385385
'scope' => 'default',
386-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Models/OrderType.cs',
387-
'template' => 'dotnet/src/Appwrite/Models/OrderType.cs.twig',
386+
'destination' => '{{ spec.title | caseUcfirst }}/Models/OrderType.cs',
387+
'template' => 'dotnet/Package/Models/OrderType.cs.twig',
388388
],
389389
[
390390
'scope' => 'default',
391-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Models/UploadProgress.cs',
392-
'template' => 'dotnet/src/Appwrite/Models/UploadProgress.cs.twig',
391+
'destination' => '{{ spec.title | caseUcfirst }}/Models/UploadProgress.cs',
392+
'template' => 'dotnet/Package/Models/UploadProgress.cs.twig',
393393
],
394394
[
395395
'scope' => 'default',
396-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Models/InputFile.cs',
397-
'template' => 'dotnet/src/Appwrite/Models/InputFile.cs.twig',
396+
'destination' => '{{ spec.title | caseUcfirst }}/Models/InputFile.cs',
397+
'template' => 'dotnet/Package/Models/InputFile.cs.twig',
398398
],
399399
[
400400
'scope' => 'default',
401-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Services/Service.cs',
402-
'template' => 'dotnet/src/Appwrite/Services/Service.cs.twig',
401+
'destination' => '{{ spec.title | caseUcfirst }}/Services/Service.cs',
402+
'template' => 'dotnet/Package/Services/Service.cs.twig',
403403
],
404404
[
405405
'scope' => 'service',
406-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Services/{{service.name | caseUcfirst}}.cs',
407-
'template' => 'dotnet/src/Appwrite/Services/ServiceTemplate.cs.twig',
406+
'destination' => '{{ spec.title | caseUcfirst }}/Services/{{service.name | caseUcfirst}}.cs',
407+
'template' => 'dotnet/Package/Services/ServiceTemplate.cs.twig',
408408
],
409409
[
410410
'scope' => 'definition',
411-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Models/{{ definition.name | caseUcfirst | overrideIdentifier }}.cs',
412-
'template' => 'dotnet/src/Appwrite/Models/Model.cs.twig',
411+
'destination' => '{{ spec.title | caseUcfirst }}/Models/{{ definition.name | caseUcfirst | overrideIdentifier }}.cs',
412+
'template' => 'dotnet/Package/Models/Model.cs.twig',
413413
],
414414
[
415415
'scope' => 'enum',
416-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Enums/{{ enum.name | caseUcfirst | overrideIdentifier }}.cs',
417-
'template' => 'dotnet/src/Appwrite/Enums/Enum.cs.twig',
416+
'destination' => '{{ spec.title | caseUcfirst }}/Enums/{{ enum.name | caseUcfirst | overrideIdentifier }}.cs',
417+
'template' => 'dotnet/Package/Enums/Enum.cs.twig',
418418
],
419419
[
420420
'scope' => 'default',
421-
'destination' => '/src/{{ spec.title | caseUcfirst }}/Enums/IEnum.cs',
422-
'template' => 'dotnet/src/Appwrite/Enums/IEnum.cs.twig',
421+
'destination' => '{{ spec.title | caseUcfirst }}/Enums/IEnum.cs',
422+
'template' => 'dotnet/Package/Enums/IEnum.cs.twig',
423423
]
424424
];
425425
}

src/SDK/Language/Flutter.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,13 @@ public function getFiles(): array
332332
],
333333
[
334334
'scope' => 'default',
335-
'destination' => '.travis.yml',
336-
'template' => 'flutter/.travis.yml.twig',
335+
'destination' => '.github/workflows/publish.yml',
336+
'template' => 'flutter/.github/workflows/publish.yml.twig',
337+
],
338+
[
339+
'scope' => 'default',
340+
'destination' => '.github/workflows/format.yml',
341+
'template' => 'flutter/.github/workflows/format.yml.twig',
337342
],
338343
[
339344
'scope' => 'enum',

src/SDK/Language/Node.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ public function getFiles(): array
234234
],
235235
[
236236
'scope' => 'default',
237-
'destination' => '.travis.yml',
238-
'template' => 'node/.travis.yml.twig',
237+
'destination' => '.github/workflows/publish.yml',
238+
'template' => 'node/.github/workflows/publish.yml.twig',
239239
],
240240
[
241241
'scope' => 'enum',

src/SDK/Language/Python.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ public function getFiles(): array
202202
],
203203
[
204204
'scope' => 'default',
205-
'destination' => '.travis.yml',
206-
'template' => 'python/.travis.yml.twig',
205+
'destination' => '.github/workflows/publish.yml',
206+
'template' => 'python/.github/workflows/publish.yml.twig',
207207
],
208208
[
209209
'scope' => 'enum',

src/SDK/Language/Ruby.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ public function getFiles(): array
174174
],
175175
[
176176
'scope' => 'default',
177-
'destination' => '.travis.yml',
178-
'template' => 'ruby/.travis.yml.twig',
177+
'destination' => '.github/workflows/publish.yml',
178+
'template' => 'ruby/.github/workflows/publish.yml.twig',
179179
],
180180
[
181181
'scope' => 'definition',

0 commit comments

Comments
 (0)