Use async functionality on abstract api.v2.models.ModelAPI
Use async functionality on abstract api.v2.models.ModelAPI
api/v2/models-async into api/v2/models
Use async functionality on abstract api.v2.models.ModelAPI
This reverts commit e6804e65f5.
Arguments: * username: email address of the user * password: password of the user * domain: domain of the server (needed if not set in config yet)
This part has been generated by manually copying the json response from the api documentation from: https://api.divera247.com/?urls.primaryName=api%2Fv2%2Falarm#/CRUD/get_api_v2_alarms__id_ https://api.divera247.com/?urls.primaryName=api%2Fv2%2Fnews#/CRUD/get_api_v2_news__id_ https://api.divera247.com/?urls.primaryName=api%2Fv2%2Fevent#/CRUD/get_api_v2_events saving each of them to a json file, reading the data with a python script and comparing them with the following code all = list(set(alarm.keys()).intersection(event.keys()).intersection(news.keys())) print("\n\n".join([f" @property\n def {x}(self) -> str:\n return self.data['{x}']" for x in all]) + "\n") The type descriptors have been manually replaced
* remove type_ argument * replace id_ with object_id * use response_text instead of note
Make a dictionary of all models as in bfad9c34ad
```
alarm = {'id': 123, 'foreign_id': '2019-1023', 'author_id': 123456789, 'alarmcode_id': 123456789, 'date': 0, 'priority': True, 'title': 'FEUER3', 'text': 'Unklare Rauchentwicklung im Hafen', 'address': 'Hauptstraße 247, 12345 Musterstadt', 'lat': 0, 'lng': 0, 'scene_object': 'string', 'caller': 'string', 'patient': 'string', 'remark': 'string', 'units': 'string', 'destination': True, 'destination_address': 'string', 'destination_lat': 0, 'destination_lng': 0, 'additional_text_1': 'string', 'additional_text_2': 'string', 'additional_text_3': 'string', 'report': '2 Einsatztabschnitte gebildet, 3 C-Rohre im Einsatz', 'cluster': [0], 'group': [0], 'user_cluster_relation': [0], 'vehicle': ['string'], 'private_mode': True, 'notification_type': 0, 'notification_filter_vehicle': True, 'notification_filter_status': True, 'notification_filter_access': True, 'notification_filter_status_ids': [0], 'send_push': True, 'send_sms': True, 'send_call': True, 'send_mail': True, 'send_pager': True, 'response_time': 0, 'closed': True, 'new': True, 'editable': True, 'answerable': True, 'hidden': True, 'deleted': True, 'ucr_adressed': [0], 'ucr_answered': [0], 'ucr_self_addressed': True, 'ucr_self_status_id': 0, 'ucr_self_note': 'string', 'count_recipients': 0, 'count_read': 0, 'ts_response': 0, 'ts_publish': 0, 'ts_close': 0, 'ts_create': 0, 'ts_update': 0, 'notification_filter_status_access': True}
event = {'id': 123, 'foreign_id': 12345678, 'author_id': 123456789, 'date': 0, 'title': 'Weihnachtsfeier', 'text': 'Gemütlicher Jahresausklang, eingeladen sind auch euren Partner', 'address': 'Ristorante Alfredo', 'cluster': [0], 'group': [0], 'user_cluster_relation': [0], 'private_mode': True, 'notification_type': 0, 'send_push': True, 'send_sms': True, 'send_call': True, 'send_mail': True, 'send_pager': True, 'send_reminder': True, 'reminder': {'ts': 0, 'send_push': True, 'send_mail': True, 'executed': True}, 'new': True, 'editable': True, 'answerable': True, 'hidden': True, 'deleted': True, 'show_result_count': 0, 'show_result_names': 0, 'multiple_answers': True, 'custom_answers': True, 'response_type': 0, 'response_until': True, 'ts_response': 0, 'access_count': True, 'access_names': True, 'participation': True, 'note': 'bin dabei!', 'ucr_adressed': [0], 'ucr_answered': [0], 'ucr_self_addressed': True, 'count_recipients': 0, 'count_read': 0, 'ts_create': 0, 'ts_update': 0}
news = {'id': 123, 'foreign_id': '2019-1023', 'author_id': 123456789, 'date': 0, 'title': 'Neue Dienstanweisung', 'text': 'Rückwärtsfahren nur mit Einweiser', 'address': 'Raum 1.23', 'cluster': [0], 'group': [0], 'user_cluster_relation': [0], 'private_mode': True, 'notification_type': 0, 'send_push': True, 'send_sms': True, 'send_call': True, 'send_mail': True, 'send_pager': True, 'survey': True, 'surveys': [{'id': 0, 'title': 'Mit wie vielen Personen nehmt ihr am Sommerfest teil?', 'show_result_count': 0, 'show_result_names': 0, 'access_count': True, 'access_names': True, 'multiple_answers': True, 'custom_answers': True, 'response_until': True, 'ts_response': 0, 'answers': {}, 'answerSorting': ['string', 0]}], 'new': True, 'editable': True, 'answerable': True, 'hidden': True, 'deleted': True, 'ucr_adressed': [0], 'ucr_answered': [0], 'ucr_self_addressed': True, 'count_recipients': 0, 'count_read': 0, 'ts_publish': 0, 'archive': True, 'ts_archive': 0, 'ts_create': 0, 'ts_update': 0}
```
Make a list of all common attributes
```
common = list(set(alarm.keys()).intersection(event.keys()).intersection(news.keys()))
```
print all special attributes
```
def attribute_to_text(attr, ex):
return "\n".join([
f" @property",
f" def {attr}(self) -> {type(ex).__name__}:",
f" return self.data['{attr}']",
])
for a in alarm.keys():
if a not in common:
print(attribute_to_text(a, alarm[a]) + "\n")
```
Copy the output into the file
Manually change lat and lng type descriptors to float
initiate self.client = divera.Client() log in if required
Change resulted in circular imports
This reverts commit b2bf262423.
Give b2bf262423 another go
Allow creating Events with custom attributes by calling Event.__init__
Conform to 96b0d54699
Use Events to test the changes made on this branch
CrudAPI is used as parent class for API wrappers to provide the basic methods for every model
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?