Skip to content

Commit 67a6414

Browse files
committed
Merge remote-tracking branch 'origin/master' into feat-qol-updates
# Conflicts: # src/SDK/Language/Dart.php # src/SDK/Language/Flutter.php # src/SDK/SDK.php # tests/Base.php
2 parents 82086d1 + ed8d3da commit 67a6414

File tree

141 files changed

+1298
-1193
lines changed

Some content is hidden

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

141 files changed

+1298
-1193
lines changed

composer.lock

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

specs/swagger2-latest-console.json

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

src/SDK/Language/Dart.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,12 @@ public function getFiles(): array
334334
[
335335
'scope' => 'default',
336336
'destination' => '/lib/role.dart',
337-
'template' => 'flutter/lib/role.dart.twig',
337+
'template' => 'dart/lib/role.dart.twig',
338338
],
339339
[
340340
'scope' => 'default',
341341
'destination' => '/lib/id.dart',
342-
'template' => 'flutter/lib/id.dart.twig',
342+
'template' => 'dart/lib/id.dart.twig',
343343
],
344344
[
345345
'scope' => 'default',
@@ -372,17 +372,20 @@ public function getFiles(): array
372372
'template' => 'dart/lib/src/service.dart.twig',
373373
],
374374
[
375-
'scope' => 'default',
376-
'destination' => '/lib/src/enums.dart',
377-
'template' => 'dart/lib/src/enums.dart.twig',
378-
'minify' => false,
379-
],
375+
'scope' => 'default',
376+
'destination' => '/lib/src/enums.dart',
377+
'template' => 'dart/lib/src/enums.dart.twig',
378+
],
380379
[
381-
'scope' => 'default',
382-
'destination' => '/lib/models.dart',
383-
'template' => 'dart/lib/models.dart.twig',
384-
'minify' => false,
385-
],
380+
'scope' => 'default',
381+
'destination' => '/lib/src/models/model.dart',
382+
'template' => 'dart/lib/src/models/model_base.dart.twig',
383+
],
384+
[
385+
'scope' => 'default',
386+
'destination' => '/lib/models.dart',
387+
'template' => 'dart/lib/models.dart.twig',
388+
],
386389
[
387390
'scope' => 'service',
388391
'destination' => '/lib/services/{{service.name | caseDash}}.dart',

src/SDK/Language/Flutter.php

Lines changed: 78 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,84 @@ public function getName(): string
2525
public function getFiles(): array
2626
{
2727
return [
28+
[
29+
'scope' => 'default',
30+
'destination' => '/lib/src/response.dart',
31+
'template' => 'dart/lib/src/response.dart.twig',
32+
'minify' => false,
33+
],
34+
[
35+
'scope' => 'default',
36+
'destination' => '/lib/src/service.dart',
37+
'template' => 'dart/lib/src/service.dart.twig',
38+
'minify' => false,
39+
],
40+
[
41+
'scope' => 'default',
42+
'destination' => '/lib/src/models/model.dart',
43+
'template' => 'dart/lib/src/models/model_base.dart.twig',
44+
'minify' => false,
45+
],
46+
[
47+
'scope' => 'default',
48+
'destination' => '/lib/src/enums.dart',
49+
'template' => 'dart/lib/src/enums.dart.twig',
50+
'minify' => false,
51+
],
52+
[
53+
'scope' => 'default',
54+
'destination' => '/lib/src/exception.dart',
55+
'template' => 'dart/lib/src/exception.dart.twig',
56+
'minify' => false,
57+
],
58+
[
59+
'scope' => 'default',
60+
'destination' => '/lib/src/upload_progress.dart',
61+
'template' => 'dart/lib/src/upload_progress.dart.twig',
62+
'minify' => false,
63+
],
64+
[
65+
'scope' => 'default',
66+
'destination' => '/lib/models.dart',
67+
'template' => 'dart/lib/models.dart.twig',
68+
'minify' => false,
69+
],
70+
[
71+
'scope' => 'default',
72+
'destination' => '/lib/permission.dart',
73+
'template' => 'dart/lib/permission.dart.twig',
74+
'minify' => false,
75+
],
76+
[
77+
'scope' => 'default',
78+
'destination' => '/lib/role.dart',
79+
'template' => 'dart/lib/role.dart.twig',
80+
'minify' => false,
81+
],
82+
[
83+
'scope' => 'default',
84+
'destination' => '/lib/id.dart',
85+
'template' => 'dart/lib/id.dart.twig',
86+
'minify' => false,
87+
],
88+
[
89+
'scope' => 'default',
90+
'destination' => '/lib/query.dart',
91+
'template' => 'dart/lib/query.dart.twig',
92+
'minify' => false,
93+
],
94+
[
95+
'scope' => 'definition',
96+
'destination' => '/lib/src/models/{{definition.name | caseSnake }}.dart',
97+
'template' => 'dart/lib/src/models/model.dart.twig',
98+
'minify' => false,
99+
],
100+
[
101+
'scope' => 'default',
102+
'destination' => 'lib/src/input_file.dart',
103+
'template' => 'dart/lib/src/input_file.dart.twig',
104+
'minify' => false,
105+
],
28106
[
29107
'scope' => 'default',
30108
'destination' => 'README.md',
@@ -140,11 +218,6 @@ public function getFiles(): array
140218
'destination' => '/lib/src/interceptor.dart',
141219
'template' => 'flutter/lib/src/interceptor.dart.twig',
142220
],
143-
[
144-
'scope' => 'default',
145-
'destination' => '/lib/src/response.dart',
146-
'template' => 'flutter/lib/src/response.dart.twig',
147-
],
148221
[
149222
'scope' => 'default',
150223
'destination' => '/lib/{{ language.params.packageName }}.dart',
@@ -175,71 +248,11 @@ public function getFiles(): array
175248
'destination' => '/pubspec.yaml',
176249
'template' => 'flutter/pubspec.yaml.twig',
177250
],
178-
[
179-
'scope' => 'default',
180-
'destination' => '/lib/src/service.dart',
181-
'template' => 'flutter/lib/src/service.dart.twig',
182-
],
183-
[
184-
'scope' => 'default',
185-
'destination' => '/lib/src/models/model.dart',
186-
'template' => 'flutter/lib/src/models/model_base.dart.twig',
187-
],
188-
[
189-
'scope' => 'default',
190-
'destination' => '/lib/src/enums.dart',
191-
'template' => 'flutter/lib/src/enums.dart.twig',
192-
],
193-
[
194-
'scope' => 'default',
195-
'destination' => '/lib/src/exception.dart',
196-
'template' => 'flutter/lib/src/exception.dart.twig',
197-
],
198-
[
199-
'scope' => 'default',
200-
'destination' => '/lib/src/upload_progress.dart',
201-
'template' => 'dart/lib/src/upload_progress.dart.twig',
202-
],
203-
[
204-
'scope' => 'default',
205-
'destination' => '/lib/models.dart',
206-
'template' => 'flutter/lib/models.dart.twig',
207-
],
208-
[
209-
'scope' => 'default',
210-
'destination' => '/lib/models.dart',
211-
'template' => 'flutter/lib/models.dart.twig',
212-
],
213-
[
214-
'scope' => 'default',
215-
'destination' => '/lib/permission.dart',
216-
'template' => 'flutter/lib/permission.dart.twig',
217-
],
218-
[
219-
'scope' => 'default',
220-
'destination' => '/lib/role.dart',
221-
'template' => 'flutter/lib/role.dart.twig',
222-
],
223-
[
224-
'scope' => 'default',
225-
'destination' => '/lib/id.dart',
226-
'template' => 'flutter/lib/id.dart.twig',
227-
],
228-
[
229-
'scope' => 'default',
230-
'destination' => '/lib/query.dart',
231-
'template' => 'flutter/lib/query.dart.twig',
232-
],
233251
[
234252
'scope' => 'service',
235253
'destination' => '/lib/services/{{service.name | caseDash}}.dart',
236254
'template' => 'flutter/lib/services/service.dart.twig',
237255
],
238-
[
239-
'scope' => 'definition',
240-
'destination' => '/lib/src/models/{{definition.name | caseSnake }}.dart',
241-
'template' => '/flutter/lib/src/models/model.dart.twig',
242-
],
243256
[
244257
'scope' => 'method',
245258
'destination' => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash}}.md',
@@ -250,11 +263,6 @@ public function getFiles(): array
250263
'destination' => '.travis.yml',
251264
'template' => 'flutter/.travis.yml.twig',
252265
],
253-
[
254-
'scope' => 'default',
255-
'destination' => 'lib/src/input_file.dart',
256-
'template' => 'flutter/lib/src/input_file.dart.twig',
257-
],
258266
];
259267
}
260268
}

src/SDK/Language/Kotlin.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,17 @@ public function getParamExample(array $param): string
226226
case self::TYPE_FILE:
227227
case self::TYPE_NUMBER:
228228
case self::TYPE_INTEGER:
229-
case self::TYPE_ARRAY:
230229
$output .= $example;
231230
break;
231+
case self::TYPE_ARRAY:
232+
if (\str_starts_with($example, '[')) {
233+
$example = \substr($example, 1);
234+
}
235+
if (\str_ends_with($example, ']')) {
236+
$example = \substr($example, 0, -1);
237+
}
238+
$output .= 'listOf(' . $example . ')';
239+
break;
232240
case self::TYPE_BOOLEAN:
233241
$output .= ($example) ? 'true' : 'false';
234242
break;

src/SDK/Language/PHP.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ public function getTypeName(array $parameter): string
223223
{
224224
switch ($parameter['type']) {
225225
case self::TYPE_STRING:
226-
return 'string';
226+
$type = 'string';
227+
break;
227228
case self::TYPE_BOOLEAN:
228229
$type = 'bool';
229230
break;

src/SDK/SDK.php

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class SDK
4949
'description' => '',
5050
'shortDescription' => '',
5151
'version' => '',
52+
'platform'=>'',
5253
'license' => '',
5354
'licenseContent' => '',
5455
'gitURL' => '',
@@ -201,23 +202,23 @@ public function setDefaultHeaders(array $headers): SDK
201202
}
202203

203204
/**
204-
* @param string $text
205+
* @param string $namespace
205206
* @return $this
206207
*/
207-
public function setNamespace(string $text): SDK
208+
public function setNamespace(string $namespace): SDK
208209
{
209-
$this->setParam('namespace', $text);
210+
$this->setParam('namespace', $namespace);
210211

211212
return $this;
212213
}
213214

214215
/**
215-
* @param string $text
216+
* @param string $name
216217
* @return $this
217218
*/
218-
public function setName(string $text): SDK
219+
public function setName(string $name): SDK
219220
{
220-
$this->setParam('name', $text);
221+
$this->setParam('name', $name);
221222

222223
return $this;
223224
}
@@ -245,23 +246,34 @@ public function setShortDescription(string $text): SDK
245246
}
246247

247248
/**
248-
* @param string $text
249+
* @param string $version
249250
* @return $this
250251
*/
251-
public function setVersion(string $text): SDK
252+
public function setVersion(string $version): SDK
252253
{
253-
$this->setParam('version', $text);
254+
$this->setParam('version', $version);
254255

255256
return $this;
256257
}
257258

258259
/**
259-
* @param string $text
260+
* @param string $platform
261+
* @return $this
262+
*/
263+
public function setPlatform(string $platform): SDK
264+
{
265+
$this->setParam('platform', $platform);
266+
267+
return $this;
268+
}
269+
270+
/**
271+
* @param string $license
260272
* @return $this
261273
*/
262-
public function setLicense(string $text): SDK
274+
public function setLicense(string $license): SDK
263275
{
264-
$this->setParam('license', $text);
276+
$this->setParam('license', $license);
265277

266278
return $this;
267279
}

templates/android/LICENSE.md.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{sdk.licenseContent}}
1+
{{sdk.licenseContent | raw}}

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import kotlin.coroutines.resume
4040

4141
class Client @JvmOverloads constructor(
4242
context: Context,
43-
var endPoint: String = "https://appwrite.io/v1",
43+
var endPoint: String = "{{spec.endpoint}}",
4444
var endPointRealtime: String? = null,
4545
private var selfSigned: Boolean = false
4646
) : CoroutineScope {
@@ -85,7 +85,10 @@ class Client @JvmOverloads constructor(
8585
"content-type" to "application/json",
8686
"origin" to "{{ spec.title | caseLower }}-android://${context.packageName}",
8787
"user-agent" to "${context.packageName}/${appVersion}, ${System.getProperty("http.agent")}",
88-
"x-sdk-version" to "{{spec.title | caseDash}}:{{ language.name | caseLower }}:${BuildConfig.SDK_VERSION}"{% if spec.global.defaultHeaders | length > 0 %},{% endif %}
88+
"x-sdk-name" to "{{ sdk.name }}",
89+
"x-sdk-platform" to "{{ sdk.platform }}",
90+
"x-sdk-language" to "{{ language.name | caseLower }}",
91+
"x-sdk-version" to "{{ sdk.version }}"{% if spec.global.defaultHeaders | length > 0 %},{% endif %}
8992

9093
{% for key,header in spec.global.defaultHeaders %}
9194
"{{ key | caseLower }}" to "{{ header }}"{% if not loop.last %},{% endif %}

0 commit comments

Comments
 (0)