Toggl¶
Toggl Classes¶
These can all be accessed from an instantiated Toggl client. For example:
>>> toggl = Toggl('api_token')
>>> toggl.Clients.get()
...
>>> toggl.Dashboard.get(3542)
...
>>> toggl.Workspaces.get()
...
-
class
togglwrapper.api.Clients(toggl)[source]¶ The
Clientsobject.Groups all actions relating to Clients together.
-
create(data)¶ Creates a new instance of the object type.
- Args:
- data (dict): The dict of information needed to create a new object.
-
delete(id=None, ids=None)¶ Deletes a specific instance by ID, or delete multiple instances.
- Args:
- id (int, optional): The ID of the instance to delete. Defaulta to
- None.
- ids (iterable of ints, optional): An iterable of IDs of instances
- to delete. Not all objects allow for deleting multiple instances at once. See Toggl’s API Documentation to see where this is allowed. Defaults to None.
-
get(id=None, child_uri=None, params=None)¶ Gets the array of objects, or a specific instance by ID.
- Args:
- id (int, optional): The ID of a specific instance of the Object.
- If none provided, the array of all available instances is retrieved, provided that an endpoint exists for it. Defaults to None.
- child_uri (str, optional): The URI of the child Object or subpath.
- e.g. If we wanted the Clients of a Workspace, where the Workspace is the parent object, the child URI is ‘/clients’. Defaults to None.
- params (dict, optional): The dictionary of additional params to
- include in as the querystring, appended to the URL. Keys with values of None will be ignored. Defaults to None.
-
get_projects(client_id, active=True)[source]¶ Gets the projects associated with the Client with the given ID.
- Args:
client_id (int): The ID of the client. active (bool or string, optional): Must be either True, False, or
the string ‘both’. Defaults to True.
-
update(id=None, ids=None, child_uri=None, data=None)¶ Updates a specific instance by ID, or update multiple instances.
- Args:
- id (int, optional): The ID of the instance to update. Defaults to
- None.
- ids (iterable of ints, optional): An iterable of IDs of instances
- to update. Not all objects allow multiple instances to be updated at once - see Toggl’s API Documentation to see where this is allowed. Defaults to None.
- child_uri (str, optional): The URI/path to append to the object’s
- URI, to update. Defaults to None.
- data (dict, optional): The dict of information to update the
- object(s). Defaults to None.
-
-
class
togglwrapper.api.Projects(toggl)[source]¶ -
create(data)¶ Creates a new instance of the object type.
- Args:
- data (dict): The dict of information needed to create a new object.
-
delete(id=None, ids=None)¶ Deletes a specific instance by ID, or delete multiple instances.
- Args:
- id (int, optional): The ID of the instance to delete. Defaulta to
- None.
- ids (iterable of ints, optional): An iterable of IDs of instances
- to delete. Not all objects allow for deleting multiple instances at once. See Toggl’s API Documentation to see where this is allowed. Defaults to None.
-
update(id=None, ids=None, child_uri=None, data=None)¶ Updates a specific instance by ID, or update multiple instances.
- Args:
- id (int, optional): The ID of the instance to update. Defaults to
- None.
- ids (iterable of ints, optional): An iterable of IDs of instances
- to update. Not all objects allow multiple instances to be updated at once - see Toggl’s API Documentation to see where this is allowed. Defaults to None.
- child_uri (str, optional): The URI/path to append to the object’s
- URI, to update. Defaults to None.
- data (dict, optional): The dict of information to update the
- object(s). Defaults to None.
-
-
class
togglwrapper.api.ProjectUsers(toggl)[source]¶ -
create(data)¶ Creates a new instance of the object type.
- Args:
- data (dict): The dict of information needed to create a new object.
-
delete(id=None, ids=None)¶ Deletes a specific instance by ID, or delete multiple instances.
- Args:
- id (int, optional): The ID of the instance to delete. Defaulta to
- None.
- ids (iterable of ints, optional): An iterable of IDs of instances
- to delete. Not all objects allow for deleting multiple instances at once. See Toggl’s API Documentation to see where this is allowed. Defaults to None.
-
update(id=None, ids=None, child_uri=None, data=None)¶ Updates a specific instance by ID, or update multiple instances.
- Args:
- id (int, optional): The ID of the instance to update. Defaults to
- None.
- ids (iterable of ints, optional): An iterable of IDs of instances
- to update. Not all objects allow multiple instances to be updated at once - see Toggl’s API Documentation to see where this is allowed. Defaults to None.
- child_uri (str, optional): The URI/path to append to the object’s
- URI, to update. Defaults to None.
- data (dict, optional): The dict of information to update the
- object(s). Defaults to None.
-
-
class
togglwrapper.api.Tags(toggl)[source]¶ -
create(data)¶ Creates a new instance of the object type.
- Args:
- data (dict): The dict of information needed to create a new object.
-
delete(id=None, ids=None)¶ Deletes a specific instance by ID, or delete multiple instances.
- Args:
- id (int, optional): The ID of the instance to delete. Defaulta to
- None.
- ids (iterable of ints, optional): An iterable of IDs of instances
- to delete. Not all objects allow for deleting multiple instances at once. See Toggl’s API Documentation to see where this is allowed. Defaults to None.
-
update(id=None, ids=None, child_uri=None, data=None)¶ Updates a specific instance by ID, or update multiple instances.
- Args:
- id (int, optional): The ID of the instance to update. Defaults to
- None.
- ids (iterable of ints, optional): An iterable of IDs of instances
- to update. Not all objects allow multiple instances to be updated at once - see Toggl’s API Documentation to see where this is allowed. Defaults to None.
- child_uri (str, optional): The URI/path to append to the object’s
- URI, to update. Defaults to None.
- data (dict, optional): The dict of information to update the
- object(s). Defaults to None.
-
-
class
togglwrapper.api.Tasks(toggl)[source]¶ -
create(data)¶ Creates a new instance of the object type.
- Args:
- data (dict): The dict of information needed to create a new object.
-
delete(id=None, ids=None)¶ Deletes a specific instance by ID, or delete multiple instances.
- Args:
- id (int, optional): The ID of the instance to delete. Defaulta to
- None.
- ids (iterable of ints, optional): An iterable of IDs of instances
- to delete. Not all objects allow for deleting multiple instances at once. See Toggl’s API Documentation to see where this is allowed. Defaults to None.
-
update(id=None, ids=None, child_uri=None, data=None)¶ Updates a specific instance by ID, or update multiple instances.
- Args:
- id (int, optional): The ID of the instance to update. Defaults to
- None.
- ids (iterable of ints, optional): An iterable of IDs of instances
- to update. Not all objects allow multiple instances to be updated at once - see Toggl’s API Documentation to see where this is allowed. Defaults to None.
- child_uri (str, optional): The URI/path to append to the object’s
- URI, to update. Defaults to None.
- data (dict, optional): The dict of information to update the
- object(s). Defaults to None.
-
-
class
togglwrapper.api.TimeEntries(toggl)[source]¶ -
create(data)¶ Creates a new instance of the object type.
- Args:
- data (dict): The dict of information needed to create a new object.
-
delete(id=None, ids=None)¶ Deletes a specific instance by ID, or delete multiple instances.
- Args:
- id (int, optional): The ID of the instance to delete. Defaulta to
- None.
- ids (iterable of ints, optional): An iterable of IDs of instances
- to delete. Not all objects allow for deleting multiple instances at once. See Toggl’s API Documentation to see where this is allowed. Defaults to None.
-
get(id=None, start_date=None, end_date=None)[source]¶ Gets a time entry, or time entires in a time range, or the latest ones.
If neither an ID or time range is given, returns the time entries started during the last 9 days. The limit of returned time entries is 1000. So only the first 1000 found time entries are returned.
- Args:
- id (int, optional): The ID of the specific instance to get.
- Defaults to None.
- start_date (str, optional): Must be ISO 8601 date and time strings.
- e.g. ‘2013-03-10T15:42:46+02:00’. Defaults to None.
- end_date (str, optional): Must be ISO 8601 date and time strings.
- e.g. ‘2013-03-10T15:42:46+02:00’. Defaults to None.
-
update(id=None, ids=None, child_uri=None, data=None)¶ Updates a specific instance by ID, or update multiple instances.
- Args:
- id (int, optional): The ID of the instance to update. Defaults to
- None.
- ids (iterable of ints, optional): An iterable of IDs of instances
- to update. Not all objects allow multiple instances to be updated at once - see Toggl’s API Documentation to see where this is allowed. Defaults to None.
- child_uri (str, optional): The URI/path to append to the object’s
- URI, to update. Defaults to None.
- data (dict, optional): The dict of information to update the
- object(s). Defaults to None.
-
-
class
togglwrapper.api.User(toggl)[source]¶ -
get(related_data=False, since=None)[source]¶ Gets the User associated with the current API token.
- Args:
- related_data (bool): If True, gets all the workspaces, clients,
- projects, tasks, time entries and tags which the user can see. Defaults to False.
- since (str or int, optional): Get objects which have changed after
- a certain time. The value should be a unix timestamp (e.g. 1362579886). Defaults to None.
-
-
class
togglwrapper.api.Workspaces(toggl)[source]¶ -
get(id=None, child_uri=None, params=None)¶ Gets the array of objects, or a specific instance by ID.
- Args:
- id (int, optional): The ID of a specific instance of the Object.
- If none provided, the array of all available instances is retrieved, provided that an endpoint exists for it. Defaults to None.
- child_uri (str, optional): The URI of the child Object or subpath.
- e.g. If we wanted the Clients of a Workspace, where the Workspace is the parent object, the child URI is ‘/clients’. Defaults to None.
- params (dict, optional): The dictionary of additional params to
- include in as the querystring, appended to the URL. Keys with values of None will be ignored. Defaults to None.
Gets the Tags for the Workspace with the given ID.
-
get_workspace_users(workspace_id)[source]¶ Gets the WorkspaceUsers for the Workspace with the given ID.
-
invite(workspace_id, data)[source]¶ Adds users to the workspace. Sends an email invite to the users.
- Args:
- workspace_id (int): The ID of the workspace to invite the user to. data (dict): The information needed to invite the right user.
-
update(id=None, ids=None, child_uri=None, data=None)¶ Updates a specific instance by ID, or update multiple instances.
- Args:
- id (int, optional): The ID of the instance to update. Defaults to
- None.
- ids (iterable of ints, optional): An iterable of IDs of instances
- to update. Not all objects allow multiple instances to be updated at once - see Toggl’s API Documentation to see where this is allowed. Defaults to None.
- child_uri (str, optional): The URI/path to append to the object’s
- URI, to update. Defaults to None.
- data (dict, optional): The dict of information to update the
- object(s). Defaults to None.
-
-
class
togglwrapper.api.WorkspaceUsers(toggl)[source]¶ -
delete(id=None, ids=None)¶ Deletes a specific instance by ID, or delete multiple instances.
- Args:
- id (int, optional): The ID of the instance to delete. Defaulta to
- None.
- ids (iterable of ints, optional): An iterable of IDs of instances
- to delete. Not all objects allow for deleting multiple instances at once. See Toggl’s API Documentation to see where this is allowed. Defaults to None.
-
update(id=None, ids=None, child_uri=None, data=None)¶ Updates a specific instance by ID, or update multiple instances.
- Args:
- id (int, optional): The ID of the instance to update. Defaults to
- None.
- ids (iterable of ints, optional): An iterable of IDs of instances
- to update. Not all objects allow multiple instances to be updated at once - see Toggl’s API Documentation to see where this is allowed. Defaults to None.
- child_uri (str, optional): The URI/path to append to the object’s
- URI, to update. Defaults to None.
- data (dict, optional): The dict of information to update the
- object(s). Defaults to None.
-