react-native-appwrite 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/autoclose.yml +11 -0
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/dist/cjs/sdk.js +1118 -1459
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +1118 -1459
- package/dist/esm/sdk.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +8 -5
- package/src/enums/image-format.ts +1 -0
- package/src/services/account.ts +104 -187
- package/src/services/avatars.ts +0 -14
- package/src/services/databases.ts +10 -20
- package/src/services/functions.ts +6 -12
- package/src/services/graphql.ts +4 -8
- package/src/services/locale.ts +16 -32
- package/src/services/messaging.ts +4 -8
- package/src/services/storage.ts +13 -31
- package/src/services/teams.ts +26 -52
- package/types/enums/image-format.d.ts +1 -0
- package/types/services/account.d.ts +15 -98
- package/types/services/avatars.d.ts +0 -14
- package/types/services/databases.d.ts +0 -10
- package/types/services/functions.d.ts +0 -6
- package/types/services/graphql.d.ts +0 -4
- package/types/services/locale.d.ts +0 -16
- package/types/services/messaging.d.ts +0 -4
- package/types/services/storage.d.ts +0 -16
- package/types/services/teams.d.ts +0 -26
package/src/services/avatars.ts
CHANGED
|
@@ -17,8 +17,6 @@ export class Avatars extends Service {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* Get browser icon
|
|
21
|
-
*
|
|
22
20
|
* You can use this endpoint to show different browser icons to your users.
|
|
23
21
|
* The code argument receives the browser code as it appears in your user [GET
|
|
24
22
|
* /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions)
|
|
@@ -68,8 +66,6 @@ export class Avatars extends Service {
|
|
|
68
66
|
}
|
|
69
67
|
|
|
70
68
|
/**
|
|
71
|
-
* Get credit card icon
|
|
72
|
-
*
|
|
73
69
|
* The credit card endpoint will return you the icon of the credit card
|
|
74
70
|
* provider you need. Use width, height and quality arguments to change the
|
|
75
71
|
* output settings.
|
|
@@ -118,8 +114,6 @@ export class Avatars extends Service {
|
|
|
118
114
|
}
|
|
119
115
|
|
|
120
116
|
/**
|
|
121
|
-
* Get favicon
|
|
122
|
-
*
|
|
123
117
|
* Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
|
|
124
118
|
* website URL.
|
|
125
119
|
*
|
|
@@ -152,8 +146,6 @@ export class Avatars extends Service {
|
|
|
152
146
|
}
|
|
153
147
|
|
|
154
148
|
/**
|
|
155
|
-
* Get country flag
|
|
156
|
-
*
|
|
157
149
|
* You can use this endpoint to show different country flags icons to your
|
|
158
150
|
* users. The code argument receives the 2 letter country code. Use width,
|
|
159
151
|
* height and quality arguments to change the output settings. Country codes
|
|
@@ -203,8 +195,6 @@ export class Avatars extends Service {
|
|
|
203
195
|
}
|
|
204
196
|
|
|
205
197
|
/**
|
|
206
|
-
* Get image from URL
|
|
207
|
-
*
|
|
208
198
|
* Use this endpoint to fetch a remote image URL and crop it to any image size
|
|
209
199
|
* you want. This endpoint is very useful if you need to crop and display
|
|
210
200
|
* remote images in your app or in case you want to make sure a 3rd party
|
|
@@ -254,8 +244,6 @@ export class Avatars extends Service {
|
|
|
254
244
|
}
|
|
255
245
|
|
|
256
246
|
/**
|
|
257
|
-
* Get user initials
|
|
258
|
-
*
|
|
259
247
|
* Use this endpoint to show your user initials avatar icon on your website or
|
|
260
248
|
* app. By default, this route will try to print your logged-in user name or
|
|
261
249
|
* email initials. You can also overwrite the user name if you pass the 'name'
|
|
@@ -311,8 +299,6 @@ export class Avatars extends Service {
|
|
|
311
299
|
}
|
|
312
300
|
|
|
313
301
|
/**
|
|
314
|
-
* Get QR code
|
|
315
|
-
*
|
|
316
302
|
* Converts a given plain text to a QR code image. You can use the query
|
|
317
303
|
* parameters to change the size and style of the resulting image.
|
|
318
304
|
*
|
|
@@ -14,8 +14,6 @@ export class Databases extends Service {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* List documents
|
|
18
|
-
*
|
|
19
17
|
* Get a list of all the user's documents in a given collection. You can use
|
|
20
18
|
* the query params to filter your results.
|
|
21
19
|
*
|
|
@@ -25,7 +23,7 @@ export class Databases extends Service {
|
|
|
25
23
|
* @throws {AppwriteException}
|
|
26
24
|
* @returns {Promise}
|
|
27
25
|
*/
|
|
28
|
-
|
|
26
|
+
listDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.DocumentList<Document>> {
|
|
29
27
|
if (typeof databaseId === 'undefined') {
|
|
30
28
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
31
29
|
}
|
|
@@ -42,14 +40,12 @@ export class Databases extends Service {
|
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
45
|
-
return
|
|
43
|
+
return this.client.call('get', uri, {
|
|
46
44
|
'content-type': 'application/json',
|
|
47
45
|
}, payload);
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
/**
|
|
51
|
-
* Create document
|
|
52
|
-
*
|
|
53
49
|
* Create a new Document. Before using this route, you should create a new
|
|
54
50
|
* collection resource using either a [server
|
|
55
51
|
* integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
|
|
@@ -63,7 +59,7 @@ export class Databases extends Service {
|
|
|
63
59
|
* @throws {AppwriteException}
|
|
64
60
|
* @returns {Promise}
|
|
65
61
|
*/
|
|
66
|
-
|
|
62
|
+
createDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data: object, permissions?: string[]): Promise<Document> {
|
|
67
63
|
if (typeof databaseId === 'undefined') {
|
|
68
64
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
69
65
|
}
|
|
@@ -96,14 +92,12 @@ export class Databases extends Service {
|
|
|
96
92
|
}
|
|
97
93
|
|
|
98
94
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
99
|
-
return
|
|
95
|
+
return this.client.call('post', uri, {
|
|
100
96
|
'content-type': 'application/json',
|
|
101
97
|
}, payload);
|
|
102
98
|
}
|
|
103
99
|
|
|
104
100
|
/**
|
|
105
|
-
* Get document
|
|
106
|
-
*
|
|
107
101
|
* Get a document by its unique ID. This endpoint response returns a JSON
|
|
108
102
|
* object with the document data.
|
|
109
103
|
*
|
|
@@ -114,7 +108,7 @@ export class Databases extends Service {
|
|
|
114
108
|
* @throws {AppwriteException}
|
|
115
109
|
* @returns {Promise}
|
|
116
110
|
*/
|
|
117
|
-
|
|
111
|
+
getDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise<Document> {
|
|
118
112
|
if (typeof databaseId === 'undefined') {
|
|
119
113
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
120
114
|
}
|
|
@@ -135,14 +129,12 @@ export class Databases extends Service {
|
|
|
135
129
|
}
|
|
136
130
|
|
|
137
131
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
138
|
-
return
|
|
132
|
+
return this.client.call('get', uri, {
|
|
139
133
|
'content-type': 'application/json',
|
|
140
134
|
}, payload);
|
|
141
135
|
}
|
|
142
136
|
|
|
143
137
|
/**
|
|
144
|
-
* Update document
|
|
145
|
-
*
|
|
146
138
|
* Update a document by its unique ID. Using the patch method you can pass
|
|
147
139
|
* only specific fields that will get updated.
|
|
148
140
|
*
|
|
@@ -154,7 +146,7 @@ export class Databases extends Service {
|
|
|
154
146
|
* @throws {AppwriteException}
|
|
155
147
|
* @returns {Promise}
|
|
156
148
|
*/
|
|
157
|
-
|
|
149
|
+
updateDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data?: object, permissions?: string[]): Promise<Document> {
|
|
158
150
|
if (typeof databaseId === 'undefined') {
|
|
159
151
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
160
152
|
}
|
|
@@ -179,14 +171,12 @@ export class Databases extends Service {
|
|
|
179
171
|
}
|
|
180
172
|
|
|
181
173
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
182
|
-
return
|
|
174
|
+
return this.client.call('patch', uri, {
|
|
183
175
|
'content-type': 'application/json',
|
|
184
176
|
}, payload);
|
|
185
177
|
}
|
|
186
178
|
|
|
187
179
|
/**
|
|
188
|
-
* Delete document
|
|
189
|
-
*
|
|
190
180
|
* Delete a document by its unique ID.
|
|
191
181
|
*
|
|
192
182
|
* @param {string} databaseId
|
|
@@ -195,7 +185,7 @@ export class Databases extends Service {
|
|
|
195
185
|
* @throws {AppwriteException}
|
|
196
186
|
* @returns {Promise}
|
|
197
187
|
*/
|
|
198
|
-
|
|
188
|
+
deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<{}> {
|
|
199
189
|
if (typeof databaseId === 'undefined') {
|
|
200
190
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
201
191
|
}
|
|
@@ -212,7 +202,7 @@ export class Databases extends Service {
|
|
|
212
202
|
const payload: Payload = {};
|
|
213
203
|
|
|
214
204
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
215
|
-
return
|
|
205
|
+
return this.client.call('delete', uri, {
|
|
216
206
|
'content-type': 'application/json',
|
|
217
207
|
}, payload);
|
|
218
208
|
}
|
|
@@ -15,8 +15,6 @@ export class Functions extends Service {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* List executions
|
|
19
|
-
*
|
|
20
18
|
* Get a list of all the current user function execution logs. You can use the
|
|
21
19
|
* query params to filter your results.
|
|
22
20
|
*
|
|
@@ -26,7 +24,7 @@ export class Functions extends Service {
|
|
|
26
24
|
* @throws {AppwriteException}
|
|
27
25
|
* @returns {Promise}
|
|
28
26
|
*/
|
|
29
|
-
|
|
27
|
+
listExecutions(functionId: string, queries?: string[], search?: string): Promise<Models.ExecutionList> {
|
|
30
28
|
if (typeof functionId === 'undefined') {
|
|
31
29
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
32
30
|
}
|
|
@@ -43,14 +41,12 @@ export class Functions extends Service {
|
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
46
|
-
return
|
|
44
|
+
return this.client.call('get', uri, {
|
|
47
45
|
'content-type': 'application/json',
|
|
48
46
|
}, payload);
|
|
49
47
|
}
|
|
50
48
|
|
|
51
49
|
/**
|
|
52
|
-
* Create execution
|
|
53
|
-
*
|
|
54
50
|
* Trigger a function execution. The returned object will return you the
|
|
55
51
|
* current execution status. You can ping the `Get Execution` endpoint to get
|
|
56
52
|
* updates on the current execution status. Once this endpoint is called, your
|
|
@@ -66,7 +62,7 @@ export class Functions extends Service {
|
|
|
66
62
|
* @throws {AppwriteException}
|
|
67
63
|
* @returns {Promise}
|
|
68
64
|
*/
|
|
69
|
-
|
|
65
|
+
createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string): Promise<Models.Execution> {
|
|
70
66
|
if (typeof functionId === 'undefined') {
|
|
71
67
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
72
68
|
}
|
|
@@ -99,14 +95,12 @@ export class Functions extends Service {
|
|
|
99
95
|
}
|
|
100
96
|
|
|
101
97
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
102
|
-
return
|
|
98
|
+
return this.client.call('post', uri, {
|
|
103
99
|
'content-type': 'application/json',
|
|
104
100
|
}, payload);
|
|
105
101
|
}
|
|
106
102
|
|
|
107
103
|
/**
|
|
108
|
-
* Get execution
|
|
109
|
-
*
|
|
110
104
|
* Get a function execution log by its unique ID.
|
|
111
105
|
*
|
|
112
106
|
* @param {string} functionId
|
|
@@ -114,7 +108,7 @@ export class Functions extends Service {
|
|
|
114
108
|
* @throws {AppwriteException}
|
|
115
109
|
* @returns {Promise}
|
|
116
110
|
*/
|
|
117
|
-
|
|
111
|
+
getExecution(functionId: string, executionId: string): Promise<Models.Execution> {
|
|
118
112
|
if (typeof functionId === 'undefined') {
|
|
119
113
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
120
114
|
}
|
|
@@ -127,7 +121,7 @@ export class Functions extends Service {
|
|
|
127
121
|
const payload: Payload = {};
|
|
128
122
|
|
|
129
123
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
130
|
-
return
|
|
124
|
+
return this.client.call('get', uri, {
|
|
131
125
|
'content-type': 'application/json',
|
|
132
126
|
}, payload);
|
|
133
127
|
}
|
package/src/services/graphql.ts
CHANGED
|
@@ -14,15 +14,13 @@ export class Graphql extends Service {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* GraphQL endpoint
|
|
18
|
-
*
|
|
19
17
|
* Execute a GraphQL mutation.
|
|
20
18
|
*
|
|
21
19
|
* @param {object} query
|
|
22
20
|
* @throws {AppwriteException}
|
|
23
21
|
* @returns {Promise}
|
|
24
22
|
*/
|
|
25
|
-
|
|
23
|
+
query(query: object): Promise<{}> {
|
|
26
24
|
if (typeof query === 'undefined') {
|
|
27
25
|
throw new AppwriteException('Missing required parameter: "query"');
|
|
28
26
|
}
|
|
@@ -35,22 +33,20 @@ export class Graphql extends Service {
|
|
|
35
33
|
}
|
|
36
34
|
|
|
37
35
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
38
|
-
return
|
|
36
|
+
return this.client.call('post', uri, {
|
|
39
37
|
'x-sdk-graphql': 'true',
|
|
40
38
|
'content-type': 'application/json',
|
|
41
39
|
}, payload);
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
/**
|
|
45
|
-
* GraphQL endpoint
|
|
46
|
-
*
|
|
47
43
|
* Execute a GraphQL mutation.
|
|
48
44
|
*
|
|
49
45
|
* @param {object} query
|
|
50
46
|
* @throws {AppwriteException}
|
|
51
47
|
* @returns {Promise}
|
|
52
48
|
*/
|
|
53
|
-
|
|
49
|
+
mutation(query: object): Promise<{}> {
|
|
54
50
|
if (typeof query === 'undefined') {
|
|
55
51
|
throw new AppwriteException('Missing required parameter: "query"');
|
|
56
52
|
}
|
|
@@ -63,7 +59,7 @@ export class Graphql extends Service {
|
|
|
63
59
|
}
|
|
64
60
|
|
|
65
61
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
66
|
-
return
|
|
62
|
+
return this.client.call('post', uri, {
|
|
67
63
|
'x-sdk-graphql': 'true',
|
|
68
64
|
'content-type': 'application/json',
|
|
69
65
|
}, payload);
|
package/src/services/locale.ts
CHANGED
|
@@ -14,8 +14,6 @@ export class Locale extends Service {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* Get user locale
|
|
18
|
-
*
|
|
19
17
|
* Get the current user location based on IP. Returns an object with user
|
|
20
18
|
* country code, country name, continent name, continent code, ip address and
|
|
21
19
|
* suggested currency. You can use the locale header to get the data in a
|
|
@@ -26,114 +24,102 @@ export class Locale extends Service {
|
|
|
26
24
|
* @throws {AppwriteException}
|
|
27
25
|
* @returns {Promise}
|
|
28
26
|
*/
|
|
29
|
-
|
|
27
|
+
get(): Promise<Models.Locale> {
|
|
30
28
|
const apiPath = '/locale';
|
|
31
29
|
const payload: Payload = {};
|
|
32
30
|
|
|
33
31
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
34
|
-
return
|
|
32
|
+
return this.client.call('get', uri, {
|
|
35
33
|
'content-type': 'application/json',
|
|
36
34
|
}, payload);
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
/**
|
|
40
|
-
* List locale codes
|
|
41
|
-
*
|
|
42
38
|
* List of all locale codes in [ISO
|
|
43
39
|
* 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
|
|
44
40
|
*
|
|
45
41
|
* @throws {AppwriteException}
|
|
46
42
|
* @returns {Promise}
|
|
47
43
|
*/
|
|
48
|
-
|
|
44
|
+
listCodes(): Promise<Models.LocaleCodeList> {
|
|
49
45
|
const apiPath = '/locale/codes';
|
|
50
46
|
const payload: Payload = {};
|
|
51
47
|
|
|
52
48
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
53
|
-
return
|
|
49
|
+
return this.client.call('get', uri, {
|
|
54
50
|
'content-type': 'application/json',
|
|
55
51
|
}, payload);
|
|
56
52
|
}
|
|
57
53
|
|
|
58
54
|
/**
|
|
59
|
-
* List continents
|
|
60
|
-
*
|
|
61
55
|
* List of all continents. You can use the locale header to get the data in a
|
|
62
56
|
* supported language.
|
|
63
57
|
*
|
|
64
58
|
* @throws {AppwriteException}
|
|
65
59
|
* @returns {Promise}
|
|
66
60
|
*/
|
|
67
|
-
|
|
61
|
+
listContinents(): Promise<Models.ContinentList> {
|
|
68
62
|
const apiPath = '/locale/continents';
|
|
69
63
|
const payload: Payload = {};
|
|
70
64
|
|
|
71
65
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
72
|
-
return
|
|
66
|
+
return this.client.call('get', uri, {
|
|
73
67
|
'content-type': 'application/json',
|
|
74
68
|
}, payload);
|
|
75
69
|
}
|
|
76
70
|
|
|
77
71
|
/**
|
|
78
|
-
* List countries
|
|
79
|
-
*
|
|
80
72
|
* List of all countries. You can use the locale header to get the data in a
|
|
81
73
|
* supported language.
|
|
82
74
|
*
|
|
83
75
|
* @throws {AppwriteException}
|
|
84
76
|
* @returns {Promise}
|
|
85
77
|
*/
|
|
86
|
-
|
|
78
|
+
listCountries(): Promise<Models.CountryList> {
|
|
87
79
|
const apiPath = '/locale/countries';
|
|
88
80
|
const payload: Payload = {};
|
|
89
81
|
|
|
90
82
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
91
|
-
return
|
|
83
|
+
return this.client.call('get', uri, {
|
|
92
84
|
'content-type': 'application/json',
|
|
93
85
|
}, payload);
|
|
94
86
|
}
|
|
95
87
|
|
|
96
88
|
/**
|
|
97
|
-
* List EU countries
|
|
98
|
-
*
|
|
99
89
|
* List of all countries that are currently members of the EU. You can use the
|
|
100
90
|
* locale header to get the data in a supported language.
|
|
101
91
|
*
|
|
102
92
|
* @throws {AppwriteException}
|
|
103
93
|
* @returns {Promise}
|
|
104
94
|
*/
|
|
105
|
-
|
|
95
|
+
listCountriesEU(): Promise<Models.CountryList> {
|
|
106
96
|
const apiPath = '/locale/countries/eu';
|
|
107
97
|
const payload: Payload = {};
|
|
108
98
|
|
|
109
99
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
110
|
-
return
|
|
100
|
+
return this.client.call('get', uri, {
|
|
111
101
|
'content-type': 'application/json',
|
|
112
102
|
}, payload);
|
|
113
103
|
}
|
|
114
104
|
|
|
115
105
|
/**
|
|
116
|
-
* List countries phone codes
|
|
117
|
-
*
|
|
118
106
|
* List of all countries phone codes. You can use the locale header to get the
|
|
119
107
|
* data in a supported language.
|
|
120
108
|
*
|
|
121
109
|
* @throws {AppwriteException}
|
|
122
110
|
* @returns {Promise}
|
|
123
111
|
*/
|
|
124
|
-
|
|
112
|
+
listCountriesPhones(): Promise<Models.PhoneList> {
|
|
125
113
|
const apiPath = '/locale/countries/phones';
|
|
126
114
|
const payload: Payload = {};
|
|
127
115
|
|
|
128
116
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
129
|
-
return
|
|
117
|
+
return this.client.call('get', uri, {
|
|
130
118
|
'content-type': 'application/json',
|
|
131
119
|
}, payload);
|
|
132
120
|
}
|
|
133
121
|
|
|
134
122
|
/**
|
|
135
|
-
* List currencies
|
|
136
|
-
*
|
|
137
123
|
* List of all currencies, including currency symbol, name, plural, and
|
|
138
124
|
* decimal digits for all major and minor currencies. You can use the locale
|
|
139
125
|
* header to get the data in a supported language.
|
|
@@ -141,31 +127,29 @@ export class Locale extends Service {
|
|
|
141
127
|
* @throws {AppwriteException}
|
|
142
128
|
* @returns {Promise}
|
|
143
129
|
*/
|
|
144
|
-
|
|
130
|
+
listCurrencies(): Promise<Models.CurrencyList> {
|
|
145
131
|
const apiPath = '/locale/currencies';
|
|
146
132
|
const payload: Payload = {};
|
|
147
133
|
|
|
148
134
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
149
|
-
return
|
|
135
|
+
return this.client.call('get', uri, {
|
|
150
136
|
'content-type': 'application/json',
|
|
151
137
|
}, payload);
|
|
152
138
|
}
|
|
153
139
|
|
|
154
140
|
/**
|
|
155
|
-
* List languages
|
|
156
|
-
*
|
|
157
141
|
* List of all languages classified by ISO 639-1 including 2-letter code, name
|
|
158
142
|
* in English, and name in the respective language.
|
|
159
143
|
*
|
|
160
144
|
* @throws {AppwriteException}
|
|
161
145
|
* @returns {Promise}
|
|
162
146
|
*/
|
|
163
|
-
|
|
147
|
+
listLanguages(): Promise<Models.LanguageList> {
|
|
164
148
|
const apiPath = '/locale/languages';
|
|
165
149
|
const payload: Payload = {};
|
|
166
150
|
|
|
167
151
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
168
|
-
return
|
|
152
|
+
return this.client.call('get', uri, {
|
|
169
153
|
'content-type': 'application/json',
|
|
170
154
|
}, payload);
|
|
171
155
|
}
|
|
@@ -14,8 +14,6 @@ export class Messaging extends Service {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* Create subscriber
|
|
18
|
-
*
|
|
19
17
|
* Create a new subscriber.
|
|
20
18
|
*
|
|
21
19
|
* @param {string} topicId
|
|
@@ -24,7 +22,7 @@ export class Messaging extends Service {
|
|
|
24
22
|
* @throws {AppwriteException}
|
|
25
23
|
* @returns {Promise}
|
|
26
24
|
*/
|
|
27
|
-
|
|
25
|
+
createSubscriber(topicId: string, subscriberId: string, targetId: string): Promise<Models.Subscriber> {
|
|
28
26
|
if (typeof topicId === 'undefined') {
|
|
29
27
|
throw new AppwriteException('Missing required parameter: "topicId"');
|
|
30
28
|
}
|
|
@@ -49,14 +47,12 @@ export class Messaging extends Service {
|
|
|
49
47
|
}
|
|
50
48
|
|
|
51
49
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
52
|
-
return
|
|
50
|
+
return this.client.call('post', uri, {
|
|
53
51
|
'content-type': 'application/json',
|
|
54
52
|
}, payload);
|
|
55
53
|
}
|
|
56
54
|
|
|
57
55
|
/**
|
|
58
|
-
* Delete subscriber
|
|
59
|
-
*
|
|
60
56
|
* Delete a subscriber by its unique ID.
|
|
61
57
|
*
|
|
62
58
|
* @param {string} topicId
|
|
@@ -64,7 +60,7 @@ export class Messaging extends Service {
|
|
|
64
60
|
* @throws {AppwriteException}
|
|
65
61
|
* @returns {Promise}
|
|
66
62
|
*/
|
|
67
|
-
|
|
63
|
+
deleteSubscriber(topicId: string, subscriberId: string): Promise<{}> {
|
|
68
64
|
if (typeof topicId === 'undefined') {
|
|
69
65
|
throw new AppwriteException('Missing required parameter: "topicId"');
|
|
70
66
|
}
|
|
@@ -77,7 +73,7 @@ export class Messaging extends Service {
|
|
|
77
73
|
const payload: Payload = {};
|
|
78
74
|
|
|
79
75
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
80
|
-
return
|
|
76
|
+
return this.client.call('delete', uri, {
|
|
81
77
|
'content-type': 'application/json',
|
|
82
78
|
}, payload);
|
|
83
79
|
}
|