Skip to content

Commit deed0fc

Browse files
committed
Merge branch 'master' into feat-cli-changes-for-sites
2 parents 2d0d4d2 + 1c11db8 commit deed0fc

File tree

36 files changed

+94
-76
lines changed

36 files changed

+94
-76
lines changed

example.php

Lines changed: 1 addition & 1 deletion
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.7.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');

mock-server/src/Utopia/Exception.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
],
7070
Exception::GENERAL_ROUTE_NOT_FOUND => [
7171
'name' => Exception::GENERAL_ROUTE_NOT_FOUND,
72-
'description' => 'The requested route was not found. Please refer to the API docs and try again.',
72+
'description' => 'Route not found. Please ensure the endpoint is configured correctly and that the API route is valid for this SDK version. Refer to the API docs for more details.',
7373
'code' => 404,
7474
],
7575
Exception::GENERAL_CURSOR_NOT_FOUND => [

src/SDK/SDK.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ public function generate(string $target): void
544544
'namespace' => $this->spec->getNamespace(),
545545
'version' => $this->spec->getVersion(),
546546
'endpoint' => $this->spec->getEndpoint(),
547+
'endpointDocs' => $this->spec->getEndpointDocs(),
547548
'host' => parse_url($this->spec->getEndpoint(), PHP_URL_HOST),
548549
'basePath' => $this->spec->getAttribute('basePath', ''),
549550
'licenseName' => $this->spec->getLicenseName(),

src/Spec/Spec.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ abstract public function getVersion();
6464
*/
6565
abstract public function getEndpoint();
6666

67+
/**
68+
* @return string
69+
*/
70+
abstract public function getEndpointDocs();
71+
6772
/**
6873
* @return string
6974
*/

src/Spec/Swagger2.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ public function getEndpoint()
4848
$this->getAttribute('basePath', '');
4949
}
5050

51+
/**
52+
* @return string
53+
*/
54+
public function getEndpointDocs()
55+
{
56+
return $this->getAttribute('schemes.0', 'https') .
57+
'://' . $this->getAttribute('x-host-docs', 'example.com') .
58+
$this->getAttribute('basePath', '');
59+
}
60+
5161
/**
5262
* @return string
5363
*/
@@ -298,6 +308,7 @@ public function getMethods($service)
298308
foreach ($method['x-appwrite']['methods'] as $additionalMethod) {
299309
$duplicatedMethod = $method;
300310
$duplicatedMethod['x-appwrite']['method'] = $additionalMethod['name'];
311+
$duplicatedMethod['x-appwrite']['auth'] = $additionalMethod['auth'] ?? [];
301312

302313
// Update Response
303314
$responses = $additionalMethod['responses'];

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {{ sdk.namespace | caseDot }}.enums.{{ name | caseUcfirst }};
2323

2424
Client client = new Client(context)
2525
{%~ if method.auth|length > 0 %}
26-
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
26+
.setEndpoint("{{ spec.endpointDocs | raw }}") // Your API Endpoint
2727
{%~ for node in method.auth %}
2828
{%~ for key,header in node|keys %}
2929
.set{{header | caseUcfirst}}("{{node[header]['x-appwrite']['demo'] | raw }}"){% if loop.last %};{% endif %} // {{ node[header].description }}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {{ sdk.namespace | caseDot }}.enums.{{ name | caseUcfirst }}
2323

2424
val client = Client(context)
2525
{%~ if method.auth|length > 0 %}
26-
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
26+
.setEndpoint("{{ spec.endpointDocs | raw }}") // Your API Endpoint
2727
{%~ for node in method.auth %}
2828
{%~ for key,header in node|keys %}
2929
.set{{header | caseUcfirst}}("{{node[header]['x-appwrite']['demo'] | raw }}") // {{node[header].description}}

templates/android/example/src/main/java/io/package/android/utils/Client.kt.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ object Client {
88

99
fun create(context: Context) {
1010
client = Client(context)
11-
.setEndpoint("http://192.168.4.24/v1")
11+
.setEndpoint("{{ spec.endpointDocs | raw }}")
1212
.setProject("65a8e2b4632c04b1f5da")
1313
.setSelfSigned(true)
1414
}

templates/android/library/src/main/java/io/package/services/Service.kt.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class {{ service.name | caseUcfirst }}(client: Client) : Service(client) {
127127
responseType = {{ method | returnType(spec, sdk.namespace | caseDot) | raw }}::class.java
128128
)
129129
{%~ else %}
130-
val apiHeaders = mutableMapOf(
130+
val apiHeaders = mutableMapOf<String, String>(
131131
{%~ for key, header in method.headers %}
132132
"{{ key }}" to "{{ header }}",
133133
{%~ endfor %}

templates/apple/Sources/Client.swift.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ open class Client {
215215

216216
return output.addingPercentEncoding(
217217
withAllowedCharacters: .urlHostAllowed
218-
) ?? ""
218+
)?.replacingOccurrences(of: "+", with: "%2B") ?? "" // since urlHostAllowed doesn't include +
219219
}
220220

221221
///

0 commit comments

Comments
 (0)