Resources¶
Base¶
-
class
bexiopy.resources.base.BaseClientResource[source]¶ Bases:
objectBase client resource that instantiates the
Client.-
client¶
-
-
class
bexiopy.resources.base.BaseResource(*args, **kwargs)[source]¶ Bases:
bexiopy.resources.base.BaseClientResourceBase resource that’s inherited by all other resources.
Inheriting classes may have additional methods, that are resource specific. Take a look at the resources to find these additional methods.
-
ENDPOINT¶ the endpoint that should be queried
Type: str
-
ENDPOINT_SEARCH¶ the serach endpoint that should be queried
Type: str
-
all()[source]¶ Get all objects of given endpoint.
Returns: List of all objects from requested endpoint. Return type: list
-
create(data)[source]¶ Add new object.
Parameters: data ( dict) – Dictionary object with appropriate data.Returns: Object that has been created. Return type: dict
-
delete(pk)[source]¶ Delete object.
Parameters: pk (str) – Bexio id of object. Returns: Response dictionary of operation. Return type: dict
-
get(pk)[source]¶ Get specific object.
Parameters: pk (str) – Bexio id of object. Returns: Object that has been pulled. Return type: dict
-
get_or_create(pk=None, data={})[source]¶ Return object if exists, else create object first.
Parameters: - pk (str) – Bexio id of object.
- data (dict) – Data for possible object creation.
Returns: Object that has been pulled.
Return type: dict
-
overwrite(pk, data)[source]¶ Add new contact
Parameters: - pk (str) – Bexio id of object.
- data (dict) – Data that should be overwritten.
Returns: Object that has been overwritten.
Return type: dict
-
search(params=[])[source]¶ Search for specific object and return response.
Parameters: params ( listofdict, optional) – Parameters to narrow down the search.Returns: List of results from request. Return type: list
-
Contacts¶
-
class
bexiopy.resources.contacts.ContactsResource(*args, **kwargs)[source]¶ Bases:
bexiopy.resources.base.BaseResourceResource to query the contacts endpoint.
Endpoint Docs:
Examples:
bexio = Bexiopy() # get all contacts contacts = bexio.contacts.all() # create an invoice contact = bexio.invoices.create(params={'attr1': 'val1', ...) # search a contact contact = bexio.contacts.search(params={'param1': 'some value'}) # get one specific contact with id 2 contact = bexio.contacts.get(pk=2)
-
ENDPOINT= 'contact'¶
-
ENDPOINT_SEARCH= 'contact/search'¶
-
General¶
Invoices¶
-
class
bexiopy.resources.invoices.InvoicesResource(*args, **kwargs)[source]¶ Bases:
bexiopy.resources.base.BaseResourceResource to query the contacts endpoint.
Endpoint Docs:
Examples:
from bexiopy.api import * api = Bexiopy() # create invoice invoice = api.invoices.create(invoice_data) # get an invoice invoice = api.invoices.get(23) # update invoice invoice = api.invoices.update(23, { 'user_id': 1, 'contact_id': 2, 'header': 'New Header' } ) # delete invoice invoice = api.invoices.delete(23) # search for invoices api.invoices.search( [ {'field': 'user_id', 'value': 1}, {'field': 'contact_id', 'value': 2} ] )
-
ENDPOINT= 'kb_invoice'¶
-
ENDPOINT_SEARCH= 'kb_invoice/search'¶
-