octostar-python-client 0.1.759__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- octostar/__init__.py +9 -0
- octostar/api/__init__.py +1 -0
- octostar/api/apps/__init__.py +0 -0
- octostar/api/apps/deploy_app.py +210 -0
- octostar/api/apps/execute_app_job.py +188 -0
- octostar/api/apps/get_app_logs.py +210 -0
- octostar/api/apps/get_apps_url.py +188 -0
- octostar/api/apps/get_job_logs.py +210 -0
- octostar/api/apps/get_job_progress.py +162 -0
- octostar/api/apps/kill_job.py +160 -0
- octostar/api/apps/list_app_jobs.py +276 -0
- octostar/api/apps/list_apps.py +251 -0
- octostar/api/apps/set_job_progress.py +216 -0
- octostar/api/apps/undeploy_app.py +160 -0
- octostar/api/metadata/__init__.py +0 -0
- octostar/api/metadata/get_version.py +232 -0
- octostar/api/metadata/get_whoami.py +232 -0
- octostar/api/notifications/__init__.py +0 -0
- octostar/api/notifications/delete_stream.py +222 -0
- octostar/api/notifications/get_subscriptions.py +240 -0
- octostar/api/notifications/publish_notification.py +275 -0
- octostar/api/notifications/pull_events_from_stream.py +282 -0
- octostar/api/notifications/push_event_to_stream.py +265 -0
- octostar/api/notifications/toast.py +264 -0
- octostar/api/ontology/__init__.py +0 -0
- octostar/api/ontology/fetch_ontology_data.py +275 -0
- octostar/api/ontology/get_ontologies.py +237 -0
- octostar/api/ontology/multi_query.py +297 -0
- octostar/api/ontology/query.py +276 -0
- octostar/api/pipeline/__init__.py +1 -0
- octostar/api/pipeline/get_processing_status.py +185 -0
- octostar/api/pipeline/update_processing_status.py +164 -0
- octostar/api/search/__init__.py +0 -0
- octostar/api/search/get_annotations.py +153 -0
- octostar/api/workspace_data/__init__.py +0 -0
- octostar/api/workspace_data/delete_blob.py +212 -0
- octostar/api/workspace_data/delete_entities.py +326 -0
- octostar/api/workspace_data/download_blob.py +235 -0
- octostar/api/workspace_data/get_attachment.py +336 -0
- octostar/api/workspace_data/get_files_tree.py +397 -0
- octostar/api/workspace_data/upload_blob.py +235 -0
- octostar/api/workspace_data/upsert_entities.py +284 -0
- octostar/api/workspace_permissions/__init__.py +0 -0
- octostar/api/workspace_permissions/get_permissions.py +325 -0
- octostar/api/workspace_tags/__init__.py +0 -0
- octostar/api/workspace_tags/delete_tag_from_entities.py +141 -0
- octostar/api/workspace_tags/tag_entities.py +180 -0
- octostar/client.py +492 -0
- octostar/errors.py +50 -0
- octostar/models/__init__.py +249 -0
- octostar/models/acknowledgement.py +74 -0
- octostar/models/acknowledgement_with_data.py +82 -0
- octostar/models/app_status.py +239 -0
- octostar/models/app_status_annotations.py +66 -0
- octostar/models/app_status_labels.py +69 -0
- octostar/models/app_with_url.py +82 -0
- octostar/models/child_processing_status.py +118 -0
- octostar/models/delete_entities_response_401.py +74 -0
- octostar/models/delete_entities_response_409.py +82 -0
- octostar/models/delete_entities_response_500.py +82 -0
- octostar/models/delete_stream_response_401.py +74 -0
- octostar/models/delete_tag_from_entities_response_401.py +74 -0
- octostar/models/deploy_app_json_body.py +90 -0
- octostar/models/deploy_app_json_body_secrets.py +65 -0
- octostar/models/deploy_app_response_200.py +98 -0
- octostar/models/deploy_app_response_200_data.py +60 -0
- octostar/models/deploy_app_response_400.py +82 -0
- octostar/models/deploy_app_response_403.py +82 -0
- octostar/models/deploy_app_response_404.py +82 -0
- octostar/models/deploy_app_response_409.py +82 -0
- octostar/models/deploy_app_response_500.py +82 -0
- octostar/models/entity.py +80 -0
- octostar/models/entity_response.py +99 -0
- octostar/models/entity_response_s3_urls.py +93 -0
- octostar/models/entity_response_s3_urls_additional_property.py +105 -0
- octostar/models/entity_response_s3_urls_additional_property_fields.py +114 -0
- octostar/models/execute_app_job_json_body.py +151 -0
- octostar/models/execute_app_job_json_body_annotation.py +65 -0
- octostar/models/execute_app_job_response_401.py +74 -0
- octostar/models/fetch_ontology_data_response_200.py +60 -0
- octostar/models/fetch_ontology_data_response_401.py +74 -0
- octostar/models/fetch_ontology_data_response_500.py +82 -0
- octostar/models/get_app_logs_response_401.py +74 -0
- octostar/models/get_app_logs_response_404.py +74 -0
- octostar/models/get_app_logs_response_500.py +82 -0
- octostar/models/get_apps_url_json_body.py +76 -0
- octostar/models/get_apps_url_response_401.py +74 -0
- octostar/models/get_apps_url_response_500.py +82 -0
- octostar/models/get_attachment_response_200.py +74 -0
- octostar/models/get_attachment_response_401.py +74 -0
- octostar/models/get_files_tree_response_200.py +106 -0
- octostar/models/get_files_tree_response_200_status.py +8 -0
- octostar/models/get_files_tree_response_400.py +111 -0
- octostar/models/get_files_tree_response_400_data.py +60 -0
- octostar/models/get_files_tree_response_400_status.py +8 -0
- octostar/models/get_files_tree_response_401.py +74 -0
- octostar/models/get_files_tree_response_500.py +111 -0
- octostar/models/get_files_tree_response_500_data.py +60 -0
- octostar/models/get_files_tree_response_500_status.py +8 -0
- octostar/models/get_job_logs_response_401.py +74 -0
- octostar/models/get_job_logs_response_404.py +74 -0
- octostar/models/get_job_logs_response_500.py +82 -0
- octostar/models/get_job_progress_response_401.py +74 -0
- octostar/models/get_object_response_401.py +74 -0
- octostar/models/get_ontologies_response_401.py +74 -0
- octostar/models/get_ontologies_response_500.py +81 -0
- octostar/models/get_permissions_response_200.py +98 -0
- octostar/models/get_permissions_response_400.py +82 -0
- octostar/models/get_permissions_response_401.py +74 -0
- octostar/models/get_permissions_response_500.py +82 -0
- octostar/models/get_processing_status_response_200.py +104 -0
- octostar/models/get_processing_status_response_200_data.py +87 -0
- octostar/models/get_processing_status_response_400.py +82 -0
- octostar/models/get_processing_status_response_500.py +82 -0
- octostar/models/get_subscriptions_response_200_item.py +74 -0
- octostar/models/get_version_response_200.py +74 -0
- octostar/models/get_version_response_404.py +74 -0
- octostar/models/get_whoami_response_200.py +129 -0
- octostar/models/get_whoami_response_401.py +74 -0
- octostar/models/insert_entity.py +114 -0
- octostar/models/insert_entity_base.py +266 -0
- octostar/models/insert_entity_relationships_item.py +107 -0
- octostar/models/insert_entity_request.py +94 -0
- octostar/models/internal_server_error.py +82 -0
- octostar/models/job_execution_result.py +146 -0
- octostar/models/job_status.py +196 -0
- octostar/models/job_status_labels.py +60 -0
- octostar/models/job_with_url.py +82 -0
- octostar/models/kill_job_response_401.py +74 -0
- octostar/models/list_app_jobs_response_401.py +74 -0
- octostar/models/list_app_jobs_response_500.py +82 -0
- octostar/models/list_apps_response_401.py +74 -0
- octostar/models/list_apps_response_500.py +82 -0
- octostar/models/multi_query_json_body.py +100 -0
- octostar/models/multi_query_json_body_queries_item.py +80 -0
- octostar/models/multi_query_response_400.py +82 -0
- octostar/models/multi_query_response_401.py +74 -0
- octostar/models/not_found_error.py +74 -0
- octostar/models/octostar_event.py +96 -0
- octostar/models/octostar_event_octostar_payload.py +100 -0
- octostar/models/octostar_event_octostar_payload_level.py +11 -0
- octostar/models/os_notification.py +122 -0
- octostar/models/processing_status.py +262 -0
- octostar/models/processing_status_code.py +14 -0
- octostar/models/progress_request.py +73 -0
- octostar/models/publish_notification_response_401.py +74 -0
- octostar/models/pull_events_from_stream_response_401.py +74 -0
- octostar/models/push_event_to_stream_response_401.py +74 -0
- octostar/models/query_json_body.py +101 -0
- octostar/models/query_json_body_params.py +60 -0
- octostar/models/query_response_400.py +82 -0
- octostar/models/query_response_401.py +74 -0
- octostar/models/set_job_progress_response_401.py +74 -0
- octostar/models/string_to_value_label_map.py +99 -0
- octostar/models/string_to_value_label_map_data.py +89 -0
- octostar/models/string_to_value_label_map_data_additional_property.py +80 -0
- octostar/models/successful_get_tags.py +103 -0
- octostar/models/successful_insertion.py +98 -0
- octostar/models/tag_entities_response_401.py +74 -0
- octostar/models/toast_level.py +11 -0
- octostar/models/toast_response_401.py +74 -0
- octostar/models/undeploy_app_response_401.py +74 -0
- octostar/models/update_processing_status_response_200.py +82 -0
- octostar/models/update_processing_status_response_400.py +82 -0
- octostar/models/update_processing_status_response_500.py +82 -0
- octostar/models/upsert_entities_response_401.py +74 -0
- octostar/models/upsert_entity.py +114 -0
- octostar/models/upsert_entity_base.py +266 -0
- octostar/models/upsert_entity_relationships_item.py +107 -0
- octostar/py.typed +1 -0
- octostar/types.py +54 -0
- octostar/utils/__init__.py +15 -0
- octostar/utils/chat/__init__.py +0 -0
- octostar/utils/chat/chat.py +513 -0
- octostar/utils/chat/detokenize.py +105 -0
- octostar/utils/chat/get_default_model.py +50 -0
- octostar/utils/chat/list_models.py +91 -0
- octostar/utils/chat/tokenize.py +105 -0
- octostar/utils/commons.py +226 -0
- octostar/utils/exceptions.py +134 -0
- octostar/utils/jobs/__init__.py +0 -0
- octostar/utils/jobs/apps/__init__.py +0 -0
- octostar/utils/jobs/apps/deploy_app.py +81 -0
- octostar/utils/jobs/apps/execute_app_job.py +114 -0
- octostar/utils/jobs/apps/get_app_logs.py +113 -0
- octostar/utils/jobs/apps/get_app_secret.py +102 -0
- octostar/utils/jobs/apps/get_apps_url.py +73 -0
- octostar/utils/jobs/apps/list_app_jobs.py +62 -0
- octostar/utils/jobs/apps/list_apps.py +126 -0
- octostar/utils/jobs/apps/undeploy_app.py +48 -0
- octostar/utils/jobs/get_job_logs.py +113 -0
- octostar/utils/jobs/get_job_progress.py +76 -0
- octostar/utils/jobs/kill_job.py +47 -0
- octostar/utils/jobs/set_job_progress.py +67 -0
- octostar/utils/meta/__init__.py +0 -0
- octostar/utils/meta/get_version.py +30 -0
- octostar/utils/meta/get_whoami.py +30 -0
- octostar/utils/notifications/__init__.py +0 -0
- octostar/utils/notifications/delete_stream.py +58 -0
- octostar/utils/notifications/get_my_subscriptions.py +49 -0
- octostar/utils/notifications/publish_notification.py +73 -0
- octostar/utils/notifications/pull_event_from_stream.py +63 -0
- octostar/utils/notifications/pull_events_from_stream.py +64 -0
- octostar/utils/notifications/push_event_to_stream.py +109 -0
- octostar/utils/notifications/push_events_to_stream.py +137 -0
- octostar/utils/notifications/toast.py +92 -0
- octostar/utils/ontology/__init__.py +10 -0
- octostar/utils/ontology/fetch_ontology_data.py +141 -0
- octostar/utils/ontology/get_ontologies.py +55 -0
- octostar/utils/ontology/multiquery_ontology.py +287 -0
- octostar/utils/ontology/query_ontology.py +186 -0
- octostar/utils/pipeline/__init__.py +1 -0
- octostar/utils/pipeline/get_processing_status.py +230 -0
- octostar/utils/pipeline/update_processing_status.py +286 -0
- octostar/utils/search/__init__.py +11 -0
- octostar/utils/search/bulk_update.py +138 -0
- octostar/utils/search/count.py +117 -0
- octostar/utils/search/get_entity_annotations.py +304 -0
- octostar/utils/search/get_index_definition.py +111 -0
- octostar/utils/search/multi_search.py +129 -0
- octostar/utils/workspace/__init__.py +0 -0
- octostar/utils/workspace/delete_entities.py +247 -0
- octostar/utils/workspace/delete_entity.py +81 -0
- octostar/utils/workspace/delete_relationship.py +78 -0
- octostar/utils/workspace/delete_relationships.py +85 -0
- octostar/utils/workspace/delete_temporary_blob.py +85 -0
- octostar/utils/workspace/extract_entities.py +140 -0
- octostar/utils/workspace/get_filepath_from_item.py +85 -0
- octostar/utils/workspace/get_filepaths_from_items.py +100 -0
- octostar/utils/workspace/get_files_tree.py +102 -0
- octostar/utils/workspace/get_item_from_filepath.py +102 -0
- octostar/utils/workspace/get_items_from_filepaths.py +108 -0
- octostar/utils/workspace/linkcharts/__init__.py +0 -0
- octostar/utils/workspace/linkcharts/create_linkchart.py +241 -0
- octostar/utils/workspace/permissions/PermissionLevel.py +8 -0
- octostar/utils/workspace/permissions/__init__.py +1 -0
- octostar/utils/workspace/permissions/get_permissions.py +81 -0
- octostar/utils/workspace/read_attachment.py +284 -0
- octostar/utils/workspace/read_file.py +113 -0
- octostar/utils/workspace/read_temporary_blob.py +428 -0
- octostar/utils/workspace/saved_searches/__init__.py +0 -0
- octostar/utils/workspace/saved_searches/create_saved_search.py +183 -0
- octostar/utils/workspace/tags/__init__.py +0 -0
- octostar/utils/workspace/tags/delete_tag_from_entities.py +96 -0
- octostar/utils/workspace/tags/tag_entities.py +175 -0
- octostar/utils/workspace/upsert_entities.py +268 -0
- octostar/utils/workspace/upsert_entity.py +110 -0
- octostar/utils/workspace/upsert_relationship.py +128 -0
- octostar/utils/workspace/upsert_relationships.py +194 -0
- octostar/utils/workspace/write_attachment.py +263 -0
- octostar/utils/workspace/write_file.py +335 -0
- octostar/utils/workspace/write_temporary_blob.py +218 -0
- octostar_python_client-0.1.759.dist-info/METADATA +159 -0
- octostar_python_client-0.1.759.dist-info/RECORD +257 -0
- octostar_python_client-0.1.759.dist-info/WHEEL +5 -0
- octostar_python_client-0.1.759.dist-info/licenses/LICENSE +21 -0
- octostar_python_client-0.1.759.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Dict, List, Optional, Union, cast
|
|
3
|
+
from warnings import warn
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...client import AuthenticatedClient, Client, get_default_client
|
|
8
|
+
from ...types import Response, UNSET
|
|
9
|
+
from ... import errors
|
|
10
|
+
|
|
11
|
+
from ...types import UNSET, Unset
|
|
12
|
+
from typing import Union
|
|
13
|
+
from typing import cast
|
|
14
|
+
from ...models.acknowledgement import Acknowledgement
|
|
15
|
+
from ...models.push_event_to_stream_response_401 import PushEventToStreamResponse401
|
|
16
|
+
from ...models.octostar_event import OctostarEvent
|
|
17
|
+
from typing import Dict
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
client_missing_msg = """No client was passed to this function. The default admin client will be used, but this is deprecated and will be removed soon.
|
|
21
|
+
Please create a client using octostar.client.make_client() and run the function via client.execute()."""
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _get_kwargs(
|
|
25
|
+
stream_id: str,
|
|
26
|
+
*,
|
|
27
|
+
client: Client = None,
|
|
28
|
+
json_body: OctostarEvent,
|
|
29
|
+
accept: Union[Unset, str] = "application/json",
|
|
30
|
+
) -> Dict[str, Any]:
|
|
31
|
+
if not client:
|
|
32
|
+
warn(client_missing_msg, FutureWarning, stacklevel=2)
|
|
33
|
+
client = get_default_client()
|
|
34
|
+
# raise RuntimeError("Missing client!")
|
|
35
|
+
|
|
36
|
+
base_url = client.get_base_url_v1()
|
|
37
|
+
url = "{}/api/v1/streams/{stream_id}".format(base_url, stream_id=stream_id)
|
|
38
|
+
|
|
39
|
+
headers: Dict[str, str] = client.get_headers()
|
|
40
|
+
cookies: Dict[str, Any] = client.get_cookies()
|
|
41
|
+
|
|
42
|
+
if not isinstance(accept, Unset):
|
|
43
|
+
headers["Accept"] = accept
|
|
44
|
+
|
|
45
|
+
json_json_body = json_body.to_dict()
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
"method": "post",
|
|
49
|
+
"url": url,
|
|
50
|
+
"headers": headers,
|
|
51
|
+
"cookies": cookies,
|
|
52
|
+
"timeout": client.get_timeout(),
|
|
53
|
+
"follow_redirects": client.follow_redirects,
|
|
54
|
+
"json": json_json_body,
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _parse_response(
|
|
59
|
+
*, client: Client = None, response: httpx.Response
|
|
60
|
+
) -> Optional[Union[Acknowledgement, Any, PushEventToStreamResponse401]]:
|
|
61
|
+
if not client:
|
|
62
|
+
warn(client_missing_msg, FutureWarning, stacklevel=2)
|
|
63
|
+
client = get_default_client()
|
|
64
|
+
# raise RuntimeError("Missing client!")
|
|
65
|
+
if response.status_code in (HTTPStatus.OK, HTTPStatus.CREATED):
|
|
66
|
+
response_200 = Acknowledgement.from_dict(response.json())
|
|
67
|
+
|
|
68
|
+
return response_200
|
|
69
|
+
if response.status_code == HTTPStatus.UNAUTHORIZED:
|
|
70
|
+
response_401 = PushEventToStreamResponse401.from_dict(response.json())
|
|
71
|
+
|
|
72
|
+
return response_401
|
|
73
|
+
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
|
|
74
|
+
response_500 = cast(Any, None)
|
|
75
|
+
return response_500
|
|
76
|
+
if client.raise_on_unexpected_status:
|
|
77
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
78
|
+
else:
|
|
79
|
+
return None
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _build_response(
|
|
83
|
+
*, client: Client = None, response: httpx.Response
|
|
84
|
+
) -> Response[Union[Acknowledgement, Any, PushEventToStreamResponse401]]:
|
|
85
|
+
if not client:
|
|
86
|
+
warn(client_missing_msg, FutureWarning, stacklevel=2)
|
|
87
|
+
client = get_default_client()
|
|
88
|
+
# raise RuntimeError("Missing client!")
|
|
89
|
+
response_kwargs = {
|
|
90
|
+
"status_code": HTTPStatus(response.status_code),
|
|
91
|
+
"content": response.content,
|
|
92
|
+
"headers": response.headers,
|
|
93
|
+
"parsed": _parse_response(client=client, response=response),
|
|
94
|
+
}
|
|
95
|
+
return Response(**response_kwargs)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def _build_chunk_response(
|
|
99
|
+
*, client: Client = None, response: httpx.Response, chunk: bytes
|
|
100
|
+
) -> Response[Union[Acknowledgement, Any, PushEventToStreamResponse401]]:
|
|
101
|
+
if not client:
|
|
102
|
+
warn(client_missing_msg, FutureWarning, stacklevel=2)
|
|
103
|
+
client = get_default_client()
|
|
104
|
+
# raise RuntimeError("Missing client!")
|
|
105
|
+
response_kwargs = {
|
|
106
|
+
"status_code": HTTPStatus(response.status_code),
|
|
107
|
+
"content": chunk,
|
|
108
|
+
"headers": response.headers,
|
|
109
|
+
"parsed": None, # cannot parse incomplete chunks of data, we leave it to the user
|
|
110
|
+
}
|
|
111
|
+
return Response(**response_kwargs)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def sync_detailed(
|
|
115
|
+
stream_id: str,
|
|
116
|
+
*,
|
|
117
|
+
client: Client = None,
|
|
118
|
+
json_body: OctostarEvent,
|
|
119
|
+
accept: Union[Unset, str] = "application/json",
|
|
120
|
+
) -> Response[Union[Acknowledgement, Any, PushEventToStreamResponse401]]:
|
|
121
|
+
"""## Push an Octostar event to a stream
|
|
122
|
+
|
|
123
|
+
Push an Octostar event to a stream
|
|
124
|
+
|
|
125
|
+
### Args:
|
|
126
|
+
* `stream_id`: stream_id (str):
|
|
127
|
+
* `Accept`: accept (Union[Unset, str]): Default: 'application/json'.
|
|
128
|
+
* `json_body`: json_body (OctostarEvent):
|
|
129
|
+
|
|
130
|
+
### Raises:
|
|
131
|
+
* `errors.UnexpectedStatus`: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
132
|
+
* `httpx.TimeoutException`: If the request takes longer than Client.timeout.
|
|
133
|
+
|
|
134
|
+
## Returns:
|
|
135
|
+
* `Response[Union[Acknowledgement, Any, PushEventToStreamResponse401]]`
|
|
136
|
+
"""
|
|
137
|
+
|
|
138
|
+
if not client:
|
|
139
|
+
warn(client_missing_msg, FutureWarning, stacklevel=2)
|
|
140
|
+
client = get_default_client()
|
|
141
|
+
# raise RuntimeError("Missing client!")
|
|
142
|
+
kwargs = _get_kwargs(
|
|
143
|
+
stream_id=stream_id,
|
|
144
|
+
client=client,
|
|
145
|
+
json_body=json_body,
|
|
146
|
+
accept=accept,
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
response = httpx.request(
|
|
150
|
+
verify=client.verify_ssl,
|
|
151
|
+
**kwargs,
|
|
152
|
+
)
|
|
153
|
+
if response.is_error:
|
|
154
|
+
print(
|
|
155
|
+
f"{str(response.status_code)} Error: {response.text} for request",
|
|
156
|
+
str(kwargs),
|
|
157
|
+
)
|
|
158
|
+
return _build_response(client=client, response=response)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def sync(
|
|
162
|
+
stream_id: str,
|
|
163
|
+
*,
|
|
164
|
+
client: Client = None,
|
|
165
|
+
json_body: OctostarEvent,
|
|
166
|
+
accept: Union[Unset, str] = "application/json",
|
|
167
|
+
) -> Optional[Union[Acknowledgement, Any, PushEventToStreamResponse401]]:
|
|
168
|
+
"""## Push an Octostar event to a stream
|
|
169
|
+
|
|
170
|
+
Push an Octostar event to a stream
|
|
171
|
+
|
|
172
|
+
### Args:
|
|
173
|
+
* `stream_id`: stream_id (str):
|
|
174
|
+
* `Accept`: accept (Union[Unset, str]): Default: 'application/json'.
|
|
175
|
+
* `json_body`: json_body (OctostarEvent):
|
|
176
|
+
|
|
177
|
+
### Raises:
|
|
178
|
+
* `errors.UnexpectedStatus`: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
179
|
+
* `httpx.TimeoutException`: If the request takes longer than Client.timeout.
|
|
180
|
+
|
|
181
|
+
## Returns:
|
|
182
|
+
* `Union[Acknowledgement, Any, PushEventToStreamResponse401]`
|
|
183
|
+
"""
|
|
184
|
+
|
|
185
|
+
return sync_detailed(
|
|
186
|
+
stream_id=stream_id,
|
|
187
|
+
client=client,
|
|
188
|
+
json_body=json_body,
|
|
189
|
+
accept=accept,
|
|
190
|
+
).parsed
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
async def asyncio_detailed(
|
|
194
|
+
stream_id: str,
|
|
195
|
+
*,
|
|
196
|
+
client: Client = None,
|
|
197
|
+
json_body: OctostarEvent,
|
|
198
|
+
accept: Union[Unset, str] = "application/json",
|
|
199
|
+
) -> Response[Union[Acknowledgement, Any, PushEventToStreamResponse401]]:
|
|
200
|
+
"""## Push an Octostar event to a stream
|
|
201
|
+
|
|
202
|
+
Push an Octostar event to a stream
|
|
203
|
+
|
|
204
|
+
### Args:
|
|
205
|
+
* `stream_id`: stream_id (str):
|
|
206
|
+
* `Accept`: accept (Union[Unset, str]): Default: 'application/json'.
|
|
207
|
+
* `json_body`: json_body (OctostarEvent):
|
|
208
|
+
|
|
209
|
+
### Raises:
|
|
210
|
+
* `errors.UnexpectedStatus`: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
211
|
+
* `httpx.TimeoutException`: If the request takes longer than Client.timeout.
|
|
212
|
+
|
|
213
|
+
## Returns:
|
|
214
|
+
* `Response[Union[Acknowledgement, Any, PushEventToStreamResponse401]]`
|
|
215
|
+
"""
|
|
216
|
+
|
|
217
|
+
if not client:
|
|
218
|
+
warn(client_missing_msg, FutureWarning, stacklevel=2)
|
|
219
|
+
client = get_default_client()
|
|
220
|
+
# raise RuntimeError("Missing client!")
|
|
221
|
+
kwargs = _get_kwargs(
|
|
222
|
+
stream_id=stream_id,
|
|
223
|
+
client=client,
|
|
224
|
+
json_body=json_body,
|
|
225
|
+
accept=accept,
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
229
|
+
response = await _client.request(**kwargs)
|
|
230
|
+
|
|
231
|
+
return _build_response(client=client, response=response)
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
async def asyncio(
|
|
235
|
+
stream_id: str,
|
|
236
|
+
*,
|
|
237
|
+
client: Client = None,
|
|
238
|
+
json_body: OctostarEvent,
|
|
239
|
+
accept: Union[Unset, str] = "application/json",
|
|
240
|
+
) -> Optional[Union[Acknowledgement, Any, PushEventToStreamResponse401]]:
|
|
241
|
+
"""## Push an Octostar event to a stream
|
|
242
|
+
|
|
243
|
+
Push an Octostar event to a stream
|
|
244
|
+
|
|
245
|
+
### Args:
|
|
246
|
+
* `stream_id`: stream_id (str):
|
|
247
|
+
* `Accept`: accept (Union[Unset, str]): Default: 'application/json'.
|
|
248
|
+
* `json_body`: json_body (OctostarEvent):
|
|
249
|
+
|
|
250
|
+
### Raises:
|
|
251
|
+
* `errors.UnexpectedStatus`: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
252
|
+
* `httpx.TimeoutException`: If the request takes longer than Client.timeout.
|
|
253
|
+
|
|
254
|
+
## Returns:
|
|
255
|
+
* `Union[Acknowledgement, Any, PushEventToStreamResponse401]`
|
|
256
|
+
"""
|
|
257
|
+
|
|
258
|
+
return (
|
|
259
|
+
await asyncio_detailed(
|
|
260
|
+
stream_id=stream_id,
|
|
261
|
+
client=client,
|
|
262
|
+
json_body=json_body,
|
|
263
|
+
accept=accept,
|
|
264
|
+
)
|
|
265
|
+
).parsed
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Dict, Optional, Union, cast
|
|
3
|
+
from warnings import warn
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...client import Client, get_default_client
|
|
8
|
+
from ...types import Response, UNSET, Unset
|
|
9
|
+
from ... import errors
|
|
10
|
+
from ...models.toast_response_401 import ToastResponse401
|
|
11
|
+
from ...models.toast_level import ToastLevel
|
|
12
|
+
from ...models.acknowledgement import Acknowledgement
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
client_missing_msg = """No client was passed to this function. The default admin client will be used, but this is deprecated and will be removed soon.
|
|
16
|
+
Please create a client using octostar.client.make_client() and run the function via client.execute()."""
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _get_kwargs(
|
|
20
|
+
*,
|
|
21
|
+
client: Client = None,
|
|
22
|
+
message: Union[Unset, None, str] = UNSET,
|
|
23
|
+
result_url: Union[Unset, None, str] = UNSET,
|
|
24
|
+
description: Union[Unset, None, str] = UNSET,
|
|
25
|
+
level: Union[Unset, None, ToastLevel] = UNSET,
|
|
26
|
+
accept: Union[Unset, str] = "application/json",
|
|
27
|
+
) -> Dict[str, Any]:
|
|
28
|
+
if not client:
|
|
29
|
+
warn(client_missing_msg, FutureWarning, stacklevel=2)
|
|
30
|
+
client = get_default_client()
|
|
31
|
+
|
|
32
|
+
base_url = client.get_base_url_v1()
|
|
33
|
+
url = "{}/api/v1/notifications/toast".format(base_url)
|
|
34
|
+
|
|
35
|
+
headers: Dict[str, str] = client.get_headers()
|
|
36
|
+
cookies: Dict[str, Any] = client.get_cookies()
|
|
37
|
+
|
|
38
|
+
if not isinstance(accept, Unset):
|
|
39
|
+
headers["Accept"] = accept
|
|
40
|
+
|
|
41
|
+
json_body: Dict[str, Any] = {}
|
|
42
|
+
if not isinstance(message, Unset) and message is not None:
|
|
43
|
+
json_body["message"] = message
|
|
44
|
+
if not isinstance(result_url, Unset) and result_url is not None:
|
|
45
|
+
json_body["result_url"] = result_url
|
|
46
|
+
if not isinstance(description, Unset) and description is not None:
|
|
47
|
+
json_body["description"] = description
|
|
48
|
+
if not isinstance(level, Unset) and level is not None:
|
|
49
|
+
json_body["level"] = level.value if level else None
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
"method": "post",
|
|
53
|
+
"url": url,
|
|
54
|
+
"headers": headers,
|
|
55
|
+
"cookies": cookies,
|
|
56
|
+
"timeout": client.get_timeout(),
|
|
57
|
+
"follow_redirects": client.follow_redirects,
|
|
58
|
+
"json": json_body,
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _parse_response(
|
|
63
|
+
*, client: Client = None, response: httpx.Response
|
|
64
|
+
) -> Optional[Union[Acknowledgement, Any, ToastResponse401]]:
|
|
65
|
+
if not client:
|
|
66
|
+
warn(client_missing_msg, FutureWarning, stacklevel=2)
|
|
67
|
+
client = get_default_client()
|
|
68
|
+
if response.status_code == HTTPStatus.OK:
|
|
69
|
+
return Acknowledgement.from_dict(response.json())
|
|
70
|
+
if response.status_code == HTTPStatus.CREATED:
|
|
71
|
+
return Acknowledgement.from_dict(response.json())
|
|
72
|
+
if response.status_code == HTTPStatus.UNAUTHORIZED:
|
|
73
|
+
return ToastResponse401.from_dict(response.json())
|
|
74
|
+
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
|
|
75
|
+
return cast(Any, None)
|
|
76
|
+
if client.raise_on_unexpected_status:
|
|
77
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
78
|
+
else:
|
|
79
|
+
return None
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _build_response(
|
|
83
|
+
*, client: Client = None, response: httpx.Response
|
|
84
|
+
) -> Response[Union[Acknowledgement, Any, ToastResponse401]]:
|
|
85
|
+
if not client:
|
|
86
|
+
warn(client_missing_msg, FutureWarning, stacklevel=2)
|
|
87
|
+
client = get_default_client()
|
|
88
|
+
return Response(
|
|
89
|
+
status_code=HTTPStatus(response.status_code),
|
|
90
|
+
content=response.content,
|
|
91
|
+
headers=response.headers,
|
|
92
|
+
parsed=_parse_response(client=client, response=response),
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def sync_detailed(
|
|
97
|
+
*,
|
|
98
|
+
client: Client = None,
|
|
99
|
+
message: Union[Unset, None, str] = UNSET,
|
|
100
|
+
result_url: Union[Unset, None, str] = UNSET,
|
|
101
|
+
description: Union[Unset, None, str] = UNSET,
|
|
102
|
+
level: Union[Unset, None, ToastLevel] = UNSET,
|
|
103
|
+
accept: Union[Unset, str] = "application/json",
|
|
104
|
+
) -> Response[Union[Acknowledgement, Any, ToastResponse401]]:
|
|
105
|
+
"""## Show a desktop notification
|
|
106
|
+
|
|
107
|
+
Show a desktop notification
|
|
108
|
+
|
|
109
|
+
### Args:
|
|
110
|
+
* `message`: message (Union[Unset, None, str]):
|
|
111
|
+
* `result_url`: result_url (Union[Unset, None, str]):
|
|
112
|
+
* `description`: description (Union[Unset, None, str]):
|
|
113
|
+
* `level`: level (Union[Unset, None, ToastLevel]):
|
|
114
|
+
* `Accept`: accept (Union[Unset, str]): Default: 'application/json'.
|
|
115
|
+
|
|
116
|
+
### Raises:
|
|
117
|
+
* `errors.UnexpectedStatus`: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
118
|
+
* `httpx.TimeoutException`: If the request takes longer than Client.timeout.
|
|
119
|
+
|
|
120
|
+
## Returns:
|
|
121
|
+
* `Response[Union[Acknowledgement, Any, ToastResponse401]]`
|
|
122
|
+
"""
|
|
123
|
+
|
|
124
|
+
if not client:
|
|
125
|
+
warn(client_missing_msg, FutureWarning, stacklevel=2)
|
|
126
|
+
client = get_default_client()
|
|
127
|
+
kwargs = _get_kwargs(
|
|
128
|
+
client=client,
|
|
129
|
+
message=message,
|
|
130
|
+
result_url=result_url,
|
|
131
|
+
description=description,
|
|
132
|
+
level=level,
|
|
133
|
+
accept=accept,
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
response = httpx.request(
|
|
137
|
+
verify=client.verify_ssl,
|
|
138
|
+
**kwargs,
|
|
139
|
+
)
|
|
140
|
+
return _build_response(client=client, response=response)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def sync(
|
|
144
|
+
*,
|
|
145
|
+
client: Client = None,
|
|
146
|
+
message: Union[Unset, None, str] = UNSET,
|
|
147
|
+
result_url: Union[Unset, None, str] = UNSET,
|
|
148
|
+
description: Union[Unset, None, str] = UNSET,
|
|
149
|
+
level: Union[Unset, None, ToastLevel] = UNSET,
|
|
150
|
+
accept: Union[Unset, str] = "application/json",
|
|
151
|
+
) -> Optional[Union[Acknowledgement, Any, ToastResponse401]]:
|
|
152
|
+
"""## Show a desktop notification
|
|
153
|
+
|
|
154
|
+
Show a desktop notification
|
|
155
|
+
|
|
156
|
+
### Args:
|
|
157
|
+
* `message`: message (Union[Unset, None, str]):
|
|
158
|
+
* `result_url`: result_url (Union[Unset, None, str]):
|
|
159
|
+
* `description`: description (Union[Unset, None, str]):
|
|
160
|
+
* `level`: level (Union[Unset, None, ToastLevel]):
|
|
161
|
+
* `Accept`: accept (Union[Unset, str]): Default: 'application/json'.
|
|
162
|
+
|
|
163
|
+
### Raises:
|
|
164
|
+
* `errors.UnexpectedStatus`: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
165
|
+
* `httpx.TimeoutException`: If the request takes longer than Client.timeout.
|
|
166
|
+
|
|
167
|
+
## Returns:
|
|
168
|
+
* `Union[Acknowledgement, Any, ToastResponse401]`
|
|
169
|
+
"""
|
|
170
|
+
|
|
171
|
+
return sync_detailed(
|
|
172
|
+
client=client,
|
|
173
|
+
message=message,
|
|
174
|
+
result_url=result_url,
|
|
175
|
+
description=description,
|
|
176
|
+
level=level,
|
|
177
|
+
accept=accept,
|
|
178
|
+
).parsed
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
async def asyncio_detailed(
|
|
182
|
+
*,
|
|
183
|
+
client: Client = None,
|
|
184
|
+
message: Union[Unset, None, str] = UNSET,
|
|
185
|
+
result_url: Union[Unset, None, str] = UNSET,
|
|
186
|
+
description: Union[Unset, None, str] = UNSET,
|
|
187
|
+
level: Union[Unset, None, ToastLevel] = UNSET,
|
|
188
|
+
accept: Union[Unset, str] = "application/json",
|
|
189
|
+
) -> Response[Union[Acknowledgement, Any, ToastResponse401]]:
|
|
190
|
+
"""## Show a desktop notification
|
|
191
|
+
|
|
192
|
+
Show a desktop notification
|
|
193
|
+
|
|
194
|
+
### Args:
|
|
195
|
+
* `message`: message (Union[Unset, None, str]):
|
|
196
|
+
* `result_url`: result_url (Union[Unset, None, str]):
|
|
197
|
+
* `description`: description (Union[Unset, None, str]):
|
|
198
|
+
* `level`: level (Union[Unset, None, ToastLevel]):
|
|
199
|
+
* `Accept`: accept (Union[Unset, str]): Default: 'application/json'.
|
|
200
|
+
|
|
201
|
+
### Raises:
|
|
202
|
+
* `errors.UnexpectedStatus`: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
203
|
+
* `httpx.TimeoutException`: If the request takes longer than Client.timeout.
|
|
204
|
+
|
|
205
|
+
## Returns:
|
|
206
|
+
* `Response[Union[Acknowledgement, Any, ToastResponse401]]`
|
|
207
|
+
"""
|
|
208
|
+
|
|
209
|
+
if not client:
|
|
210
|
+
warn(client_missing_msg, FutureWarning, stacklevel=2)
|
|
211
|
+
client = get_default_client()
|
|
212
|
+
kwargs = _get_kwargs(
|
|
213
|
+
client=client,
|
|
214
|
+
message=message,
|
|
215
|
+
result_url=result_url,
|
|
216
|
+
description=description,
|
|
217
|
+
level=level,
|
|
218
|
+
accept=accept,
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
222
|
+
response = await _client.request(**kwargs)
|
|
223
|
+
|
|
224
|
+
return _build_response(client=client, response=response)
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
async def asyncio(
|
|
228
|
+
*,
|
|
229
|
+
client: Client = None,
|
|
230
|
+
message: Union[Unset, None, str] = UNSET,
|
|
231
|
+
result_url: Union[Unset, None, str] = UNSET,
|
|
232
|
+
description: Union[Unset, None, str] = UNSET,
|
|
233
|
+
level: Union[Unset, None, ToastLevel] = UNSET,
|
|
234
|
+
accept: Union[Unset, str] = "application/json",
|
|
235
|
+
) -> Optional[Union[Acknowledgement, Any, ToastResponse401]]:
|
|
236
|
+
"""## Show a desktop notification
|
|
237
|
+
|
|
238
|
+
Show a desktop notification
|
|
239
|
+
|
|
240
|
+
### Args:
|
|
241
|
+
* `message`: message (Union[Unset, None, str]):
|
|
242
|
+
* `result_url`: result_url (Union[Unset, None, str]):
|
|
243
|
+
* `description`: description (Union[Unset, None, str]):
|
|
244
|
+
* `level`: level (Union[Unset, None, ToastLevel]):
|
|
245
|
+
* `Accept`: accept (Union[Unset, str]): Default: 'application/json'.
|
|
246
|
+
|
|
247
|
+
### Raises:
|
|
248
|
+
* `errors.UnexpectedStatus`: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
249
|
+
* `httpx.TimeoutException`: If the request takes longer than Client.timeout.
|
|
250
|
+
|
|
251
|
+
## Returns:
|
|
252
|
+
* `Union[Acknowledgement, Any, ToastResponse401]`
|
|
253
|
+
"""
|
|
254
|
+
|
|
255
|
+
return (
|
|
256
|
+
await asyncio_detailed(
|
|
257
|
+
client=client,
|
|
258
|
+
message=message,
|
|
259
|
+
result_url=result_url,
|
|
260
|
+
description=description,
|
|
261
|
+
level=level,
|
|
262
|
+
accept=accept,
|
|
263
|
+
)
|
|
264
|
+
).parsed
|
|
File without changes
|