Skip to content

Commit 4fa0614

Browse files
committed
Merge branch 'master' into 883-fix-enum-casings
2 parents 76dc779 + 591e07b commit 4fa0614

Some content is hidden

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

61 files changed

+5547
-1622
lines changed

.github/ISSUE_TEMPLATE/bug.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ body:
3737
label: "🎲 Appwrite version"
3838
description: "What version of Appwrite are you using?"
3939
options:
40-
- Version 0.11.x
41-
- Version 0.10.x
42-
- Version 0.9.x
43-
- Version 0.8.x
44-
- Version 0.7.x
45-
- Version 0.6.x
40+
- Appwrite Cloud
41+
- Version 1.5.x
42+
- Version 1.4.x
43+
- Version 1.3.x
44+
- Version 1.2.x
45+
- Version 1.1.x
46+
- Version 1.0.x
4647
- Different version (specify in environment)
4748
validations:
4849
required: true
@@ -59,7 +60,7 @@ body:
5960
validations:
6061
required: true
6162
- type: textarea
62-
id: enviromnemt
63+
id: environment
6364
validations:
6465
required: false
6566
attributes:

composer.lock

Lines changed: 181 additions & 111 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function getSSLPage($url) {
4242
$platform = 'console';
4343
// $platform = 'server';
4444

45-
$spec = getSSLPage("https://raw.githubusercontent.com/appwrite/appwrite/1.5.x/app/config/specs/swagger2-latest-{$platform}.json");
45+
$spec = getSSLPage("https://raw.githubusercontent.com/appwrite/appwrite/1.6.x/app/config/specs/swagger2-latest-{$platform}.json");
4646

4747
if(empty($spec)) {
4848
throw new Exception('Failed to fetch spec from Appwrite server');
@@ -186,7 +186,7 @@ function getSSLPage($url) {
186186
->setTwitter('appwrite_io')
187187
->setDiscord('564160730845151244', 'https://appwrite.io/discord')
188188
->setDefaultHeaders([
189-
'X-Appwrite-Response-Format' => '0.15.0',
189+
'X-Appwrite-Response-Format' => '1.5.0',
190190
])
191191
;
192192

@@ -393,7 +393,7 @@ function getSSLPage($url) {
393393
;
394394

395395
$sdk->generate(__DIR__ . '/examples/apple');
396-
396+
397397
// DotNet
398398
$sdk = new SDK(new DotNet(), new Swagger2($spec));
399399

@@ -442,7 +442,7 @@ function getSSLPage($url) {
442442
// Android
443443

444444
$sdk = new SDK(new Android(), new Swagger2($spec));
445-
445+
446446
$sdk
447447
->setName('Android')
448448
->setNamespace('io appwrite')
@@ -466,7 +466,7 @@ function getSSLPage($url) {
466466

467467
// Kotlin
468468
$sdk = new SDK(new Kotlin(), new Swagger2($spec));
469-
469+
470470
$sdk
471471
->setName('Kotlin')
472472
->setNamespace('io appwrite')

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: 109 additions & 2 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
*/
@@ -127,6 +185,16 @@ public function getFiles(): array
127185
'destination' => 'lib/questions.js',
128186
'template' => 'cli/lib/questions.js.twig',
129187
],
188+
[
189+
'scope' => 'default',
190+
'destination' => 'lib/validations.js',
191+
'template' => 'cli/lib/validations.js.twig',
192+
],
193+
[
194+
'scope' => 'default',
195+
'destination' => 'lib/spinner.js',
196+
'template' => 'cli/lib/spinner.js.twig',
197+
],
130198
[
131199
'scope' => 'default',
132200
'destination' => 'lib/parser.js',
@@ -152,6 +220,11 @@ public function getFiles(): array
152220
'destination' => 'lib/client.js',
153221
'template' => 'cli/lib/client.js.twig',
154222
],
223+
[
224+
'scope' => 'default',
225+
'destination' => 'lib/id.js',
226+
'template' => 'cli/lib/id.js.twig',
227+
],
155228
[
156229
'scope' => 'default',
157230
'destination' => 'lib/utils.js',
@@ -164,8 +237,28 @@ public function getFiles(): array
164237
],
165238
[
166239
'scope' => 'default',
167-
'destination' => 'lib/commands/deploy.js',
168-
'template' => 'cli/lib/commands/deploy.js.twig',
240+
'destination' => 'lib/commands/pull.js',
241+
'template' => 'cli/lib/commands/pull.js.twig',
242+
],
243+
[
244+
'scope' => 'default',
245+
'destination' => 'lib/commands/push.js',
246+
'template' => 'cli/lib/commands/push.js.twig',
247+
],
248+
[
249+
'scope' => 'default',
250+
'destination' => 'lib/commands/run.js',
251+
'template' => 'cli/lib/commands/run.js.twig',
252+
],
253+
[
254+
'scope' => 'default',
255+
'destination' => 'lib/emulation/docker.js',
256+
'template' => 'cli/lib/emulation/docker.js.twig',
257+
],
258+
[
259+
'scope' => 'default',
260+
'destination' => 'lib/emulation/utils.js',
261+
'template' => 'cli/lib/emulation/utils.js.twig',
169262
],
170263
[
171264
'scope' => 'service',
@@ -270,4 +363,18 @@ public function getParamExample(array $param): string
270363

271364
return $output;
272365
}
366+
367+
/**
368+
* Language specific filters.
369+
* @return array
370+
*/
371+
public function getFunctions(): array
372+
{
373+
return [
374+
/** Return true if the entered service->method is enabled for a console preview link */
375+
new TwigFunction('hasConsolePreview', fn($method, $service) => preg_match('/^([Gg]et|[Ll]ist)/', $method)
376+
&& !in_array(strtolower($method), $this->consoleIgnoreFunctions)
377+
&& !in_array($service, $this->consoleIgnoreServices)),
378+
];
379+
}
273380
}

0 commit comments

Comments
 (0)