Skip to content

Commit 767964c

Browse files
committed
Merge branch 'master' into feat-improve-file-upload-node
2 parents 23bdd04 + dfe67ab commit 767964c

Some content is hidden

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

62 files changed

+1497
-850
lines changed

composer.lock

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

specs/swagger-appwrite-0.12.0.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

specs/swagger-appwrite.0.12.0.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

specs/swagger2-latest-console.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/SDK/Language.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,13 @@ public function getParams()
7474
{
7575
return $this->params;
7676
}
77+
78+
/**
79+
* Language specific filters.
80+
* @return array
81+
*/
82+
public function getFilters(): array
83+
{
84+
return [];
85+
}
7786
}

src/SDK/Language/Dart.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Appwrite\SDK\Language;
44

55
use Appwrite\SDK\Language;
6+
use Twig\TwigFilter;
67

78
class Dart extends Language {
89

@@ -420,18 +421,19 @@ public function getFiles()
420421
'template' => 'dart/lib/src/input_file.dart.twig',
421422
'minify' => false,
422423
],
423-
[
424-
'scope' => 'default',
425-
'destination' => 'lib/src/chunked_upload_io.dart',
426-
'template' => 'dart/lib/src/chunked_upload_io.dart.twig',
427-
'minify' => false,
428-
],
429-
[
430-
'scope' => 'default',
431-
'destination' => 'lib/src/chunked_upload_stub.dart',
432-
'template' => 'dart/lib/src/chunked_upload_stub.dart.twig',
433-
'minify' => false,
434-
],
424+
];
425+
}
426+
427+
public function getFilters(): array
428+
{
429+
return [
430+
new TwigFilter('dartComment', function ($value) {
431+
$value = explode("\n", $value);
432+
foreach ($value as $key => $line) {
433+
$value[$key] = " /// " . wordwrap($value[$key], 75, "\n /// ");
434+
}
435+
return implode("\n", $value);
436+
}, ['is_safe' => ['html']]),
435437
];
436438
}
437439
}

src/SDK/Language/DotNet.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Appwrite\SDK\Language;
44

55
use Appwrite\SDK\Language;
6+
use Twig\TwigFilter;
67

78
class DotNet extends Language {
89

@@ -376,5 +377,18 @@ public function getFiles()
376377
]
377378
];
378379
}
380+
381+
public function getFilters(): array
382+
{
383+
return [
384+
new TwigFilter('dotnetComment', function ($value) {
385+
$value = explode("\n", $value);
386+
foreach ($value as $key => $line) {
387+
$value[$key] = " /// " . wordwrap($value[$key], 75, "\n /// ");
388+
}
389+
return implode("\n", $value);
390+
}, ['is_safe' => ['html']])
391+
];
392+
}
379393
}
380394

src/SDK/Language/Flutter.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -277,18 +277,6 @@ public function getFiles()
277277
'template' => 'flutter/lib/src/input_file.dart.twig',
278278
'minify' => false,
279279
],
280-
[
281-
'scope' => 'default',
282-
'destination' => 'lib/src/chunked_upload_io.dart',
283-
'template' => 'flutter/lib/src/chunked_upload_io.dart.twig',
284-
'minify' => false,
285-
],
286-
[
287-
'scope' => 'default',
288-
'destination' => 'lib/src/chunked_upload_stub.dart',
289-
'template' => 'flutter/lib/src/chunked_upload_stub.dart.twig',
290-
'minify' => false,
291-
],
292280
];
293281
}
294282
}

src/SDK/Language/Go.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Appwrite\SDK\Language;
44

55
use Appwrite\SDK\Language;
6+
use Twig\TwigFilter;
67

78
class Go extends Language {
89

@@ -246,4 +247,17 @@ public function getParamExample(array $param)
246247

247248
return $output;
248249
}
250+
251+
public function getFilters(): array
252+
{
253+
return [
254+
new TwigFilter('godocComment', function ($value) {
255+
$value = explode("\n", $value);
256+
foreach ($value as $key => $line) {
257+
$value[$key] = "// " . wordwrap($value[$key], 75, "\n// ");
258+
}
259+
return implode("\n", $value);
260+
}, ['is_safe' => ['html']])
261+
];
262+
}
249263
}

src/SDK/Language/PHP.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Appwrite\SDK\Language;
44

55
use Appwrite\SDK\Language;
6+
use Twig\TwigFilter;
67

78
class PHP extends Language {
89

@@ -183,6 +184,12 @@ public function getFiles()
183184
'template' => 'php/src/Query.php.twig',
184185
'minify' => false,
185186
],
187+
[
188+
'scope' => 'default',
189+
'destination' => 'src/{{ spec.title | caseUcfirst}}/InputFile.php',
190+
'template' => 'php/src/InputFile.php.twig',
191+
'minify' => false,
192+
],
186193
[
187194
'scope' => 'default',
188195
'destination' => 'src/{{ spec.title | caseUcfirst}}/{{ spec.title | caseUcfirst}}Exception.php',
@@ -222,7 +229,7 @@ public function getTypeName($type)
222229
$type = 'array';
223230
break;
224231
case self::TYPE_FILE:
225-
$type = 'string';
232+
$type = 'InputFile';
226233
break;
227234
}
228235

@@ -356,4 +363,21 @@ protected function jsonToAssoc(array $data):string
356363

357364
return $output;
358365
}
366+
367+
protected function getReturn(array $method): string
368+
{
369+
if(($method['emptyResponse'] ?? true) || $method['type'] === 'location') {
370+
return 'string';
371+
}
372+
373+
return 'array';
374+
}
375+
376+
public function getFilters(): array {
377+
return [
378+
new TwigFilter('getReturn', function($value) {
379+
return $this->getReturn($value);
380+
})
381+
];
382+
}
359383
}

0 commit comments

Comments
 (0)