Hello {user.name}!
25 |34 |
38 |
42 | 43 |
68 |
let
| No | string
| -- | -- |
41 | | project | let
| No | string
| -- | -- |
42 | | locale | let
| No | string
| "en"
| -- |
43 |
44 | ### Slots
45 |
46 | | Slot name | Default | Props | Fallback |
47 | | :-------- | :------ | :---- | :------- |
48 | | -- | Yes | -- | -- |
49 |
50 | ### Events
51 |
52 | None.
53 |
54 | ## `AuthEmail`
55 |
56 | ### Props
57 |
58 | None.
59 |
60 | ### Slots
61 |
62 | | Slot name | Default | Props | Fallback |
63 | | :-------- | :------ | :--------------------------------------------------------------------------------- | :------- |
64 | | -- | Yes | { authorize: (email: string, password: string) => Promise
| -- |
65 | | error | No | { error: object }
| -- |
66 | | loading | No | -- | -- |
67 | | success | No | { user: any }
| -- |
68 |
69 | ### Events
70 |
71 | | Event name | Type | Detail |
72 | | :--------- | :--------- | :----- |
73 | | success | dispatched | -- |
74 | | failure | dispatched | -- |
75 |
76 | ## `AuthOAuth2`
77 |
78 | ### Props
79 |
80 | | Prop name | Kind | Reactive | Type | Default value | Description |
81 | | :-------- | :--------------- | :------- | :--- | ------------- | ----------- |
82 | | provider | let
| No | -- | -- | -- |
83 | | success | let
| No | -- | -- | -- |
84 | | failure | let
| No | -- | -- | -- |
85 |
86 | ### Slots
87 |
88 | | Slot name | Default | Props | Fallback |
89 | | :-------- | :------ | :---------------------------------------------------------------------------------------------------- | :------- |
90 | | -- | Yes | { authorize: (provider: string, success: string, failure: string) => Promise
| -- |
91 |
92 | ### Events
93 |
94 | None.
95 |
96 | ## `Browser`
97 |
98 | ### Props
99 |
100 | | Prop name | Kind | Reactive | Type | Default value | Description |
101 | | :-------- | :--------------- | :------- | :------------------ | ---------------- | ----------- |
102 | | code | let
| No | -- | -- | -- |
103 | | width | let
| No | number
| 100
| -- |
104 | | height | let
| No | number
| 100
| -- |
105 | | quality | let
| No | number
| 100
| -- |
106 |
107 | ### Slots
108 |
109 | | Slot name | Default | Props | Fallback |
110 | | :-------- | :------ | :------------------------- | :------- |
111 | | -- | Yes | { src: any }
| -- |
112 |
113 | ### Events
114 |
115 | None.
116 |
117 | ## `Collection`
118 |
119 | ### Props
120 |
121 | | Prop name | Kind | Reactive | Type | Default value | Description |
122 | | :--------- | :--------------- | :------- | :-------------------- | --------------------- | ----------- |
123 | | id | let
| No | string
| -- | -- |
124 | | filters | let
| No | string[]
| []
| -- |
125 | | offset | let
| No | number
| 0
| -- |
126 | | limit | let
| No | number
| 25
| -- |
127 | | orderField | let
| No | string
| ""
| -- |
128 | | orderType | let
| No | string
| ""
| -- |
129 | | orderCast | let
| No | string
| "string"
| -- |
130 | | search | let
| No | string
| ""
| -- |
131 | | cache | let
| No | boolean
| false
| -- |
132 |
133 | ### Slots
134 |
135 | | Slot name | Default | Props | Fallback |
136 | | :-------- | :------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- |
137 | | -- | Yes | { documents: any[]; actions: { reload: () => Promise
| -- |
138 | | error | No | { error: object }
| -- |
139 | | loading | No | -- | -- |
140 |
141 | ### Events
142 |
143 | None.
144 |
145 | ## `Continents`
146 |
147 | ### Props
148 |
149 | None.
150 |
151 | ### Slots
152 |
153 | | Slot name | Default | Props | Fallback |
154 | | :-------- | :------ | :---------------------------------------------------------------------------- | :------- |
155 | | -- | Yes | { continents: any; actions: { reload: () => Promise; }}
| -- |
156 | | error | No | { error: object }
| -- |
157 | | loading | No | -- | -- |
158 |
159 | ### Events
160 |
161 | None.
162 |
163 | ## `Countries`
164 |
165 | ### Props
166 |
167 | | Prop name | Kind | Reactive | Type | Default value | Description |
168 | | :-------- | :--------------- | :------- | :------------------- | ------------------ | ----------- |
169 | | eu | let
| No | boolean
| false
| -- |
170 |
171 | ### Slots
172 |
173 | | Slot name | Default | Props | Fallback |
174 | | :-------- | :------ | :--------------------------------------------------------------------------- | :------- |
175 | | -- | Yes | { countries: any; actions: { reload: () => Promise; }}
| -- |
176 | | error | No | { error: object }
| -- |
177 | | loading | No | -- | -- |
178 |
179 | ### Events
180 |
181 | None.
182 |
183 | ## `Create`
184 |
185 | ### Props
186 |
187 | None.
188 |
189 | ### Slots
190 |
191 | | Slot name | Default | Props | Fallback |
192 | | :-------- | :------ | :---------------------------------------------------------------------------------------------------------- | :------- |
193 | | -- | Yes | { actions: { create: (email: string, password: string, name?: string) => Promise; } }
| -- |
194 |
195 | ### Events
196 |
197 | | Event name | Type | Detail |
198 | | :--------- | :--------- | :----- |
199 | | success | dispatched | -- |
200 | | failure | dispatched | -- |
201 |
202 | ## `CreditCard`
203 |
204 | ### Props
205 |
206 | | Prop name | Kind | Reactive | Type | Default value | Description |
207 | | :-------- | :--------------- | :------- | :------------------ | ---------------- | ----------- |
208 | | code | let
| No | -- | -- | -- |
209 | | width | let
| No | number
| 100
| -- |
210 | | height | let
| No | number
| 100
| -- |
211 | | quality | let
| No | number
| 100
| -- |
212 |
213 | ### Slots
214 |
215 | | Slot name | Default | Props | Fallback |
216 | | :-------- | :------ | :------------------------- | :------- |
217 | | -- | Yes | { src: any }
| -- |
218 |
219 | ### Events
220 |
221 | None.
222 |
223 | ## `Delete`
224 |
225 | ### Props
226 |
227 | None.
228 |
229 | ### Slots
230 |
231 | | Slot name | Default | Props | Fallback |
232 | | :-------- | :------ | :------------------------------------------------------------ | :------- |
233 | | -- | Yes | { actions: { delete: () => Promise; } }
| -- |
234 |
235 | ### Events
236 |
237 | None.
238 |
239 | ## `Document`
240 |
241 | ### Props
242 |
243 | | Prop name | Kind | Reactive | Type | Default value | Description |
244 | | :--------- | :--------------- | :------- | :------------------- | ------------- | ----------- |
245 | | document | let
| Yes | any
| -- | -- |
246 | | collection | let
| Yes | string
| -- | -- |
247 | | id | let
| Yes | string
| -- | -- |
248 | | cache | let
| No | boolean
| -- | -- |
249 |
250 | ### Slots
251 |
252 | | Slot name | Default | Props | Fallback |
253 | | :-------- | :------ | :-------------------------------------------------------------------------------------------------------------------------------------------------- | :------- |
254 | | -- | Yes | { document: any; actions: { reload: () => Promise; update: (data: any) => Promise; remove: () => Promise; } }
| -- |
255 | | error | No | { error: any }
| -- |
256 | | loading | No | -- | -- |
257 |
258 | ### Events
259 |
260 | | Event name | Type | Detail |
261 | | :--------- | :--------- | :----- |
262 | | change | dispatched | -- |
263 |
264 | ## `Favicon`
265 |
266 | ### Props
267 |
268 | | Prop name | Kind | Reactive | Type | Default value | Description |
269 | | :-------- | :--------------- | :------- | :--- | ------------- | ----------- |
270 | | url | let
| No | -- | -- | -- |
271 |
272 | ### Slots
273 |
274 | | Slot name | Default | Props | Fallback |
275 | | :-------- | :------ | :------------------------- | :------- |
276 | | -- | Yes | { src: any }
| -- |
277 |
278 | ### Events
279 |
280 | None.
281 |
282 | ## `File`
283 |
284 | ### Props
285 |
286 | | Prop name | Kind | Reactive | Type | Default value | Description |
287 | | :-------- | :--------------- | :------- | :--- | ------------- | ----------- |
288 | | file | let
| No | -- | -- | -- |
289 |
290 | ### Slots
291 |
292 | | Slot name | Default | Props | Fallback |
293 | | :-------- | :------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- |
294 | | -- | Yes | { file: any; actions: { download: () => string; view: (as?: string) => string; preview: (width?: string, height?: string, quality?: string, background?: string, output?: string) => string; update: (read?: any, write?: any) => Promise; delete: () => Promise; }}
| -- |
295 | | error | No | { error: object }
| -- |
296 |
297 | ### Events
298 |
299 | None.
300 |
301 | ## `FileList`
302 |
303 | ### Props
304 |
305 | | Prop name | Kind | Reactive | Type | Default value | Description |
306 | | :-------- | :--------------- | :------- | :------------------ | ------------------ | ----------- |
307 | | search | let
| No | string
| ""
| -- |
308 | | limit | let
| No | number
| 25
| -- |
309 | | offset | let
| No | number
| 0
| -- |
310 | | orderType | let
| No | string
| "ASC"
| -- |
311 |
312 | ### Slots
313 |
314 | | Slot name | Default | Props | Fallback |
315 | | :-------- | :------ | :------------------------------------------------------------------------- | :------- |
316 | | -- | Yes | { files: any[]; actions: { reload: () => Promise; }}
| -- |
317 | | error | No | { error: object }
| -- |
318 | | loading | No | -- | -- |
319 |
320 | ### Events
321 |
322 | None.
323 |
324 | ## `Flag`
325 |
326 | ### Props
327 |
328 | | Prop name | Kind | Reactive | Type | Default value | Description |
329 | | :-------- | :--------------- | :------- | :------------------ | ---------------- | ----------- |
330 | | code | let
| No | -- | -- | -- |
331 | | width | let
| No | number
| 100
| -- |
332 | | height | let
| No | number
| 100
| -- |
333 | | quality | let
| No | number
| 100
| -- |
334 |
335 | ### Slots
336 |
337 | | Slot name | Default | Props | Fallback |
338 | | :-------- | :------ | :------------------------- | :------- |
339 | | -- | Yes | { src: any }
| -- |
340 |
341 | ### Events
342 |
343 | None.
344 |
345 | ## `Function`
346 |
347 | ### Props
348 |
349 | | Prop name | Kind | Reactive | Type | Default value | Description |
350 | | :-------- | :--------------- | :------- | :------------------ | --------------- | ----------- |
351 | | id | let
| No | -- | -- | -- |
352 | | search | let
| No | string
| ""
| -- |
353 | | limit | let
| No | number
| 25
| -- |
354 | | offset | let
| No | number
| 0
| -- |
355 | | orderType | let
| No | string
| ""
| -- |
356 |
357 | ### Slots
358 |
359 | | Slot name | Default | Props | Fallback |
360 | | :-------- | :------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- |
361 | | -- | Yes | { executions: any; actions: { reload: () => Promise; create: () => Promise; get: (execution: string) => Promise; }}
| -- |
362 | | error | No | { error: object }
| -- |
363 | | loading | No | -- | -- |
364 |
365 | ### Events
366 |
367 | None.
368 |
369 | ## `Image`
370 |
371 | ### Props
372 |
373 | | Prop name | Kind | Reactive | Type | Default value | Description |
374 | | :-------- | :--------------- | :------- | :------------------ | --------------- | ----------- |
375 | | url | let
| No | -- | -- | -- |
376 | | width | let
| No | string
| ""
| -- |
377 | | height | let
| No | string
| ""
| -- |
378 |
379 | ### Slots
380 |
381 | | Slot name | Default | Props | Fallback |
382 | | :-------- | :------ | :------------------------- | :------- |
383 | | -- | Yes | { src: any }
| -- |
384 |
385 | ### Events
386 |
387 | None.
388 |
389 | ## `Languages`
390 |
391 | ### Props
392 |
393 | None.
394 |
395 | ### Slots
396 |
397 | | Slot name | Default | Props | Fallback |
398 | | :-------- | :------ | :--------------------------------------------------------------------------- | :------- |
399 | | -- | Yes | { languages: any; actions: { reload: () => Promise; }}
| -- |
400 | | error | No | { error: object }
| -- |
401 | | loading | No | -- | -- |
402 |
403 | ### Events
404 |
405 | None.
406 |
407 | ## `Locale`
408 |
409 | ### Props
410 |
411 | None.
412 |
413 | ### Slots
414 |
415 | | Slot name | Default | Props | Fallback |
416 | | :-------- | :------ | :---------------------------------------------------------------------- | :------- |
417 | | -- | Yes | { code: any; actions: { reload: () => Promise; }}
| -- |
418 | | error | No | { error: object }
| -- |
419 | | loading | No | -- | -- |
420 |
421 | ### Events
422 |
423 | None.
424 |
425 | ## `Preferences`
426 |
427 | ### Props
428 |
429 | None.
430 |
431 | ### Slots
432 |
433 | | Slot name | Default | Props | Fallback |
434 | | :-------- | :------ | :------------------------------------------------------------------------------------------------------ | :------- |
435 | | -- | Yes | { actions: { reload: () => Promise; update: (prefs: object) => Promise; } }
| -- |
436 | | error | No | { error: object }
| -- |
437 | | loading | No | -- | -- |
438 |
439 | ### Events
440 |
441 | None.
442 |
443 | ## `QR`
444 |
445 | ### Props
446 |
447 | | Prop name | Kind | Reactive | Type | Default value | Description |
448 | | :-------- | :--------------- | :------- | :------------------- | ------------------ | ----------- |
449 | | text | let
| No | -- | -- | -- |
450 | | size | let
| No | number
| 400
| -- |
451 | | margin | let
| No | number
| 1
| -- |
452 | | download | let
| No | boolean
| false
| -- |
453 |
454 | ### Slots
455 |
456 | | Slot name | Default | Props | Fallback |
457 | | :-------- | :------ | :------------------------- | :------- |
458 | | -- | Yes | { src: any }
| -- |
459 |
460 | ### Events
461 |
462 | None.
463 |
464 | ## `RecoverPassword`
465 |
466 | ### Props
467 |
468 | None.
469 |
470 | ### Slots
471 |
472 | | Slot name | Default | Props | Fallback |
473 | | :-------- | :------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- |
474 | | -- | Yes | { actions: { recover: (email: string, url: string) => Promise; complete: (user: string, secret: string, password: string, passwordAgain: string) => Promise; } }
| -- |
475 |
476 | ### Events
477 |
478 | None.
479 |
480 | ## `Storage`
481 |
482 | ### Props
483 |
484 | None.
485 |
486 | ### Slots
487 |
488 | | Slot name | Default | Props | Fallback |
489 | | :-------- | :------ | :------------------------------------------------------------------------------------------------------- | :------- |
490 | | -- | Yes | { actions: { create: (file: any, read?: string[], write?: string[]) => Promise; }}
| -- |
491 | | error | No | { error: object }
| -- |
492 |
493 | ### Events
494 |
495 | | Event name | Type | Detail |
496 | | :--------- | :--------- | :----- |
497 | | upload | dispatched | -- |
498 | | success | dispatched | -- |
499 | | failure | dispatched | -- |
500 |
501 | ## `Update`
502 |
503 | ### Props
504 |
505 | None.
506 |
507 | ### Slots
508 |
509 | | Slot name | Default | Props | Fallback |
510 | | :-------- | :------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- |
511 | | -- | Yes | { actions: { name: (name: string) => Promise; email: (email: string, password: string) => Promise; password: (password: string, oldPassword: string) => Promise; } }
| -- |
512 |
513 | ### Events
514 |
515 | None.
516 |
517 | ## `User`
518 |
519 | ### Types
520 |
521 | ```ts
522 | export interface AppwriteUser {
523 | $id: string;
524 | email: string;
525 | emailVerification: boolean;
526 | name: string;
527 | registration: number;
528 | status: number;
529 | prefs: object;
530 | }
531 | ```
532 |
533 | ### Props
534 |
535 | None.
536 |
537 | ### Slots
538 |
539 | | Slot name | Default | Props | Fallback |
540 | | :-------- | :------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- |
541 | | -- | Yes | { user: AppwriteUser; actions: { reload: () => void; logout: () => Promise; logoutFrom: (session: string) => Promise; logoutAll: () => Promise; } }
| -- |
542 | | error | No | { error: object }
| -- |
543 | | loading | No | -- | -- |
544 |
545 | ### Events
546 |
547 | | Event name | Type | Detail |
548 | | :---------------- | :--------- | :----- |
549 | | success | dispatched | -- |
550 | | failure | dispatched | -- |
551 | | successLogout | dispatched | -- |
552 | | failureLogout | dispatched | -- |
553 | | successLogoutFrom | dispatched | -- |
554 | | failureLogoutFrom | dispatched | -- |
555 | | successLogoutAll | dispatched | -- |
556 | | failureLogoutAll | dispatched | -- |
557 |
558 | ## `Verification`
559 |
560 | ### Props
561 |
562 | None.
563 |
564 | ### Slots
565 |
566 | | Slot name | Default | Props | Fallback |
567 | | :-------- | :------ | :------------------------------------------------------------------------------------------------------------------------------------ | :------- |
568 | | -- | Yes | { actions: { create: (url: string) => Promise; complete: (user: string, secret: string) => Promise; } }
| -- |
569 |
570 | ### Events
571 |
572 | None.
573 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2020, Appwrite
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | 1. Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | 2. Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | 3. Neither the name of the copyright holder nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | **⚠️ Warning - this SDK was designed to support Appwrite 0.9 and is not compatible with the latest Appwrite versions. We are planing to refactor it as part of the [SDK Generator](https://github.com/appwrite/sdk-generator) for better support and maintenance.**
2 |
3 | # svelte-appwrite (Beta)
4 |
5 | Easy to use [Appwrite](https://appwrite.io/) components for Svelte. Install it:
6 |
7 | ```bash
8 | npm install svelte-appwrite
9 | # or
10 | yarn svelte-appwrite
11 | ```
12 |
13 | # Table of contents
14 |
15 | - [Usage](#usage)
16 | - [Initialize](#initialize)
17 | - [Create user](#create-user)
18 | - [Login via Email](#login-via-email)
19 | - [Login via OAuth2](#login-via-oauth2)
20 | - [Get user](#get-user)
21 | - [Get Collection](#get-collection)
22 | - [Get Document](#get-document)
23 | - [API](#api)
24 | - [Account](#account)
25 | - [`22 | 26 | | 27 |{document.label} | 28 |29 | {#if document.done} 30 | remove 31 | {/if} 32 | | 33 |
Collection not found, you have to create following collection with following rules in Appwrite:
39 |40 | - label: text 41 | - done: boolean 42 |43 |
Now paste the collection id in TodoList.svelte.
44 |