python-amcards 1.2.31__tar.gz → 1.2.33__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.
- {python_amcards-1.2.31 → python_amcards-1.2.33}/PKG-INFO +1 -1
- {python_amcards-1.2.31 → python_amcards-1.2.33}/amcards/amcards.py +23 -0
- {python_amcards-1.2.31 → python_amcards-1.2.33}/amcards/models.py +6 -0
- {python_amcards-1.2.31 → python_amcards-1.2.33}/python_amcards.egg-info/PKG-INFO +1 -1
- {python_amcards-1.2.31 → python_amcards-1.2.33}/setup.py +1 -1
- {python_amcards-1.2.31 → python_amcards-1.2.33}/LICENSE +0 -0
- {python_amcards-1.2.31 → python_amcards-1.2.33}/README.rst +0 -0
- {python_amcards-1.2.31 → python_amcards-1.2.33}/amcards/__helpers.py +0 -0
- {python_amcards-1.2.31 → python_amcards-1.2.33}/amcards/__init__.py +0 -0
- {python_amcards-1.2.31 → python_amcards-1.2.33}/amcards/exceptions.py +0 -0
- {python_amcards-1.2.31 → python_amcards-1.2.33}/python_amcards.egg-info/SOURCES.txt +0 -0
- {python_amcards-1.2.31 → python_amcards-1.2.33}/python_amcards.egg-info/dependency_links.txt +0 -0
- {python_amcards-1.2.31 → python_amcards-1.2.33}/python_amcards.egg-info/requires.txt +0 -0
- {python_amcards-1.2.31 → python_amcards-1.2.33}/python_amcards.egg-info/top_level.txt +0 -0
- {python_amcards-1.2.31 → python_amcards-1.2.33}/setup.cfg +0 -0
|
@@ -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
|
|
|
@@ -288,6 +288,11 @@ class Campaign:
|
|
|
288
288
|
"""Drip campaign's name."""
|
|
289
289
|
return self._name
|
|
290
290
|
|
|
291
|
+
@property
|
|
292
|
+
def drip_count(self) -> int:
|
|
293
|
+
"""Drip campaign's drip count."""
|
|
294
|
+
return self._drip_count
|
|
295
|
+
|
|
291
296
|
@property
|
|
292
297
|
def send_if_duplicate(self) -> bool:
|
|
293
298
|
"""If True, AMcards will not attempt to detect and prevent duplicates. Otherwise, if this campaign has been previously sent to a contact, further campaign send attempts to the same contact will be prevented."""
|
|
@@ -308,6 +313,7 @@ class Campaign:
|
|
|
308
313
|
return cls(
|
|
309
314
|
id=json['id'],
|
|
310
315
|
name=json['title'],
|
|
316
|
+
drip_count=json['drip_count'],
|
|
311
317
|
send_if_duplicate=json['send_even_if_duplicate'],
|
|
312
318
|
has_anniversary_drip=json['has_anniversary_drip'],
|
|
313
319
|
has_birthday_drip=json['has_birthday_drip'],
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_amcards-1.2.31 → python_amcards-1.2.33}/python_amcards.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|