Skip to content

Commit c078669

Browse files
fix return types for location endpoints
1 parent 6782a59 commit c078669

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

lib/client.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Client {
99
this.endpoint = 'https://appwrite.io/v1';
1010
this.headers = {
1111
'content-type': '',
12-
'x-sdk-version': 'appwrite:nodejs:2.2.4',
12+
'x-sdk-version': 'appwrite:nodejs:2.3.0',
1313
'X-Appwrite-Response-Format' : '0.8.0',
1414
};
1515
this.selfSigned = false;
@@ -125,7 +125,7 @@ class Client {
125125
if (contentType.startsWith('multipart/form-data')) {
126126
const form = new FormData();
127127

128-
let flatParams = this.flatten(params);
128+
let flatParams = Client.flatten(params);
129129

130130
for (const key in flatParams) {
131131
form.append(key, flatParams[key])
@@ -159,26 +159,25 @@ class Client {
159159
} else {
160160
throw new AppwriteException(error.response.data.message, error.response.status, error.response.data);
161161
}
162-
}else{
162+
} else {
163163
throw new AppwriteException(error.response.statusText, error.response.status, error.response.data);
164164
}
165-
}else{
165+
} else {
166166
throw new AppwriteException(error.message);
167167
}
168168
}
169169
}
170170

171-
flatten(data, prefix = '') {
171+
static flatten(data, prefix = '') {
172172
let output = {};
173173

174174
for (const key in data) {
175175
let value = data[key];
176176
let finalKey = prefix ? prefix + '[' + key +']' : key;
177177

178178
if (Array.isArray(value)) {
179-
output = Object.assign(output, this.flatten(value, finalKey)); // @todo: handle name collision here if needed
180-
}
181-
else {
179+
output = Object.assign(output, Client.flatten(value, finalKey)); // @todo: handle name collision here if needed
180+
} else {
182181
output[finalKey] = value;
183182
}
184183
}
@@ -187,4 +186,4 @@ class Client {
187186
}
188187
}
189188

190-
module.exports = Client;
189+
module.exports = Client;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "node-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": "2.2.4",
5+
"version": "2.3.0",
66
"license": "BSD-3-Clause",
77
"main": "./index.js",
88
"types": "./index.d.ts",

0 commit comments

Comments
 (0)