Skip to content

fix: add uri searchParams to URL based methods #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change log

## 0.10.1

* Fix URL based methods like `getFileViewURL`, `getFilePreviewURL` etc. by adding the missing `projectId` to searchParams
* Add `gif` to ImageFormat enum

## 0.10.0

* Add generate file URL methods like`getFilePreviewURL`, `getFileViewURL` etc.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "react-native-appwrite",
"homepage": "https://appwrite.io/support",
"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",
"version": "0.10.0",
"version": "0.10.1",
"license": "BSD-3-Clause",
"main": "dist/cjs/sdk.js",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class Client {
'x-sdk-name': 'React Native',
'x-sdk-platform': 'client',
'x-sdk-language': 'reactnative',
'x-sdk-version': '0.10.0',
'x-sdk-version': '0.10.1',
'X-Appwrite-Response-Format': '1.7.0',
};

Expand Down
1 change: 1 addition & 0 deletions src/enums/image-format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export enum ImageFormat {
Webp = 'webp',
Heic = 'heic',
Avif = 'avif',
Gif = 'gif',
}
35 changes: 35 additions & 0 deletions src/services/avatars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,11 @@ export class Avatars extends Service {
}

const uri = new URL(this.client.config.endpoint + apiPath);
payload['project'] = this.client.config.project;

for (const [key, value] of Object.entries(Service.flatten(payload))) {
uri.searchParams.append(key, value);
}

return uri;
}
Expand Down Expand Up @@ -426,6 +431,11 @@ export class Avatars extends Service {
}

const uri = new URL(this.client.config.endpoint + apiPath);
payload['project'] = this.client.config.project;

for (const [key, value] of Object.entries(Service.flatten(payload))) {
uri.searchParams.append(key, value);
}

return uri;
}
Expand All @@ -449,6 +459,11 @@ export class Avatars extends Service {
}

const uri = new URL(this.client.config.endpoint + apiPath);
payload['project'] = this.client.config.project;

for (const [key, value] of Object.entries(Service.flatten(payload))) {
uri.searchParams.append(key, value);
}

return uri;
}
Expand Down Expand Up @@ -489,6 +504,11 @@ export class Avatars extends Service {
}

const uri = new URL(this.client.config.endpoint + apiPath);
payload['project'] = this.client.config.project;

for (const [key, value] of Object.entries(Service.flatten(payload))) {
uri.searchParams.append(key, value);
}

return uri;
}
Expand Down Expand Up @@ -529,6 +549,11 @@ export class Avatars extends Service {
}

const uri = new URL(this.client.config.endpoint + apiPath);
payload['project'] = this.client.config.project;

for (const [key, value] of Object.entries(Service.flatten(payload))) {
uri.searchParams.append(key, value);
}

return uri;
}
Expand Down Expand Up @@ -579,6 +604,11 @@ export class Avatars extends Service {
}

const uri = new URL(this.client.config.endpoint + apiPath);
payload['project'] = this.client.config.project;

for (const [key, value] of Object.entries(Service.flatten(payload))) {
uri.searchParams.append(key, value);
}

return uri;
}
Expand Down Expand Up @@ -616,6 +646,11 @@ export class Avatars extends Service {
}

const uri = new URL(this.client.config.endpoint + apiPath);
payload['project'] = this.client.config.project;

for (const [key, value] of Object.entries(Service.flatten(payload))) {
uri.searchParams.append(key, value);
}

return uri;
}
Expand Down
4 changes: 4 additions & 0 deletions src/services/databases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ export class Databases extends Service {
}

/**
* **WARNING: Experimental Feature** - This endpoint is experimental and not
* yet officially supported. It may be subject to breaking changes or removal
* in future versions.
*
* Create or update a Document. Before using this route, you should create a
* new collection resource using either a [server
* integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
Expand Down
15 changes: 15 additions & 0 deletions src/services/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,11 @@ export class Storage extends Service {
}

const uri = new URL(this.client.config.endpoint + apiPath);
payload['project'] = this.client.config.project;

for (const [key, value] of Object.entries(Service.flatten(payload))) {
uri.searchParams.append(key, value);
}

return uri;
}
Expand Down Expand Up @@ -523,6 +528,11 @@ export class Storage extends Service {
}

const uri = new URL(this.client.config.endpoint + apiPath);
payload['project'] = this.client.config.project;

for (const [key, value] of Object.entries(Service.flatten(payload))) {
uri.searchParams.append(key, value);
}

return uri;
}
Expand All @@ -547,6 +557,11 @@ export class Storage extends Service {
}

const uri = new URL(this.client.config.endpoint + apiPath);
payload['project'] = this.client.config.project;

for (const [key, value] of Object.entries(Service.flatten(payload))) {
uri.searchParams.append(key, value);
}

return uri;
}
Expand Down