Models
- class freshbooks.models.Identity(data)
Bases:
Result
An Identity is a
freshbooks.models.Result
object with additional properties and helper methods to make accessing the current user’s identity easier.Example:
>>> current_user = freshBooksClient.current_user() >>> current_user.email <some email> >>> current_user.business_memberships <list of businesses>
- property business_memberships: dict
The authenticated user’s businesses and their role in that business.
- property full_name: str
The authenticated user’s name
- property identity_id: int
The authenticated user’s identity_id
- class freshbooks.models.ListResult(name, single_name, data, include_pages=True)
Bases:
object
Result object from API calls with a list of resources returned.
Data in the API can be accessed via attributes.
Example:
clients = freshBooksClient.clients.list(account_id) assert clients[0].organization == "FreshBooks"
The json-parsed dictionary can also be directly accessed via the
data
attribute.Example:
assert clients.data["clients"][0]["organization"] == "FreshBooks"
The list can also be iterated over to access the individual resources as
Result
obejcts.Example:
for client in clients: assert client.organization == "FreshBooks" assert client.data["organization"] == "FreshBooks"
Pagination results are included in the
pages
attribute:>>> clients.pages PageResult(page=1, pages=1, per_page=30, total=6) >>> clients.pages.total 6
For including pagination in requests, see
freshbooks.builders.paginator.PaginateBuilder
.
- class freshbooks.models.Result(name, data)
Bases:
object
Result object from API calls with a single resource returned.
Data in the API can be accessed via attributes.
Example:
client = freshBooksClient.clients.get(account_id, user_id) assert client.organization == "FreshBooks" assert client.userid == user_id
The json-parsed dictionary can also be directly accessed via the
data
attribute.Example:
assert client.data["organization"] == "FreshBooks" assert client.data["userid"] == user_id