@anvil-works/anvil-pyright 0.0.1 → 0.0.2-canary

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 (98) hide show
  1. package/dist/anvil-typeshed/TODOS.md +70 -0
  2. package/dist/anvil-typeshed/client/anvil/__init__.pyi +1291 -0
  3. package/dist/anvil-typeshed/client/anvil/__pycache__/server.cpython-39.pyc +0 -0
  4. package/dist/anvil-typeshed/client/anvil/email.pyi +152 -0
  5. package/dist/anvil-typeshed/client/anvil/facebook/__init__.pyi +8 -0
  6. package/dist/anvil-typeshed/client/anvil/facebook/auth.pyi +30 -0
  7. package/dist/anvil-typeshed/client/anvil/google/__init__.pyi +11 -0
  8. package/dist/anvil-typeshed/client/anvil/google/auth.pyi +37 -0
  9. package/dist/anvil-typeshed/client/anvil/google/drive.pyi +98 -0
  10. package/dist/anvil-typeshed/client/anvil/google/sheets.pyi +98 -0
  11. package/dist/anvil-typeshed/client/anvil/http.pyi +66 -0
  12. package/dist/anvil-typeshed/client/anvil/image.pyi +30 -0
  13. package/dist/anvil-typeshed/client/anvil/js/__init__.pyi +143 -0
  14. package/dist/anvil-typeshed/client/anvil/js/window/__init__.pyi +2935 -0
  15. package/dist/anvil-typeshed/client/anvil/media.pyi +46 -0
  16. package/dist/anvil-typeshed/client/anvil/microsoft/__init__.pyi +8 -0
  17. package/dist/anvil-typeshed/client/anvil/microsoft/auth.pyi +34 -0
  18. package/dist/anvil-typeshed/client/anvil/mpl_util.pyi +29 -0
  19. package/dist/anvil-typeshed/client/anvil/plotly_templates.pyi +15 -0
  20. package/dist/anvil-typeshed/client/anvil/saml/__init__.pyi +8 -0
  21. package/dist/anvil-typeshed/client/anvil/saml/auth.pyi +24 -0
  22. package/dist/anvil-typeshed/client/anvil/secrets.pyi +22 -0
  23. package/dist/anvil-typeshed/client/anvil/server.pyi +376 -0
  24. package/dist/anvil-typeshed/client/anvil/stripe.pyi +23 -0
  25. package/dist/anvil-typeshed/client/anvil/tables/__init__.pyi +297 -0
  26. package/dist/anvil-typeshed/client/anvil/tables/query.pyi +88 -0
  27. package/dist/anvil-typeshed/client/anvil/tz.pyi +92 -0
  28. package/dist/anvil-typeshed/client/anvil/users/__init__.pyi +191 -0
  29. package/dist/anvil-typeshed/client/anvil/users/mfa.pyi +76 -0
  30. package/dist/anvil-typeshed/client/stripe/__init__.pyi +8 -0
  31. package/dist/anvil-typeshed/client/stripe/checkout.pyi +67 -0
  32. package/dist/anvil-typeshed/server/anvil/__init__.pyi +148 -0
  33. package/dist/anvil-typeshed/server/anvil/email.pyi +188 -0
  34. package/dist/anvil-typeshed/server/anvil/facebook/__init__.pyi +8 -0
  35. package/dist/anvil-typeshed/server/anvil/facebook/auth.pyi +27 -0
  36. package/dist/anvil-typeshed/server/anvil/files.pyi +53 -0
  37. package/dist/anvil-typeshed/server/anvil/google/__init__.pyi +11 -0
  38. package/dist/anvil-typeshed/server/anvil/google/auth.pyi +31 -0
  39. package/dist/anvil-typeshed/server/anvil/google/drive.pyi +98 -0
  40. package/dist/anvil-typeshed/server/anvil/google/mail.pyi +24 -0
  41. package/dist/anvil-typeshed/server/anvil/google/sheets.pyi +98 -0
  42. package/dist/anvil-typeshed/server/anvil/http.pyi +66 -0
  43. package/dist/anvil-typeshed/server/anvil/image.pyi +30 -0
  44. package/dist/anvil-typeshed/server/anvil/media.pyi +32 -0
  45. package/dist/anvil-typeshed/server/anvil/microsoft/__init__.pyi +8 -0
  46. package/dist/anvil-typeshed/server/anvil/microsoft/auth.pyi +31 -0
  47. package/dist/anvil-typeshed/server/anvil/mpl_util.pyi +29 -0
  48. package/dist/anvil-typeshed/server/anvil/pdf.pyi +61 -0
  49. package/dist/anvil-typeshed/server/anvil/plotly_templates.pyi +15 -0
  50. package/dist/anvil-typeshed/server/anvil/saml/__init__.pyi +8 -0
  51. package/dist/anvil-typeshed/server/anvil/saml/auth.pyi +21 -0
  52. package/dist/anvil-typeshed/server/anvil/secrets.pyi +22 -0
  53. package/dist/anvil-typeshed/server/anvil/server.pyi +470 -0
  54. package/dist/anvil-typeshed/server/anvil/stripe.pyi +23 -0
  55. package/dist/anvil-typeshed/server/anvil/tables/__init__.pyi +319 -0
  56. package/dist/anvil-typeshed/server/anvil/tables/query.pyi +88 -0
  57. package/dist/anvil-typeshed/server/anvil/tz.pyi +92 -0
  58. package/dist/anvil-typeshed/server/anvil/users/__init__.pyi +83 -0
  59. package/dist/anvil-typeshed/server/anvil/users/mfa.pyi +65 -0
  60. package/dist/anvil-typeshed/server/stripe/__init__.pyi +8 -0
  61. package/dist/anvil-typeshed/server/stripe/checkout.pyi +9 -0
  62. package/dist/anvil-typeshed/source/anvil/__init__.pyi +1306 -0
  63. package/dist/anvil-typeshed/source/anvil/email.pyi +188 -0
  64. package/dist/anvil-typeshed/source/anvil/facebook/__init__.pyi +4 -0
  65. package/dist/anvil-typeshed/source/anvil/facebook/auth.pyi +28 -0
  66. package/dist/anvil-typeshed/source/anvil/files.pyi +50 -0
  67. package/dist/anvil-typeshed/source/anvil/google/__init__.pyi +7 -0
  68. package/dist/anvil-typeshed/source/anvil/google/auth.pyi +35 -0
  69. package/dist/anvil-typeshed/source/anvil/google/drive.pyi +94 -0
  70. package/dist/anvil-typeshed/source/anvil/google/mail.pyi +21 -0
  71. package/dist/anvil-typeshed/source/anvil/google/sheets.pyi +94 -0
  72. package/dist/anvil-typeshed/source/anvil/http.pyi +62 -0
  73. package/dist/anvil-typeshed/source/anvil/image.pyi +26 -0
  74. package/dist/anvil-typeshed/source/anvil/js/__init__.pyi +140 -0
  75. package/dist/anvil-typeshed/source/anvil/js/window/__init__.pyi +2932 -0
  76. package/dist/anvil-typeshed/source/anvil/media.pyi +62 -0
  77. package/dist/anvil-typeshed/source/anvil/microsoft/__init__.pyi +4 -0
  78. package/dist/anvil-typeshed/source/anvil/microsoft/auth.pyi +32 -0
  79. package/dist/anvil-typeshed/source/anvil/mpl_util.pyi +25 -0
  80. package/dist/anvil-typeshed/source/anvil/pdf.pyi +58 -0
  81. package/dist/anvil-typeshed/source/anvil/plotly_templates.pyi +11 -0
  82. package/dist/anvil-typeshed/source/anvil/saml/__init__.pyi +4 -0
  83. package/dist/anvil-typeshed/source/anvil/saml/auth.pyi +22 -0
  84. package/dist/anvil-typeshed/source/anvil/secrets.pyi +18 -0
  85. package/dist/anvil-typeshed/source/anvil/server.pyi +511 -0
  86. package/dist/anvil-typeshed/source/anvil/stripe.pyi +19 -0
  87. package/dist/anvil-typeshed/source/anvil/tables/__init__.pyi +319 -0
  88. package/dist/anvil-typeshed/source/anvil/tables/query.pyi +84 -0
  89. package/dist/anvil-typeshed/source/anvil/tz.pyi +88 -0
  90. package/dist/anvil-typeshed/source/anvil/users/__init__.pyi +196 -0
  91. package/dist/anvil-typeshed/source/anvil/users/mfa.pyi +74 -0
  92. package/dist/anvil-typeshed/source/stripe/__init__.pyi +4 -0
  93. package/dist/anvil-typeshed/source/stripe/checkout.pyi +65 -0
  94. package/dist/pyright-langserver.js +1 -1
  95. package/dist/pyright-langserver.js.map +1 -1
  96. package/dist/pyright.js +1 -1
  97. package/dist/pyright.js.map +1 -1
  98. package/package.json +1 -1
@@ -0,0 +1,188 @@
1
+ """The `anvil.email` module contains functions for sending and receiving email in your Anvil app.
2
+
3
+ [Anvil Docs](https://anvil.works/docs/email)"""
4
+
5
+ from typing import Callable, TypeVar, overload
6
+
7
+ from anvil import Media
8
+
9
+ # @server-only
10
+ # TypeVar for email handler functions
11
+ _MessageHandler = TypeVar("_MessageHandler", bound=Callable[["Message"], None])
12
+ # @end-server-only
13
+
14
+
15
+ class SendFailure(Exception):
16
+ """Raised when sending an email fails."""
17
+ ...
18
+
19
+
20
+ class DeliveryFailure(Exception):
21
+ """While handling an error, you can raise a DeliveryFailure exception to reject email delivery.
22
+
23
+ Optionally, you may specify a message and SMTP error code with the rejection.
24
+
25
+ [Anvil Docs](https://anvil.works/docs/email/sending_and_receiving#rejecting-email)"""
26
+
27
+ def __init__(self, message: str | None = None, smtp_code: int = 554) -> None: ...
28
+
29
+
30
+ class Address:
31
+ """Represents an email address."""
32
+ address: str
33
+ """The email address this object represents."""
34
+ name: str
35
+ """The name associated with the address this object represents."""
36
+ raw_value: str
37
+ """The full string value of this address."""
38
+
39
+
40
+ class SendReport:
41
+ """Report returned after sending an email."""
42
+ message_id: str
43
+ """The Message-ID header given to this outgoing message."""
44
+
45
+
46
+ class Message:
47
+ """Represents an incoming email message.
48
+
49
+ [Anvil Docs](https://anvil.works/docs/email/incoming)"""
50
+
51
+ class Envelope:
52
+ """The sender and recipient of an email, according to the SMTP envelope."""
53
+ from_address: str
54
+ """The email address from which this message was sent, according to the SMTP envelope."""
55
+ recipient: str
56
+ """The email address that received this message.
57
+
58
+ Note that this email address may not appear in any of the headers (eg if the email has been BCCed or blind forwarded)."""
59
+
60
+ class DKIM:
61
+ """Object describing whether a message was signed by the sending domain."""
62
+ valid_from_sender: bool
63
+ """Was this message signed by the domain in its envelope "from" address?"""
64
+ domains: list[str]
65
+ """A list of the DKIM domains that signed this message."""
66
+
67
+ class Addressees:
68
+ """The addresses an email was sent from and to, according to the headers."""
69
+ to_addresses: list[Address]
70
+ """The addresses this message was sent to."""
71
+ from_address: Address | None
72
+ """The address this message was sent from."""
73
+ cc_addresses: list[Address]
74
+ """The addresses this message was copied to."""
75
+
76
+ envelope: Envelope
77
+ """The sender and recipient of this email, according to the SMTP envelope."""
78
+ dkim: DKIM
79
+ """Object describing whether this message was signed by the sending domain."""
80
+ addressees: Addressees
81
+ """The addresses this email was sent from and to, according to the headers."""
82
+ headers: list[tuple[str, str]]
83
+ """All the headers in this email, as a list of (name, value) pairs."""
84
+ text: str | None
85
+ """The plain-text content of this email, or None if there is no plain-text part."""
86
+ subject: str | None
87
+ """The subject of this email, or None if there is no subject."""
88
+ html: str | None
89
+ """The HTML content of this email, or None if there is no HTML part."""
90
+ attachments: list[Media]
91
+ """A list of this email's attachments."""
92
+ inline_attachments: dict[str, Media]
93
+ """A dictionary of this email's inline attachments. Keys are ContentID headers, values are the attachments as Media Objects."""
94
+
95
+ def get_header(self, header_name: str, default: str | None = None) -> str | None:
96
+ """Return the value of the specified header, or default value if it is not present.
97
+
98
+ Case-insensitive. If the header is specified multiple times, returns the first value."""
99
+ ...
100
+
101
+ def list_header(self, header_name: str) -> list[str]:
102
+ """Return a list containing every value of the specified header. Case-insensitive."""
103
+ ...
104
+
105
+ def reply(
106
+ self,
107
+ *,
108
+ to: str | list[str] | None = None,
109
+ cc: str | list[str] | None = None,
110
+ bcc: str | list[str] | None = None,
111
+ from_address: str | None = None,
112
+ from_name: str | None = None,
113
+ subject: str | None = None,
114
+ text: str | None = None,
115
+ html: str | None = None,
116
+ attachments: list[Media] | None = None,
117
+ ) -> SendReport:
118
+ """Reply to this email."""
119
+ ...
120
+
121
+
122
+ def send(
123
+ *,
124
+ to: str | list[str] | None = None,
125
+ cc: str | list[str] | None = None,
126
+ bcc: str | list[str] | None = None,
127
+ from_address: str = "no-reply",
128
+ from_name: str | None = None,
129
+ subject: str | None = None,
130
+ text: str | None = None,
131
+ html: str | None = None,
132
+ attachments: list[Media] | None = None,
133
+ inline_attachments: dict[str, Media] | None = None,
134
+ ) -> SendReport:
135
+ """Send an email.
136
+
137
+ Args:
138
+ to: The email recipient[s] in the 'To' field. Can be a string or list of strings.
139
+ Each string can be a bare address (eg 'joe@example.com') or include a display name (eg 'Joe Bloggs <joe@example.com>').
140
+ cc: The email recipient[s] in the 'Cc' field. Can be a string or list of strings.
141
+ bcc: The email recipient[s] in the 'Bcc' field. Can be a string or list of strings.
142
+ from_address: The From: address from this email. If no domain is specified, or the specified domain is not a legal sending domain for this app, the address will be replaced with a valid domain.
143
+ from_name: The name associated with the From: address for this email. (Only valid if the from_address is a bare email address.)
144
+ subject: The subject line for this email.
145
+ text: The plain-text (no HTML) content for this email. You must specify at least one of 'text' and 'html'.
146
+ html: The HTML content for this email. You must specify at least one of 'text' and 'html'.
147
+ attachments: A list of Media objects to send as attachments with this email.
148
+ inline_attachments: Inline attachments that can be used in this email's HTML, for example in <img> tags. Must be a dictionary whose keys are IDs and values are Media objects. IDs can then be used in a message's HTML with 'cid:xxx' URIs.
149
+
150
+ [Anvil Docs](https://anvil.works/docs/email)"""
151
+ ...
152
+
153
+
154
+ # @server-only
155
+ @overload
156
+ def handle_message(fn: _MessageHandler) -> _MessageHandler:
157
+ """Decorator to handle incoming emails.
158
+
159
+ [Anvil Docs](https://anvil.works/docs/email/incoming)"""
160
+ ...
161
+
162
+
163
+ @overload
164
+ def handle_message(*, require_dkim: bool = False) -> Callable[[_MessageHandler], _MessageHandler]:
165
+ """Decorator to handle incoming emails.
166
+
167
+ Args:
168
+ require_dkim: If True, reject emails without a valid DKIM signature from the sender.
169
+
170
+ [Anvil Docs](https://anvil.works/docs/email/incoming)"""
171
+ ...
172
+
173
+
174
+ def handle_message(
175
+ fn: _MessageHandler | None = None, require_dkim: bool = False
176
+ ) -> _MessageHandler | Callable[[_MessageHandler], _MessageHandler]:
177
+ """Decorator to handle incoming emails.
178
+
179
+ Can be used with or without arguments:
180
+ - `@anvil.email.handle_message` - handle all incoming emails
181
+ - `@anvil.email.handle_message(require_dkim=True)` - only handle emails with valid DKIM
182
+
183
+ Args:
184
+ require_dkim: If True, reject emails without a valid DKIM signature from the sender.
185
+
186
+ [Anvil Docs](https://anvil.works/docs/email/incoming)"""
187
+ ...
188
+ # @end-server-only
@@ -0,0 +1,4 @@
1
+ # Type stubs for anvil.facebook module
2
+ # Generated files: client/anvil/facebook/__init__.pyi, server/anvil/facebook/__init__.pyi
3
+
4
+ from anvil.facebook import auth as auth
@@ -0,0 +1,28 @@
1
+ # Type stubs for anvil.facebook.auth module
2
+ # Generated files: client/anvil/facebook/auth.pyi, server/anvil/facebook/auth.pyi
3
+
4
+ # @client-only
5
+ def login() -> None:
6
+ """Prompt the user to log in with their Facebook account."""
7
+ ...
8
+ # @end-client-only
9
+
10
+ def get_user_email() -> str | None:
11
+ """Get the email address of the currently-logged-in Facebook user.
12
+
13
+ To log in with Facebook, call facebook.auth.login() from form code."""
14
+ ...
15
+
16
+ def get_user_id() -> str | None:
17
+ """Get the Facebook user ID of the currently-logged-in Facebook user.
18
+
19
+ To log in with Facebook, call facebook.auth.login() from form code."""
20
+ ...
21
+
22
+ def get_user_access_token() -> str | None:
23
+ """Get the Facebook access token of the currently-logged-in Facebook user.
24
+
25
+ To log in with Facebook, call facebook.auth.login() from form code.
26
+
27
+ [Anvil Docs](https://anvil.works/docs/integrations/facebook)"""
28
+ ...
@@ -0,0 +1,50 @@
1
+ # @server-only-file
2
+ # Type stubs for anvil.files module
3
+ # Generated files: server/anvil/files.pyi
4
+
5
+ from typing import IO, Any
6
+
7
+ class OpenContextManager:
8
+ """Context manager for opening data files."""
9
+
10
+ def __enter__(self) -> IO[Any]:
11
+ """Open the file."""
12
+ ...
13
+ def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
14
+ """Close the file, uploading its contents if it was opened for writing or appending."""
15
+ ...
16
+
17
+ class EditingContextManager:
18
+ """Context manager for editing data files."""
19
+
20
+ def __enter__(self) -> str:
21
+ """Begin editing the file. Returns the path to a temporary file."""
22
+ ...
23
+ def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
24
+ """End editing the file, uploading its new contents."""
25
+ ...
26
+
27
+ class Files:
28
+ """Access to Data Files from the Data Files Service.
29
+
30
+ To access a file stored in the Data Files Service use square brackets
31
+ containing the path of the desired file - `data_files['<file_path>']`."""
32
+
33
+ def __getitem__(self, path: str) -> str:
34
+ """Return the path of a file."""
35
+ ...
36
+ def editing(self, path: str) -> EditingContextManager:
37
+ """Edit a file.
38
+
39
+ To ensure the proper acquisition and release of the file, use the `editing`
40
+ function in a `with` statement e.g. `with data_files.editing('test.txt') as file:`"""
41
+ ...
42
+ def open(self, path: str, mode: str = "r") -> OpenContextManager:
43
+ """The open() function opens the file (if possible) and returns the corresponding file object."""
44
+ ...
45
+
46
+ data_files: Files
47
+ """Access Data Files from the Data Files Service.
48
+
49
+ To access a file stored in the Data Files Service use square brackets
50
+ containing the path of the desired file - `data_files['<file_path>']`."""
@@ -0,0 +1,7 @@
1
+ # Type stubs for anvil.google module
2
+ # Generated files: client/anvil/google/__init__.pyi, server/anvil/google/__init__.pyi
3
+
4
+ from anvil.google import auth as auth
5
+ from anvil.google import drive as drive
6
+ from anvil.google import mail as mail
7
+ from anvil.google import sheets as sheets
@@ -0,0 +1,35 @@
1
+ # Type stubs for anvil.google.auth module
2
+ # Generated files: client/anvil/google/auth.pyi, server/anvil/google/auth.pyi
3
+
4
+ # @client-only
5
+ def login(additional_scopes: list[str] | None = None) -> None:
6
+ """Prompt the user to log in with their Google account.
7
+
8
+ If you have specified your own client ID in the Google Service configuration,
9
+ you can specify additional OAuth scopes for use with the Google REST API."""
10
+ ...
11
+ # @end-client-only
12
+
13
+ def get_user_email() -> str | None:
14
+ """Get the email address of the currently-logged-in Google user.
15
+
16
+ To log in with Google, call anvil.google.auth.login() from form code."""
17
+ ...
18
+
19
+ def get_user_access_token() -> str | None:
20
+ """Get the secret access token of the currently-logged-in Google user, for use with the Google REST API.
21
+
22
+ Requires this app to have its own Google client ID and secret."""
23
+ ...
24
+
25
+ def get_user_refresh_token() -> str | None:
26
+ """Get the secret refresh token of the currently-logged-in Google user, for use with the Google REST API.
27
+
28
+ Requires this app to have its own Google client ID and secret."""
29
+ ...
30
+
31
+ def refresh_access_token(refresh_token: str, /) -> str:
32
+ """Get a new access token from a refresh token you have saved, for use with the Google REST API.
33
+
34
+ Requires this app to have its own Google client ID and secret."""
35
+ ...
@@ -0,0 +1,94 @@
1
+ # Type stubs for anvil.google.drive module
2
+ # Generated files: client/anvil/google/drive.pyi, server/anvil/google/drive.pyi
3
+
4
+ from typing import Iterator
5
+
6
+ from anvil import Media
7
+
8
+ class DriveItem:
9
+ """Base class for Google Drive items (files and folders)."""
10
+
11
+ id: str
12
+ """ID of the DriveItem."""
13
+
14
+ def move(self, dest_folder: "Folder", /) -> None:
15
+ """Move the DriveItem from one folder to another."""
16
+ ...
17
+ def trash(self) -> None:
18
+ """Move the DriveItem to the trash folder."""
19
+ ...
20
+ def delete(self) -> None:
21
+ """Delete the DriveItem (this cannot be undone)."""
22
+ ...
23
+
24
+ class File(DriveItem, Media):
25
+ """A Google Drive file."""
26
+
27
+ def get_bytes(self) -> bytes:
28
+ """Get the contents of an object representing a Google Drive file.
29
+
30
+ Native Google files such as Docs, Slides and Sheets must first be exported
31
+ to an appropriate file type. All other file types support get_bytes()."""
32
+ ...
33
+ def set_bytes(self, content: bytes, /) -> None:
34
+ """Set the contents of an object representing a Google Drive file."""
35
+ ...
36
+ def set_media(self, media: Media, /) -> None:
37
+ """Upload new contents to an existing File.
38
+
39
+ Media must be a Media object."""
40
+ ...
41
+
42
+ class Folder(DriveItem):
43
+ """A Google Drive folder.
44
+
45
+ [Anvil Docs](https://anvil.works/docs/integrations/google/google-drive#folders)"""
46
+
47
+ folders: list["Folder"]
48
+ """List of Folder items in the Folder."""
49
+
50
+ files: list[File]
51
+ """List of File items in the Folder."""
52
+
53
+ def list_files(self) -> Iterator[File]:
54
+ """List the files (not folders) in the Folder."""
55
+ ...
56
+ def list_folders(self) -> Iterator["Folder"]:
57
+ """List the folders (not files) in the Folder."""
58
+ ...
59
+ def get(self, title: str, /) -> File | None:
60
+ """Get the File item by title.
61
+
62
+ The title argument should be a string."""
63
+ ...
64
+ def get_by_id(self, id: str, /) -> File | None:
65
+ """Get the File item by ID.
66
+
67
+ The ID argument should be a string."""
68
+ ...
69
+ def create_folder(self, title: str, /) -> "Folder":
70
+ """Create a new folder within the Folder."""
71
+ ...
72
+ def create_file(
73
+ self,
74
+ title: str,
75
+ *,
76
+ content_bytes: bytes | None = None,
77
+ content_type: str = "text/plain",
78
+ ) -> File:
79
+ """Create a new file within the Folder."""
80
+ ...
81
+
82
+ def login(*, extra_scopes: list[str] | None = None) -> None:
83
+ """Prompt the user to log in to their Google account and ask permission to access their Google Drive files.
84
+
85
+ [Anvil Docs](https://anvil.works/docs/integrations/google/google-drive#user-files)"""
86
+ ...
87
+
88
+ def get_user_files() -> Folder:
89
+ """Return the top-level folder containing all the files in the Users drive.
90
+
91
+ anvil.google.drive.login() must be called first.
92
+
93
+ [Anvil Docs](https://anvil.works/docs/integrations/google/google-drive#user-files)"""
94
+ ...
@@ -0,0 +1,21 @@
1
+ # @server-only-file
2
+ # Type stubs for anvil.google.mail module
3
+ # Generated files: server/anvil/google/mail.pyi
4
+
5
+ def send(
6
+ *,
7
+ to: str | list[str] | None = None,
8
+ subject: str | None = None,
9
+ text: str | None = None,
10
+ html: str | None = None,
11
+ cc: str | list[str] | None = None,
12
+ bcc: str | list[str] | None = None,
13
+ from_address: str | None = None,
14
+ draft: bool = False,
15
+ ) -> None:
16
+ """Send an email via GMail.
17
+
18
+ 'to', 'cc' and 'bcc' may be strings (email addresses) or lists of strings (multiple addresses).
19
+ At least one of 'text' and 'html' need to be provided (both strings).
20
+ Passing draft=True will create a draft message rather than sending it."""
21
+ ...
@@ -0,0 +1,94 @@
1
+ # Type stubs for anvil.google.sheets module
2
+ # Generated files: client/anvil/google/sheets.pyi, server/anvil/google/sheets.pyi
3
+
4
+ from typing import Any, Iterator
5
+
6
+ class Cell:
7
+ """A cell in a Google Sheets worksheet."""
8
+
9
+ row: int
10
+ """This cell's row index (starting from 1)."""
11
+
12
+ col: int
13
+ """This cell's column index (starting from 1)."""
14
+
15
+ value: str
16
+ """The value in this cell."""
17
+
18
+ input_value: str
19
+ """The value that was entered into the cell."""
20
+
21
+ class Row:
22
+ """A row in a Google Sheets worksheet."""
23
+
24
+ def __getattr__(self, name: str) -> Any: ...
25
+ def __setattr__(self, name: str, value: Any) -> None: ...
26
+ def delete(self) -> None:
27
+ """Delete this row from the worksheet.
28
+
29
+ This will cause data in subsequent rows to shift up."""
30
+ ...
31
+
32
+ class Worksheet:
33
+ """A worksheet (tab) in a Google Sheets spreadsheet."""
34
+
35
+ title: str
36
+ """The title of this worksheet."""
37
+
38
+ row_count: int
39
+ """The number of rows in this worksheet."""
40
+
41
+ column_count: int
42
+ """The number of columns in this worksheet."""
43
+
44
+ fields: list[str]
45
+ """The fields in this worksheet (ie the column headers, or the values in the first row)."""
46
+
47
+ rows: list[Row]
48
+ """The rows in this worksheet (excluding the header)."""
49
+
50
+ cells: list[Cell]
51
+ """A list of all the cells in this worksheet."""
52
+
53
+ def list_rows(self, **query: Any) -> list[Row]:
54
+ """List rows in this worksheet.
55
+
56
+ Optionally restricting to rows with the specified column values
57
+ specified as keyword arguments."""
58
+ ...
59
+ def add_row(self, **fields: Any) -> Row:
60
+ """Add a row to the end of the worksheet.
61
+
62
+ Specifying values for columns as keywords arguments."""
63
+ ...
64
+ def list_cells(
65
+ self,
66
+ *,
67
+ min_row: int | None = None,
68
+ max_row: int | None = None,
69
+ min_col: int | None = None,
70
+ max_col: int | None = None,
71
+ ) -> list[Cell]:
72
+ """List cells in the worksheet, optionally specifying a region."""
73
+ ...
74
+ def get_cell(self, row: int, col: int) -> Cell:
75
+ """Get a particular cell from the spreadsheet."""
76
+ ...
77
+ def __iter__(self) -> Iterator[Cell]: ...
78
+
79
+ class Spreadsheet:
80
+ """A Google Sheets spreadsheet."""
81
+
82
+ title: str
83
+ """The title of this spreadsheet."""
84
+
85
+ id: str
86
+ """The ID of this spreadsheet in Google Drive."""
87
+
88
+ worksheets: list[Worksheet]
89
+ """The worksheets in this spreadsheet."""
90
+
91
+ def list_worksheets(self) -> list[Worksheet]:
92
+ """Get a list of all worksheets in this spreadsheet."""
93
+ ...
94
+ def __iter__(self) -> Iterator[Worksheet]: ...
@@ -0,0 +1,62 @@
1
+ # Type stubs for anvil.http module
2
+ # Generated files: client/anvil/http.pyi, server/anvil/http.pyi
3
+
4
+ from typing import Any
5
+
6
+ from anvil import Media
7
+
8
+ class HttpError(Exception):
9
+ """HTTP error with status code and content.
10
+
11
+ [Anvil Docs](https://anvil.works/docs/http-apis/making-http-requests)"""
12
+
13
+ status: int
14
+ """The numeric HTTP status error (eg 404 for "not found").
15
+
16
+ Status will be 0 for errors that prevent the request completing at all
17
+ (eg cross-origin policy in the browser)."""
18
+
19
+ content: Media
20
+ """The content returned by the request (eg the body of a 404 response)."""
21
+
22
+ class UrlEncodingError(Exception):
23
+ """URL encoding/decoding error."""
24
+ ...
25
+
26
+ def request(
27
+ url: str,
28
+ *,
29
+ method: str = "GET",
30
+ data: Any = None,
31
+ json: bool = False,
32
+ headers: dict[str, str] | None = None,
33
+ username: str | None = None,
34
+ password: str | None = None,
35
+ timeout: int | float | None = None,
36
+ ) -> Media | Any:
37
+ """Make an HTTP request to the specified URL.
38
+
39
+ Args:
40
+ url: The request will be made to this URL.
41
+ method: The HTTP method. Defaults to 'GET'.
42
+ data: The data to send in the request body.
43
+ json: If set to True, the response is parsed into Python objects (dicts/lists/etc),
44
+ and 'data' is JSON-encoded before sending. If False, the response will be a Media object.
45
+ headers: A dict of strings to set HTTP headers.
46
+ username: If specified, used to perform HTTP Basic authentication.
47
+ password: If specified, used to perform HTTP Basic authentication.
48
+ timeout: An int or float representing the amount of time, in seconds, to wait for a response.
49
+ Default is 60 seconds.
50
+
51
+ [Anvil Docs](https://anvil.works/docs/http-apis/making-http-requests)"""
52
+ ...
53
+
54
+ def url_encode(string_to_encode: str, /) -> str:
55
+ """URL-encode a string."""
56
+ ...
57
+
58
+ def url_decode(string_to_decode: str, /) -> str:
59
+ """URL-decode a string.
60
+
61
+ Raises UrlEncodingError on failure."""
62
+ ...
@@ -0,0 +1,26 @@
1
+ # Type stubs for anvil.image module
2
+ # Generated files: client/anvil/image.pyi, server/anvil/image.pyi
3
+
4
+ from anvil import Media
5
+
6
+ class ImageException(Exception):
7
+ """Image processing exception."""
8
+ ...
9
+
10
+ def get_dimensions(image_media: Media, /) -> tuple[int, int]:
11
+ """Get the dimensions of an image (width, height).
12
+
13
+ Pass in an anvil.Media object representing the image."""
14
+ ...
15
+
16
+ def generate_thumbnail(image_media: Media, max_size: int, /) -> Media:
17
+ """Resize the supplied image so that neither width nor height exceeds max_size (in pixels).
18
+
19
+ Pass in an anvil.Media object representing the image."""
20
+ ...
21
+
22
+ def rotate(image_media: Media, angle: float, /) -> Media:
23
+ """Rotate the supplied image clockwise by the given number of degrees.
24
+
25
+ Pass in an anvil.Media object representing the image."""
26
+ ...