openemail.files
Каждый метод этого пространства имён: его сигнатура, параметры, что он возвращает, и пример.
Методы
Every attachment the mailbox holds, sent and received, and the files uploaded to it, with their bytes, the download links they went out as and whether each can be deleted.
files.list()
List one page of the files the mailbox holds
def list( *, limit: int | None = None, cursor: str | None = None, q: str | None = None, kind: FileKind | None = None, direction: FileDirection | None = None, address: str | None = None, since: datetime | str | None = None, until: datetime | str | None = None, sort: FileSort | None = None, api_key: str | None = None, timeout: float | None = None,) -> Page[FileResource]Returns one page of the Files page: every attachment the mailbox holds, sent and received, and every file uploaded to it, with its name, type, size, the address it came to, the thread it belongs to and whether it can be deleted. list_all collects every page and iterate walks them lazily.
Only an upload that nothing depends on can be deleted, and its deletable is True. Every other row has a usage saying what keeps it: received, sent, linked for an upload that went out as a download link that still works, or scheduled for one attached to a message that has not gone out yet.
A key limited to particular addresses or domains sees only the files that arrived at them, the same boundary the thread list uses, so it does not see files uploaded for the whole workspace. A deleted file is not listed.
The index starts from the day it shipped, so an older mailbox lists what has arrived since. Older attachments are still on their messages, where threads.list_attachments reads them.
Параметры
limitintPage size, from 1 to 100. The server defaults to 25.
cursorstrThe
nextCursorof the previous page. Leave it out for the first page.qstrSearches the file name and its type. Words match loosely, and a close spelling is tried when nothing matches exactly.
kindFileKindKeeps one kind:
image,pdf,audio,videoortext, the choices of the filter on the Files page.directionFileDirectionKeeps one direction:
inboundfor files that arrived on a message,outboundfor files that went out on one,uploadedfor files put on the Files page.addressstrKeeps the files of one address, the
deliveredToof the file, compared without regard to case.sincedatetime | strKeeps files added at or after this moment. A
datetimeor an ISO 8601 string.untildatetime | strKeeps files added before this moment. A
datetimeor an ISO 8601 string.sortFileSortnewest(the default),oldest,largestorname. A cursor carries on in the order it was handed out in.api_keystrOverrides the client's API key for this call only.
timeoutfloatSeconds this call may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
Возвращает
Page[FileResource], a dict with items, hasMore and nextCursor. Each item has id, filename, mimeType, sizeBytes, direction, threadId, messageId, deliveredTo, usage, deletable, visibility, publicUrl and createdAt.
Пример
from openemail import openemail page = openemail.files.list(kind='pdf', sort='largest') for file in page['items']: print(file['filename'], file['sizeBytes'], file['usage'] or 'deletable') print(page['hasMore'], page['nextCursor'])Примечания
Needs
files:read. Reading an email withthreads:readstill reads the attachments on it, whilefiles:readreads every file, uploads included.The cursor is opaque and holds where the last row sat in this order. A cursor this list did not hand out, or one handed out under another
sort, is a 400invalid_cursor.
Также доступно в
- API
GET /files- TypeScript
files.list()- Ruby
files.list- CLI
openemail files list
files.list_all()
Collect every file into one list
def list_all( *, limit: int | None = None, cursor: str | None = None, q: str | None = None, kind: FileKind | None = None, direction: FileDirection | None = None, address: str | None = None, since: datetime | str | None = None, until: datetime | str | None = None, sort: FileSort | None = None, api_key: str | None = None, timeout: float | None = None,) -> builtins.list[FileResource]Walks every page of list and returns every file in one list, in the order sort= names. One request per page, with the same filters on each.
Параметры
limitintPage size for each request, from 1 to 100. The server defaults to 25.
cursorstrStarts the walk after this cursor instead of the first page.
qstrSearches the file name and its type. Words match loosely, and a close spelling is tried when nothing matches exactly.
kindFileKindKeeps one kind:
image,pdf,audio,videoortext, the choices of the filter on the Files page.directionFileDirectionKeeps one direction:
inboundfor files that arrived on a message,outboundfor files that went out on one,uploadedfor files put on the Files page.addressstrKeeps the files of one address, the
deliveredToof the file, compared without regard to case.sincedatetime | strKeeps files added at or after this moment. A
datetimeor an ISO 8601 string.untildatetime | strKeeps files added before this moment. A
datetimeor an ISO 8601 string.sortFileSortnewest(the default),oldest,largestorname. A cursor carries on in the order it was handed out in.api_keystrOverrides the client's API key for every page of this walk.
timeoutfloatSeconds this call may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
Возвращает
list[FileResource] holding every file.
Пример
from openemail import openemail invoices = openemail.files.list_all(q='invoice', direction='inbound') total = sum(file['sizeBytes'] for file in invoices)print(len(invoices), 'invoices received,', total, 'bytes in all')Примечания
If any page fails the call raises, and the rows already fetched are discarded.
Также доступно в
- API
GET /files- TypeScript
files.listAll()- Ruby
files.list_all
files.iterate()
Stream the files one at a time
def iterate( *, limit: int | None = None, cursor: str | None = None, q: str | None = None, kind: FileKind | None = None, direction: FileDirection | None = None, address: str | None = None, since: datetime | str | None = None, until: datetime | str | None = None, sort: FileSort | None = None, api_key: str | None = None, timeout: float | None = None,) -> Iterator[FileResource]Returns a generator that yields one file at a time, in the order sort= names, and requests the next page only once the current one is used up. Nothing is fetched until the loop starts, and leaving the loop with break stops the requests.
Параметры
limitintPage size for each request, from 1 to 100. The server defaults to 25.
cursorstrStarts the walk after this cursor instead of the first page.
qstrSearches the file name and its type. Words match loosely, and a close spelling is tried when nothing matches exactly.
kindFileKindKeeps one kind:
image,pdf,audio,videoortext, the choices of the filter on the Files page.directionFileDirectionKeeps one direction:
inboundfor files that arrived on a message,outboundfor files that went out on one,uploadedfor files put on the Files page.addressstrKeeps the files of one address, the
deliveredToof the file, compared without regard to case.sincedatetime | strKeeps files added at or after this moment. A
datetimeor an ISO 8601 string.untildatetime | strKeeps files added before this moment. A
datetimeor an ISO 8601 string.sortFileSortnewest(the default),oldest,largestorname. A cursor carries on in the order it was handed out in.api_keystrOverrides the client's API key for every page of this walk.
timeoutfloatSeconds this call may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
Возвращает
Iterator[FileResource], a generator yielding one file per step.
Пример
from openemail import openemail for file in openemail.files.iterate(sort='oldest'): print(file['createdAt'], file['filename'], file['deliveredTo'])Примечания
The generator is lazy, so an abandoned loop costs only the pages you consumed.
Также доступно в
- API
GET /files- TypeScript
files.iterate()- Ruby
files.iterate
files.get()
Read one file by id
def get( id: str, *, api_key: str | None = None, timeout: float | None = None,) -> FileResourceReturns one file: its name, type, size, whether it was sent, received or uploaded, the address it came to, the thread and message it belongs to, and whether it can be deleted. download fetches its bytes.
deletable is True only for an upload that nothing depends on. Otherwise usage says what keeps it: received or sent for a file that came in or went out on a message, linked for an upload that went out as a download link that still works, and scheduled for one attached to a message that has not gone out yet.
Параметры
idstrОбязательноThe id from
list,file_and 24 hex.api_keystrOverrides the client's API key for this call only.
timeoutfloatSeconds this call may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
Возвращает
FileResource, with usage and deletable. visibility is public while a download link to it works, and publicUrl is then one of those links.
Пример
from openemail import openemail file = openemail.files.get('file_6bb640f5b99e47deb758f1f5') print(file['filename'], file['mimeType'], file['deletable'])Примечания
A deleted file, one outside the addresses a narrowed key holds, and an unknown id all answer 404
resource_not_found, which raisesOpenEmailApiErrorwithis_not_found.
Также доступно в
- API
GET /files/{id}- TypeScript
files.get()- Ruby
files.get- CLI
openemail files get
files.stats()
Count the files and the space they take
def stats( *, api_key: str | None = None, timeout: float | None = None,) -> FileStatsResourceReturns the numbers on the Analytics tab of the Files page in one request: how many files the mailbox holds and how many bytes they take, in all and split into received, sent and uploaded, the file types and the addresses taking the most space, how many files arrived on each of the last 30 days, and the download links still working with how often they were fetched.
Deleted files are not counted. A key limited to particular addresses or domains counts only the files that arrived at them, so files uploaded for the whole workspace are left out of its numbers.
Параметры
api_keystrOverrides the client's API key for this call only.
timeoutfloatSeconds this call may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
Возвращает
FileStatsResource with totals, received, sent and uploaded, each a dict with files and bytes, then types, byDay, addresses and links.
Пример
from openemail import openemail stats = openemail.files.stats() print(stats['totals']['files'], 'files in', stats['totals']['bytes'], 'bytes') for kind in stats['types']: print(kind['mimeType'], kind['files'], kind['bytes'])Примечания
Needs
files:read.typesholds at most the 8 types taking the most bytes andaddressesat most the 6 addresses holding the most. A file uploaded for the whole workspace has no address, so it counts in the totals and never inaddresses.byDaycovers the last 30 days in UTC, today included, and is sparse: a day on which no file arrived has no entry, so a chart must fill the gaps. EachdayisYYYY-MM-DD.linkscounts the download links that still work:sharesof them, fetcheddownloadstimes in all, last atlastDownloadAt, which isNonewhen none was ever fetched. Scanners and link previewers are left out of the count.
Также доступно в
- API
GET /files/stats- TypeScript
files.stats()- Ruby
files.stats- CLI
openemail files stats
files.download()
Fetch the bytes of a file
def download( id: str, *, api_key: str | None = None, timeout: float | None = None,) -> bytesReturns the file exactly as it is stored, the same bytes the Download action on the Files page saves. The server sends it with the file's own Content-Type and name, but the method returns only the bytes, so read the name and the type from get.
Параметры
idstrОбязательноThe id from
list.api_keystrOverrides the client's API key for this call only.
timeoutfloatSeconds this call may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
Возвращает
bytes holding the file.
Пример
from pathlib import Path from openemail import openemail file = openemail.files.get('file_6bb640f5b99e47deb758f1f5')data = openemail.files.download(file['id']) name = Path(file['filename']).namePath(name).write_bytes(data)print('Saved', name, len(data), 'bytes')Примечания
The whole file is held in memory, so fetch very large ones one at a time.
A file whose bytes are gone from storage answers 404 like a missing one.
Также доступно в
- API
GET /files/{id}/content- TypeScript
files.download()- Ruby
files.download- CLI
openemail files download
files.list_links()
List the download links a file went out as
def list_links( id: str, *, limit: int | None = None, cursor: str | None = None, api_key: str | None = None, timeout: float | None = None,) -> Page[FileLinkResource]Returns one page of the download links made for this file, newest first. A large attachment sent from OpenEmail travels as a link rather than inside the message, and each send makes a link of its own. Every row says how often it was fetched, when last, and whether it was revoked. While one of its links still works, an upload cannot be deleted.
A file attached inside a message has no links, because nothing records when those are opened.
Параметры
idstrОбязательноThe file id from
list.limitintPage size, from 1 to 100. The server defaults to 25.
cursorstrThe
nextCursorof the previous page. Leave it out for the first page.api_keystrOverrides the client's API key for this call only.
timeoutfloatSeconds this call may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
Возвращает
Page[FileLinkResource], a dict with items, hasMore and nextCursor. Each item has id, url, host, published, downloads, lastDownloadAt, revokedAt and createdAt.
Пример
from openemail import openemail page = openemail.files.list_links('file_6bb640f5b99e47deb758f1f5') for link in page['items']: print(link['url'], link['downloads'], link['revokedAt'])Примечания
The count leaves out scanners and link previewers, the same classifier the
email.downloadedwebhook uses.publishedisTruefor a link made withcreate_link, which does not stop the file being deleted, andFalsefor a link that went out in a message.
Также доступно в
- API
GET /files/{id}/links- TypeScript
files.listLinks()- Ruby
files.list_links- CLI
openemail files list-links
files.list_all_links()
Collect every download link of a file into one list
def list_all_links( id: str, *, limit: int | None = None, cursor: str | None = None, api_key: str | None = None, timeout: float | None = None,) -> builtins.list[FileLinkResource]Walks every page of list_links and returns every download link of the file in one list, newest first. One request per page, with the same limit= on each.
Параметры
idstrОбязательноThe file id from
list.limitintPage size for each request, from 1 to 100. The server defaults to 25.
cursorstrStarts the walk after this cursor instead of the first page.
api_keystrOverrides the client's API key for every page of this walk.
timeoutfloatSeconds this call may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
Возвращает
list[FileLinkResource] holding every download link of the file.
Пример
from openemail import openemail links = openemail.files.list_all_links('file_6bb640f5b99e47deb758f1f5') fetched = sum(link['downloads'] for link in links)print(len(links), 'links fetched', fetched, 'times')Примечания
If any page fails the call raises, and the rows already fetched are discarded.
Также доступно в
- API
GET /files/{id}/links- TypeScript
files.listAllLinks()- Ruby
files.list_all_links
files.iterate_links()
Stream the download links of a file one at a time
def iterate_links( id: str, *, limit: int | None = None, cursor: str | None = None, api_key: str | None = None, timeout: float | None = None,) -> Iterator[FileLinkResource]Returns a generator that yields one link at a time, newest first, and requests the next page only once the current one is used up. Nothing is fetched until the loop starts, and leaving the loop with break stops the requests.
Параметры
idstrОбязательноThe file id from
list.limitintPage size for each request, from 1 to 100. The server defaults to 25.
cursorstrStarts the walk after this cursor instead of the first page.
api_keystrOverrides the client's API key for every page of this walk.
timeoutfloatSeconds this call may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
Возвращает
Iterator[FileLinkResource], a generator yielding one link per step.
Пример
from openemail import openemail for link in openemail.files.iterate_links('file_6bb640f5b99e47deb758f1f5'): if link['revokedAt'] is None: print('Still working:', link['url']) breakПримечания
The generator is lazy, so an abandoned loop costs only the pages you consumed.
Также доступно в
- API
GET /files/{id}/links- TypeScript
files.iterateLinks()- Ruby
files.iterate_links
files.create_link()
Publish a file at a public link
def create_link( id: str, *, domain: str | None = None, api_key: str | None = None, timeout: float | None = None,) -> FileLinkResourceMakes a public download link for the file and returns it. Anybody holding url can open the file without signing in, which is how an image or a document is referenced from an email or a web page. Each call makes a new link with its own download count, and a link keeps working until it is revoked with revoke_link or the file is deleted.
The link lives on the files host of domain= when that domain has one set up, such as files.acme.com, else on the files host of the address the file belongs to, else on the OpenEmail API address. A file that came in or went out on a message is copied to public storage first. Programs and scripts are refused with 422 file_unshareable.
Параметры
idstrОбязательноThe file id from
list.domainstrThe domain whose files host serves the link, such as
acme.com.api_keystrOverrides the client's API key for this call only.
timeoutfloatSeconds this call may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
Возвращает
FileLinkResource with id, url, host, downloads, lastDownloadAt, revokedAt and createdAt.
Пример
from openemail import openemail link = openemail.files.create_link('file_6bb640f5b99e47deb758f1f5', domain='acme.com') print(link['url'], link['host'])Примечания
Needs
files:write.Not retried after a lost response, because a second call makes a second link. Look for it with
list_linksfirst.
Также доступно в
files.revoke_link()
Revoke a public link
def revoke_link( id: str, link_id: str, *, api_key: str | None = None, timeout: float | None = None,) -> FileLinkResourceStops a public link from working, for good, including in mail that already went out with it, and returns the link with revokedAt set. Revoking a link that is already revoked returns it unchanged, so the call is safe to repeat, and the SDK retries it after a network failure. An unknown link is a 404.
Параметры
idstrОбязательноThe file id from
list.link_idstrОбязательноThe link id from
list_linksorcreate_link,fshr_and 24 hex.api_keystrOverrides the client's API key for this call only.
timeoutfloatSeconds this call may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
Возвращает
FileLinkResource with revokedAt set.
Пример
from openemail import openemail link = openemail.files.revoke_link( 'file_6bb640f5b99e47deb758f1f5', 'fshr_2f9c4a1e7b3d48a06c1e9f4b') print(link['url'], 'stopped working at', link['revokedAt'])Примечания
Needs
files:write.
Также доступно в
files.revoke_all_links()
Revoke every link to a file
def revoke_all_links( id: str, *, api_key: str | None = None, timeout: float | None = None,) -> FileLinkRevocationResourceMakes the file private, as Make private on the Files page does: every public download link to it stops working at once, including the ones in mail that already went out. Returns revoked, how many links were still working. The file itself stays, and create_link can publish it again at a new link.
A key limited to particular addresses reaches only the files that arrived at them, and any other file is a 404.
Параметры
idstrОбязательноThe file id from
list.api_keystrOverrides the client's API key for this call only.
timeoutfloatSeconds this call may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
Возвращает
FileLinkRevocationResource with fileId and revoked, the number of links that stopped working.
Пример
from openemail import openemail result = openemail.files.revoke_all_links('file_6bb640f5b99e47deb758f1f5') print(result['revoked'], 'links stopped working')Примечания
A file with no working links returns
revokedas0, so the call is safe to repeat, and the SDK retries it after a network failure.Needs
files:write.
Также доступно в
files.upload()
Upload a file to the Files page
def upload( data: RawBody, *, filename: str, content_type: str | None = None, api_key: str | None = None, timeout: float | None = None,) -> FileResourceStores the bytes as a new file, the way the Upload button on the Files page does, and returns it: direction is uploaded, usage is None and deletable is True. Attach it to a send as {'fileId': file['id']} in emails.send, which is how a file larger than the inline cap goes out.
data is bytes, a bytearray or a memoryview, sent as the request body. The name travels as the filename query parameter, and it is cleaned rather than refused: characters a file name cannot hold become _, and a name longer than 255 characters is cut, keeping its extension. The type is content_type=, and application/octet-stream without it. A value that is not shaped like a MIME type is stored as application/octet-stream too.
A key limited to particular addresses or domains uploads to the first address it holds, which becomes deliveredTo. An unlimited key uploads for the whole workspace and deliveredTo is None, so a narrowed key never reaches that file afterwards.
Параметры
dataRawBodyОбязательноThe file as
bytes, abytearrayor amemoryview, not empty and at most 100 MB.filenamestrОбязательноThe name the file is stored and downloaded under, such as
report.pdf. A blank name raisesValueErrorbefore anything is sent.content_typestrThe MIME type, such as
application/pdf. Left out, the file is stored asapplication/octet-stream.api_keystrOverrides the client's API key for this call only.
timeoutfloatSeconds the upload may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. Left out, it is 600 seconds, or the client'stimeoutwhen that is longer, and no limit at all when the client'stimeoutis0.0turns the limit off for this call.
Возвращает
FileResource for the new file, with direction set to 'uploaded', usage set to None and deletable set to True.
Пример
from pathlib import Path from openemail import openemail file = openemail.files.upload( Path('invoice.pdf').read_bytes(), filename='invoice.pdf', content_type='application/pdf') openemail.emails.send( { 'from': '[email protected]', 'to': '[email protected]', 'subject': 'Your September invoice', 'text': 'The invoice is attached.', 'attachments': [{'fileId': file['id']}], })Примечания
Needs
files:write, the same scope that deletes files.The SDK does not retry an upload, because a second attempt after a lost response could store the file twice. Look for it with
listbefore trying again.An empty file is a 400
upload_empty, a program or script, judged by its name, is a 400upload_dangerous, and a file over 100 MB is a 413upload_too_large. A key limited to addresses that holds none is a 403upload_no_address.A workspace keeps up to 10 GB of uploads, and past that a 507
upload_storage_fullholds until some are deleted. It takes 500 uploads an hour, deleted ones included, and more is a 429upload_rate_limited. A 502upload_failedmeans storage failed and nothing was kept, so it is safe to try again.
Также доступно в
- API
POST /files- TypeScript
files.upload()- Ruby
files.upload- CLI
openemail files upload
files.delete()
Delete an uploaded file for good
def delete( id: str, *, api_key: str | None = None, timeout: float | None = None,) -> DeletedFileResourceRemoves an uploaded file: its bytes are deleted from storage and it leaves the Files page. The row stays, marked deleted, so the index knows the file existed. There is no undo.
Only an upload that nothing depends on can be deleted, the files whose deletable is True. A file that was received or sent stays with its message, and so does an upload that went out as a download link that still works or is attached to a message that has not gone out yet. Those are refused with 409 file_in_use, and the message names the file and says why. An upload that was sent inside a message can still be deleted, because the message keeps its own copy, which is listed as a separate sent file.
delete_many deletes up to 100 in one call and reports the ones it kept instead of failing.
Параметры
idstrОбязательноThe id from
list.api_keystrOverrides the client's API key for this call only.
timeoutfloatSeconds this call may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
Возвращает
DeletedFileResource, such as {'object': 'file', 'id': 'file_6bb640f5b99e47deb758f1f5', 'deleted': True}.
Пример
from openemail import OpenEmailApiError, openemail try: removed = openemail.files.delete('file_6bb640f5b99e47deb758f1f5') print(removed['id'], removed['deleted'])except OpenEmailApiError as error: if error.is_not_found: print('Already deleted') elif error.code == 'file_in_use': print(error.message) else: raiseПримечания
Needs
files:write, the same scope that uploads. A key limited to some addresses may delete only files that arrived at them, so an upload made for the whole workspace answers it 404.A file that is unknown, already deleted or out of reach answers 404
resource_not_found. A file in use answers 409file_in_use, withparamset to'id'on the error, and itsusageongetsays which rule keeps it.The SDK does not retry a delete. A 404 on your own second attempt after a lost response means the first one worked.
Также доступно в
- API
DELETE /files/{id}- TypeScript
files.delete()- Ruby
files.delete- CLI
openemail files delete
files.delete_many()
Delete up to 100 files in one call
def delete_many( ids: Sequence[str], *, api_key: str | None = None, timeout: float | None = None,) -> FileBatchDeleteResourceDeletes every file in ids that can be deleted, the way delete deletes one, and reports the rest instead of failing. It is what selecting several files on the Files page and pressing Delete does.
Only an uploaded file that nothing depends on can be deleted. A file that was received or sent stays with its message, and so does an upload that went out as a download link that still works or is attached to a message that has not gone out yet. Each of those comes back in kept with its usage and a reason in plain words. An id that is unknown, already deleted or outside the addresses a narrowed key holds comes back in missing. The rule is checked again at the moment of deleting, so a file that became used in between is kept.
There is no undo.
Параметры
idsSequence[str]ОбязательноA list of 1 to 100 file ids from
list. More than 100, or none, is a 422 onids. A repeated id counts once.api_keystrOverrides the client's API key for this call only.
timeoutfloatSeconds this call may take, the response included, before it raises
OpenEmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
Возвращает
FileBatchDeleteResource with object set to 'file_batch_delete', deleted, kept and missing. deleted and missing are lists of ids, and each entry of kept is a dict with id, filename, usage and reason.
Пример
from openemail import openemail result = openemail.files.delete_many( ['file_6bb640f5b99e47deb758f1f5', 'file_0c3e2a91d4b7f6058e1a2b3c']) print(len(result['deleted']), 'deleted,', len(result['missing']), 'missing') for kept in result['kept']: print(kept['filename'], kept['reason'])Примечания
Needs
files:write, the same scope that uploads.A partial result returns rather than raises, so read
keptandmissingto see what stayed.The SDK does not retry it. Calling it again after a lost response reports the files the first call deleted in
missing.To clear out every upload that can go, keep the rows of
list_allwhosedeletableisTrueand pass their ids 100 at a time.