bifrostsdk 1.0.0__py3-none-any.whl

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 (48) hide show
  1. bifrostsdk-1.0.0.dist-info/LICENSE +21 -0
  2. bifrostsdk-1.0.0.dist-info/METADATA +124 -0
  3. bifrostsdk-1.0.0.dist-info/RECORD +48 -0
  4. bifrostsdk-1.0.0.dist-info/WHEEL +5 -0
  5. bifrostsdk-1.0.0.dist-info/top_level.txt +1 -0
  6. byfrost/__init__.py +46 -0
  7. byfrost/__init__.pyi +81 -0
  8. byfrost/bifrost.py +148 -0
  9. byfrost/bifrost.pyi +36 -0
  10. byfrost/gcs/__init__.py +3 -0
  11. byfrost/gcs/__init__.pyi +3 -0
  12. byfrost/gcs/gcs.py +189 -0
  13. byfrost/gcs/gcs.pyi +65 -0
  14. byfrost/pinata/__init__.py +0 -0
  15. byfrost/pinata/__init__.pyi +0 -0
  16. byfrost/pinata/pinata.py +221 -0
  17. byfrost/pinata/pinata.pyi +54 -0
  18. byfrost/s3/__init__.py +0 -0
  19. byfrost/s3/__init__.pyi +0 -0
  20. byfrost/s3/s3.py +188 -0
  21. byfrost/s3/s3.pyi +65 -0
  22. byfrost/shared/__init__.py +3 -0
  23. byfrost/shared/config/__init__.py +29 -0
  24. byfrost/shared/config/__init__.pyi +29 -0
  25. byfrost/shared/config/option.py +21 -0
  26. byfrost/shared/config/provider.py +22 -0
  27. byfrost/shared/config/request.py +24 -0
  28. byfrost/shared/config/url.py +24 -0
  29. byfrost/shared/errors/__init__.py +16 -0
  30. byfrost/shared/errors/__init__.pyi +16 -0
  31. byfrost/shared/errors/color.py +18 -0
  32. byfrost/shared/errors/constant.py +30 -0
  33. byfrost/shared/errors/interface.py +21 -0
  34. byfrost/shared/errors/interface.pyi +21 -0
  35. byfrost/shared/errors/loga.py +28 -0
  36. byfrost/shared/errors/loga.pyi +21 -0
  37. byfrost/shared/request/__init__.py +1 -0
  38. byfrost/shared/request/__init__.pyi +1 -0
  39. byfrost/shared/request/builder.py +51 -0
  40. byfrost/shared/types/__init__.py +1 -0
  41. byfrost/shared/types/dataclass/__init__.py +4 -0
  42. byfrost/shared/types/dataclass/__init__.pyi +4 -0
  43. byfrost/shared/types/dataclass/bridge.py +155 -0
  44. byfrost/shared/types/dataclass/file.py +222 -0
  45. byfrost/shared/types/typeddict/__init__.py +12 -0
  46. byfrost/shared/types/typeddict/__init__.pyi +12 -0
  47. byfrost/shared/types/typeddict/bridge.py +85 -0
  48. byfrost/shared/types/typeddict/file.py +203 -0
@@ -0,0 +1,155 @@
1
+ #!usr/bin/env python3
2
+
3
+ from typing import Optional, Callable, Tuple, List
4
+ from dataclasses import dataclass
5
+
6
+ from . import file as bfile
7
+ from ...errors.interface import BifrostError
8
+
9
+
10
+ @dataclass
11
+ class BridgeConfig:
12
+ """
13
+ BridgeConfig is the configuration for the rainbow bridge.
14
+
15
+ Attributes:
16
+
17
+ provider {str}{required} -- provider is the name of the cloud storage service to use.
18
+
19
+ zone {str} -- zone is the service zone to use for storage.
20
+
21
+ default_bucket {str} -- default_bucket is the default storage bucket to use for storing.
22
+ This is only implemented by some providers (e.g. google cloud storage, s3).
23
+
24
+ credentials_file {str} -- credentials_file is the path to the credentials file.
25
+
26
+ secret_key {str} -- secret_key is the secret key for iam authentication.
27
+
28
+ access_key {str} -- access_key is the access key for iam authentication.
29
+
30
+ region {str} -- region is the service region to use for storing.
31
+ This is only implemented by some providers (e.g. s3, google cloud storage).
32
+
33
+ default_timeout {int} -- default_timeout is the time-to-live for time-dependent storage operations.
34
+
35
+ enable_debug {bool} -- enable_debug enables debug logging.
36
+
37
+ project {str} -- project is the cloud project to use for storage.
38
+ This is only implemented by some providers (e.g. google cloud storage).
39
+
40
+ public_read {bool} -- public_read enables public read access to uploaded files.
41
+
42
+ use_async {bool} -- use_async enables asynchronous operations with any of asyncio, threads, queue, and multi-processing.
43
+
44
+ pinata_jwt {str} -- pinata_jwt is the jwt generated for your pinata cloud account.
45
+ """
46
+
47
+ provider: str
48
+ """provider is the name of the cloud storage service to use."""
49
+
50
+ zone: Optional[str] = ""
51
+ """zone is the service zone to use for storage."""
52
+
53
+ default_bucket: Optional[str] = ""
54
+ """default_bucket is the default storage bucket to use for storing."""
55
+
56
+ credentials_file: Optional[str] = ""
57
+ """credentials_file is the path to the credentials file."""
58
+
59
+ secret_key: Optional[str] = ""
60
+ """secret_key is the secret key for iam authentication."""
61
+
62
+ access_key: Optional[str] = ""
63
+ """access_key is the access key for iam authentication."""
64
+
65
+ region: Optional[str] = ""
66
+ """region is the service region to use for storing."""
67
+
68
+ default_timeout: Optional[int] = 0
69
+ """default_timeout is the time-to-live for time-dependent storage operations."""
70
+
71
+ enable_debug: Optional[bool] = False
72
+ """enable_debug enables debug logging."""
73
+
74
+ project: Optional[str] = ""
75
+ """project is the cloud project to use for storage. This is only implemented by some providers (e.g. google cloud storage)."""
76
+
77
+ public_read: Optional[bool] = False
78
+ """public_read enables public read access to uploaded files."""
79
+
80
+ use_async: Optional[bool] = False
81
+ """use_async enables asynchronous operations with any of asyncio, threads, queue, and multi-processing."""
82
+
83
+ pinata_jwt: Optional[str] = ""
84
+ """pinata_jwt is the jwt generated for your pinata cloud account."""
85
+
86
+
87
+ @dataclass
88
+ class RainbowBridge:
89
+ """
90
+ The RainbowBridge interface for Google Cloud Storage. All providers must implement
91
+ this interface completely.
92
+
93
+ Attributes:
94
+
95
+ upload_file uploads a file to the provider storage and returns an error if one occurs.
96
+ Note: for some providers, upload_file requires that a default bucket be set in bifrosbfile.BridgeConfig.
97
+
98
+ upload_multi_file uploads mutliple files to the provider storage and returns an error if one occurs. If any of the
99
+ uploads fail, the error is appended to the []UploadedFile.Error and also logged when debug is enabled while the
100
+ rest of the uploads continue. Note: for some providers, UploadMultiFile requires that a default bucket be set
101
+ in bifrosbfile.BridgeConfig.
102
+
103
+ disconnect closes the provider client connection and returns an error if one occurs. Disconnect should
104
+ only be called when the connection is no longer needed.
105
+
106
+ config returns the provider configuration.
107
+
108
+ is_connected returns true if there is an active connection to the provider.
109
+
110
+ upload_folder uploads a folder to the provider storage and returns an error if one occurs.
111
+ Note: for some providers, upload_folder requires that a default bucket be set in bifrosbfile.BridgeConfig.
112
+
113
+ """
114
+
115
+ upload_file: Callable[[bfile.File], Tuple[bfile.UploadedFile, BifrostError]]
116
+ """
117
+ upload_file uploads a file to the provider storage and returns an error if one occurs.
118
+
119
+ Note: for some providers, upload_file requires that a default bucket be set in bifrosbfile.BridgeConfig.
120
+ """
121
+
122
+ upload_multi_file: Callable[
123
+ [bfile.MultiFile], Tuple[List[bfile.UploadedFile], BifrostError]
124
+ ]
125
+ """
126
+ upload_multi_file uploads mutliple files to the provider storage and returns an error if one occurs. If any of the uploads fail, the error is appended to the []UploadedFile.Error and also logged when debug is enabled while the rest of the uploads continue.
127
+
128
+ Note: for some providers, UploadMultiFile requires that a default bucket be set in bifrosbfile.BridgeConfig.
129
+ """
130
+
131
+ disconnect: Callable[[], BifrostError]
132
+ """
133
+ disconnect closes the provider client connection and returns an error if one occurs.
134
+
135
+ Disconnect should only be called when the connection is no longer needed.
136
+ """
137
+
138
+ config: Callable[[], BridgeConfig]
139
+ """
140
+ config returns the provider configuration.
141
+ """
142
+
143
+ is_connected: Callable[[], bool]
144
+ """
145
+ is_connected returns true if there is an active connection to the provider.
146
+ """
147
+
148
+ upload_folder: Callable[
149
+ [bfile.MultiFile], Tuple[List[bfile.UploadedFile], BifrostError]
150
+ ]
151
+ """
152
+ upload_folder uploads a folder to the provider storage and returns an error if one occurs.
153
+
154
+ Note: for some providers, upload_folder requires that a default bucket be set in bifrosbfile.BridgeConfig.
155
+ """
@@ -0,0 +1,222 @@
1
+ #!usr/bin/env python3
2
+
3
+ """
4
+ All type definitions to files in bifrost but using Typed.
5
+
6
+ This is majorly for end users who want to pass a kwargs dict to the bifrost dataclass when using bifrost functions.
7
+ """
8
+
9
+ import queue
10
+ from typing import Optional, Dict, Any, List
11
+ from dataclasses import dataclass
12
+
13
+ # from shared.errors.interface import BifrostError
14
+ from ...errors.interface import BifrostError
15
+
16
+
17
+ @dataclass
18
+ class Options:
19
+ """
20
+ Options is a dict of options to store along with each file.
21
+
22
+ Attributes:
23
+ metadata {Dict[str, Any]} -- metadata is a map of metadata to store along with each file.
24
+ acl {str} -- acl is the access control list to specify the visibility of the file.
25
+ public: anyone can access the file.
26
+ private: only authenticated users can access the file.
27
+ """
28
+
29
+ metadata: Optional[Dict[str, Any]] = None
30
+ """metadata is a map of metadata to store along with each file."""
31
+
32
+ acl: Optional[str] = ""
33
+ """acl is the access control list to specify the visibility of the file
34
+ public: anyone can access the file.
35
+ private: only authenticated users can access the file.
36
+ """
37
+
38
+
39
+ @dataclass
40
+ class File:
41
+ """
42
+ File is the dict for uploading a single file
43
+
44
+ Attributes:
45
+ path {str}{required} -- path is the path to the file.
46
+
47
+ filename {str} -- filename is the name to store the file as with the provider.
48
+
49
+ options {Options} -- options is a dict of options to store along with each file.
50
+ """
51
+
52
+ path: str
53
+ """path is the path to the file."""
54
+
55
+ filename: Optional[str] = ""
56
+ """filename is the name to store the file as with the provider."""
57
+
58
+ options: Optional[Options] = None
59
+ """options is a dict of options to store along with each file."""
60
+
61
+ def validate(self):
62
+ if self.path == "" and self.handle is None:
63
+ return ValueError("file.path or file.handle is required")
64
+ if self.path != "" and self.handle is not None:
65
+ return ValueError("only one of file.path and file.handle can be set")
66
+ if self.filename == "" and self.handle is not None:
67
+ return ValueError("file.filename is required when file.handle is set")
68
+
69
+
70
+ @dataclass
71
+ class MultiFile:
72
+ """
73
+ MultiFile is the dict for uploading multiple files.
74
+ Along with options, you can also set global options that will be applied to all files.
75
+
76
+ Attributes:
77
+ files {List[File]} -- files is a list of files to upload
78
+
79
+ global_options {Options} -- global_options is a map of options to store along with all the files.
80
+ say 3 of 4 files need to share the same option, you can set globally for those 3 files and set the 4th
81
+ file's option separately, bifrost won't override the option.
82
+ """
83
+
84
+ files: List[File]
85
+ """files is a list of files to upload"""
86
+
87
+ global_options: Optional[Options] = None
88
+ """global_options is a map of options to store along with all the files.
89
+ say 3 of 4 files need to share the same option, you can set globally for those 3 files and set the 4th
90
+ file's option separately, bifrost won't override the option."""
91
+
92
+ def validate(self):
93
+ if len(self.files) == 0:
94
+ return ValueError("no files to upload")
95
+
96
+ for file in self.files:
97
+ file.validate()
98
+
99
+
100
+ @dataclass
101
+ class ParamFile:
102
+ """ "
103
+ ParamFile is the dict for uploading a single file in a multipart request.
104
+
105
+ Attributes:
106
+ name {str}{required} -- name is the name of the file.
107
+
108
+ path {str}{required} -- path is the path to the file.
109
+
110
+ key {str}{required} -- key is the key to use for the file.
111
+ """
112
+
113
+ name: str
114
+ """name is the name of the file."""
115
+
116
+ path: str
117
+ """path is the path to the file."""
118
+
119
+ key: str
120
+ """key is the key to use for the file."""
121
+
122
+
123
+ @dataclass
124
+ class ParamData:
125
+ """
126
+ ParamData is the dict for uploading data along with files in a multipart request.
127
+
128
+ Attributes:
129
+ key {str}{required} -- key is the key to use for the data.
130
+
131
+ value {str}{required} -- value is the value to use for the data.
132
+ """
133
+
134
+ key: str
135
+ """key is the key to use for the data."""
136
+
137
+ value: str
138
+ """value is the value to use for the data."""
139
+
140
+
141
+ @dataclass
142
+ class Param:
143
+ """
144
+ Param is the dict used to pass parameters to request methods
145
+
146
+ Attributes:
147
+ files {List[ParamFile]} -- files is a list of files to upload.
148
+
149
+ data {List[ParamData]} -- data is a list of data to upload along with the files.
150
+ """
151
+
152
+ files: Optional[List[ParamFile]] = None
153
+ """files is a list of files to upload."""
154
+
155
+ data: Optional[List[ParamData]] = None
156
+ """data is a list of data to upload along with the files."""
157
+
158
+
159
+ @dataclass
160
+ class UploadedFile:
161
+ """
162
+ UploadedFile is the dict representing a completed file/files upload.
163
+
164
+ Attributes:
165
+ name {str}{required} -- name is the name of the file.
166
+
167
+ bucket {str} -- bucket is the bucket the file was uploaded to.
168
+
169
+ path {str}{required} -- path is the local path to the file.
170
+
171
+ size {int}{required} -- size is the size of the file in bytes.
172
+
173
+ url {str}{required} -- url is the location of the file in the cloud.
174
+
175
+ preview {str}{required} -- preview is the url to a preview of the file.
176
+
177
+ provider_object {Any}{required} -- provider_object is the object returned by the cloud storage provider.
178
+ you need to cast it to the appropriate type before using it.
179
+
180
+ done {queue.Queue} -- done sends a message to signal when an async process is complete.
181
+
182
+ quit {queue.Queue} -- quit receives a message to signal for an exit of an async process.
183
+
184
+ cid {str} -- cid is the content identifier for the file.
185
+ this is only implemented by some providers (e.g. Pinata Cloud)
186
+
187
+ error {BifrostError} -- error is the error returned by the provider. This is only used for async operations
188
+ and multi file uploads.
189
+ """
190
+
191
+ name: str
192
+ """name is the name of the file."""
193
+
194
+ path: str
195
+ """path is the local path to the file."""
196
+
197
+ size: int
198
+ """size is the size of the file in bytes."""
199
+
200
+ url: str
201
+ """url is the location of the file in the cloud."""
202
+
203
+ preview: str
204
+ """preview is the url to a preview of the file."""
205
+
206
+ provider_object: Any
207
+ """provider_object is the object returned by the cloud storage provider."""
208
+
209
+ bucket: Optional[str] = ""
210
+ """bucket is the bucket the file was uploaded to."""
211
+
212
+ done: Optional[queue.Queue] = None
213
+ """done sends a message to signal when an async process is complete."""
214
+
215
+ quit: Optional[queue.Queue] = None
216
+ """quit receives a message to signal for an exit of an async process."""
217
+
218
+ cid: Optional[str] = ""
219
+ """cid is the content identifier for the file."""
220
+
221
+ error: Optional[BifrostError] = None
222
+ """error is the error returned by the provider. This is only used for async operations and multi file uploads."""
@@ -0,0 +1,12 @@
1
+ #!usr/bin/env python3
2
+
3
+ from .bridge import BridgeConfigDict
4
+ from .file import (
5
+ OptionsDict,
6
+ FileDict,
7
+ MultiFileDict,
8
+ ParamFileDict,
9
+ ParamDataDict,
10
+ ParamDict,
11
+ UploadedFileDict,
12
+ )
@@ -0,0 +1,12 @@
1
+ #!usr/bin/env python3
2
+
3
+ from .bridge import BridgeConfigDict
4
+ from .file import (
5
+ OptionsDict,
6
+ FileDict,
7
+ MultiFileDict,
8
+ ParamFileDict,
9
+ ParamDataDict,
10
+ ParamDict,
11
+ UploadedFileDict,
12
+ )
@@ -0,0 +1,85 @@
1
+ #!usr/bin/env python3
2
+
3
+ import sys
4
+ from typing import TypedDict
5
+
6
+ if sys.version_info < (3, 11):
7
+ from typing_extensions import NotRequired
8
+ else:
9
+ from typing import NotRequired
10
+
11
+
12
+ class BridgeConfigDict(TypedDict):
13
+ """
14
+ BridgeConfigDict is the configuration for the rainbow bridge.
15
+
16
+ Attributes:
17
+
18
+ provider {str}{required} -- provider is the name of the cloud storage service to use.
19
+
20
+ zone {str} -- zone is the service zone to use for storage.
21
+
22
+ default_bucket {str} -- default_bucket is the default storage bucket to use for storing.
23
+ This is only implemented by some providers (e.g. google cloud storage, s3).
24
+
25
+ credentials_file {str} -- credentials_file is the path to the credentials file.
26
+
27
+ secret_key {str} -- secret_key is the secret key for iam authentication.
28
+
29
+ access_key {str} -- access_key is the access key for iam authentication.
30
+
31
+ region {str} -- region is the service region to use for storing.
32
+ This is only implemented by some providers (e.g. s3, google cloud storage).
33
+
34
+ default_timeout {int} -- default_timeout is the time-to-live for time-dependent storage operations.
35
+
36
+ enable_debug {bool} -- enable_debug enables debug logging.
37
+
38
+ project {str} -- project is the cloud project to use for storage.
39
+ This is only implemented by some providers (e.g. google cloud storage).
40
+
41
+ public_read {bool} -- public_read enables public read access to uploaded files.
42
+
43
+ use_async {bool} -- use_async enables asynchronous operations with any of asyncio, threads, queue, and multi-processing.
44
+
45
+ pinata_jwt {str} -- pinata_jwt is the jwt generated for your pinata cloud account.
46
+ """
47
+
48
+ provider: str
49
+ """provider is the name of the cloud storage service to use."""
50
+
51
+ zone: NotRequired[str]
52
+ """zone is the service zone to use for storage."""
53
+
54
+ default_bucket: NotRequired[str]
55
+ """default_bucket is the default storage bucket to use for storing."""
56
+
57
+ credentials_file: NotRequired[str]
58
+ """credentials_file is the path to the credentials file."""
59
+
60
+ secret_key: NotRequired[str]
61
+ """secret_key is the secret key for iam authentication."""
62
+
63
+ access_key: NotRequired[str]
64
+ """access_key is the access key for iam authentication."""
65
+
66
+ region: NotRequired[str]
67
+ """region is the service region to use for storing."""
68
+
69
+ default_timeout: NotRequired[int]
70
+ """default_timeout is the time-to-live for time-dependent storage operations."""
71
+
72
+ enable_debug: NotRequired[bool]
73
+ """enable_debug enables debug logging."""
74
+
75
+ project: NotRequired[str]
76
+ """project is the cloud project to use for storage. This is only implemented by some providers (e.g. google cloud storage)."""
77
+
78
+ public_read: NotRequired[bool]
79
+ """public_read enables public read access to uploaded files."""
80
+
81
+ use_async: NotRequired[bool]
82
+ """use_async enables asynchronous operations with any of asyncio, threads, queue, and multi-processing."""
83
+
84
+ pinata_jwt: NotRequired[str]
85
+ """pinata_jwt is the jwt generated for your pinata cloud account."""
@@ -0,0 +1,203 @@
1
+ #!usr/bin/env python3
2
+
3
+ """
4
+ All type definitions to files in bifrost but using TypedDict.
5
+
6
+ This is majorly for end users who want to pass a kwargs dict to the bifrost dataclass when using bifrost functions.
7
+ """
8
+
9
+ import sys
10
+ from typing import TypedDict, Dict, Any, List
11
+ import queue
12
+ from ...errors.interface import BifrostError
13
+
14
+ if sys.version_info < (3, 11):
15
+ from typing_extensions import NotRequired
16
+ else:
17
+ from typing import NotRequired
18
+
19
+
20
+ class OptionsDict(TypedDict):
21
+ """
22
+ Options is a dict of options to store along with each file.
23
+
24
+ Attributes:
25
+ metadata {Dict[str, Any]} -- metadata is a map of metadata to store along with each file.
26
+ acl {str} -- acl is the access control list to specify the visibility of the file.
27
+ public: anyone can access the file.
28
+ private: only authenticated users can access the file.
29
+ """
30
+
31
+ metadata: NotRequired[Dict[str, Any]]
32
+ """metadata is a map of metadata to store along with each file."""
33
+
34
+ acl: NotRequired[str]
35
+ """acl is the access control list to specify the visibility of the file
36
+ public: anyone can access the file.
37
+ private: only authenticated users can access the file.
38
+ """
39
+
40
+
41
+ class FileDict(TypedDict):
42
+ """
43
+ File is the dict for uploading a single file
44
+
45
+ Attributes:
46
+ path {str}{required} -- path is the path to the file.
47
+
48
+ filename {str} -- filename is the name to store the file as with the provider.
49
+
50
+ options {OptionsDict} -- options is a dict of options to store along with each file.
51
+ """
52
+
53
+ path: str
54
+ """path is the path to the file."""
55
+
56
+ filemane: NotRequired[str]
57
+ """filename is the name to store the file as with the provider."""
58
+
59
+ options: NotRequired[OptionsDict]
60
+ """options is a dict of options to store along with each file."""
61
+
62
+
63
+ class MultiFileDict(TypedDict):
64
+ """
65
+ MultiFile is the dict for uploading multiple files.
66
+ Along with options, you can also set global options that will be applied to all files.
67
+
68
+ Attributes:
69
+ files {List[FileDict]} -- files is a list of files to upload
70
+
71
+ global_options {OptionsDict} -- global_options is a map of options to store along with all the files.
72
+ say 3 of 4 files need to share the same option, you can set globally for those 3 files and set the 4th
73
+ file's option separately, bifrost won't override the option.
74
+ """
75
+
76
+ files: List[FileDict]
77
+ """files is a list of files to upload"""
78
+
79
+ global_options: NotRequired[OptionsDict]
80
+ """global_options is a map of options to store along with all the files.
81
+ say 3 of 4 files need to share the same option, you can set globally for those 3 files and set the 4th
82
+ file's option separately, bifrost won't override the option."""
83
+
84
+
85
+ class ParamFileDict(TypedDict):
86
+ """
87
+ ParamFile is the dict for uploading a single file in a multipart request.
88
+
89
+ Attributes:
90
+ name {str}{required} -- name is the name of the file.
91
+
92
+ path {str}{required} -- path is the path to the file.
93
+
94
+ key {str}{required} -- key is the key to use for the file.
95
+ """
96
+
97
+ name: str
98
+ """name is the name of the file."""
99
+
100
+ path: str
101
+ """path is the path to the file."""
102
+
103
+ key: str
104
+ """key is the key to use for the file."""
105
+
106
+
107
+ class ParamDataDict(TypedDict):
108
+ """
109
+ ParamData is the dict for uploading data along with files in a multipart request.
110
+
111
+ Attributes:
112
+ key {str}{required} -- key is the key to use for the data.
113
+
114
+ value {str}{required} -- value is the value to use for the data.
115
+ """
116
+
117
+ key: str
118
+ """key is the key to use for the data."""
119
+
120
+ value: str
121
+ """value is the value to use for the data."""
122
+
123
+
124
+ class ParamDict(TypedDict):
125
+ """
126
+ Param is the dict used to pass parameters to request methods
127
+
128
+ Attributes:
129
+ files {List[ParamFile]} -- files is a list of files to upload.
130
+
131
+ data {List[ParamData]} -- data is a list of data to upload along with the files.
132
+ """
133
+
134
+ files: NotRequired[List[ParamFileDict]]
135
+ """files is a list of files to upload."""
136
+
137
+ data: NotRequired[List[ParamDataDict]]
138
+ """data is a list of data to upload along with the files."""
139
+
140
+
141
+ class UploadedFileDict(TypedDict):
142
+ """
143
+ UploadedFile is the dict representing a completed file/files upload.
144
+
145
+ Attributes:
146
+ name {str}{required} -- name is the name of the file.
147
+
148
+ bucket {str} -- bucket is the bucket the file was uploaded to.
149
+
150
+ path {str}{required} -- path is the local path to the file.
151
+
152
+ size {int}{required} -- size is the size of the file in bytes.
153
+
154
+ url {str}{required} -- url is the location of the file in the cloud.
155
+
156
+ preview {str}{required} -- preview is the url to a preview of the file.
157
+
158
+ provider_object {Any}{required} -- provider_object is the object returned by the cloud storage provider.
159
+ you need to cast it to the appropriate type before using it.
160
+
161
+ done {queue.Queue} -- done sends a message to signal when an async process is complete.
162
+
163
+ quit {queue.Queue} -- quit receives a message to signal for an exit of an async process.
164
+
165
+ cid {str} -- cid is the content identifier for the file.
166
+ this is only implemented by some providers (e.g. Pinata Cloud)
167
+
168
+ error {BifrostError} -- error is the error returned by the provider. This is only used for async operations
169
+ and multi file uploads.
170
+ """
171
+
172
+ name: str
173
+ """name is the name of the file."""
174
+
175
+ bucket: NotRequired[str]
176
+ """bucket is the bucket the file was uploaded to."""
177
+
178
+ path: str
179
+ """path is the local path to the file."""
180
+
181
+ size: int
182
+ """size is the size of the file in bytes."""
183
+
184
+ url: str
185
+ """url is the location of the file in the cloud."""
186
+
187
+ preview: str
188
+ """preview is the url to a preview of the file."""
189
+
190
+ provider_object: Any
191
+ """provider_object is the object returned by the cloud storage provider."""
192
+
193
+ done: NotRequired[queue.Queue]
194
+ """done sends a message to signal when an async process is complete."""
195
+
196
+ quit: NotRequired[queue.Queue]
197
+ """quit receives a message to signal for an exit of an async process."""
198
+
199
+ cid: NotRequired[str]
200
+ """cid is the content identifier for the file."""
201
+
202
+ error: NotRequired[BifrostError]
203
+ """error is the error returned by the provider. This is only used for async operations and multi file uploads."""