|
| 1 | +from ..service import Service |
| 2 | +from typing import List, Dict, Any, Optional |
| 3 | +from ..exception import AppwriteException |
| 4 | +from appwrite.utils.deprecated import deprecated |
| 5 | + |
| 6 | +class Activities(Service): |
| 7 | + |
| 8 | + def __init__(self, client) -> None: |
| 9 | + super(Activities, self).__init__(client) |
| 10 | + |
| 11 | + def list_events(self, queries: Optional[str] = None) -> Dict[str, Any]: |
| 12 | + """ |
| 13 | + List all events for selected filters. |
| 14 | +
|
| 15 | + Parameters |
| 16 | + ---------- |
| 17 | + queries : Optional[str] |
| 18 | + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc. |
| 19 | + |
| 20 | + Returns |
| 21 | + ------- |
| 22 | + Dict[str, Any] |
| 23 | + API response as a dictionary |
| 24 | + |
| 25 | + Raises |
| 26 | + ------ |
| 27 | + AppwriteException |
| 28 | + If API request fails |
| 29 | + """ |
| 30 | + |
| 31 | + api_path = '/activities/events' |
| 32 | + api_params = {} |
| 33 | + |
| 34 | + if queries is not None: |
| 35 | + api_params['queries'] = queries |
| 36 | + |
| 37 | + return self.client.call('get', api_path, { |
| 38 | + }, api_params) |
| 39 | + |
| 40 | + def get_event(self, event_id: str) -> Dict[str, Any]: |
| 41 | + """ |
| 42 | + Get event by ID. |
| 43 | + |
| 44 | +
|
| 45 | + Parameters |
| 46 | + ---------- |
| 47 | + event_id : str |
| 48 | + Event ID. |
| 49 | + |
| 50 | + Returns |
| 51 | + ------- |
| 52 | + Dict[str, Any] |
| 53 | + API response as a dictionary |
| 54 | + |
| 55 | + Raises |
| 56 | + ------ |
| 57 | + AppwriteException |
| 58 | + If API request fails |
| 59 | + """ |
| 60 | + |
| 61 | + api_path = '/activities/events/{eventId}' |
| 62 | + api_params = {} |
| 63 | + if event_id is None: |
| 64 | + raise AppwriteException('Missing required parameter: "event_id"') |
| 65 | + |
| 66 | + api_path = api_path.replace('{eventId}', event_id) |
| 67 | + |
| 68 | + |
| 69 | + return self.client.call('get', api_path, { |
| 70 | + }, api_params) |
0 commit comments