react-native-appwrite 0.18.0 → 0.20.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.
Files changed (161) hide show
  1. package/.github/workflows/publish.yml +9 -8
  2. package/CHANGELOG.md +11 -0
  3. package/LICENSE +1 -1
  4. package/README.md +2 -2
  5. package/dist/cjs/sdk.js +881 -36
  6. package/dist/cjs/sdk.js.map +1 -1
  7. package/dist/esm/sdk.js +877 -37
  8. package/dist/esm/sdk.js.map +1 -1
  9. package/docs/examples/account/create-anonymous-session.md +2 -0
  10. package/docs/examples/account/create-email-password-session.md +2 -0
  11. package/docs/examples/account/create-email-token.md +2 -0
  12. package/docs/examples/account/create-email-verification.md +2 -0
  13. package/docs/examples/account/create-jwt.md +5 -1
  14. package/docs/examples/account/create-magic-url-token.md +2 -0
  15. package/docs/examples/account/create-mfa-authenticator.md +2 -0
  16. package/docs/examples/account/create-mfa-challenge.md +2 -0
  17. package/docs/examples/account/create-mfa-recovery-codes.md +2 -0
  18. package/docs/examples/account/create-o-auth-2-session.md +2 -0
  19. package/docs/examples/account/create-o-auth-2-token.md +2 -0
  20. package/docs/examples/account/create-phone-token.md +2 -0
  21. package/docs/examples/account/create-phone-verification.md +2 -0
  22. package/docs/examples/account/create-push-target.md +2 -0
  23. package/docs/examples/account/create-recovery.md +2 -0
  24. package/docs/examples/account/create-session.md +2 -0
  25. package/docs/examples/account/create-verification.md +2 -0
  26. package/docs/examples/account/create.md +2 -0
  27. package/docs/examples/account/delete-identity.md +2 -0
  28. package/docs/examples/account/delete-mfa-authenticator.md +2 -0
  29. package/docs/examples/account/delete-push-target.md +2 -0
  30. package/docs/examples/account/delete-session.md +2 -0
  31. package/docs/examples/account/delete-sessions.md +2 -0
  32. package/docs/examples/account/get-mfa-recovery-codes.md +2 -0
  33. package/docs/examples/account/get-prefs.md +2 -0
  34. package/docs/examples/account/get-session.md +2 -0
  35. package/docs/examples/account/get.md +2 -0
  36. package/docs/examples/account/list-identities.md +2 -0
  37. package/docs/examples/account/list-logs.md +2 -0
  38. package/docs/examples/account/list-mfa-factors.md +2 -0
  39. package/docs/examples/account/list-sessions.md +2 -0
  40. package/docs/examples/account/update-email-verification.md +2 -0
  41. package/docs/examples/account/update-email.md +2 -0
  42. package/docs/examples/account/update-magic-url-session.md +2 -0
  43. package/docs/examples/account/update-mfa-authenticator.md +2 -0
  44. package/docs/examples/account/update-mfa-challenge.md +2 -0
  45. package/docs/examples/account/update-mfa-recovery-codes.md +2 -0
  46. package/docs/examples/account/update-mfa.md +2 -0
  47. package/docs/examples/account/update-name.md +2 -0
  48. package/docs/examples/account/update-password.md +2 -0
  49. package/docs/examples/account/update-phone-session.md +2 -0
  50. package/docs/examples/account/update-phone-verification.md +2 -0
  51. package/docs/examples/account/update-phone.md +2 -0
  52. package/docs/examples/account/update-prefs.md +2 -0
  53. package/docs/examples/account/update-push-target.md +2 -0
  54. package/docs/examples/account/update-recovery.md +2 -0
  55. package/docs/examples/account/update-session.md +2 -0
  56. package/docs/examples/account/update-status.md +2 -0
  57. package/docs/examples/account/update-verification.md +2 -0
  58. package/docs/examples/avatars/get-browser.md +2 -0
  59. package/docs/examples/avatars/get-credit-card.md +2 -0
  60. package/docs/examples/avatars/get-favicon.md +2 -0
  61. package/docs/examples/avatars/get-flag.md +2 -0
  62. package/docs/examples/avatars/get-image.md +2 -0
  63. package/docs/examples/avatars/get-initials.md +2 -0
  64. package/docs/examples/avatars/get-qr.md +2 -0
  65. package/docs/examples/avatars/get-screenshot.md +37 -0
  66. package/docs/examples/databases/create-document.md +2 -0
  67. package/docs/examples/databases/create-operations.md +2 -0
  68. package/docs/examples/databases/create-transaction.md +2 -0
  69. package/docs/examples/databases/decrement-document-attribute.md +2 -0
  70. package/docs/examples/databases/delete-document.md +2 -0
  71. package/docs/examples/databases/delete-transaction.md +2 -0
  72. package/docs/examples/databases/get-document.md +2 -0
  73. package/docs/examples/databases/get-transaction.md +2 -0
  74. package/docs/examples/databases/increment-document-attribute.md +2 -0
  75. package/docs/examples/databases/list-documents.md +2 -0
  76. package/docs/examples/databases/list-transactions.md +2 -0
  77. package/docs/examples/databases/update-document.md +9 -1
  78. package/docs/examples/databases/update-transaction.md +2 -0
  79. package/docs/examples/databases/upsert-document.md +9 -1
  80. package/docs/examples/functions/create-execution.md +2 -0
  81. package/docs/examples/functions/get-execution.md +2 -0
  82. package/docs/examples/functions/list-executions.md +2 -0
  83. package/docs/examples/graphql/mutation.md +2 -0
  84. package/docs/examples/graphql/query.md +2 -0
  85. package/docs/examples/locale/get.md +2 -0
  86. package/docs/examples/locale/list-codes.md +2 -0
  87. package/docs/examples/locale/list-continents.md +2 -0
  88. package/docs/examples/locale/list-countries-eu.md +2 -0
  89. package/docs/examples/locale/list-countries-phones.md +2 -0
  90. package/docs/examples/locale/list-countries.md +2 -0
  91. package/docs/examples/locale/list-currencies.md +2 -0
  92. package/docs/examples/locale/list-languages.md +2 -0
  93. package/docs/examples/messaging/create-subscriber.md +2 -0
  94. package/docs/examples/messaging/delete-subscriber.md +2 -0
  95. package/docs/examples/storage/create-file.md +2 -0
  96. package/docs/examples/storage/delete-file.md +2 -0
  97. package/docs/examples/storage/get-file-download.md +2 -0
  98. package/docs/examples/storage/get-file-preview.md +2 -0
  99. package/docs/examples/storage/get-file-view.md +2 -0
  100. package/docs/examples/storage/get-file.md +2 -0
  101. package/docs/examples/storage/list-files.md +2 -0
  102. package/docs/examples/storage/update-file.md +2 -0
  103. package/docs/examples/tablesdb/create-operations.md +2 -0
  104. package/docs/examples/tablesdb/create-row.md +2 -0
  105. package/docs/examples/tablesdb/create-transaction.md +2 -0
  106. package/docs/examples/tablesdb/decrement-row-column.md +2 -0
  107. package/docs/examples/tablesdb/delete-row.md +2 -0
  108. package/docs/examples/tablesdb/delete-transaction.md +2 -0
  109. package/docs/examples/tablesdb/get-row.md +2 -0
  110. package/docs/examples/tablesdb/get-transaction.md +2 -0
  111. package/docs/examples/tablesdb/increment-row-column.md +2 -0
  112. package/docs/examples/tablesdb/list-rows.md +2 -0
  113. package/docs/examples/tablesdb/list-transactions.md +2 -0
  114. package/docs/examples/tablesdb/update-row.md +9 -1
  115. package/docs/examples/tablesdb/update-transaction.md +2 -0
  116. package/docs/examples/tablesdb/upsert-row.md +9 -1
  117. package/docs/examples/teams/create-membership.md +4 -2
  118. package/docs/examples/teams/create.md +2 -0
  119. package/docs/examples/teams/delete-membership.md +2 -0
  120. package/docs/examples/teams/delete.md +2 -0
  121. package/docs/examples/teams/get-membership.md +2 -0
  122. package/docs/examples/teams/get-prefs.md +2 -0
  123. package/docs/examples/teams/get.md +2 -0
  124. package/docs/examples/teams/list-memberships.md +2 -0
  125. package/docs/examples/teams/list.md +2 -0
  126. package/docs/examples/teams/update-membership-status.md +2 -0
  127. package/docs/examples/teams/update-membership.md +4 -2
  128. package/docs/examples/teams/update-name.md +2 -0
  129. package/docs/examples/teams/update-prefs.md +2 -0
  130. package/package.json +7 -4
  131. package/rollup.config.js +3 -1
  132. package/src/channel.ts +134 -0
  133. package/src/client.ts +41 -6
  134. package/src/enums/browser-permission.ts +22 -0
  135. package/src/enums/o-auth-provider.ts +0 -1
  136. package/src/enums/roles.ts +5 -0
  137. package/src/enums/theme.ts +4 -0
  138. package/src/enums/timezone.ts +421 -0
  139. package/src/index.ts +6 -1
  140. package/src/models.ts +8 -0
  141. package/src/query.ts +54 -9
  142. package/src/services/account.ts +34 -5
  143. package/src/services/avatars.ts +348 -0
  144. package/src/services/databases.ts +5 -9
  145. package/src/services/storage.ts +8 -8
  146. package/src/services/teams.ts +19 -18
  147. package/types/channel.d.ts +71 -0
  148. package/types/enums/browser-permission.d.ts +22 -0
  149. package/types/enums/o-auth-provider.d.ts +1 -2
  150. package/types/enums/roles.d.ts +5 -0
  151. package/types/enums/theme.d.ts +4 -0
  152. package/types/enums/timezone.d.ts +421 -0
  153. package/types/index.d.ts +6 -1
  154. package/types/models.d.ts +8 -0
  155. package/types/query.d.ts +36 -6
  156. package/types/services/account.d.ts +13 -1
  157. package/types/services/avatars.d.ts +124 -0
  158. package/types/services/databases.d.ts +2 -2
  159. package/types/services/storage.d.ts +8 -8
  160. package/types/services/teams.d.ts +9 -8
  161. package/.gitpod.yml +0 -10
@@ -8,6 +8,10 @@ import { Platform } from 'react-native';
8
8
  import { Browser } from '../enums/browser';
9
9
  import { CreditCard } from '../enums/credit-card';
10
10
  import { Flag } from '../enums/flag';
11
+ import { Theme } from '../enums/theme';
12
+ import { Timezone } from '../enums/timezone';
13
+ import { BrowserPermission } from '../enums/browser-permission';
14
+ import { ImageFormat } from '../enums/image-format';
11
15
 
12
16
  export class Avatars extends Service {
13
17
 
@@ -560,6 +564,221 @@ export class Avatars extends Service {
560
564
  }, payload, 'arrayBuffer');
561
565
  }
562
566
 
567
+ /**
568
+ * Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image.
569
+ *
570
+ * You can configure the browser viewport size, theme, user agent, geolocation, permissions, and more. Capture either just the viewport or the full page scroll.
571
+ *
572
+ * When width and height are specified, the image is resized accordingly. If both dimensions are 0, the API provides an image at original size. If dimensions are not specified, the default viewport size is 1280x720px.
573
+ *
574
+ * @param {string} params.url - Website URL which you want to capture.
575
+ * @param {object} params.headers - HTTP headers to send with the browser request. Defaults to empty.
576
+ * @param {number} params.viewportWidth - Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280.
577
+ * @param {number} params.viewportHeight - Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720.
578
+ * @param {number} params.scale - Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1.
579
+ * @param {Theme} params.theme - Browser theme. Pass "light" or "dark". Defaults to "light".
580
+ * @param {string} params.userAgent - Custom user agent string. Defaults to browser default.
581
+ * @param {boolean} params.fullpage - Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0.
582
+ * @param {string} params.locale - Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default.
583
+ * @param {Timezone} params.timezone - IANA timezone identifier (e.g., "America/New_York", "Europe/London"). Defaults to browser default.
584
+ * @param {number} params.latitude - Geolocation latitude. Pass a number between -90 to 90. Defaults to 0.
585
+ * @param {number} params.longitude - Geolocation longitude. Pass a number between -180 to 180. Defaults to 0.
586
+ * @param {number} params.accuracy - Geolocation accuracy in meters. Pass a number between 0 to 100000. Defaults to 0.
587
+ * @param {boolean} params.touch - Enable touch support. Pass 0 for no touch, or 1 for touch enabled. Defaults to 0.
588
+ * @param {BrowserPermission[]} params.permissions - Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty.
589
+ * @param {number} params.sleep - Wait time in seconds before taking the screenshot. Pass an integer between 0 to 10. Defaults to 0.
590
+ * @param {number} params.width - Output image width. Pass 0 to use original width, or an integer between 1 to 2000. Defaults to 0 (original width).
591
+ * @param {number} params.height - Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height).
592
+ * @param {number} params.quality - Screenshot quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
593
+ * @param {ImageFormat} params.output - Output format type (jpeg, jpg, png, gif and webp).
594
+ * @throws {AppwriteException}
595
+ * @returns {ArrayBuffer}
596
+ */
597
+ getScreenshot(params: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }): Promise<ArrayBuffer>;
598
+ /**
599
+ * Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image.
600
+ *
601
+ * You can configure the browser viewport size, theme, user agent, geolocation, permissions, and more. Capture either just the viewport or the full page scroll.
602
+ *
603
+ * When width and height are specified, the image is resized accordingly. If both dimensions are 0, the API provides an image at original size. If dimensions are not specified, the default viewport size is 1280x720px.
604
+ *
605
+ * @param {string} url - Website URL which you want to capture.
606
+ * @param {object} headers - HTTP headers to send with the browser request. Defaults to empty.
607
+ * @param {number} viewportWidth - Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280.
608
+ * @param {number} viewportHeight - Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720.
609
+ * @param {number} scale - Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1.
610
+ * @param {Theme} theme - Browser theme. Pass "light" or "dark". Defaults to "light".
611
+ * @param {string} userAgent - Custom user agent string. Defaults to browser default.
612
+ * @param {boolean} fullpage - Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0.
613
+ * @param {string} locale - Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default.
614
+ * @param {Timezone} timezone - IANA timezone identifier (e.g., "America/New_York", "Europe/London"). Defaults to browser default.
615
+ * @param {number} latitude - Geolocation latitude. Pass a number between -90 to 90. Defaults to 0.
616
+ * @param {number} longitude - Geolocation longitude. Pass a number between -180 to 180. Defaults to 0.
617
+ * @param {number} accuracy - Geolocation accuracy in meters. Pass a number between 0 to 100000. Defaults to 0.
618
+ * @param {boolean} touch - Enable touch support. Pass 0 for no touch, or 1 for touch enabled. Defaults to 0.
619
+ * @param {BrowserPermission[]} permissions - Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty.
620
+ * @param {number} sleep - Wait time in seconds before taking the screenshot. Pass an integer between 0 to 10. Defaults to 0.
621
+ * @param {number} width - Output image width. Pass 0 to use original width, or an integer between 1 to 2000. Defaults to 0 (original width).
622
+ * @param {number} height - Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height).
623
+ * @param {number} quality - Screenshot quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
624
+ * @param {ImageFormat} output - Output format type (jpeg, jpg, png, gif and webp).
625
+ * @throws {AppwriteException}
626
+ * @returns {Promise<ArrayBuffer>}
627
+ * @deprecated Use the object parameter style method for a better developer experience.
628
+ */
629
+ getScreenshot(url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat): Promise<ArrayBuffer>;
630
+ getScreenshot(
631
+ paramsOrFirst: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat } | string,
632
+ ...rest: [(object)?, (number)?, (number)?, (number)?, (Theme)?, (string)?, (boolean)?, (string)?, (Timezone)?, (number)?, (number)?, (number)?, (boolean)?, (BrowserPermission[])?, (number)?, (number)?, (number)?, (number)?, (ImageFormat)?]
633
+ ): Promise<ArrayBuffer> {
634
+ let params: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat };
635
+
636
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
637
+ params = (paramsOrFirst || {}) as { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat };
638
+ } else {
639
+ params = {
640
+ url: paramsOrFirst as string,
641
+ headers: rest[0] as object,
642
+ viewportWidth: rest[1] as number,
643
+ viewportHeight: rest[2] as number,
644
+ scale: rest[3] as number,
645
+ theme: rest[4] as Theme,
646
+ userAgent: rest[5] as string,
647
+ fullpage: rest[6] as boolean,
648
+ locale: rest[7] as string,
649
+ timezone: rest[8] as Timezone,
650
+ latitude: rest[9] as number,
651
+ longitude: rest[10] as number,
652
+ accuracy: rest[11] as number,
653
+ touch: rest[12] as boolean,
654
+ permissions: rest[13] as BrowserPermission[],
655
+ sleep: rest[14] as number,
656
+ width: rest[15] as number,
657
+ height: rest[16] as number,
658
+ quality: rest[17] as number,
659
+ output: rest[18] as ImageFormat
660
+ };
661
+ }
662
+
663
+ const url = params.url;
664
+ const headers = params.headers;
665
+ const viewportWidth = params.viewportWidth;
666
+ const viewportHeight = params.viewportHeight;
667
+ const scale = params.scale;
668
+ const theme = params.theme;
669
+ const userAgent = params.userAgent;
670
+ const fullpage = params.fullpage;
671
+ const locale = params.locale;
672
+ const timezone = params.timezone;
673
+ const latitude = params.latitude;
674
+ const longitude = params.longitude;
675
+ const accuracy = params.accuracy;
676
+ const touch = params.touch;
677
+ const permissions = params.permissions;
678
+ const sleep = params.sleep;
679
+ const width = params.width;
680
+ const height = params.height;
681
+ const quality = params.quality;
682
+ const output = params.output;
683
+
684
+ if (typeof url === 'undefined') {
685
+ throw new AppwriteException('Missing required parameter: "url"');
686
+ }
687
+
688
+ const apiPath = '/avatars/screenshots';
689
+ const payload: Payload = {};
690
+
691
+ if (typeof url !== 'undefined') {
692
+ payload['url'] = url;
693
+ }
694
+
695
+ if (typeof headers !== 'undefined') {
696
+ payload['headers'] = headers;
697
+ }
698
+
699
+ if (typeof viewportWidth !== 'undefined') {
700
+ payload['viewportWidth'] = viewportWidth;
701
+ }
702
+
703
+ if (typeof viewportHeight !== 'undefined') {
704
+ payload['viewportHeight'] = viewportHeight;
705
+ }
706
+
707
+ if (typeof scale !== 'undefined') {
708
+ payload['scale'] = scale;
709
+ }
710
+
711
+ if (typeof theme !== 'undefined') {
712
+ payload['theme'] = theme;
713
+ }
714
+
715
+ if (typeof userAgent !== 'undefined') {
716
+ payload['userAgent'] = userAgent;
717
+ }
718
+
719
+ if (typeof fullpage !== 'undefined') {
720
+ payload['fullpage'] = fullpage;
721
+ }
722
+
723
+ if (typeof locale !== 'undefined') {
724
+ payload['locale'] = locale;
725
+ }
726
+
727
+ if (typeof timezone !== 'undefined') {
728
+ payload['timezone'] = timezone;
729
+ }
730
+
731
+ if (typeof latitude !== 'undefined') {
732
+ payload['latitude'] = latitude;
733
+ }
734
+
735
+ if (typeof longitude !== 'undefined') {
736
+ payload['longitude'] = longitude;
737
+ }
738
+
739
+ if (typeof accuracy !== 'undefined') {
740
+ payload['accuracy'] = accuracy;
741
+ }
742
+
743
+ if (typeof touch !== 'undefined') {
744
+ payload['touch'] = touch;
745
+ }
746
+
747
+ if (typeof permissions !== 'undefined') {
748
+ payload['permissions'] = permissions;
749
+ }
750
+
751
+ if (typeof sleep !== 'undefined') {
752
+ payload['sleep'] = sleep;
753
+ }
754
+
755
+ if (typeof width !== 'undefined') {
756
+ payload['width'] = width;
757
+ }
758
+
759
+ if (typeof height !== 'undefined') {
760
+ payload['height'] = height;
761
+ }
762
+
763
+ if (typeof quality !== 'undefined') {
764
+ payload['quality'] = quality;
765
+ }
766
+
767
+ if (typeof output !== 'undefined') {
768
+ payload['output'] = output;
769
+ }
770
+
771
+ const uri = new URL(this.client.config.endpoint + apiPath);
772
+ payload['project'] = this.client.config.project;
773
+
774
+
775
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
776
+ uri.searchParams.append(key, value);
777
+ }
778
+ return this.client.call('get', uri, {
779
+ }, payload, 'arrayBuffer');
780
+ }
781
+
563
782
  /**
564
783
  * You can use this endpoint to show different browser icons to your users.
565
784
  * The code argument receives the browser code as it appears in your user [GET
@@ -863,4 +1082,133 @@ export class Avatars extends Service {
863
1082
 
864
1083
  return uri;
865
1084
  }
1085
+
1086
+ /**
1087
+ * Use this endpoint to capture a screenshot of any website URL. This endpoint
1088
+ * uses a headless browser to render the webpage and capture it as an image.
1089
+ *
1090
+ * You can configure the browser viewport size, theme, user agent,
1091
+ * geolocation, permissions, and more. Capture either just the viewport or the
1092
+ * full page scroll.
1093
+ *
1094
+ * When width and height are specified, the image is resized accordingly. If
1095
+ * both dimensions are 0, the API provides an image at original size. If
1096
+ * dimensions are not specified, the default viewport size is 1280x720px.
1097
+ *
1098
+ * @param {string} url
1099
+ * @param {object} headers
1100
+ * @param {number} viewportWidth
1101
+ * @param {number} viewportHeight
1102
+ * @param {number} scale
1103
+ * @param {Theme} theme
1104
+ * @param {string} userAgent
1105
+ * @param {boolean} fullpage
1106
+ * @param {string} locale
1107
+ * @param {Timezone} timezone
1108
+ * @param {number} latitude
1109
+ * @param {number} longitude
1110
+ * @param {number} accuracy
1111
+ * @param {boolean} touch
1112
+ * @param {BrowserPermission[]} permissions
1113
+ * @param {number} sleep
1114
+ * @param {number} width
1115
+ * @param {number} height
1116
+ * @param {number} quality
1117
+ * @param {ImageFormat} output
1118
+ * @throws {AppwriteException}
1119
+ * @returns {URL}
1120
+ */
1121
+ getScreenshotURL(url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat): URL {
1122
+ const apiPath = '/avatars/screenshots';
1123
+ const payload: Payload = {};
1124
+
1125
+ if (typeof url !== 'undefined') {
1126
+ payload['url'] = url;
1127
+ }
1128
+
1129
+ if (typeof headers !== 'undefined') {
1130
+ payload['headers'] = headers;
1131
+ }
1132
+
1133
+ if (typeof viewportWidth !== 'undefined') {
1134
+ payload['viewportWidth'] = viewportWidth;
1135
+ }
1136
+
1137
+ if (typeof viewportHeight !== 'undefined') {
1138
+ payload['viewportHeight'] = viewportHeight;
1139
+ }
1140
+
1141
+ if (typeof scale !== 'undefined') {
1142
+ payload['scale'] = scale;
1143
+ }
1144
+
1145
+ if (typeof theme !== 'undefined') {
1146
+ payload['theme'] = theme;
1147
+ }
1148
+
1149
+ if (typeof userAgent !== 'undefined') {
1150
+ payload['userAgent'] = userAgent;
1151
+ }
1152
+
1153
+ if (typeof fullpage !== 'undefined') {
1154
+ payload['fullpage'] = fullpage;
1155
+ }
1156
+
1157
+ if (typeof locale !== 'undefined') {
1158
+ payload['locale'] = locale;
1159
+ }
1160
+
1161
+ if (typeof timezone !== 'undefined') {
1162
+ payload['timezone'] = timezone;
1163
+ }
1164
+
1165
+ if (typeof latitude !== 'undefined') {
1166
+ payload['latitude'] = latitude;
1167
+ }
1168
+
1169
+ if (typeof longitude !== 'undefined') {
1170
+ payload['longitude'] = longitude;
1171
+ }
1172
+
1173
+ if (typeof accuracy !== 'undefined') {
1174
+ payload['accuracy'] = accuracy;
1175
+ }
1176
+
1177
+ if (typeof touch !== 'undefined') {
1178
+ payload['touch'] = touch;
1179
+ }
1180
+
1181
+ if (typeof permissions !== 'undefined') {
1182
+ payload['permissions'] = permissions;
1183
+ }
1184
+
1185
+ if (typeof sleep !== 'undefined') {
1186
+ payload['sleep'] = sleep;
1187
+ }
1188
+
1189
+ if (typeof width !== 'undefined') {
1190
+ payload['width'] = width;
1191
+ }
1192
+
1193
+ if (typeof height !== 'undefined') {
1194
+ payload['height'] = height;
1195
+ }
1196
+
1197
+ if (typeof quality !== 'undefined') {
1198
+ payload['quality'] = quality;
1199
+ }
1200
+
1201
+ if (typeof output !== 'undefined') {
1202
+ payload['output'] = output;
1203
+ }
1204
+
1205
+ const uri = new URL(this.client.config.endpoint + apiPath);
1206
+ payload['project'] = this.client.config.project;
1207
+
1208
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
1209
+ uri.searchParams.append(key, value);
1210
+ }
1211
+
1212
+ return uri;
1213
+ }
866
1214
  };
@@ -571,7 +571,7 @@ export class Databases extends Service {
571
571
  * @returns {Promise}
572
572
  * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRow` instead.
573
573
  */
574
- upsertDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string }): Promise<Document>;
574
+ upsertDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string }): Promise<Document>;
575
575
  /**
576
576
  * 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) API or directly from your database console.
577
577
  *
@@ -585,15 +585,15 @@ export class Databases extends Service {
585
585
  * @returns {Promise<Document>}
586
586
  * @deprecated Use the object parameter style method for a better developer experience.
587
587
  */
588
- upsertDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string): Promise<Document>;
588
+ upsertDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string): Promise<Document>;
589
589
  upsertDocument<Document extends Models.Document = Models.DefaultDocument>(
590
- paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string } | string,
590
+ paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string } | string,
591
591
  ...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>)?, (string[])?, (string)?]
592
592
  ): Promise<Document> {
593
- let params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string };
593
+ let params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string };
594
594
 
595
595
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
596
- params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string };
596
+ params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string };
597
597
  } else {
598
598
  params = {
599
599
  databaseId: paramsOrFirst as string,
@@ -624,10 +624,6 @@ export class Databases extends Service {
624
624
  throw new AppwriteException('Missing required parameter: "documentId"');
625
625
  }
626
626
 
627
- if (typeof data === 'undefined') {
628
- throw new AppwriteException('Missing required parameter: "data"');
629
- }
630
-
631
627
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
632
628
  const payload: Payload = {};
633
629
 
@@ -289,10 +289,10 @@ export class Storage extends Service {
289
289
  /**
290
290
  * Update a file by its unique ID. Only users with write permissions have access to update this resource.
291
291
  *
292
- * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
293
- * @param {string} params.fileId - File unique ID.
294
- * @param {string} params.name - Name of the file
295
- * @param {string[]} params.permissions - An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
292
+ * @param {string} params.bucketId - Bucket unique ID.
293
+ * @param {string} params.fileId - File ID.
294
+ * @param {string} params.name - File name.
295
+ * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
296
296
  * @throws {AppwriteException}
297
297
  * @returns {Promise}
298
298
  */
@@ -300,10 +300,10 @@ export class Storage extends Service {
300
300
  /**
301
301
  * Update a file by its unique ID. Only users with write permissions have access to update this resource.
302
302
  *
303
- * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
304
- * @param {string} fileId - File unique ID.
305
- * @param {string} name - Name of the file
306
- * @param {string[]} permissions - An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
303
+ * @param {string} bucketId - Bucket unique ID.
304
+ * @param {string} fileId - File ID.
305
+ * @param {string} name - File name.
306
+ * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
307
307
  * @throws {AppwriteException}
308
308
  * @returns {Promise<Models.File>}
309
309
  * @deprecated Use the object parameter style method for a better developer experience.
@@ -5,6 +5,7 @@ import type { UploadProgress, Payload } from '../client';
5
5
  import * as FileSystem from 'expo-file-system';
6
6
  import { Platform } from 'react-native';
7
7
 
8
+ import { Roles } from '../enums/roles';
8
9
 
9
10
  export class Teams extends Service {
10
11
 
@@ -371,7 +372,7 @@ export class Teams extends Service {
371
372
  *
372
373
  *
373
374
  * @param {string} params.teamId - Team ID.
374
- * @param {string[]} params.roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
375
+ * @param {Roles[]} params.roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
375
376
  * @param {string} params.email - Email of the new team member.
376
377
  * @param {string} params.userId - ID of the user to be added to a team.
377
378
  * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
@@ -380,7 +381,7 @@ export class Teams extends Service {
380
381
  * @throws {AppwriteException}
381
382
  * @returns {Promise}
382
383
  */
383
- createMembership(params: { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string }): Promise<Models.Membership>;
384
+ createMembership(params: { teamId: string, roles: Roles[], email?: string, userId?: string, phone?: string, url?: string, name?: string }): Promise<Models.Membership>;
384
385
  /**
385
386
  * Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team.
386
387
  *
@@ -392,7 +393,7 @@ export class Teams extends Service {
392
393
  *
393
394
  *
394
395
  * @param {string} teamId - Team ID.
395
- * @param {string[]} roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
396
+ * @param {Roles[]} roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
396
397
  * @param {string} email - Email of the new team member.
397
398
  * @param {string} userId - ID of the user to be added to a team.
398
399
  * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
@@ -402,19 +403,19 @@ export class Teams extends Service {
402
403
  * @returns {Promise<Models.Membership>}
403
404
  * @deprecated Use the object parameter style method for a better developer experience.
404
405
  */
405
- createMembership(teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise<Models.Membership>;
406
+ createMembership(teamId: string, roles: Roles[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise<Models.Membership>;
406
407
  createMembership(
407
- paramsOrFirst: { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string } | string,
408
- ...rest: [(string[])?, (string)?, (string)?, (string)?, (string)?, (string)?]
408
+ paramsOrFirst: { teamId: string, roles: Roles[], email?: string, userId?: string, phone?: string, url?: string, name?: string } | string,
409
+ ...rest: [(Roles[])?, (string)?, (string)?, (string)?, (string)?, (string)?]
409
410
  ): Promise<Models.Membership> {
410
- let params: { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string };
411
+ let params: { teamId: string, roles: Roles[], email?: string, userId?: string, phone?: string, url?: string, name?: string };
411
412
 
412
413
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
413
- params = (paramsOrFirst || {}) as { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string };
414
+ params = (paramsOrFirst || {}) as { teamId: string, roles: Roles[], email?: string, userId?: string, phone?: string, url?: string, name?: string };
414
415
  } else {
415
416
  params = {
416
417
  teamId: paramsOrFirst as string,
417
- roles: rest[0] as string[],
418
+ roles: rest[0] as Roles[],
418
419
  email: rest[1] as string,
419
420
  userId: rest[2] as string,
420
421
  phone: rest[3] as string,
@@ -531,36 +532,36 @@ export class Teams extends Service {
531
532
  *
532
533
  * @param {string} params.teamId - Team ID.
533
534
  * @param {string} params.membershipId - Membership ID.
534
- * @param {string[]} params.roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
535
+ * @param {Roles[]} params.roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
535
536
  * @throws {AppwriteException}
536
537
  * @returns {Promise}
537
538
  */
538
- updateMembership(params: { teamId: string, membershipId: string, roles: string[] }): Promise<Models.Membership>;
539
+ updateMembership(params: { teamId: string, membershipId: string, roles: Roles[] }): Promise<Models.Membership>;
539
540
  /**
540
541
  * Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions).
541
542
  *
542
543
  *
543
544
  * @param {string} teamId - Team ID.
544
545
  * @param {string} membershipId - Membership ID.
545
- * @param {string[]} roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
546
+ * @param {Roles[]} roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
546
547
  * @throws {AppwriteException}
547
548
  * @returns {Promise<Models.Membership>}
548
549
  * @deprecated Use the object parameter style method for a better developer experience.
549
550
  */
550
- updateMembership(teamId: string, membershipId: string, roles: string[]): Promise<Models.Membership>;
551
+ updateMembership(teamId: string, membershipId: string, roles: Roles[]): Promise<Models.Membership>;
551
552
  updateMembership(
552
- paramsOrFirst: { teamId: string, membershipId: string, roles: string[] } | string,
553
- ...rest: [(string)?, (string[])?]
553
+ paramsOrFirst: { teamId: string, membershipId: string, roles: Roles[] } | string,
554
+ ...rest: [(string)?, (Roles[])?]
554
555
  ): Promise<Models.Membership> {
555
- let params: { teamId: string, membershipId: string, roles: string[] };
556
+ let params: { teamId: string, membershipId: string, roles: Roles[] };
556
557
 
557
558
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
558
- params = (paramsOrFirst || {}) as { teamId: string, membershipId: string, roles: string[] };
559
+ params = (paramsOrFirst || {}) as { teamId: string, membershipId: string, roles: Roles[] };
559
560
  } else {
560
561
  params = {
561
562
  teamId: paramsOrFirst as string,
562
563
  membershipId: rest[0] as string,
563
- roles: rest[1] as string[]
564
+ roles: rest[1] as Roles[]
564
565
  };
565
566
  }
566
567
 
@@ -0,0 +1,71 @@
1
+ interface Database {
2
+ _db: any;
3
+ }
4
+ interface Collection {
5
+ _coll: any;
6
+ }
7
+ interface Document {
8
+ _doc: any;
9
+ }
10
+ interface TablesDB {
11
+ _tdb: any;
12
+ }
13
+ interface Table {
14
+ _tbl: any;
15
+ }
16
+ interface Row {
17
+ _row: any;
18
+ }
19
+ interface Bucket {
20
+ _bkt: any;
21
+ }
22
+ interface File {
23
+ _file: any;
24
+ }
25
+ interface Func {
26
+ _fn: any;
27
+ }
28
+ interface Execution {
29
+ _exec: any;
30
+ }
31
+ interface Team {
32
+ _team: any;
33
+ }
34
+ interface Membership {
35
+ _mem: any;
36
+ }
37
+ interface Resolved {
38
+ _res: any;
39
+ }
40
+ type Actionable = Document | Row | File | Execution | Team | Membership;
41
+ export declare class Channel<T> {
42
+ private readonly segments;
43
+ _type: T;
44
+ private constructor();
45
+ private next;
46
+ private resolve;
47
+ toString(): string;
48
+ collection(this: Channel<Database>, id?: string): Channel<Collection>;
49
+ document(this: Channel<Collection>, id?: string): Channel<Document>;
50
+ table(this: Channel<TablesDB>, id?: string): Channel<Table>;
51
+ row(this: Channel<Table>, id?: string): Channel<Row>;
52
+ file(this: Channel<Bucket>, id?: string): Channel<File>;
53
+ execution(this: Channel<Func>, id?: string): Channel<Execution>;
54
+ create(this: Channel<Actionable>): Channel<Resolved>;
55
+ update(this: Channel<Actionable>): Channel<Resolved>;
56
+ delete(this: Channel<Actionable>): Channel<Resolved>;
57
+ static database(id?: string): Channel<Database>;
58
+ static tablesdb(id?: string): Channel<TablesDB>;
59
+ static bucket(id?: string): Channel<Bucket>;
60
+ static function(id?: string): Channel<Func>;
61
+ static team(id?: string): Channel<Team>;
62
+ static membership(id?: string): Channel<Membership>;
63
+ static account(userId?: string): string;
64
+ static get documents(): string;
65
+ static get rows(): string;
66
+ static get files(): string;
67
+ static get executions(): string;
68
+ }
69
+ export type ActionableChannel = Channel<Document> | Channel<Row> | Channel<File> | Channel<Execution> | Channel<Team> | Channel<Membership>;
70
+ export type ResolvedChannel = Channel<Resolved>;
71
+ export {};
@@ -0,0 +1,22 @@
1
+ export declare enum BrowserPermission {
2
+ Geolocation = "geolocation",
3
+ Camera = "camera",
4
+ Microphone = "microphone",
5
+ Notifications = "notifications",
6
+ Midi = "midi",
7
+ Push = "push",
8
+ ClipboardRead = "clipboard-read",
9
+ ClipboardWrite = "clipboard-write",
10
+ PaymentHandler = "payment-handler",
11
+ Usb = "usb",
12
+ Bluetooth = "bluetooth",
13
+ Accelerometer = "accelerometer",
14
+ Gyroscope = "gyroscope",
15
+ Magnetometer = "magnetometer",
16
+ AmbientLightSensor = "ambient-light-sensor",
17
+ BackgroundSync = "background-sync",
18
+ PersistentStorage = "persistent-storage",
19
+ ScreenWakeLock = "screen-wake-lock",
20
+ WebShare = "web-share",
21
+ XrSpatialTracking = "xr-spatial-tracking"
22
+ }
@@ -37,6 +37,5 @@ export declare enum OAuthProvider {
37
37
  Yammer = "yammer",
38
38
  Yandex = "yandex",
39
39
  Zoho = "zoho",
40
- Zoom = "zoom",
41
- Mock = "mock"
40
+ Zoom = "zoom"
42
41
  }
@@ -0,0 +1,5 @@
1
+ export declare enum Roles {
2
+ Admin = "admin",
3
+ Developer = "developer",
4
+ Owner = "owner"
5
+ }