python-amcards 1.2.31__py3-none-any.whl → 1.2.32__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.
- amcards/amcards.py +23 -0
- {python_amcards-1.2.31.dist-info → python_amcards-1.2.32.dist-info}/METADATA +1 -1
- python_amcards-1.2.32.dist-info/RECORD +10 -0
- python_amcards-1.2.31.dist-info/RECORD +0 -10
- {python_amcards-1.2.31.dist-info → python_amcards-1.2.32.dist-info}/LICENSE +0 -0
- {python_amcards-1.2.31.dist-info → python_amcards-1.2.32.dist-info}/WHEEL +0 -0
- {python_amcards-1.2.31.dist-info → python_amcards-1.2.32.dist-info}/top_level.txt +0 -0
amcards/amcards.py
CHANGED
|
@@ -265,6 +265,29 @@ class AMcardsClient:
|
|
|
265
265
|
card_json = res.json()
|
|
266
266
|
return Card._from_json(card_json)
|
|
267
267
|
|
|
268
|
+
def card_count(self, filters: dict = None) -> int:
|
|
269
|
+
"""Fetches count of client's AMcards cards.
|
|
270
|
+
|
|
271
|
+
:param Optional[dict] filters: Defaults to ``None``. Filters to be applied when counting cards.
|
|
272
|
+
|
|
273
|
+
A common use case is to use ``filter = {'third_party_contact_id': 'some_target_id'}``, this will fetch all cards that were shipped to a recipient with a ``third_party_contact_id == 'some_target_id'``.
|
|
274
|
+
|
|
275
|
+
:return: The count of client's cards.
|
|
276
|
+
:rtype: int
|
|
277
|
+
|
|
278
|
+
:raises AuthenticationError: When the client's ``access_token`` is invalid.
|
|
279
|
+
|
|
280
|
+
"""
|
|
281
|
+
params = {
|
|
282
|
+
'limit': 1,
|
|
283
|
+
} | (filters or {})
|
|
284
|
+
|
|
285
|
+
res = requests.get(url=f'{DOMAIN}/.api/v1/card/', headers=self._HEADERS, params=params)
|
|
286
|
+
if not res.ok:
|
|
287
|
+
raise exceptions.AuthenticationError('Access token provided to client is unauthorized')
|
|
288
|
+
|
|
289
|
+
return res.json()['meta']['total_count']
|
|
290
|
+
|
|
268
291
|
def mailing(self, id: str | int) -> Mailing:
|
|
269
292
|
"""Fetches client's AMcards mailing with a specified id.
|
|
270
293
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
amcards/__helpers.py,sha256=iQ3L-79XyDBoE8ZsenCac7xii-1LN86Go3w_yu95VaE,5466
|
|
2
|
+
amcards/__init__.py,sha256=nl-oq4BKdYSQZPNbtraEMHFf_8MU8gSOlJZIYxKudcM,34
|
|
3
|
+
amcards/amcards.py,sha256=xuL68Qu23fj9zv_NxdAiutDWzbAV0y_rQWlQH46KgpI,59157
|
|
4
|
+
amcards/exceptions.py,sha256=wPu5lipT4oTJ2h-NY82jO_AjG68flmbFpcA-0xy0t_w,1978
|
|
5
|
+
amcards/models.py,sha256=AZdr_L1uKfFgoDtcSFZE7od9CQdveAuZxXpFHKNQwIg,27723
|
|
6
|
+
python_amcards-1.2.32.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
7
|
+
python_amcards-1.2.32.dist-info/METADATA,sha256=Rrr-at-Y3pmA-OOpkiGegTtKl2jP9UbZKQTBnoD6c0k,3078
|
|
8
|
+
python_amcards-1.2.32.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
9
|
+
python_amcards-1.2.32.dist-info/top_level.txt,sha256=xst-AU0pzvWXz3DQR-QICIruzgcf4Bkt6FF_GldcIck,8
|
|
10
|
+
python_amcards-1.2.32.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
amcards/__helpers.py,sha256=iQ3L-79XyDBoE8ZsenCac7xii-1LN86Go3w_yu95VaE,5466
|
|
2
|
-
amcards/__init__.py,sha256=nl-oq4BKdYSQZPNbtraEMHFf_8MU8gSOlJZIYxKudcM,34
|
|
3
|
-
amcards/amcards.py,sha256=tQNyySFCzenAX2C6nxC2PYjySieGQNFNt8SyCoswmsg,58224
|
|
4
|
-
amcards/exceptions.py,sha256=wPu5lipT4oTJ2h-NY82jO_AjG68flmbFpcA-0xy0t_w,1978
|
|
5
|
-
amcards/models.py,sha256=AZdr_L1uKfFgoDtcSFZE7od9CQdveAuZxXpFHKNQwIg,27723
|
|
6
|
-
python_amcards-1.2.31.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
7
|
-
python_amcards-1.2.31.dist-info/METADATA,sha256=MFcBZMz-md7OH5juPH-3nCrDbQf9Y3bPpkeHXUUX5oI,3078
|
|
8
|
-
python_amcards-1.2.31.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
9
|
-
python_amcards-1.2.31.dist-info/top_level.txt,sha256=xst-AU0pzvWXz3DQR-QICIruzgcf4Bkt6FF_GldcIck,8
|
|
10
|
-
python_amcards-1.2.31.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|