Schedules¶
Resource¶
Methods¶
-
Schedule.
get
(name) → Any¶ 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.
-
Schedule.
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
- Return type
Resource
-
Schedule.
delete
() → None¶ Deletes the resource from the server.
- Raises
HTTPException if the resource don't exist. –
Attributes¶
-
Schedule.
id
¶ Resource ID
- Type
int
-
Schedule.
name
¶ Name of the scheduled event
- Type
str
-
Schedule.
message
¶ Message string
- Type
str
-
Schedule.
status
¶ Status of the scheduled event
- Type
int
-
Schedule.
scheduled_at
¶ When the event is schedule for
- Type
datetime
-
Schedule.
completed_at
¶ When the event is completed
- Type
datetime
-
Schedule.
attrs
¶ The raw json response from the server
- Type
dict
Manager¶
Methods¶
-
ScheduleManager.
__init__
(http_client: cachetclient.httpclient.HttpClient)¶ Manager initializer.
- Parameters
http_client – The httpclient
-
ScheduleManager.
create
(*, name: str, status: int, message: str = None, scheduled_at: datetime.datetime = None, completed_at: datetime.datetime = None, notify: bool = True)¶ Create a schedule.
- Keyword Arguments
name (str) – Name of the scheduled event
status (int) – Schedule status. See
enums
mesage (str) – Message string
scheduled_at (datetime) – When the event starts
completed_at (datetime) – When the event ends
notify (bool) – Notify subscribers
- Returns
Schedule
instance
-
ScheduleManager.
update
(schedule_id: int, *, name: str, status: int, message: str = None, scheduled_at: datetime.datetime = None, **kwargs) → cachetclient.v1.schedules.Schedule¶ Update a Schedule by id.
- Parameters
schedule_id (int) – The schedule to update
- Keyword Arguments
status (int) – Status of the schedule (see enums)
name (str) – New name
description (str) – New description
- Returns
Updated Schedule from server
-
ScheduleManager.
list
(page: int = 1, per_page: int = 20) → Generator[cachetclient.v1.schedules.Schedule, None, None]¶ List all schedules
- Keyword Arguments
page (int) – The page to start listing
per_page (int) – Number of entries per page
- Returns
Generator of Schedules instances
-
ScheduleManager.
get
(schedule_id: int) → cachetclient.v1.schedules.Schedule¶ Get a schedule by id
- Parameters
schedule_id (int) – Id of the schedule
- Returns
Schedule instance
- Raises
HttpError – if not found
-
ScheduleManager.
delete
(schedule_id: int) → None¶ Delete a schedule
- Parameters
schedule_id (int) – Id of the schedule
- Raises
HTTPError – if schedule do not exist
-
ScheduleManager.
count
() → int¶ Count the total number of scheduled events
- Returns
Number of subscribers
- Return type
int
-
ScheduleManager.
instance_from_dict
(data: dict) → cachetclient.base.Resource¶ Creates a resource instance from a dictionary.
This doesn’t hit any endpoints in cachet, but rather enables us to create a resource class instance from dictionary data. This can be useful when caching data from cachet in memcache or databases.
- Parameters
data (dict) – dictionary containing the instance data
- Returns
The resource class instance
- Return type
Resource
-
ScheduleManager.
instance_from_json
(data: str) → cachetclient.base.Resource¶ Creates a resource instance from a json string.
This doesn’t hit any endpoints in cachet, but rather enables us to create a resource class instance from json data. This can be useful when caching data from cachet in memcache or databases.
- Parameters
data (str) – json string containing the instance data
- Returns
The resource class instance
- Return type
Resource
-
ScheduleManager.
instance_list_from_json
(data: str) → List[cachetclient.base.Resource]¶ Creates a resource instance list from a json string.
This doesn’t hit any endpoints in cachet, but rather enables us to create a resource class instances from json data. This can be useful when caching data from cachet in memcache or databases.
- Parameters
data (str) – json string containing the instance data
- Returns
The resource class instance
- Return type
Resource
- Raises
ValueError – if json data do not deserialize into a list