Skip to content

Commit 14950e5

Browse files
authored
Merge pull request #63 from appwrite/dev
fix: add uri searchParams to URL based methods
2 parents 0816819 + 1883cbe commit 14950e5

File tree

7 files changed

+62
-2
lines changed

7 files changed

+62
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change log
22

3+
## 0.10.1
4+
5+
* Fix URL based methods like `getFileViewURL`, `getFilePreviewURL` etc. by adding the missing `projectId` to searchParams
6+
* Add `gif` to ImageFormat enum
7+
38
## 0.10.0
49

510
* Add generate file URL methods like`getFilePreviewURL`, `getFileViewURL` etc.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "react-native-appwrite",
33
"homepage": "https://appwrite.io/support",
44
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
5-
"version": "0.10.0",
5+
"version": "0.10.1",
66
"license": "BSD-3-Clause",
77
"main": "dist/cjs/sdk.js",
88
"exports": {

src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class Client {
115115
'x-sdk-name': 'React Native',
116116
'x-sdk-platform': 'client',
117117
'x-sdk-language': 'reactnative',
118-
'x-sdk-version': '0.10.0',
118+
'x-sdk-version': '0.10.1',
119119
'X-Appwrite-Response-Format': '1.7.0',
120120
};
121121

src/enums/image-format.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ export enum ImageFormat {
55
Webp = 'webp',
66
Heic = 'heic',
77
Avif = 'avif',
8+
Gif = 'gif',
89
}

src/services/avatars.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,11 @@ export class Avatars extends Service {
387387
}
388388

389389
const uri = new URL(this.client.config.endpoint + apiPath);
390+
payload['project'] = this.client.config.project;
391+
392+
for (const [key, value] of Object.entries(Service.flatten(payload))) {
393+
uri.searchParams.append(key, value);
394+
}
390395

391396
return uri;
392397
}
@@ -426,6 +431,11 @@ export class Avatars extends Service {
426431
}
427432

428433
const uri = new URL(this.client.config.endpoint + apiPath);
434+
payload['project'] = this.client.config.project;
435+
436+
for (const [key, value] of Object.entries(Service.flatten(payload))) {
437+
uri.searchParams.append(key, value);
438+
}
429439

430440
return uri;
431441
}
@@ -449,6 +459,11 @@ export class Avatars extends Service {
449459
}
450460

451461
const uri = new URL(this.client.config.endpoint + apiPath);
462+
payload['project'] = this.client.config.project;
463+
464+
for (const [key, value] of Object.entries(Service.flatten(payload))) {
465+
uri.searchParams.append(key, value);
466+
}
452467

453468
return uri;
454469
}
@@ -489,6 +504,11 @@ export class Avatars extends Service {
489504
}
490505

491506
const uri = new URL(this.client.config.endpoint + apiPath);
507+
payload['project'] = this.client.config.project;
508+
509+
for (const [key, value] of Object.entries(Service.flatten(payload))) {
510+
uri.searchParams.append(key, value);
511+
}
492512

493513
return uri;
494514
}
@@ -529,6 +549,11 @@ export class Avatars extends Service {
529549
}
530550

531551
const uri = new URL(this.client.config.endpoint + apiPath);
552+
payload['project'] = this.client.config.project;
553+
554+
for (const [key, value] of Object.entries(Service.flatten(payload))) {
555+
uri.searchParams.append(key, value);
556+
}
532557

533558
return uri;
534559
}
@@ -579,6 +604,11 @@ export class Avatars extends Service {
579604
}
580605

581606
const uri = new URL(this.client.config.endpoint + apiPath);
607+
payload['project'] = this.client.config.project;
608+
609+
for (const [key, value] of Object.entries(Service.flatten(payload))) {
610+
uri.searchParams.append(key, value);
611+
}
582612

583613
return uri;
584614
}
@@ -616,6 +646,11 @@ export class Avatars extends Service {
616646
}
617647

618648
const uri = new URL(this.client.config.endpoint + apiPath);
649+
payload['project'] = this.client.config.project;
650+
651+
for (const [key, value] of Object.entries(Service.flatten(payload))) {
652+
uri.searchParams.append(key, value);
653+
}
619654

620655
return uri;
621656
}

src/services/databases.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ export class Databases extends Service {
133133
}
134134

135135
/**
136+
* **WARNING: Experimental Feature** - This endpoint is experimental and not
137+
* yet officially supported. It may be subject to breaking changes or removal
138+
* in future versions.
139+
*
136140
* Create or update a Document. Before using this route, you should create a
137141
* new collection resource using either a [server
138142
* integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)

src/services/storage.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,11 @@ export class Storage extends Service {
442442
}
443443

444444
const uri = new URL(this.client.config.endpoint + apiPath);
445+
payload['project'] = this.client.config.project;
446+
447+
for (const [key, value] of Object.entries(Service.flatten(payload))) {
448+
uri.searchParams.append(key, value);
449+
}
445450

446451
return uri;
447452
}
@@ -523,6 +528,11 @@ export class Storage extends Service {
523528
}
524529

525530
const uri = new URL(this.client.config.endpoint + apiPath);
531+
payload['project'] = this.client.config.project;
532+
533+
for (const [key, value] of Object.entries(Service.flatten(payload))) {
534+
uri.searchParams.append(key, value);
535+
}
526536

527537
return uri;
528538
}
@@ -547,6 +557,11 @@ export class Storage extends Service {
547557
}
548558

549559
const uri = new URL(this.client.config.endpoint + apiPath);
560+
payload['project'] = this.client.config.project;
561+
562+
for (const [key, value] of Object.entries(Service.flatten(payload))) {
563+
uri.searchParams.append(key, value);
564+
}
550565

551566
return uri;
552567
}

0 commit comments

Comments
 (0)