client
The central API client.
Client(secret=None, base='https://watz.coach')
Bases: ClientBase
The central API client.
Instantiates a new client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
secret |
Optional[str]
|
The API key. If omitted, will be read from the WATZ_SECRET environment variable. |
None
|
base |
str
|
The base URL of the Watz API. |
'https://watz.coach'
|
Source code in watz/client.py
activity_create(activities)
Create new activities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
activities |
list[NewActivity]
|
The activities to create. |
required |
Returns:
Type | Description |
---|---|
list[Activity]
|
list[Activity]: The created activity models, in the same order they were supplied. |
Source code in watz/client.py
ping()
subject_create(subjects)
Create new subjects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
subjects |
list[NewSubject]
|
The subjects to create. |
required |
Returns:
Type | Description |
---|---|
list[Subject]
|
list[Subject]: The created subject models, in the same order they were supplied. |
Source code in watz/client.py
subject_list()
trace_create(traces)
Create new traces.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
traces |
list[NewTrace]
|
The traces to create. |
required |
Returns:
Type | Description |
---|---|
list[Trace]
|
list[Trace]: The created |
Source code in watz/client.py
trace_data(uids)
Retrieves the trace data for the request traces.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uids |
list[str]
|
The trace uids to retrieve data for. |
required |
Returns:
Type | Description |
---|---|
list[bytes]
|
list[bytes]: The encoded trace data objects in the same order they were requested. The data can be decoded with |
Source code in watz/client.py
trace_hydrate(traces)
Hydrates Trace
objects with their data, internally calls client.trace_data()
. This method supports a simple list of traces or the direct output from client.trace_list()
for ease of use.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
traces |
`list[Trace] | dict[str, list[Trace]]`
|
The traces to hydrate, either a specific list of traces, or the whole output from |
required |
Returns:
Type | Description |
---|---|
Union[list[TraceWithData], dict[str, list[TraceWithData]]]
|
|
Source code in watz/client.py
trace_list(uids)
Retrieves the trace metadata for the requested subjects/activities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uids |
list[str]
|
The subject/activity uids to retrieve trace metadata for. |
required |
Returns:
Type | Description |
---|---|
dict[str, list[Trace]]
|
dict[str, list[Trace]]: The parent uid as key and list of their traces as values. |
Source code in watz/client.py
Created: October 19, 2023