mailbox-org-api 0.2.2__tar.gz → 0.4__tar.gz
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.
- {mailbox_org_api-0.2.2 → mailbox_org_api-0.4}/PKG-INFO +2 -2
- {mailbox_org_api-0.2.2 → mailbox_org_api-0.4}/README.md +1 -1
- {mailbox_org_api-0.2.2 → mailbox_org_api-0.4}/mailbox_org_api/APIClient.py +117 -0
- {mailbox_org_api-0.2.2 → mailbox_org_api-0.4}/mailbox_org_api.egg-info/PKG-INFO +2 -2
- {mailbox_org_api-0.2.2 → mailbox_org_api-0.4}/pyproject.toml +1 -1
- {mailbox_org_api-0.2.2 → mailbox_org_api-0.4}/setup.py +1 -1
- {mailbox_org_api-0.2.2 → mailbox_org_api-0.4}/LICENSE +0 -0
- {mailbox_org_api-0.2.2 → mailbox_org_api-0.4}/mailbox_org_api/__init__.py +0 -0
- {mailbox_org_api-0.2.2 → mailbox_org_api-0.4}/mailbox_org_api.egg-info/SOURCES.txt +0 -0
- {mailbox_org_api-0.2.2 → mailbox_org_api-0.4}/mailbox_org_api.egg-info/dependency_links.txt +0 -0
- {mailbox_org_api-0.2.2 → mailbox_org_api-0.4}/mailbox_org_api.egg-info/top_level.txt +0 -0
- {mailbox_org_api-0.2.2 → mailbox_org_api-0.4}/setup.cfg +0 -0
- {mailbox_org_api-0.2.2 → mailbox_org_api-0.4}/tests/__init__.py +0 -0
- {mailbox_org_api-0.2.2 → mailbox_org_api-0.4}/tests/tests.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mailbox-org-api
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4
|
|
4
4
|
Summary: A library to access the mailbox.org Business API.
|
|
5
5
|
Author: Hendrik Schlange
|
|
6
6
|
Author-email: Hendrik Schlange <mail@heshsum.de>
|
|
@@ -61,7 +61,7 @@ The implemented functions follow the naming scheme of the API, but with undersco
|
|
|
61
61
|
1. I'm not a programmer. I'm not very good at this. Be aware of my incompetence.
|
|
62
62
|
2. Implementation is not complete. Not all functions of the API have been implemented
|
|
63
63
|
3. Type hinting is available for most functions, but not all of them.
|
|
64
|
-
E.g. `
|
|
64
|
+
E.g. `mail_set()` accepts kwargs due to the number of available attributes.
|
|
65
65
|
In that case type errors will be returned if wrong types are provided.
|
|
66
66
|
|
|
67
67
|
## API documentation
|
|
@@ -46,7 +46,7 @@ The implemented functions follow the naming scheme of the API, but with undersco
|
|
|
46
46
|
1. I'm not a programmer. I'm not very good at this. Be aware of my incompetence.
|
|
47
47
|
2. Implementation is not complete. Not all functions of the API have been implemented
|
|
48
48
|
3. Type hinting is available for most functions, but not all of them.
|
|
49
|
-
E.g. `
|
|
49
|
+
E.g. `mail_set()` accepts kwargs due to the number of available attributes.
|
|
50
50
|
In that case type errors will be returned if wrong types are provided.
|
|
51
51
|
|
|
52
52
|
## API documentation
|
|
@@ -161,6 +161,69 @@ class APIClient:
|
|
|
161
161
|
"""
|
|
162
162
|
return self.api_request('account.del', {'account':account})
|
|
163
163
|
|
|
164
|
+
def account_invoice_list(self, account: str) -> dict:
|
|
165
|
+
"""
|
|
166
|
+
Function to list all invoices for a specific account
|
|
167
|
+
:param account: the account name to list
|
|
168
|
+
:return: the response from the mailbox.org Business API
|
|
169
|
+
"""
|
|
170
|
+
return self.api_request('account.invoice.list', {'account':account})
|
|
171
|
+
|
|
172
|
+
def account_invoice_get(self, account: str, token: str) -> dict:
|
|
173
|
+
"""
|
|
174
|
+
Function to get a specific of all invoices for an account
|
|
175
|
+
:param account: the account name
|
|
176
|
+
:param token: the token for the invoice
|
|
177
|
+
:return: the response from the mailbox.org Business API - the invoice as a Base64 encoded gzipped string
|
|
178
|
+
"""
|
|
179
|
+
return self.api_request('account.invoice.get', {'account':account, 'token':token})
|
|
180
|
+
|
|
181
|
+
def account_invoice_get_list(self, account: str) -> list:
|
|
182
|
+
"""
|
|
183
|
+
Function to get a list of all invoices for a specific account
|
|
184
|
+
"""
|
|
185
|
+
response = self.api_request('account.invoice.list', {'account':account})
|
|
186
|
+
invoices = []
|
|
187
|
+
|
|
188
|
+
for invoice in response:
|
|
189
|
+
invoices.append(invoice['invoice_id'])
|
|
190
|
+
|
|
191
|
+
return invoices
|
|
192
|
+
|
|
193
|
+
def account_invoice_get_token(self, account: str, invoice_id: str) -> str:
|
|
194
|
+
"""
|
|
195
|
+
Function to get the token for a specific invoices of an account
|
|
196
|
+
:param account: the account name
|
|
197
|
+
:param invoice_id: the id of the invoice
|
|
198
|
+
:return: the response from the mailbox.org Business API - the token to get the invoice
|
|
199
|
+
"""
|
|
200
|
+
response = self.api_request('account.invoice.list', {'account': account})
|
|
201
|
+
for invoice in response:
|
|
202
|
+
if invoice['invoice_id'] == invoice_id:
|
|
203
|
+
return invoice['token']
|
|
204
|
+
raise ValueError('Invoice not found')
|
|
205
|
+
|
|
206
|
+
def account_invoice_get_pdf(self, account: str, token: str) -> bytes:
|
|
207
|
+
"""
|
|
208
|
+
Function to get a specific invoice as a PDf-file
|
|
209
|
+
:param account: the account name
|
|
210
|
+
:param token: the token for the invoice
|
|
211
|
+
:return: the PDF as bytes
|
|
212
|
+
"""
|
|
213
|
+
import base64
|
|
214
|
+
import zlib
|
|
215
|
+
|
|
216
|
+
# Get the invoice data
|
|
217
|
+
response = self.api_request('account.invoice.get', {'account': account, 'token': token})
|
|
218
|
+
|
|
219
|
+
# Get the Base64 encoded data and decode it Decode string to gzip
|
|
220
|
+
compressed_data = base64.b64decode(response['bin'])
|
|
221
|
+
|
|
222
|
+
# Decompress the gzipped data
|
|
223
|
+
decompressed_data = zlib.decompress(compressed_data)
|
|
224
|
+
|
|
225
|
+
return decompressed_data
|
|
226
|
+
|
|
164
227
|
def domain_list(self, account: str) -> dict:
|
|
165
228
|
"""
|
|
166
229
|
Function to list all domains
|
|
@@ -392,6 +455,60 @@ class APIClient:
|
|
|
392
455
|
"""
|
|
393
456
|
return self.api_request('mail.externaluid', {'mail':mail})
|
|
394
457
|
|
|
458
|
+
def mail_backup_list(self, mail: str) -> dict:
|
|
459
|
+
"""
|
|
460
|
+
Function to list all backups for a given mail
|
|
461
|
+
:param mail: the mail to list backups for
|
|
462
|
+
:return: the response for the request - a list of backups
|
|
463
|
+
"""
|
|
464
|
+
return self.api_request('mail.backup.list', {'mail':mail})
|
|
465
|
+
|
|
466
|
+
def mail_backup_import(self, mail: str, id: str, time: str, filter: str) -> dict:
|
|
467
|
+
"""
|
|
468
|
+
Function to import a backup for a mail
|
|
469
|
+
:param mail: the mail to import
|
|
470
|
+
:param id: the id of the backup
|
|
471
|
+
:param time: the time of the backup
|
|
472
|
+
:param filter: the filter of the backup - "all" or an IMAP foldername
|
|
473
|
+
"""
|
|
474
|
+
return self.api_request('mail.backup.import',
|
|
475
|
+
{'mail':mail, 'id':id, 'time':time, 'filter':filter})
|
|
476
|
+
|
|
477
|
+
def group_list(self) -> dict:
|
|
478
|
+
"""
|
|
479
|
+
Function to list all groups for an account
|
|
480
|
+
"""
|
|
481
|
+
return self.api_request('group.list', {})
|
|
482
|
+
|
|
483
|
+
def group_add(self, name: str, display_name: str, mail_addresses_to_add: list) -> dict:
|
|
484
|
+
"""
|
|
485
|
+
Function to add a group
|
|
486
|
+
:param name: the group name
|
|
487
|
+
:param display_name: the group's display name
|
|
488
|
+
:param mail_addresses_to_add: a list of mail addresses to add
|
|
489
|
+
"""
|
|
490
|
+
return self.api_request('group.add', {'name':name, 'display_name':display_name,
|
|
491
|
+
'mail_addresses_to_add':mail_addresses_to_add})
|
|
492
|
+
|
|
493
|
+
def group_set(self, name: str, display_name: str, mail_addresses_to_add: list, mail_addresses_to_remove: list) -> dict:
|
|
494
|
+
"""
|
|
495
|
+
Function to modify a group
|
|
496
|
+
:param name: the group name
|
|
497
|
+
:param display_name: the group's display name
|
|
498
|
+
:param mail_addresses_to_add: a list of mail addresses to add
|
|
499
|
+
:param mail_addresses_to_remove: a list of mail addresses to remove
|
|
500
|
+
"""
|
|
501
|
+
return self.api_request('group.set', {'name':name, 'display_name':display_name,
|
|
502
|
+
'mail_addresses_to_add':mail_addresses_to_add,
|
|
503
|
+
'mail_addresses_to_remove':mail_addresses_to_remove})
|
|
504
|
+
|
|
505
|
+
def group_del(self, name: str) -> dict:
|
|
506
|
+
"""
|
|
507
|
+
Function to delete a group
|
|
508
|
+
:param name: the group's name
|
|
509
|
+
"""
|
|
510
|
+
return self.api_request('group.delete', {'name':name})
|
|
511
|
+
|
|
395
512
|
def context_list(self, account: str) -> dict:
|
|
396
513
|
"""
|
|
397
514
|
Function to list all contexts of a given account
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mailbox-org-api
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4
|
|
4
4
|
Summary: A library to access the mailbox.org Business API.
|
|
5
5
|
Author: Hendrik Schlange
|
|
6
6
|
Author-email: Hendrik Schlange <mail@heshsum.de>
|
|
@@ -61,7 +61,7 @@ The implemented functions follow the naming scheme of the API, but with undersco
|
|
|
61
61
|
1. I'm not a programmer. I'm not very good at this. Be aware of my incompetence.
|
|
62
62
|
2. Implementation is not complete. Not all functions of the API have been implemented
|
|
63
63
|
3. Type hinting is available for most functions, but not all of them.
|
|
64
|
-
E.g. `
|
|
64
|
+
E.g. `mail_set()` accepts kwargs due to the number of available attributes.
|
|
65
65
|
In that case type errors will be returned if wrong types are provided.
|
|
66
66
|
|
|
67
67
|
## API documentation
|
|
@@ -3,7 +3,7 @@ from setuptools import find_packages, setup
|
|
|
3
3
|
setup(
|
|
4
4
|
name='mailbox_org_api',
|
|
5
5
|
packages=find_packages(),
|
|
6
|
-
version='0.
|
|
6
|
+
version='0.4',
|
|
7
7
|
description='A library to access the mailbox.org Business API',
|
|
8
8
|
author='Hendrik Schlange',
|
|
9
9
|
install_requires=['requests'],
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|