@appwrite.io/console 0.0.1 → 0.0.2-preview-0.0

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.
@@ -0,0 +1,183 @@
1
+ import { Service } from '../service';
2
+ import { Client } from '../client';
3
+ import type { Models } from '../models';
4
+ export declare class Teams extends Service {
5
+ constructor(client: Client);
6
+ /**
7
+ * List Teams
8
+ *
9
+ * Get a list of all the teams in which the current user is a member. You can
10
+ * use the parameters to filter your results.
11
+ *
12
+ * @param {string[]} queries
13
+ * @param {string} search
14
+ * @throws {AppwriteException}
15
+ * @returns {Promise}
16
+ */
17
+ list(queries?: string[], search?: string): Promise<Models.TeamList>;
18
+ /**
19
+ * Create Team
20
+ *
21
+ * Create a new team. The user who creates the team will automatically be
22
+ * assigned as the owner of the team. Only the users with the owner role can
23
+ * invite new members, add new owners and delete or update the team.
24
+ *
25
+ * @param {string} teamId
26
+ * @param {string} name
27
+ * @param {string[]} roles
28
+ * @throws {AppwriteException}
29
+ * @returns {Promise}
30
+ */
31
+ create(teamId: string, name: string, roles?: string[]): Promise<Models.Team>;
32
+ /**
33
+ * Get Team
34
+ *
35
+ * Get a team by its ID. All team members have read access for this resource.
36
+ *
37
+ * @param {string} teamId
38
+ * @throws {AppwriteException}
39
+ * @returns {Promise}
40
+ */
41
+ get(teamId: string): Promise<Models.Team>;
42
+ /**
43
+ * Update Team
44
+ *
45
+ * Update a team using its ID. Only members with the owner role can update the
46
+ * team.
47
+ *
48
+ * @param {string} teamId
49
+ * @param {string} name
50
+ * @throws {AppwriteException}
51
+ * @returns {Promise}
52
+ */
53
+ update(teamId: string, name: string): Promise<Models.Team>;
54
+ /**
55
+ * Delete Team
56
+ *
57
+ * Delete a team using its ID. Only team members with the owner role can
58
+ * delete the team.
59
+ *
60
+ * @param {string} teamId
61
+ * @throws {AppwriteException}
62
+ * @returns {Promise}
63
+ */
64
+ delete(teamId: string): Promise<{}>;
65
+ /**
66
+ * List Team Logs
67
+ *
68
+ * Get the team activity logs list by its unique ID.
69
+ *
70
+ * @param {string} teamId
71
+ * @param {string[]} queries
72
+ * @throws {AppwriteException}
73
+ * @returns {Promise}
74
+ */
75
+ listLogs(teamId: string, queries?: string[]): Promise<Models.LogList>;
76
+ /**
77
+ * List Team Memberships
78
+ *
79
+ * Use this endpoint to list a team's members using the team's ID. All team
80
+ * members have read access to this endpoint.
81
+ *
82
+ * @param {string} teamId
83
+ * @param {string[]} queries
84
+ * @param {string} search
85
+ * @throws {AppwriteException}
86
+ * @returns {Promise}
87
+ */
88
+ listMemberships(teamId: string, queries?: string[], search?: string): Promise<Models.MembershipList>;
89
+ /**
90
+ * Create Team Membership
91
+ *
92
+ * Invite a new member to join your team. Provide an ID for existing users, or
93
+ * invite unregistered users using an email or phone number. If initiated from
94
+ * a Client SDK, Appwrite will send an email or sms with a link to join the
95
+ * team to the invited user, and an account will be created for them if one
96
+ * doesn't exist. If initiated from a Server SDK, the new member will be added
97
+ * automatically to the team.
98
+ *
99
+ * You only need to provide one of a user ID, email, or phone number. Appwrite
100
+ * will prioritize accepting the user ID > email > phone number if you provide
101
+ * more than one of these parameters.
102
+ *
103
+ * Use the `url` parameter to redirect the user from the invitation email to
104
+ * your app. After the user is redirected, use the [Update Team Membership
105
+ * Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow
106
+ * the user to accept the invitation to the team.
107
+ *
108
+ * Please note that to avoid a [Redirect
109
+ * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
110
+ * Appwrite will accept the only redirect URLs under the domains you have
111
+ * added as a platform on the Appwrite Console.
112
+ *
113
+ *
114
+ * @param {string} teamId
115
+ * @param {string[]} roles
116
+ * @param {string} url
117
+ * @param {string} email
118
+ * @param {string} userId
119
+ * @param {string} phone
120
+ * @param {string} name
121
+ * @throws {AppwriteException}
122
+ * @returns {Promise}
123
+ */
124
+ createMembership(teamId: string, roles: string[], url: string, email?: string, userId?: string, phone?: string, name?: string): Promise<Models.Membership>;
125
+ /**
126
+ * Get Team Membership
127
+ *
128
+ * Get a team member by the membership unique id. All team members have read
129
+ * access for this resource.
130
+ *
131
+ * @param {string} teamId
132
+ * @param {string} membershipId
133
+ * @throws {AppwriteException}
134
+ * @returns {Promise}
135
+ */
136
+ getMembership(teamId: string, membershipId: string): Promise<Models.Membership>;
137
+ /**
138
+ * Update Membership Roles
139
+ *
140
+ * Modify the roles of a team member. Only team members with the owner role
141
+ * have access to this endpoint. Learn more about [roles and
142
+ * permissions](/docs/permissions).
143
+ *
144
+ * @param {string} teamId
145
+ * @param {string} membershipId
146
+ * @param {string[]} roles
147
+ * @throws {AppwriteException}
148
+ * @returns {Promise}
149
+ */
150
+ updateMembershipRoles(teamId: string, membershipId: string, roles: string[]): Promise<Models.Membership>;
151
+ /**
152
+ * Delete Team Membership
153
+ *
154
+ * This endpoint allows a user to leave a team or for a team owner to delete
155
+ * the membership of any other team member. You can also use this endpoint to
156
+ * delete a user membership even if it is not accepted.
157
+ *
158
+ * @param {string} teamId
159
+ * @param {string} membershipId
160
+ * @throws {AppwriteException}
161
+ * @returns {Promise}
162
+ */
163
+ deleteMembership(teamId: string, membershipId: string): Promise<{}>;
164
+ /**
165
+ * Update Team Membership Status
166
+ *
167
+ * Use this endpoint to allow a user to accept an invitation to join a team
168
+ * after being redirected back to your app from the invitation email received
169
+ * by the user.
170
+ *
171
+ * If the request is successful, a session for the user is automatically
172
+ * created.
173
+ *
174
+ *
175
+ * @param {string} teamId
176
+ * @param {string} membershipId
177
+ * @param {string} userId
178
+ * @param {string} secret
179
+ * @throws {AppwriteException}
180
+ * @returns {Promise}
181
+ */
182
+ updateMembershipStatus(teamId: string, membershipId: string, userId: string, secret: string): Promise<Models.Membership>;
183
+ }
@@ -0,0 +1,340 @@
1
+ import { Service } from '../service';
2
+ import { Client } from '../client';
3
+ import type { Models } from '../models';
4
+ export declare class Users extends Service {
5
+ constructor(client: Client);
6
+ /**
7
+ * List Users
8
+ *
9
+ * Get a list of all the project's users. You can use the query params to
10
+ * filter your results.
11
+ *
12
+ * @param {string[]} queries
13
+ * @param {string} search
14
+ * @throws {AppwriteException}
15
+ * @returns {Promise}
16
+ */
17
+ list<Preferences extends Models.Preferences>(queries?: string[], search?: string): Promise<Models.UserList<Preferences>>;
18
+ /**
19
+ * Create User
20
+ *
21
+ * Create a new user.
22
+ *
23
+ * @param {string} userId
24
+ * @param {string} email
25
+ * @param {string} phone
26
+ * @param {string} password
27
+ * @param {string} name
28
+ * @throws {AppwriteException}
29
+ * @returns {Promise}
30
+ */
31
+ create<Preferences extends Models.Preferences>(userId: string, email?: string, phone?: string, password?: string, name?: string): Promise<Models.User<Preferences>>;
32
+ /**
33
+ * Create User with Argon2 Password
34
+ *
35
+ * Create a new user. Password provided must be hashed with the
36
+ * [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST
37
+ * /users](/docs/server/users#usersCreate) endpoint to create users with a
38
+ * plain text password.
39
+ *
40
+ * @param {string} userId
41
+ * @param {string} email
42
+ * @param {string} password
43
+ * @param {string} name
44
+ * @throws {AppwriteException}
45
+ * @returns {Promise}
46
+ */
47
+ createArgon2User<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>;
48
+ /**
49
+ * Create User with Bcrypt Password
50
+ *
51
+ * Create a new user. Password provided must be hashed with the
52
+ * [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST
53
+ * /users](/docs/server/users#usersCreate) endpoint to create users with a
54
+ * plain text password.
55
+ *
56
+ * @param {string} userId
57
+ * @param {string} email
58
+ * @param {string} password
59
+ * @param {string} name
60
+ * @throws {AppwriteException}
61
+ * @returns {Promise}
62
+ */
63
+ createBcryptUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>;
64
+ /**
65
+ * Create User with MD5 Password
66
+ *
67
+ * Create a new user. Password provided must be hashed with the
68
+ * [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST
69
+ * /users](/docs/server/users#usersCreate) endpoint to create users with a
70
+ * plain text password.
71
+ *
72
+ * @param {string} userId
73
+ * @param {string} email
74
+ * @param {string} password
75
+ * @param {string} name
76
+ * @throws {AppwriteException}
77
+ * @returns {Promise}
78
+ */
79
+ createMD5User<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>;
80
+ /**
81
+ * Create User with PHPass Password
82
+ *
83
+ * Create a new user. Password provided must be hashed with the
84
+ * [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST
85
+ * /users](/docs/server/users#usersCreate) endpoint to create users with a
86
+ * plain text password.
87
+ *
88
+ * @param {string} userId
89
+ * @param {string} email
90
+ * @param {string} password
91
+ * @param {string} name
92
+ * @throws {AppwriteException}
93
+ * @returns {Promise}
94
+ */
95
+ createPHPassUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>;
96
+ /**
97
+ * Create User with Scrypt Password
98
+ *
99
+ * Create a new user. Password provided must be hashed with the
100
+ * [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST
101
+ * /users](/docs/server/users#usersCreate) endpoint to create users with a
102
+ * plain text password.
103
+ *
104
+ * @param {string} userId
105
+ * @param {string} email
106
+ * @param {string} password
107
+ * @param {string} passwordSalt
108
+ * @param {number} passwordCpu
109
+ * @param {number} passwordMemory
110
+ * @param {number} passwordParallel
111
+ * @param {number} passwordLength
112
+ * @param {string} name
113
+ * @throws {AppwriteException}
114
+ * @returns {Promise}
115
+ */
116
+ createScryptUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string): Promise<Models.User<Preferences>>;
117
+ /**
118
+ * Create User with Scrypt Modified Password
119
+ *
120
+ * Create a new user. Password provided must be hashed with the [Scrypt
121
+ * Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc)
122
+ * algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint
123
+ * to create users with a plain text password.
124
+ *
125
+ * @param {string} userId
126
+ * @param {string} email
127
+ * @param {string} password
128
+ * @param {string} passwordSalt
129
+ * @param {string} passwordSaltSeparator
130
+ * @param {string} passwordSignerKey
131
+ * @param {string} name
132
+ * @throws {AppwriteException}
133
+ * @returns {Promise}
134
+ */
135
+ createScryptModifiedUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string): Promise<Models.User<Preferences>>;
136
+ /**
137
+ * Create User with SHA Password
138
+ *
139
+ * Create a new user. Password provided must be hashed with the
140
+ * [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use
141
+ * the [POST /users](/docs/server/users#usersCreate) endpoint to create users
142
+ * with a plain text password.
143
+ *
144
+ * @param {string} userId
145
+ * @param {string} email
146
+ * @param {string} password
147
+ * @param {string} passwordVersion
148
+ * @param {string} name
149
+ * @throws {AppwriteException}
150
+ * @returns {Promise}
151
+ */
152
+ createSHAUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, passwordVersion?: string, name?: string): Promise<Models.User<Preferences>>;
153
+ /**
154
+ * Get usage stats for the users API
155
+ *
156
+ *
157
+ * @param {string} range
158
+ * @param {string} provider
159
+ * @throws {AppwriteException}
160
+ * @returns {Promise}
161
+ */
162
+ getUsage(range?: string, provider?: string): Promise<Models.UsageUsers>;
163
+ /**
164
+ * Get User
165
+ *
166
+ * Get a user by its unique ID.
167
+ *
168
+ * @param {string} userId
169
+ * @throws {AppwriteException}
170
+ * @returns {Promise}
171
+ */
172
+ get<Preferences extends Models.Preferences>(userId: string): Promise<Models.User<Preferences>>;
173
+ /**
174
+ * Delete User
175
+ *
176
+ * Delete a user by its unique ID, thereby releasing it's ID. Since ID is
177
+ * released and can be reused, all user-related resources like documents or
178
+ * storage files should be deleted before user deletion. If you want to keep
179
+ * ID reserved, use the [updateStatus](/docs/server/users#usersUpdateStatus)
180
+ * endpoint instead.
181
+ *
182
+ * @param {string} userId
183
+ * @throws {AppwriteException}
184
+ * @returns {Promise}
185
+ */
186
+ delete(userId: string): Promise<{}>;
187
+ /**
188
+ * Update Email
189
+ *
190
+ * Update the user email by its unique ID.
191
+ *
192
+ * @param {string} userId
193
+ * @param {string} email
194
+ * @throws {AppwriteException}
195
+ * @returns {Promise}
196
+ */
197
+ updateEmail<Preferences extends Models.Preferences>(userId: string, email: string): Promise<Models.User<Preferences>>;
198
+ /**
199
+ * List User Logs
200
+ *
201
+ * Get the user activity logs list by its unique ID.
202
+ *
203
+ * @param {string} userId
204
+ * @param {string[]} queries
205
+ * @throws {AppwriteException}
206
+ * @returns {Promise}
207
+ */
208
+ listLogs(userId: string, queries?: string[]): Promise<Models.LogList>;
209
+ /**
210
+ * List User Memberships
211
+ *
212
+ * Get the user membership list by its unique ID.
213
+ *
214
+ * @param {string} userId
215
+ * @throws {AppwriteException}
216
+ * @returns {Promise}
217
+ */
218
+ listMemberships(userId: string): Promise<Models.MembershipList>;
219
+ /**
220
+ * Update Name
221
+ *
222
+ * Update the user name by its unique ID.
223
+ *
224
+ * @param {string} userId
225
+ * @param {string} name
226
+ * @throws {AppwriteException}
227
+ * @returns {Promise}
228
+ */
229
+ updateName<Preferences extends Models.Preferences>(userId: string, name: string): Promise<Models.User<Preferences>>;
230
+ /**
231
+ * Update Password
232
+ *
233
+ * Update the user password by its unique ID.
234
+ *
235
+ * @param {string} userId
236
+ * @param {string} password
237
+ * @throws {AppwriteException}
238
+ * @returns {Promise}
239
+ */
240
+ updatePassword<Preferences extends Models.Preferences>(userId: string, password: string): Promise<Models.User<Preferences>>;
241
+ /**
242
+ * Update Phone
243
+ *
244
+ * Update the user phone by its unique ID.
245
+ *
246
+ * @param {string} userId
247
+ * @param {string} number
248
+ * @throws {AppwriteException}
249
+ * @returns {Promise}
250
+ */
251
+ updatePhone<Preferences extends Models.Preferences>(userId: string, number: string): Promise<Models.User<Preferences>>;
252
+ /**
253
+ * Get User Preferences
254
+ *
255
+ * Get the user preferences by its unique ID.
256
+ *
257
+ * @param {string} userId
258
+ * @throws {AppwriteException}
259
+ * @returns {Promise}
260
+ */
261
+ getPrefs<Preferences extends Models.Preferences>(userId: string): Promise<Preferences>;
262
+ /**
263
+ * Update User Preferences
264
+ *
265
+ * Update the user preferences by its unique ID. The object you pass is stored
266
+ * as is, and replaces any previous value. The maximum allowed prefs size is
267
+ * 64kB and throws error if exceeded.
268
+ *
269
+ * @param {string} userId
270
+ * @param {object} prefs
271
+ * @throws {AppwriteException}
272
+ * @returns {Promise}
273
+ */
274
+ updatePrefs<Preferences extends Models.Preferences>(userId: string, prefs: object): Promise<Preferences>;
275
+ /**
276
+ * List User Sessions
277
+ *
278
+ * Get the user sessions list by its unique ID.
279
+ *
280
+ * @param {string} userId
281
+ * @throws {AppwriteException}
282
+ * @returns {Promise}
283
+ */
284
+ listSessions(userId: string): Promise<Models.SessionList>;
285
+ /**
286
+ * Delete User Sessions
287
+ *
288
+ * Delete all user's sessions by using the user's unique ID.
289
+ *
290
+ * @param {string} userId
291
+ * @throws {AppwriteException}
292
+ * @returns {Promise}
293
+ */
294
+ deleteSessions(userId: string): Promise<{}>;
295
+ /**
296
+ * Delete User Session
297
+ *
298
+ * Delete a user sessions by its unique ID.
299
+ *
300
+ * @param {string} userId
301
+ * @param {string} sessionId
302
+ * @throws {AppwriteException}
303
+ * @returns {Promise}
304
+ */
305
+ deleteSession(userId: string, sessionId: string): Promise<{}>;
306
+ /**
307
+ * Update User Status
308
+ *
309
+ * Update the user status by its unique ID. Use this endpoint as an
310
+ * alternative to deleting a user if you want to keep user's ID reserved.
311
+ *
312
+ * @param {string} userId
313
+ * @param {boolean} status
314
+ * @throws {AppwriteException}
315
+ * @returns {Promise}
316
+ */
317
+ updateStatus<Preferences extends Models.Preferences>(userId: string, status: boolean): Promise<Models.User<Preferences>>;
318
+ /**
319
+ * Update Email Verification
320
+ *
321
+ * Update the user email verification status by its unique ID.
322
+ *
323
+ * @param {string} userId
324
+ * @param {boolean} emailVerification
325
+ * @throws {AppwriteException}
326
+ * @returns {Promise}
327
+ */
328
+ updateEmailVerification<Preferences extends Models.Preferences>(userId: string, emailVerification: boolean): Promise<Models.User<Preferences>>;
329
+ /**
330
+ * Update Phone Verification
331
+ *
332
+ * Update the user phone verification status by its unique ID.
333
+ *
334
+ * @param {string} userId
335
+ * @param {boolean} phoneVerification
336
+ * @throws {AppwriteException}
337
+ * @returns {Promise}
338
+ */
339
+ updatePhoneVerification<Preferences extends Models.Preferences>(userId: string, phoneVerification: boolean): Promise<Models.User<Preferences>>;
340
+ }