Jestor SDK for Python (Beta)

Python SDK documentation.

Create Record

To create a record use the table method using the table name as a parameter, then the insert method using a Dictionary as a parameter. Example:

jestor = Jestor(token, org)
result = jestor.table('table_name').insert({'name': 'test'})
print(result) #result will be a python array with the values

Edit Record

To edit a record use the table method using the table name as a parameter, then the update method using the id of the record that will be changed and a Dictionary as a parameter. Example:

jestor = Jestor(token, org)
recordId = 1
result = jestor.table('table_name').update(recordId, {'name': 'test'})
print(result) #result will be a python array with the values

Delete Record

To delete a record use the table method using the table name as a parameter, then the delete method using the record id as a parameter. Example:

jestor = Jestor(token, org)
result = jestor.table('table_name').delete(1)
print(result)

List Records

To list records use the table method using the table name as a parameter, then the get method. Example:

jestor = Jestor(token, org)
result = jestor.table('table_name').get()
print(result) #result will be a python array with the values

## To apply filters use the Filter object:

filters = [
	Filter('name', 'test', Operators.CONTAINS, 'string'),
]

result = jestor.table('table_name').get(filters)
print(result) #result will be a python array with the values

The Filter object receives the following parameters:

  • field: str (field name).
  • value: str (field value).
  • operator: str (operators can be found in the Operators class).
  • type: str (field type).

Create User

To create a user use the user() method, then the createUser() method passing a list as a parameter. This list must contain the fields in order [email, password, profile_id, name]. Example:

jestor = Jestor(token, org)
result = jestor.user().createUser(['[email protected]', 'passworda@123', '1','Test']);
print(result) #result will be a python array with the values

List Users

To list users use the user() method, then the get method. The get method accepts the following parameters:

  • filters: List[Filter] = None,
  • limit: int = 100,
  • page: int = 1,
  • sort: str = None

Example:

jestor = Jestor(token, org)
result = jestor.user().get();
print(result) #result will be a python array with the values

## To apply filters use the Filter object:

filters = [
	Filter('name', 'test', Operators.CONTAINS, 'string'),
]

result = jestor.user().get(filters=filters,sort='name asc')
print(result) #result will be a python array with the values

List Tasks

To list the tasks use the fetchTasks method. The fetchTasks method accepts a parameter list type, which can contain the fields in order [[Filter], limit, page]. Example:

jestor = Jestor(token, org)
result = jestor.fetchTasks();
print(result) #result will be a python array with the values

## To apply filters use the Filter object:

filters = [
	Filter('description', 'test', Operators.CONTAINS, 'string'),
]
limit = 10
page = 1
result = jestor.fetchTasks([filters, limit, page])
print(result) #result will be a python array with the values

Files

To manipulate files use the File object. It takes the following parameters:

  • table: str
  • recordId: int = None
  • field: str = None
tableName = 'table_name'
recordId = 1
field = 'teste'
files = jestor.file(tableName, recordId, field)

Adding, removing and editing files in an existing registry:

tableName = 'table_name'
recordId = 1
field = 'teste'
files = jestor.file(tableName, recordId, field)

files.add({'name': 'file_test', 'content': '<content string>', 'contentType': 'pdf'})

idFile = 'A1CVwLAxzjjYprO5Bjdfi-5'
files.remove(idFile)

idFile = 'E0DOdSKgvkkMncI8Fnhst-2'
files.update(idFile, {'name': 'file_update_name'})


result = jestor.table('table_teste').update(recordId, {field: files.toJson()})

print(result) #result will be a python array with the values

Adding files to a new record:

tableName = 'table_name'
files = jestor.file(tableName)

files.add({'name': 'file_test', 'content': '<content string>', 'contentType': 'pdf'})

result = jestor.table(tableName).insert({'name': 'create new record', 'files': files.toJson()})

print(result) #result will be a python array with the values