Event module
Source code in kili/event/presentation/client/event.py
class EventClientMethods:
def __init__(self, kili_api_gateway: KiliAPIGateway):
self.kili_api_gateway = kili_api_gateway
def list(
self,
project_id: str,
fields: Optional[List[str]] = None,
created_at_gte: Optional[str] = None,
created_at_lte: Optional[str] = None,
user_id: Optional[str] = None,
event: Optional[str] = None,
skip: int = 0,
from_event_id: Optional[str] = None,
until_event_id: Optional[str] = None,
order: Optional[OrderType] = "asc",
) -> List[EventDict]:
"""List events of my project.
Args:
project_id: Identifier of the project.
fields: All the fields to request among the possible fields for the events.
Defaults is ["createdAt", "event", "id", "organizationId", "payload", "projectId", "userId"].
created_at_gte: Filter events created after this date.
created_at_lte: Filter events created before this date.
user_id: Filter events by user id.
event: Filter events by event type.
skip: Number of events to skip.
from_event_id: Filter events from this event id.
until_event_id: Filter events until this event id.
order: Order of the events. Can be "asc" or "desc".
Returns:
A list of events.
Examples:
>>> kili.events.list(project_id="your_project_id")
"""
converted_filters = EventFilters(
project_id=ProjectId(project_id),
created_at_gte=created_at_gte,
created_at_lte=created_at_lte,
user_id=UserId(user_id) if user_id else None,
event=event,
)
options = QueryOptions(
skip=skip,
from_event_id=from_event_id,
until_event_id=until_event_id,
order=order,
)
return list(
self.kili_api_gateway.list_events(
filters=converted_filters, options=options, fields=fields
)
)
list(self, project_id, fields=None, created_at_gte=None, created_at_lte=None, user_id=None, event=None, skip=0, from_event_id=None, until_event_id=None, order='asc')
List events of my project.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_id |
str |
Identifier of the project. |
required |
fields |
Optional[List[str]] |
All the fields to request among the possible fields for the events. Defaults is ["createdAt", "event", "id", "organizationId", "payload", "projectId", "userId"]. |
None |
created_at_gte |
Optional[str] |
Filter events created after this date. |
None |
created_at_lte |
Optional[str] |
Filter events created before this date. |
None |
user_id |
Optional[str] |
Filter events by user id. |
None |
event |
Optional[str] |
Filter events by event type. |
None |
skip |
int |
Number of events to skip. |
0 |
from_event_id |
Optional[str] |
Filter events from this event id. |
None |
until_event_id |
Optional[str] |
Filter events until this event id. |
None |
order |
Optional[Literal['asc', 'desc']] |
Order of the events. Can be "asc" or "desc". |
'asc' |
Returns:
Type | Description |
---|---|
List[kili.domain.event.EventDict] |
A list of events. |
Examples:
>>> kili.events.list(project_id="your_project_id")
Source code in kili/event/presentation/client/event.py
def list(
self,
project_id: str,
fields: Optional[List[str]] = None,
created_at_gte: Optional[str] = None,
created_at_lte: Optional[str] = None,
user_id: Optional[str] = None,
event: Optional[str] = None,
skip: int = 0,
from_event_id: Optional[str] = None,
until_event_id: Optional[str] = None,
order: Optional[OrderType] = "asc",
) -> List[EventDict]:
"""List events of my project.
Args:
project_id: Identifier of the project.
fields: All the fields to request among the possible fields for the events.
Defaults is ["createdAt", "event", "id", "organizationId", "payload", "projectId", "userId"].
created_at_gte: Filter events created after this date.
created_at_lte: Filter events created before this date.
user_id: Filter events by user id.
event: Filter events by event type.
skip: Number of events to skip.
from_event_id: Filter events from this event id.
until_event_id: Filter events until this event id.
order: Order of the events. Can be "asc" or "desc".
Returns:
A list of events.
Examples:
>>> kili.events.list(project_id="your_project_id")
"""
converted_filters = EventFilters(
project_id=ProjectId(project_id),
created_at_gte=created_at_gte,
created_at_lte=created_at_lte,
user_id=UserId(user_id) if user_id else None,
event=event,
)
options = QueryOptions(
skip=skip,
from_event_id=from_event_id,
until_event_id=until_event_id,
order=order,
)
return list(
self.kili_api_gateway.list_events(
filters=converted_filters, options=options, fields=fields
)
)