Subscribers¶
Resource¶
Methods¶
-
Subscriber.
update
()¶ Posts the values in the resource to the server.
Example:
# Change an attribute and save the resource >> resource.value = something >> updated_resource = resource.update()
Returns: The updated resource from the server
-
Subscriber.
get
(name) → Union[int, str, float, bool]¶ Safely obtain any attribute name for the resource
Parameters: name (str) – Key name in json response Returns: Value from the raw json response. If the key doesn’t exist None
is returned.
-
Subscriber.
delete
() → None¶ Deletes the resource from the server
Attributes¶
-
Subscriber.
attrs
¶ The raw json respons from the server
Type: dict
-
Subscriber.
id
¶ Resource ID
Type: int
-
Subscriber.
email
¶ email address
Type: str
-
Subscriber.
verify_code
¶ Auto generated unique verify code
Type: str
-
Subscriber.
is_global
¶ Is the user subscribed to all components?
Type: bool
-
Subscriber.
created_at
¶ When the subscription was created
Type: datetime
-
Subscriber.
updated_at
¶ Last time the subscription was updated
Type: datetime
-
Subscriber.
verified_at
¶ When the subscription was verified.
None
if not verifiedType: datetime
Manager¶
-
SubscriberManager.
create
(*, email: str, components: List[int] = None, verify: bool = True) → cachetclient.v1.subscribers.Subscriber¶ Create a subscriber. If a subscriber already exists the existing one will be returned. Note that this endoint cannot be used to edit the user.
Keyword Arguments: - email (str) – Email address to subscribe
- components (List[int]) – The components to subscribe to. If omitted all components are subscribed.
- verify (bool) – Verification status. If
False
a verification email is sent to the user
Returns: Subscriber
instance
-
SubscriberManager.
list
(page: int = 1, per_page: int = 20) → Generator[cachetclient.v1.subscribers.Subscriber, None, None]¶ List all subscribers
Keyword Arguments: - page (int) – The page to start listing
- per_page – Number of entires per page
Returns: Generator of Subscriber instances
-
SubscriberManager.
delete
(subscriber_id: int) → None¶ Delete a specific subscriber id
Parameters: subscriber_id (int) – Subscriber id to delete Raises: requests.exceptions.HttpError
– if subscriber do not exist
-
SubscriberManager.
count
() → int¶ Count the total number of subscribers
Returns: Number of subscribers Return type: int