pangea-sdk 4.4.0__py3-none-any.whl → 5.1.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.
@@ -0,0 +1,621 @@
1
+ # Copyright 2022 Pangea Cyber Corporation
2
+ # Author: Pangea Cyber Corporation
3
+ from __future__ import annotations
4
+
5
+ import io
6
+ from typing import Dict, List, Optional, Tuple, Union
7
+
8
+ import pangea.services.share.share as m
9
+ from pangea.asyncio.services.base import ServiceBaseAsync
10
+ from pangea.response import PangeaResponse, TransferMethod
11
+ from pangea.services.share.file_format import FileFormat
12
+ from pangea.utils import get_file_size, get_file_upload_params
13
+
14
+
15
+ class ShareAsync(ServiceBaseAsync):
16
+ """Share service client."""
17
+
18
+ service_name = "share"
19
+
20
+ async def buckets(self) -> PangeaResponse[m.BucketsResult]:
21
+ """
22
+ Buckets
23
+
24
+ Get information on the accessible buckets.
25
+
26
+ OperationId: share_post_v1_buckets
27
+
28
+ Returns:
29
+ A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
30
+
31
+ Examples:
32
+ response = share.buckets()
33
+ """
34
+
35
+ return await self.request.post("v1/buckets", m.BucketsResult)
36
+
37
+ async def delete(
38
+ self,
39
+ id: Optional[str] = None,
40
+ force: Optional[bool] = None,
41
+ bucket_id: Optional[str] = None,
42
+ ) -> PangeaResponse[m.DeleteResult]:
43
+ """
44
+ Delete
45
+
46
+ Delete object by ID or path. If both are supplied, the path must match
47
+ that of the object represented by the ID.
48
+
49
+ OperationId: share_post_v1_delete
50
+
51
+ Args:
52
+ id (str, optional): The ID of the object to delete.
53
+ force (bool, optional): If true, delete a folder even if it's not empty.
54
+ bucket_id (str, optional): The bucket to use, if not the default.
55
+
56
+ Returns:
57
+ A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
58
+
59
+ Examples:
60
+ response = await share.delete(id="pos_3djfmzg2db4c6donarecbyv5begtj2bm")
61
+ """
62
+
63
+ input = m.DeleteRequest(id=id, force=force, bucket_id=bucket_id)
64
+ return await self.request.post("v1/delete", m.DeleteResult, data=input.model_dump(exclude_none=True))
65
+
66
+ async def folder_create(
67
+ self,
68
+ name: Optional[str] = None,
69
+ metadata: Optional[m.Metadata] = None,
70
+ parent_id: Optional[str] = None,
71
+ folder: Optional[str] = None,
72
+ tags: Optional[m.Tags] = None,
73
+ bucket_id: Optional[str] = None,
74
+ ) -> PangeaResponse[m.FolderCreateResult]:
75
+ """
76
+ Create a folder
77
+
78
+ Create a folder, either by name or path and parent_id.
79
+
80
+ OperationId: share_post_v1_folder_create
81
+
82
+ Args:
83
+ name (str, optional): The name of an object.
84
+ metadata (Metadata, optional): A set of string-based key/value pairs used to provide additional data about an object.
85
+ parent_id (str, optional): The ID of a stored object.
86
+ folder (str, optional): The folder to place the folder in. Must
87
+ match `parent_id` if also set.
88
+ tags (Tags, optional): A list of user-defined tags.
89
+ bucket_id (str, optional): The bucket to use, if not the default.
90
+
91
+ Returns:
92
+ A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
93
+
94
+ Examples:
95
+ response = await share.folder_create(
96
+ metadata={
97
+ "created_by": "jim",
98
+ "priority": "medium",
99
+ },
100
+ parent_id="pos_3djfmzg2db4c6donarecbyv5begtj2bm",
101
+ folder="/",
102
+ tags=["irs_2023", "personal"],
103
+ )
104
+ """
105
+
106
+ input = m.FolderCreateRequest(
107
+ name=name, metadata=metadata, parent_id=parent_id, folder=folder, tags=tags, bucket_id=bucket_id
108
+ )
109
+ return await self.request.post(
110
+ "v1/folder/create", m.FolderCreateResult, data=input.model_dump(exclude_none=True)
111
+ )
112
+
113
+ async def get(
114
+ self,
115
+ id: Optional[str] = None,
116
+ transfer_method: Optional[TransferMethod] = None,
117
+ bucket_id: Optional[str] = None,
118
+ password: Optional[str] = None,
119
+ ) -> PangeaResponse[m.GetResult]:
120
+ """
121
+ Get an object
122
+
123
+ Get object. If both ID and Path are supplied, the call will fail if the
124
+ target object doesn't match both properties.
125
+
126
+ OperationId: share_post_v1_get
127
+
128
+ Args:
129
+ id (str, optional): The ID of the object to retrieve.
130
+ transfer_method (TransferMethod, optional): The requested transfer method for the file data.
131
+ bucket_id (str, optional): The bucket to use, if not the default.
132
+ password (str, optional): If the file was protected with a password, the password to decrypt with.
133
+
134
+ Returns:
135
+ A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
136
+
137
+ Examples:
138
+ response = await share.get(
139
+ id="pos_3djfmzg2db4c6donarecbyv5begtj2bm",
140
+ folder="/",
141
+ )
142
+ """
143
+
144
+ input = m.GetRequest(id=id, transfer_method=transfer_method, bucket_id=bucket_id, password=password)
145
+ return await self.request.post("v1/get", m.GetResult, data=input.model_dump(exclude_none=True))
146
+
147
+ async def get_archive(
148
+ self,
149
+ ids: List[str] = [],
150
+ format: Optional[m.ArchiveFormat] = None,
151
+ transfer_method: Optional[TransferMethod] = None,
152
+ bucket_id: Optional[str] = None,
153
+ ) -> PangeaResponse[m.GetArchiveResult]:
154
+ """
155
+ Get archive
156
+
157
+ Get an archive file of multiple objects.
158
+
159
+ OperationId: share_post_v1_get_archive
160
+
161
+ Args:
162
+ ids (List[str]): The IDs of the objects to include in the archive. Folders include all children.
163
+ format (ArchiveFormat, optional): The format to use for the built archive.
164
+ transfer_method (TransferMethod, optional): The requested transfer method for the file data.
165
+ bucket_id (str, optional): The bucket to use, if not the default.
166
+
167
+ Returns:
168
+ A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
169
+
170
+ Examples:
171
+ response = await share.get_archive(
172
+ ids=["pos_3djfmzg2db4c6donarecbyv5begtj2bm"],
173
+ )
174
+ """
175
+
176
+ if (
177
+ transfer_method is not None
178
+ and transfer_method != TransferMethod.DEST_URL
179
+ and transfer_method != TransferMethod.MULTIPART
180
+ ):
181
+ raise ValueError(f"Only {TransferMethod.DEST_URL} and {TransferMethod.MULTIPART} are supported")
182
+
183
+ input = m.GetArchiveRequest(ids=ids, format=format, transfer_method=transfer_method, bucket_id=bucket_id)
184
+ return await self.request.post("v1/get_archive", m.GetArchiveResult, data=input.model_dump(exclude_none=True))
185
+
186
+ async def list(
187
+ self,
188
+ filter: Optional[Union[Dict[str, str], m.FilterList]] = None,
189
+ last: Optional[str] = None,
190
+ order: Optional[m.ItemOrder] = None,
191
+ order_by: Optional[m.ItemOrderBy] = None,
192
+ size: Optional[int] = None,
193
+ bucket_id: Optional[str] = None,
194
+ ) -> PangeaResponse[m.ListResult]:
195
+ """
196
+ List
197
+
198
+ List or filter/search records.
199
+
200
+ OperationId: share_post_v1_list
201
+
202
+ Args:
203
+ filter (Union[Dict[str, str], FilterList], optional):
204
+ last (str, optional): Reflected value from a previous response to obtain the next page of results.
205
+ order (ItemOrder, optional): Order results asc(ending) or desc(ending).
206
+ order_by (ItemOrderBy, optional): Which field to order results by.
207
+ size (int, optional): Maximum results to include in the response.
208
+ bucket_id (str, optional): The bucket to use, if not the default.
209
+
210
+ Returns:
211
+ A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
212
+
213
+ Examples:
214
+ response = await share.list()
215
+ """
216
+
217
+ input = m.ListRequest(filter=filter, last=last, order=order, order_by=order_by, size=size, bucket_id=bucket_id)
218
+ return await self.request.post("v1/list", m.ListResult, data=input.model_dump(exclude_none=True))
219
+
220
+ async def put(
221
+ self,
222
+ file: io.BufferedReader,
223
+ name: Optional[str] = None,
224
+ folder: Optional[str] = None,
225
+ format: Optional[FileFormat] = None,
226
+ metadata: Optional[m.Metadata] = None,
227
+ mimetype: Optional[str] = None,
228
+ parent_id: Optional[str] = None,
229
+ tags: Optional[m.Tags] = None,
230
+ transfer_method: Optional[TransferMethod] = TransferMethod.POST_URL,
231
+ crc32c: Optional[str] = None,
232
+ md5: Optional[str] = None,
233
+ sha1: Optional[str] = None,
234
+ sha256: Optional[str] = None,
235
+ sha512: Optional[str] = None,
236
+ size: Optional[int] = None,
237
+ bucket_id: Optional[str] = None,
238
+ password: Optional[str] = None,
239
+ password_algorithm: Optional[str] = None,
240
+ ) -> PangeaResponse[m.PutResult]:
241
+ """
242
+ Upload a file
243
+
244
+ Upload a file.
245
+
246
+ OperationId: share_post_v1_put
247
+
248
+ Args:
249
+ file (io.BufferedReader):
250
+ name (str, optional): The name of the object to store.
251
+ folder (str, optional): The path to the parent folder. Leave blank
252
+ for the root folder. Path must resolve to `parent_id` if also set.
253
+ format (FileFormat, optional): The format of the file, which will be verified by the server if provided. Uploads not matching the supplied format will be rejected.
254
+ metadata (Metadata, optional): A set of string-based key/value pairs used to provide additional data about an object.
255
+ mimetype (str, optional): The MIME type of the file, which will be verified by the server if provided. Uploads not matching the supplied MIME type will be rejected.
256
+ parent_id (str, optional): The parent ID of the object (a folder). Leave blank to keep in the root folder.
257
+ tags (Tags, optional): A list of user-defined tags.
258
+ transfer_method (TransferMethod, optional): The transfer method used to upload the file data.
259
+ crc32c (str, optional): The hexadecimal-encoded CRC32C hash of the file data, which will be verified by the server if provided.
260
+ md5 (str, optional): The hexadecimal-encoded MD5 hash of the file data, which will be verified by the server if provided.
261
+ sha1 (str, optional): The hexadecimal-encoded SHA1 hash of the file data, which will be verified by the server if provided.
262
+ sha256 (str, optional): The SHA256 hash of the file data, which will be verified by the server if provided.
263
+ sha512 (str, optional): The hexadecimal-encoded SHA512 hash of the file data, which will be verified by the server if provided.
264
+ size (str, optional): The size (in bytes) of the file. If the upload doesn't match, the call will fail.
265
+ bucket_id (str, optional): The bucket to use, if not the default.
266
+ password (str, optional): An optional password to protect the file with. Downloading the file will require this password.
267
+ password_algorithm (str, optional): An optional password algorithm to protect the file with. See symmetric vault password_algorithm.
268
+ Returns:
269
+ A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
270
+
271
+ Examples:
272
+ try:
273
+ with open("./path/to/file.pdf", "rb") as f:
274
+ response = await share.put(file=f)
275
+ print(f"Response: {response.result}")
276
+ except pe.PangeaAPIException as e:
277
+ print(f"Request Error: {e.response.summary}")
278
+ for err in e.errors:
279
+ print(f"\\t{err.detail} \\n")
280
+ """
281
+
282
+ files: List[Tuple] = [("upload", (name, file, "application/octet-stream"))]
283
+
284
+ if transfer_method == TransferMethod.POST_URL:
285
+ params = get_file_upload_params(file)
286
+ crc32c = params.crc_hex
287
+ sha256 = params.sha256_hex
288
+ size = params.size
289
+ elif size is None and get_file_size(file=file) == 0:
290
+ # Needed to upload zero byte files
291
+ size = 0
292
+
293
+ input = m.PutRequest(
294
+ name=name,
295
+ format=format,
296
+ metadata=metadata,
297
+ mimetype=mimetype,
298
+ parent_id=parent_id,
299
+ folder=folder,
300
+ tags=tags,
301
+ transfer_method=transfer_method,
302
+ crc32c=crc32c,
303
+ md5=md5,
304
+ sha1=sha1,
305
+ sha256=sha256,
306
+ sha512=sha512,
307
+ size=size,
308
+ bucket_id=bucket_id,
309
+ password=password,
310
+ password_algorithm=password_algorithm,
311
+ )
312
+ data = input.model_dump(exclude_none=True)
313
+ return await self.request.post("v1/put", m.PutResult, data=data, files=files)
314
+
315
+ async def request_upload_url(
316
+ self,
317
+ name: Optional[str] = None,
318
+ folder: Optional[str] = None,
319
+ format: Optional[FileFormat] = None,
320
+ metadata: Optional[m.Metadata] = None,
321
+ mimetype: Optional[str] = None,
322
+ parent_id: Optional[str] = None,
323
+ tags: Optional[m.Tags] = None,
324
+ transfer_method: Optional[TransferMethod] = TransferMethod.PUT_URL,
325
+ md5: Optional[str] = None,
326
+ sha1: Optional[str] = None,
327
+ sha512: Optional[str] = None,
328
+ crc32c: Optional[str] = None,
329
+ sha256: Optional[str] = None,
330
+ size: Optional[int] = None,
331
+ bucket_id: Optional[str] = None,
332
+ ) -> PangeaResponse[m.PutResult]:
333
+ """
334
+ Request upload URL
335
+
336
+ Request an upload URL.
337
+
338
+ OperationId: share_post_v1_put 2
339
+
340
+ Args:
341
+ name (str, optional): The name of the object to store.
342
+ folder (str, optional): The path to the parent folder. Leave blank
343
+ for the root folder. Path must resolve to `parent_id` if also set.
344
+ format (FileFormat, optional): The format of the file, which will be verified by the server if provided. Uploads not matching the supplied format will be rejected.
345
+ metadata (Metadata, optional): A set of string-based key/value pairs used to provide additional data about an object.
346
+ mimetype (str, optional): The MIME type of the file, which will be verified by the server if provided. Uploads not matching the supplied MIME type will be rejected.
347
+ parent_id (str, optional): The parent ID of the object (a folder). Leave blank to keep in the root folder.
348
+ tags (Tags, optional): A list of user-defined tags.
349
+ transfer_method (TransferMethod, optional): The transfer method used to upload the file data.
350
+ md5 (str, optional): The hexadecimal-encoded MD5 hash of the file data, which will be verified by the server if provided.
351
+ sha1 (str, optional): The hexadecimal-encoded SHA1 hash of the file data, which will be verified by the server if provided.
352
+ sha512 (str, optional): The hexadecimal-encoded SHA512 hash of the file data, which will be verified by the server if provided.
353
+ crc32c (str, optional): The hexadecimal-encoded CRC32C hash of the file data, which will be verified by the server if provided.
354
+ sha256 (str, optional): The SHA256 hash of the file data, which will be verified by the server if provided.
355
+ size (str, optional): The size (in bytes) of the file. If the upload doesn't match, the call will fail.
356
+ bucket_id (str, optional): The bucket to use, if not the default.
357
+
358
+ Returns:
359
+ A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
360
+
361
+ Examples:
362
+ response = await share.request_upload_url(
363
+ transfer_method=TransferMethod.POST_URL,
364
+ crc32c="515f7c32",
365
+ sha256="c0b56b1a154697f79d27d57a3a2aad4c93849aa2239cd23048fc6f45726271cc",
366
+ size=222089,
367
+ metadata={
368
+ "created_by": "jim",
369
+ "priority": "medium",
370
+ },
371
+ parent_id="pos_3djfmzg2db4c6donarecbyv5begtj2bm",
372
+ folder="/",
373
+ tags=["irs_2023", "personal"],
374
+ )
375
+ """
376
+
377
+ input = m.PutRequest(
378
+ name=name,
379
+ format=format,
380
+ metadata=metadata,
381
+ mimetype=mimetype,
382
+ parent_id=parent_id,
383
+ folder=folder,
384
+ tags=tags,
385
+ transfer_method=transfer_method,
386
+ crc32c=crc32c,
387
+ md5=md5,
388
+ sha1=sha1,
389
+ sha256=sha256,
390
+ sha512=sha512,
391
+ size=size,
392
+ bucket_id=bucket_id,
393
+ )
394
+
395
+ data = input.model_dump(exclude_none=True)
396
+ return await self.request.request_presigned_url("v1/put", m.PutResult, data=data)
397
+
398
+ async def update(
399
+ self,
400
+ id: Optional[str] = None,
401
+ folder: Optional[str] = None,
402
+ add_metadata: Optional[m.Metadata] = None,
403
+ remove_metadata: Optional[m.Metadata] = None,
404
+ metadata: Optional[m.Metadata] = None,
405
+ add_tags: Optional[m.Tags] = None,
406
+ remove_tags: Optional[m.Tags] = None,
407
+ tags: Optional[m.Tags] = None,
408
+ parent_id: Optional[str] = None,
409
+ updated_at: Optional[str] = None,
410
+ bucket_id: Optional[str] = None,
411
+ ) -> PangeaResponse[m.UpdateResult]:
412
+ """
413
+ Update a file
414
+
415
+ Update a file.
416
+
417
+ OperationId: share_post_v1_update
418
+
419
+ Args:
420
+ id (str, optional): An identifier for the file to update.
421
+ folder (str, optional): Set the parent (folder). Leave blank for the
422
+ root folder. Path must resolve to `parent_id` if also set.
423
+ add_metadata (Metadata, optional): A list of Metadata key/values to set in the object. If a provided key exists, the value will be replaced.
424
+ remove_metadata (Metadata, optional): A list of Metadata key/values to remove in the object. It is not an error for a provided key to not exist. If a provided key exists but doesn't match the provided value, it will not be removed.
425
+ metadata (Metadata, optional): Set the object's Metadata.
426
+ add_tags (Tags, optional): A list of Tags to add. It is not an error to provide a tag which already exists.
427
+ remove_tags (Tags, optional): A list of Tags to remove. It is not an error to provide a tag which is not present.
428
+ tags (Tags, optional): Set the object's Tags.
429
+ parent_id (str, optional): Set the parent (folder) of the object.
430
+ updated_at (str, optional): The date and time the object was last updated. If included, the update will fail if this doesn't match what's stored.
431
+ bucket_id (str, optional): The bucket to use, if not the default.
432
+
433
+ Returns:
434
+ A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
435
+
436
+ Examples:
437
+ response = await share.update(
438
+ id="pos_3djfmzg2db4c6donarecbyv5begtj2bm",
439
+ remove_metadata={
440
+ "created_by": "jim",
441
+ "priority": "medium",
442
+ },
443
+ remove_tags=["irs_2023", "personal"],
444
+ )
445
+ """
446
+
447
+ input = m.UpdateRequest(
448
+ id=id,
449
+ folder=folder,
450
+ add_metadata=add_metadata,
451
+ remove_metadata=remove_metadata,
452
+ metadata=metadata,
453
+ add_tags=add_tags,
454
+ remove_tags=remove_tags,
455
+ tags=tags,
456
+ parent_id=parent_id,
457
+ updated_at=updated_at,
458
+ bucket_id=bucket_id,
459
+ )
460
+ return await self.request.post("v1/update", m.UpdateResult, data=input.model_dump(exclude_none=True))
461
+
462
+ async def share_link_create(
463
+ self, links: List[m.ShareLinkCreateItem], bucket_id: Optional[str] = None
464
+ ) -> PangeaResponse[m.ShareLinkCreateResult]:
465
+ """
466
+ Create share links
467
+
468
+ Create a share link.
469
+
470
+ OperationId: share_post_v1_share_link_create
471
+
472
+ Args:
473
+ links (List[ShareLinkCreateItem]):
474
+ bucket_id (str, optional): The bucket to use, if not the default.
475
+
476
+ Returns:
477
+ A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
478
+
479
+ Examples:
480
+ response = await share.share_link_create(
481
+ links=[
482
+ {
483
+ targets: ["pos_3djfmzg2db4c6donarecbyv5begtj2bm"],
484
+ link_type: LinkType.DOWNLOAD,
485
+ authenticators: [
486
+ {
487
+ "auth_type": AuthenticatorType.PASSWORD,
488
+ "auth_context": "my_fav_Pa55word",
489
+ }
490
+ ],
491
+ }
492
+ ],
493
+ )
494
+ """
495
+
496
+ input = m.ShareLinkCreateRequest(links=links, bucket_id=bucket_id)
497
+ return await self.request.post(
498
+ "v1/share/link/create", m.ShareLinkCreateResult, data=input.model_dump(exclude_none=True)
499
+ )
500
+
501
+ async def share_link_get(self, id: str) -> PangeaResponse[m.ShareLinkGetResult]:
502
+ """
503
+ Get share link
504
+
505
+ Get a share link.
506
+
507
+ OperationId: share_post_v1_share_link_get
508
+
509
+ Args:
510
+ id (str, optional): The ID of a share link.
511
+
512
+ Returns:
513
+ A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
514
+
515
+ Examples:
516
+ response = await share.share_link_get(
517
+ id="psl_3djfmzg2db4c6donarecbyv5begtj2bm"
518
+ )
519
+ """
520
+
521
+ input = m.ShareLinkGetRequest(id=id)
522
+ return await self.request.post(
523
+ "v1/share/link/get", m.ShareLinkGetResult, data=input.model_dump(exclude_none=True)
524
+ )
525
+
526
+ async def share_link_list(
527
+ self,
528
+ filter: Optional[Union[Dict[str, str], m.FilterShareLinkList]] = None,
529
+ last: Optional[str] = None,
530
+ order: Optional[m.ItemOrder] = None,
531
+ order_by: Optional[m.ShareLinkOrderBy] = None,
532
+ size: Optional[int] = None,
533
+ bucket_id: Optional[str] = None,
534
+ ) -> PangeaResponse[m.ShareLinkListResult]:
535
+ """
536
+ List share links
537
+
538
+ Look up share links by filter options.
539
+
540
+ OperationId: share_post_v1_share_link_list
541
+
542
+ Args:
543
+ filter (Union[Dict[str, str], ShareLinkListFilter], optional):
544
+ last (str, optional): Reflected value from a previous response to obtain the next page of results.
545
+ order (ItemOrder, optional): Order results asc(ending) or desc(ending).
546
+ order_by (ItemOrderBy, optional): Which field to order results by.
547
+ size (int, optional): Maximum results to include in the response.
548
+ bucket_id (str, optional): The bucket to use, if not the default.
549
+
550
+ Returns:
551
+ A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
552
+
553
+ Examples:
554
+ response = await share.share_link_list()
555
+ """
556
+
557
+ input = m.ShareLinkListRequest(
558
+ filter=filter, last=last, order=order, order_by=order_by, size=size, bucket_id=bucket_id
559
+ )
560
+ return await self.request.post(
561
+ "v1/share/link/list", m.ShareLinkListResult, data=input.model_dump(exclude_none=True)
562
+ )
563
+
564
+ async def share_link_delete(
565
+ self, ids: List[str], bucket_id: Optional[str] = None
566
+ ) -> PangeaResponse[m.ShareLinkDeleteResult]:
567
+ """
568
+ Delete share links
569
+
570
+ Delete share links.
571
+
572
+ OperationId: share_post_v1_share_link_delete
573
+
574
+ Args:
575
+ ids (List[str]): list of the share link's id to delete
576
+ bucket_id (str, optional): The bucket to use, if not the default.
577
+
578
+ Returns:
579
+ A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
580
+
581
+ Examples:
582
+ response = await share.share_link_delete(
583
+ ids=["psl_3djfmzg2db4c6donarecbyv5begtj2bm"]
584
+ )
585
+ """
586
+
587
+ input = m.ShareLinkDeleteRequest(ids=ids, bucket_id=bucket_id)
588
+ return await self.request.post(
589
+ "v1/share/link/delete", m.ShareLinkDeleteResult, data=input.model_dump(exclude_none=True)
590
+ )
591
+
592
+ async def share_link_send(
593
+ self, links: List[m.ShareLinkSendItem], sender_email: str, sender_name: Optional[str] = None
594
+ ) -> PangeaResponse[m.ShareLinkSendResult]:
595
+ """
596
+ Send share links
597
+
598
+ Send a secure share-link notification to a set of email addresses. The
599
+ notification email will contain an Open button that the recipient can
600
+ use to follow the secured share-link to authenticate and then access the
601
+ shared content.
602
+
603
+ OperationId: share_post_v1_share_link_send
604
+
605
+ Args:
606
+ sender_email: An email address.
607
+
608
+ Returns:
609
+ A PangeaResponse. Available response fields can be found in our [API documentation](https://pangea.cloud/docs/api/share).
610
+
611
+ Examples:
612
+ response = await share.share_link_send(
613
+ links=[ShareLinkSendItem(id=link.id, email="foo@example.org")],
614
+ sender_email="sender@example.org",
615
+ )
616
+ """
617
+
618
+ input = m.ShareLinkSendRequest(links=links, sender_email=sender_email, sender_name=sender_name)
619
+ return await self.request.post(
620
+ "v1/share/link/send", m.ShareLinkSendResult, data=input.model_dump(exclude_none=True)
621
+ )