mailbox-org-api 2.2__tar.gz → 2.3__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-2.2 → mailbox_org_api-2.3}/PKG-INFO +2 -2
- {mailbox_org_api-2.2 → mailbox_org_api-2.3}/mailbox_org_api/APIClient.py +50 -28
- {mailbox_org_api-2.2 → mailbox_org_api-2.3}/mailbox_org_api.egg-info/PKG-INFO +2 -2
- {mailbox_org_api-2.2 → mailbox_org_api-2.3}/pyproject.toml +2 -2
- {mailbox_org_api-2.2 → mailbox_org_api-2.3}/setup.py +2 -2
- {mailbox_org_api-2.2 → mailbox_org_api-2.3}/LICENSE +0 -0
- {mailbox_org_api-2.2 → mailbox_org_api-2.3}/README.md +0 -0
- {mailbox_org_api-2.2 → mailbox_org_api-2.3}/mailbox_org_api/APIError.py +0 -0
- {mailbox_org_api-2.2 → mailbox_org_api-2.3}/mailbox_org_api/Account.py +0 -0
- {mailbox_org_api-2.2 → mailbox_org_api-2.3}/mailbox_org_api/Invoice.py +0 -0
- {mailbox_org_api-2.2 → mailbox_org_api-2.3}/mailbox_org_api/Mail.py +0 -0
- {mailbox_org_api-2.2 → mailbox_org_api-2.3}/mailbox_org_api/__init__.py +0 -0
- {mailbox_org_api-2.2 → mailbox_org_api-2.3}/mailbox_org_api.egg-info/SOURCES.txt +0 -0
- {mailbox_org_api-2.2 → mailbox_org_api-2.3}/mailbox_org_api.egg-info/dependency_links.txt +0 -0
- {mailbox_org_api-2.2 → mailbox_org_api-2.3}/mailbox_org_api.egg-info/top_level.txt +0 -0
- {mailbox_org_api-2.2 → mailbox_org_api-2.3}/setup.cfg +0 -0
- {mailbox_org_api-2.2 → mailbox_org_api-2.3}/tests/TestAPIClient.py +0 -0
- {mailbox_org_api-2.2 → mailbox_org_api-2.3}/tests/TestAccount.py +0 -0
- {mailbox_org_api-2.2 → mailbox_org_api-2.3}/tests/TestInvoice.py +0 -0
- {mailbox_org_api-2.2 → mailbox_org_api-2.3}/tests/TestMail.py +0 -0
- {mailbox_org_api-2.2 → mailbox_org_api-2.3}/tests/__init__.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mailbox-org-api
|
|
3
|
-
Version: 2.
|
|
4
|
-
Summary: A library to access the mailbox
|
|
3
|
+
Version: 2.3
|
|
4
|
+
Summary: A library to access the mailbox Business API.
|
|
5
5
|
Author: Hendrik Schlange
|
|
6
6
|
Author-email: Hendrik Schlange <mail@heshsum.de>
|
|
7
7
|
Project-URL: Homepage, https://github.com/heshsum/mailbox-org-api
|
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
Module for the mailbox Business API client
|
|
3
3
|
"""
|
|
4
4
|
import json
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
5
7
|
import requests
|
|
8
|
+
import typing_extensions
|
|
6
9
|
from requests.adapters import HTTPAdapter
|
|
7
|
-
from urllib3.util.retry import Retry
|
|
8
10
|
from requests.exceptions import RequestException
|
|
9
|
-
import
|
|
11
|
+
from urllib3.util.retry import Retry
|
|
12
|
+
|
|
10
13
|
from mailbox_org_api.APIError import APIError
|
|
11
14
|
from mailbox_org_api.Account import Account
|
|
12
|
-
from mailbox_org_api.Mail import Mail
|
|
13
15
|
from mailbox_org_api.Invoice import Invoice
|
|
16
|
+
from mailbox_org_api.Mail import Mail
|
|
14
17
|
|
|
15
18
|
headers = {'content-type': 'application/json'}
|
|
16
19
|
|
|
@@ -62,7 +65,7 @@ class APIClient:
|
|
|
62
65
|
self.jsonrpc_id += 1
|
|
63
66
|
return str(self.jsonrpc_id)
|
|
64
67
|
|
|
65
|
-
def api_request(self, method: str, params: dict) -> dict:
|
|
68
|
+
def api_request(self, method: str, params: dict) -> dict | Any:
|
|
66
69
|
"""
|
|
67
70
|
Function to send API calls
|
|
68
71
|
:param method: the method to call
|
|
@@ -365,7 +368,7 @@ class APIClient:
|
|
|
365
368
|
# Take the Base64 encoded data (response['bin']), decode the Base 64, decompress the gz and return the bytes
|
|
366
369
|
return zlib.decompress(base64.b64decode(response['bin']))
|
|
367
370
|
|
|
368
|
-
def domain_list(self, account:
|
|
371
|
+
def domain_list(self, account:str, search_filter:str | None = None) -> dict:
|
|
369
372
|
"""
|
|
370
373
|
Function to list all domains
|
|
371
374
|
:param account: the account to list domains for
|
|
@@ -373,8 +376,8 @@ class APIClient:
|
|
|
373
376
|
:return: the API response
|
|
374
377
|
"""
|
|
375
378
|
params = {'account':account}
|
|
376
|
-
if
|
|
377
|
-
params.update({'filter':search_filter})
|
|
379
|
+
if isinstance(search_filter, str):
|
|
380
|
+
params.update({'filter':str(search_filter)})
|
|
378
381
|
return self.api_request('domain.list',params)
|
|
379
382
|
|
|
380
383
|
def domain_add(self, account: str, domain: str, password: str, **kwargs) -> dict:
|
|
@@ -452,8 +455,8 @@ class APIClient:
|
|
|
452
455
|
"""
|
|
453
456
|
return self.api_request('domain.validate.spf', {'domain':domain})
|
|
454
457
|
|
|
455
|
-
def mail_list(self, domain: str, details: bool = False, page_size: int = None, page: int
|
|
456
|
-
sort_order: str = None) -> dict:
|
|
458
|
+
def mail_list(self, domain: str, details: bool = False, page_size: int | None= None, page: int | None = None,
|
|
459
|
+
sort_field: str | None = None, sort_order: str | None = None) -> dict:
|
|
457
460
|
"""
|
|
458
461
|
Function to list all mailboxes
|
|
459
462
|
:param domain: the domain to list
|
|
@@ -488,7 +491,7 @@ class APIClient:
|
|
|
488
491
|
return self.api_request('mail.list', params)
|
|
489
492
|
|
|
490
493
|
def mail_add(self, mail:str, password: str, plan: str, first_name: str, last_name: str, inboxsave: bool = True,
|
|
491
|
-
forwards: list = None, **kwargs) -> dict:
|
|
494
|
+
forwards: list | None= None, **kwargs) -> dict:
|
|
492
495
|
"""
|
|
493
496
|
Function to add a mail
|
|
494
497
|
:param mail: the mail to add
|
|
@@ -818,7 +821,7 @@ class APIClient:
|
|
|
818
821
|
return self.api_request('mail.vacation.get', {'mail':mail})
|
|
819
822
|
|
|
820
823
|
def mail_vacation_set(self, mail: str, subject: str, body: str, start_date: str, end_date: str,
|
|
821
|
-
additional_mail_addresses: list = None) -> dict:
|
|
824
|
+
additional_mail_addresses: list | None = None) -> dict:
|
|
822
825
|
"""
|
|
823
826
|
Function to set the vacation notice for a given mail
|
|
824
827
|
:param mail: the mail to get the vacation notice for
|
|
@@ -838,57 +841,75 @@ class APIClient:
|
|
|
838
841
|
|
|
839
842
|
return self.api_request('mail.vacation.set', params)
|
|
840
843
|
|
|
841
|
-
def group_list(self) -> dict:
|
|
844
|
+
def group_list(self, account:str | None = None) -> dict:
|
|
842
845
|
"""
|
|
843
846
|
Function to list all groups for an account
|
|
847
|
+
:param account: optional parameter for the account to list the groups for
|
|
844
848
|
:return: mailbox API response - the list of groups
|
|
845
849
|
"""
|
|
846
|
-
|
|
850
|
+
params = {}
|
|
851
|
+
if account:
|
|
852
|
+
params['account'] = account
|
|
853
|
+
return self.api_request('group.list', params)
|
|
847
854
|
|
|
848
|
-
def group_get(self, group_id: int) -> dict:
|
|
855
|
+
def group_get(self, group_id: int, account: str | None = None) -> dict:
|
|
849
856
|
"""
|
|
850
857
|
Function to get a group from the account by the group id
|
|
851
858
|
:param group_id: the id of the group to get
|
|
859
|
+
:param account: optional parameter for the account to get the group for
|
|
852
860
|
:return: mailbox API response - the list of groups of the account
|
|
853
861
|
"""
|
|
854
|
-
|
|
862
|
+
params = {'group_id': group_id}
|
|
863
|
+
if account:
|
|
864
|
+
params['account'] = account
|
|
865
|
+
return self.api_request('group.get', params)
|
|
855
866
|
|
|
856
|
-
def group_del(self, group_id: int) -> dict:
|
|
867
|
+
def group_del(self, group_id: int, account: str | None = None) -> dict:
|
|
857
868
|
"""
|
|
858
869
|
Function to delete a group
|
|
859
870
|
:param group_id: the group's id of the group to delete
|
|
871
|
+
:param account: optional parameter for the account to delete the group for
|
|
860
872
|
:return: mailbox API response - True if the group was deleted, False otherwise
|
|
861
873
|
"""
|
|
862
|
-
|
|
874
|
+
params = {'group_id': group_id}
|
|
875
|
+
if account:
|
|
876
|
+
params['account'] = account
|
|
877
|
+
return self.api_request('group.del', params)
|
|
863
878
|
|
|
864
|
-
def group_add(self, name: str, display_name: str, mail_addresses_to_add: list) -> dict:
|
|
879
|
+
def group_add(self, name: str, display_name: str, mail_addresses_to_add: list, account: str | None = None) -> dict:
|
|
865
880
|
"""
|
|
866
881
|
Function to add a group
|
|
867
882
|
:param name: the group name
|
|
868
883
|
:param display_name: the group's display name
|
|
869
884
|
:param mail_addresses_to_add: a list of mail addresses to add
|
|
885
|
+
:param account: optional parameter for the account to add the group for
|
|
870
886
|
:return: mailbox API response - True if the group was added, False otherwise
|
|
871
887
|
"""
|
|
872
|
-
|
|
873
|
-
|
|
888
|
+
params = {'name':name, 'display_name':display_name, 'mail_addresses_to_add':mail_addresses_to_add}
|
|
889
|
+
if account:
|
|
890
|
+
params['account'] = account
|
|
891
|
+
return self.api_request('group.add', params)
|
|
874
892
|
|
|
875
|
-
def group_set(self, group_id: int, display_name: str, mail_addresses_to_add: list = None,
|
|
876
|
-
mail_addresses_to_remove: list = None) -> dict:
|
|
893
|
+
def group_set(self, group_id: int, display_name: str, mail_addresses_to_add: list | None = None,
|
|
894
|
+
mail_addresses_to_remove: list | None = None, account: str | None= None) -> dict:
|
|
877
895
|
"""
|
|
878
896
|
Function to modify a group. Either mail_addresses_to_add or mail_addresses_to_remove have to be specified.
|
|
879
897
|
:param group_id: the group's id of the group to modify
|
|
880
898
|
:param display_name: the group's display name
|
|
881
899
|
:param mail_addresses_to_add: a list of mail addresses to add. Defaults to None
|
|
882
900
|
:param mail_addresses_to_remove: a list of mail addresses to remove. Defaults to None
|
|
901
|
+
:param account: optional parameter for the account to set the group for
|
|
883
902
|
:return: mailbox API response - True if the group was edited, False otherwise
|
|
884
903
|
"""
|
|
885
904
|
# If mail_addresses_to_add and mail_addresses_to_remove are both empty, raise error
|
|
886
905
|
if mail_addresses_to_add is None and mail_addresses_to_remove is None:
|
|
887
906
|
raise ValueError('mail_addresses_to_add or mail_addresses_to_remove are required')
|
|
888
907
|
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
908
|
+
params = {'group_id':group_id, 'display_name':display_name, 'mail_addresses_to_add':mail_addresses_to_add,
|
|
909
|
+
'mail_addresses_to_remove':mail_addresses_to_remove}
|
|
910
|
+
if account:
|
|
911
|
+
params['account'] = account
|
|
912
|
+
return self.api_request('group.set', params)
|
|
892
913
|
|
|
893
914
|
def mail_passwordreset_listmethods(self, mail: str) -> dict:
|
|
894
915
|
"""
|
|
@@ -945,7 +966,7 @@ class APIClient:
|
|
|
945
966
|
"""
|
|
946
967
|
return self.api_request('mailinglist.list', {'account':account})
|
|
947
968
|
|
|
948
|
-
def mailinglist_add(self, mailinglist: str, password: str, account: str, adminmail: str = None) -> dict:
|
|
969
|
+
def mailinglist_add(self, mailinglist: str, password: str, account: str, adminmail: str | None = None) -> dict:
|
|
949
970
|
"""
|
|
950
971
|
Function to add a mailing list
|
|
951
972
|
:param mailinglist: the mailing list to add
|
|
@@ -966,7 +987,8 @@ class APIClient:
|
|
|
966
987
|
"""
|
|
967
988
|
return self.api_request('mailinglist.get', {'mailinglist':mailinglist, 'account':account})
|
|
968
989
|
|
|
969
|
-
def mailinglist_set(self, mailinglist: str, account: str, password: str
|
|
990
|
+
def mailinglist_set(self, mailinglist: str, account: str, password: str | None = None,
|
|
991
|
+
adminmail: str | None = None) -> dict:
|
|
970
992
|
"""
|
|
971
993
|
Function to change a mailing list
|
|
972
994
|
:param mailinglist: the mailing list to change
|
|
@@ -996,7 +1018,7 @@ class APIClient:
|
|
|
996
1018
|
return self.api_request('additionalmailaccount.list', {'parent_mail':parent_mail})
|
|
997
1019
|
|
|
998
1020
|
def additionalmailaccount_add(self, parent_mail: str, new_account_mail: str, new_account_password: str,
|
|
999
|
-
primary_address: str = None, mail_server: str = 'imap.mailbox.org',
|
|
1021
|
+
primary_address: str | None = None, mail_server: str = 'imap.mailbox.org',
|
|
1000
1022
|
mail_port: int = 993, mail_secure: bool = True, mail_starttls: bool = False,
|
|
1001
1023
|
transport_server: str = 'smtp.mailbox.org', transport_port: int = 465,
|
|
1002
1024
|
transport_secure: bool = True, transport_starttls: bool = False,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mailbox-org-api
|
|
3
|
-
Version: 2.
|
|
4
|
-
Summary: A library to access the mailbox
|
|
3
|
+
Version: 2.3
|
|
4
|
+
Summary: A library to access the mailbox Business API.
|
|
5
5
|
Author: Hendrik Schlange
|
|
6
6
|
Author-email: Hendrik Schlange <mail@heshsum.de>
|
|
7
7
|
Project-URL: Homepage, https://github.com/heshsum/mailbox-org-api
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "mailbox-org-api"
|
|
3
|
-
version = "2.
|
|
3
|
+
version = "2.3"
|
|
4
4
|
authors = [
|
|
5
5
|
{ name="Hendrik Schlange", email="mail@heshsum.de" },
|
|
6
6
|
]
|
|
7
|
-
description = "A library to access the mailbox
|
|
7
|
+
description = "A library to access the mailbox Business API."
|
|
8
8
|
readme = "README.md"
|
|
9
9
|
requires-python = ">=3.11"
|
|
10
10
|
classifiers = [
|
|
@@ -3,8 +3,8 @@ from setuptools import find_packages, setup
|
|
|
3
3
|
setup(
|
|
4
4
|
name='mailbox_org_api',
|
|
5
5
|
packages=find_packages(),
|
|
6
|
-
version='2.
|
|
7
|
-
description='A library to access the mailbox
|
|
6
|
+
version='2.3',
|
|
7
|
+
description='A library to access the mailbox Business API',
|
|
8
8
|
author='Hendrik Schlange',
|
|
9
9
|
install_requires=['requests'],
|
|
10
10
|
tests_require=['pytest'],
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|