microsoft-agents-activity 0.7.0.dev0__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.
- microsoft_agents/activity/__init__.py +200 -0
- microsoft_agents/activity/_channel_id_field_mixin.py +95 -0
- microsoft_agents/activity/_load_configuration.py +33 -0
- microsoft_agents/activity/_model_utils.py +64 -0
- microsoft_agents/activity/_type_aliases.py +7 -0
- microsoft_agents/activity/_utils/__init__.py +6 -0
- microsoft_agents/activity/_utils/_deferred_string.py +34 -0
- microsoft_agents/activity/action_types.py +17 -0
- microsoft_agents/activity/activity.py +787 -0
- microsoft_agents/activity/activity_event_names.py +9 -0
- microsoft_agents/activity/activity_importance.py +10 -0
- microsoft_agents/activity/activity_types.py +25 -0
- microsoft_agents/activity/adaptive_card_invoke_action.py +27 -0
- microsoft_agents/activity/adaptive_card_invoke_response.py +23 -0
- microsoft_agents/activity/adaptive_card_invoke_value.py +25 -0
- microsoft_agents/activity/agents_model.py +49 -0
- microsoft_agents/activity/animation_card.py +57 -0
- microsoft_agents/activity/attachment.py +27 -0
- microsoft_agents/activity/attachment_data.py +24 -0
- microsoft_agents/activity/attachment_info.py +22 -0
- microsoft_agents/activity/attachment_layout_types.py +9 -0
- microsoft_agents/activity/attachment_view.py +18 -0
- microsoft_agents/activity/audio_card.py +57 -0
- microsoft_agents/activity/basic_card.py +33 -0
- microsoft_agents/activity/caller_id_constants.py +10 -0
- microsoft_agents/activity/card_action.py +42 -0
- microsoft_agents/activity/card_image.py +22 -0
- microsoft_agents/activity/channel_account.py +39 -0
- microsoft_agents/activity/channel_adapter_protocol.py +79 -0
- microsoft_agents/activity/channel_id.py +95 -0
- microsoft_agents/activity/channels.py +161 -0
- microsoft_agents/activity/contact_relation_update_action_types.py +9 -0
- microsoft_agents/activity/conversation_account.py +41 -0
- microsoft_agents/activity/conversation_members.py +19 -0
- microsoft_agents/activity/conversation_parameters.py +40 -0
- microsoft_agents/activity/conversation_reference.py +69 -0
- microsoft_agents/activity/conversation_resource_response.py +22 -0
- microsoft_agents/activity/conversation_update_types.py +18 -0
- microsoft_agents/activity/conversations_result.py +20 -0
- microsoft_agents/activity/delivery_modes.py +12 -0
- microsoft_agents/activity/end_of_conversation_codes.py +13 -0
- microsoft_agents/activity/entity/__init__.py +36 -0
- microsoft_agents/activity/entity/ai_entity.py +111 -0
- microsoft_agents/activity/entity/entity.py +41 -0
- microsoft_agents/activity/entity/entity_types.py +14 -0
- microsoft_agents/activity/entity/geo_coordinates.py +33 -0
- microsoft_agents/activity/entity/mention.py +24 -0
- microsoft_agents/activity/entity/place.py +33 -0
- microsoft_agents/activity/entity/product_info.py +20 -0
- microsoft_agents/activity/entity/thing.py +21 -0
- microsoft_agents/activity/error.py +22 -0
- microsoft_agents/activity/error_response.py +15 -0
- microsoft_agents/activity/errors/__init__.py +14 -0
- microsoft_agents/activity/errors/error_message.py +64 -0
- microsoft_agents/activity/errors/error_resources.py +52 -0
- microsoft_agents/activity/expected_replies.py +16 -0
- microsoft_agents/activity/fact.py +21 -0
- microsoft_agents/activity/hero_card.py +33 -0
- microsoft_agents/activity/inner_http_error.py +17 -0
- microsoft_agents/activity/input_hints.py +10 -0
- microsoft_agents/activity/installation_update_action_types.py +9 -0
- microsoft_agents/activity/invoke_response.py +27 -0
- microsoft_agents/activity/media_card.py +57 -0
- microsoft_agents/activity/media_event_value.py +15 -0
- microsoft_agents/activity/media_url.py +19 -0
- microsoft_agents/activity/message_reaction.py +16 -0
- microsoft_agents/activity/message_reaction_types.py +14 -0
- microsoft_agents/activity/message_update_types.py +10 -0
- microsoft_agents/activity/oauth_card.py +27 -0
- microsoft_agents/activity/paged_members_result.py +19 -0
- microsoft_agents/activity/receipt_card.py +39 -0
- microsoft_agents/activity/receipt_item.py +38 -0
- microsoft_agents/activity/resource_response.py +15 -0
- microsoft_agents/activity/role_types.py +12 -0
- microsoft_agents/activity/semantic_action.py +21 -0
- microsoft_agents/activity/semantic_actions_states.py +10 -0
- microsoft_agents/activity/sign_in_constants.py +13 -0
- microsoft_agents/activity/sign_in_resource.py +17 -0
- microsoft_agents/activity/signin_card.py +19 -0
- microsoft_agents/activity/suggested_actions.py +21 -0
- microsoft_agents/activity/teams/__init__.py +198 -0
- microsoft_agents/activity/teams/app_based_link_query.py +18 -0
- microsoft_agents/activity/teams/batch_failed_entries_response.py +15 -0
- microsoft_agents/activity/teams/batch_failed_entry.py +16 -0
- microsoft_agents/activity/teams/batch_operation_response.py +13 -0
- microsoft_agents/activity/teams/batch_operation_state_response.py +24 -0
- microsoft_agents/activity/teams/bot_config_auth.py +18 -0
- microsoft_agents/activity/teams/cache_info.py +18 -0
- microsoft_agents/activity/teams/cancel_operation_response.py +19 -0
- microsoft_agents/activity/teams/channel_info.py +21 -0
- microsoft_agents/activity/teams/config_auth_response.py +17 -0
- microsoft_agents/activity/teams/config_response.py +18 -0
- microsoft_agents/activity/teams/config_response_base.py +14 -0
- microsoft_agents/activity/teams/config_task_response.py +18 -0
- microsoft_agents/activity/teams/conversation_list.py +17 -0
- microsoft_agents/activity/teams/file_consent_card.py +24 -0
- microsoft_agents/activity/teams/file_consent_card_response.py +21 -0
- microsoft_agents/activity/teams/file_download_info.py +24 -0
- microsoft_agents/activity/teams/file_info_card.py +21 -0
- microsoft_agents/activity/teams/file_upload_info.py +26 -0
- microsoft_agents/activity/teams/meeting_details.py +23 -0
- microsoft_agents/activity/teams/meeting_details_base.py +21 -0
- microsoft_agents/activity/teams/meeting_end_event_details.py +15 -0
- microsoft_agents/activity/teams/meeting_event_details.py +15 -0
- microsoft_agents/activity/teams/meeting_info.py +24 -0
- microsoft_agents/activity/teams/meeting_notification.py +15 -0
- microsoft_agents/activity/teams/meeting_notification_base.py +14 -0
- microsoft_agents/activity/teams/meeting_notification_channel_data.py +16 -0
- microsoft_agents/activity/teams/meeting_notification_recipient_failure_info.py +20 -0
- microsoft_agents/activity/teams/meeting_notification_response.py +20 -0
- microsoft_agents/activity/teams/meeting_participant_info.py +18 -0
- microsoft_agents/activity/teams/meeting_participants_event_details.py +16 -0
- microsoft_agents/activity/teams/meeting_stage_surface.py +25 -0
- microsoft_agents/activity/teams/meeting_start_event_details.py +15 -0
- microsoft_agents/activity/teams/meeting_tab_icon_surface.py +15 -0
- microsoft_agents/activity/teams/message_actions_payload.py +70 -0
- microsoft_agents/activity/teams/message_actions_payload_app.py +29 -0
- microsoft_agents/activity/teams/message_actions_payload_attachment.py +30 -0
- microsoft_agents/activity/teams/message_actions_payload_body.py +17 -0
- microsoft_agents/activity/teams/message_actions_payload_conversation.py +20 -0
- microsoft_agents/activity/teams/message_actions_payload_from.py +25 -0
- microsoft_agents/activity/teams/message_actions_payload_mention.py +23 -0
- microsoft_agents/activity/teams/message_actions_payload_reaction.py +23 -0
- microsoft_agents/activity/teams/message_actions_payload_user.py +27 -0
- microsoft_agents/activity/teams/messaging_extension_action.py +37 -0
- microsoft_agents/activity/teams/messaging_extension_action_response.py +24 -0
- microsoft_agents/activity/teams/messaging_extension_attachment.py +32 -0
- microsoft_agents/activity/teams/messaging_extension_parameter.py +17 -0
- microsoft_agents/activity/teams/messaging_extension_query.py +27 -0
- microsoft_agents/activity/teams/messaging_extension_query_options.py +17 -0
- microsoft_agents/activity/teams/messaging_extension_response.py +21 -0
- microsoft_agents/activity/teams/messaging_extension_result.py +34 -0
- microsoft_agents/activity/teams/messaging_extension_suggested_action.py +17 -0
- microsoft_agents/activity/teams/notification_info.py +21 -0
- microsoft_agents/activity/teams/o365_connector_card.py +32 -0
- microsoft_agents/activity/teams/o365_connector_card_action_base.py +21 -0
- microsoft_agents/activity/teams/o365_connector_card_action_card.py +30 -0
- microsoft_agents/activity/teams/o365_connector_card_action_query.py +15 -0
- microsoft_agents/activity/teams/o365_connector_card_date_input.py +30 -0
- microsoft_agents/activity/teams/o365_connector_card_fact.py +17 -0
- microsoft_agents/activity/teams/o365_connector_card_http_post.py +25 -0
- microsoft_agents/activity/teams/o365_connector_card_image.py +18 -0
- microsoft_agents/activity/teams/o365_connector_card_input_base.py +28 -0
- microsoft_agents/activity/teams/o365_connector_card_multichoice_input.py +40 -0
- microsoft_agents/activity/teams/o365_connector_card_multichoice_input_choice.py +17 -0
- microsoft_agents/activity/teams/o365_connector_card_open_uri.py +26 -0
- microsoft_agents/activity/teams/o365_connector_card_open_uri_target.py +17 -0
- microsoft_agents/activity/teams/o365_connector_card_section.py +42 -0
- microsoft_agents/activity/teams/o365_connector_card_text_input.py +31 -0
- microsoft_agents/activity/teams/o365_connector_card_view_action.py +25 -0
- microsoft_agents/activity/teams/on_behalf_of.py +23 -0
- microsoft_agents/activity/teams/read_receipt_info.py +47 -0
- microsoft_agents/activity/teams/signin_state_verification_query.py +14 -0
- microsoft_agents/activity/teams/surface.py +18 -0
- microsoft_agents/activity/teams/tab_context.py +14 -0
- microsoft_agents/activity/teams/tab_entity_context.py +15 -0
- microsoft_agents/activity/teams/tab_request.py +22 -0
- microsoft_agents/activity/teams/tab_response.py +16 -0
- microsoft_agents/activity/teams/tab_response_card.py +14 -0
- microsoft_agents/activity/teams/tab_response_cards.py +17 -0
- microsoft_agents/activity/teams/tab_response_payload.py +25 -0
- microsoft_agents/activity/teams/tab_submit.py +23 -0
- microsoft_agents/activity/teams/tab_submit_data.py +18 -0
- microsoft_agents/activity/teams/tab_suggested_actions.py +17 -0
- microsoft_agents/activity/teams/targeted_meeting_notification.py +19 -0
- microsoft_agents/activity/teams/targeted_meeting_notification_value.py +19 -0
- microsoft_agents/activity/teams/task_module_card_response.py +15 -0
- microsoft_agents/activity/teams/task_module_continue_response.py +19 -0
- microsoft_agents/activity/teams/task_module_message_response.py +18 -0
- microsoft_agents/activity/teams/task_module_request.py +25 -0
- microsoft_agents/activity/teams/task_module_request_context.py +15 -0
- microsoft_agents/activity/teams/task_module_response.py +20 -0
- microsoft_agents/activity/teams/task_module_response_base.py +17 -0
- microsoft_agents/activity/teams/task_module_task_info.py +30 -0
- microsoft_agents/activity/teams/team_details.py +29 -0
- microsoft_agents/activity/teams/team_info.py +20 -0
- microsoft_agents/activity/teams/teams_batch_operation_response.py +19 -0
- microsoft_agents/activity/teams/teams_channel_account.py +44 -0
- microsoft_agents/activity/teams/teams_channel_data.py +43 -0
- microsoft_agents/activity/teams/teams_channel_data_settings.py +15 -0
- microsoft_agents/activity/teams/teams_meeting_info.py +14 -0
- microsoft_agents/activity/teams/teams_meeting_member.py +19 -0
- microsoft_agents/activity/teams/teams_meeting_participant.py +24 -0
- microsoft_agents/activity/teams/teams_member.py +14 -0
- microsoft_agents/activity/teams/teams_paged_members_result.py +19 -0
- microsoft_agents/activity/teams/tenant_info.py +14 -0
- microsoft_agents/activity/teams/user_meeting_details.py +17 -0
- microsoft_agents/activity/text_format_types.py +10 -0
- microsoft_agents/activity/text_highlight.py +19 -0
- microsoft_agents/activity/thumbnail_card.py +33 -0
- microsoft_agents/activity/thumbnail_url.py +18 -0
- microsoft_agents/activity/token_exchange_invoke_request.py +24 -0
- microsoft_agents/activity/token_exchange_invoke_response.py +24 -0
- microsoft_agents/activity/token_exchange_resource.py +16 -0
- microsoft_agents/activity/token_exchange_state.py +41 -0
- microsoft_agents/activity/token_or_sign_in_resource_response.py +21 -0
- microsoft_agents/activity/token_post_resource.py +14 -0
- microsoft_agents/activity/token_request.py +19 -0
- microsoft_agents/activity/token_response.py +46 -0
- microsoft_agents/activity/token_status.py +32 -0
- microsoft_agents/activity/transcript.py +16 -0
- microsoft_agents/activity/turn_context_protocol.py +68 -0
- microsoft_agents/activity/video_card.py +57 -0
- microsoft_agents_activity-0.7.0.dev0.dist-info/METADATA +173 -0
- microsoft_agents_activity-0.7.0.dev0.dist-info/RECORD +208 -0
- microsoft_agents_activity-0.7.0.dev0.dist-info/WHEEL +5 -0
- microsoft_agents_activity-0.7.0.dev0.dist-info/licenses/LICENSE +21 -0
- microsoft_agents_activity-0.7.0.dev0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
from pydantic import model_serializer, model_validator
|
|
7
|
+
from pydantic.alias_generators import to_camel, to_snake
|
|
8
|
+
|
|
9
|
+
from ..agents_model import AgentsModel, ConfigDict
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Entity(AgentsModel):
|
|
13
|
+
"""Metadata object pertaining to an activity.
|
|
14
|
+
|
|
15
|
+
:param type: Type of this entity (RFC 3987 IRI)
|
|
16
|
+
:type type: str
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
model_config = ConfigDict(extra="allow")
|
|
20
|
+
|
|
21
|
+
type: str
|
|
22
|
+
|
|
23
|
+
@property
|
|
24
|
+
def additional_properties(self) -> dict[str, Any]:
|
|
25
|
+
"""Returns the set of properties that are not None."""
|
|
26
|
+
return self.model_extra
|
|
27
|
+
|
|
28
|
+
@model_validator(mode="before")
|
|
29
|
+
@classmethod
|
|
30
|
+
def to_snake_for_all(cls, data):
|
|
31
|
+
ret = {to_snake(k): v for k, v in data.items()}
|
|
32
|
+
return ret
|
|
33
|
+
|
|
34
|
+
@model_serializer(mode="plain")
|
|
35
|
+
def to_camel_for_all(self, config):
|
|
36
|
+
if config.by_alias:
|
|
37
|
+
new_data = {}
|
|
38
|
+
for k, v in self:
|
|
39
|
+
new_data[to_camel(k)] = v
|
|
40
|
+
return new_data
|
|
41
|
+
return {k: v for k, v in self}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from enum import Enum
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class EntityTypes(str, Enum):
|
|
8
|
+
"""Well-known enumeration of entity types."""
|
|
9
|
+
|
|
10
|
+
GEO_COORDINATES = "GeoCoordinates"
|
|
11
|
+
MENTION = "mention"
|
|
12
|
+
PLACE = "Place"
|
|
13
|
+
THING = "Thing"
|
|
14
|
+
PRODUCT_INFO = "ProductInfo"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from typing import Literal
|
|
5
|
+
|
|
6
|
+
from .._type_aliases import NonEmptyString
|
|
7
|
+
from .entity import Entity
|
|
8
|
+
from .entity_types import EntityTypes
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class GeoCoordinates(Entity):
|
|
12
|
+
"""GeoCoordinates (entity type: "https://schema.org/GeoCoordinates").
|
|
13
|
+
|
|
14
|
+
:param elevation: Elevation of the location [WGS
|
|
15
|
+
84](https://en.wikipedia.org/wiki/World_Geodetic_System)
|
|
16
|
+
:type elevation: float
|
|
17
|
+
:param latitude: Latitude of the location [WGS
|
|
18
|
+
84](https://en.wikipedia.org/wiki/World_Geodetic_System)
|
|
19
|
+
:type latitude: float
|
|
20
|
+
:param longitude: Longitude of the location [WGS
|
|
21
|
+
84](https://en.wikipedia.org/wiki/World_Geodetic_System)
|
|
22
|
+
:type longitude: float
|
|
23
|
+
:param type: The type of the thing
|
|
24
|
+
:type type: str
|
|
25
|
+
:param name: The name of the thing
|
|
26
|
+
:type name: str
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
elevation: float = None
|
|
30
|
+
latitude: float = None
|
|
31
|
+
longitude: float = None
|
|
32
|
+
type: Literal[EntityTypes.GEO_COORDINATES] = EntityTypes.GEO_COORDINATES
|
|
33
|
+
name: NonEmptyString = None
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from typing import Literal
|
|
5
|
+
|
|
6
|
+
from ..channel_account import ChannelAccount
|
|
7
|
+
from .entity import Entity
|
|
8
|
+
from .entity_types import EntityTypes
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Mention(Entity):
|
|
12
|
+
"""Mention information (entity type: "mention").
|
|
13
|
+
|
|
14
|
+
:param mentioned: The mentioned user
|
|
15
|
+
:type mentioned: ~microsoft_agents.activity.ChannelAccount
|
|
16
|
+
:param text: Sub Text which represents the mention (can be null or empty)
|
|
17
|
+
:type text: str
|
|
18
|
+
:param type: Type of this entity (RFC 3987 IRI)
|
|
19
|
+
:type type: str
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
mentioned: ChannelAccount = None
|
|
23
|
+
text: str = None
|
|
24
|
+
type: Literal[EntityTypes.MENTION] = EntityTypes.MENTION
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from typing import Literal
|
|
5
|
+
|
|
6
|
+
from .._type_aliases import NonEmptyString
|
|
7
|
+
from .entity import Entity
|
|
8
|
+
from .entity_types import EntityTypes
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Place(Entity):
|
|
12
|
+
"""Place (entity type: "https://schema.org/Place").
|
|
13
|
+
|
|
14
|
+
:param address: Address of the place (may be `string` or complex object of
|
|
15
|
+
type `PostalAddress`)
|
|
16
|
+
:type address: object
|
|
17
|
+
:param geo: Geo coordinates of the place (may be complex object of type
|
|
18
|
+
`GeoCoordinates` or `GeoShape`)
|
|
19
|
+
:type geo: object
|
|
20
|
+
:param has_map: Map to the place (may be `string` (URL) or complex object
|
|
21
|
+
of type `Map`)
|
|
22
|
+
:type has_map: object
|
|
23
|
+
:param type: The type of the thing
|
|
24
|
+
:type type: str
|
|
25
|
+
:param name: The name of the thing
|
|
26
|
+
:type name: str
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
address: object = None
|
|
30
|
+
geo: object = None
|
|
31
|
+
has_map: object = None
|
|
32
|
+
type: Literal[EntityTypes.PLACE] = EntityTypes.PLACE
|
|
33
|
+
name: NonEmptyString = None
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from typing import Literal
|
|
5
|
+
|
|
6
|
+
from .entity import Entity
|
|
7
|
+
from .entity_types import EntityTypes
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ProductInfo(Entity):
|
|
11
|
+
"""Product information (entity type: "productInfo").
|
|
12
|
+
|
|
13
|
+
:param type: The type of the entity, always "productInfo".
|
|
14
|
+
:type type: str
|
|
15
|
+
:param id: The unique identifier for the product.
|
|
16
|
+
:type id: str
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
type: Literal[EntityTypes.PRODUCT_INFO] = EntityTypes.PRODUCT_INFO
|
|
20
|
+
id: str = None
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from typing import Literal
|
|
5
|
+
|
|
6
|
+
from .._type_aliases import NonEmptyString
|
|
7
|
+
from .entity import Entity
|
|
8
|
+
from .entity_types import EntityTypes
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Thing(Entity):
|
|
12
|
+
"""Thing (entity type: "https://schema.org/Thing").
|
|
13
|
+
|
|
14
|
+
:param type: The type of the thing
|
|
15
|
+
:type type: str
|
|
16
|
+
:param name: The name of the thing
|
|
17
|
+
:type name: str
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
type: Literal[EntityTypes.THING] = EntityTypes.THING
|
|
21
|
+
name: NonEmptyString = None
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from .inner_http_error import InnerHttpError
|
|
5
|
+
from .agents_model import AgentsModel
|
|
6
|
+
from ._type_aliases import NonEmptyString
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Error(AgentsModel):
|
|
10
|
+
"""Object representing error information.
|
|
11
|
+
|
|
12
|
+
:param code: Error code
|
|
13
|
+
:type code: str
|
|
14
|
+
:param message: Error message
|
|
15
|
+
:type message: str
|
|
16
|
+
:param inner_http_error: Error from inner http call
|
|
17
|
+
:type inner_http_error: ~microsoft_agents.activity.InnerHttpError
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
code: NonEmptyString = None
|
|
21
|
+
message: NonEmptyString = None
|
|
22
|
+
inner_http_error: InnerHttpError = None
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from .agents_model import AgentsModel
|
|
5
|
+
from .error import Error
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ErrorResponse(AgentsModel):
|
|
9
|
+
"""An HTTP API response.
|
|
10
|
+
|
|
11
|
+
:param error: Error message
|
|
12
|
+
:type error: ~microsoft_agents.activity.Error
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
error: Error = None
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Error resources for Microsoft Agents Activity package.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .error_message import ErrorMessage
|
|
9
|
+
from .error_resources import ActivityErrorResources
|
|
10
|
+
|
|
11
|
+
# Singleton instance
|
|
12
|
+
activity_errors = ActivityErrorResources()
|
|
13
|
+
|
|
14
|
+
__all__ = ["ErrorMessage", "ActivityErrorResources", "activity_errors"]
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
ErrorMessage class for formatting error messages with error codes and help URLs.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ErrorMessage:
|
|
10
|
+
"""
|
|
11
|
+
Represents a formatted error message with error code and help URL.
|
|
12
|
+
|
|
13
|
+
This class formats error messages according to the Microsoft Agents SDK pattern:
|
|
14
|
+
- Original error message
|
|
15
|
+
- Error Code: [negative number]
|
|
16
|
+
- Help URL: https://aka.ms/M365AgentsErrorCodes/#[error_code]
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
def __init__(
|
|
20
|
+
self,
|
|
21
|
+
message_template: str,
|
|
22
|
+
error_code: int,
|
|
23
|
+
):
|
|
24
|
+
"""
|
|
25
|
+
Initialize an ErrorMessage.
|
|
26
|
+
|
|
27
|
+
:param message_template: The error message template (may include format placeholders)
|
|
28
|
+
:type message_template: str
|
|
29
|
+
:param error_code: The error code (should be negative)
|
|
30
|
+
:type error_code: int
|
|
31
|
+
"""
|
|
32
|
+
self.message_template = message_template
|
|
33
|
+
self.error_code = error_code
|
|
34
|
+
self.base_url = "https://aka.ms/M365AgentsErrorCodes"
|
|
35
|
+
|
|
36
|
+
def format(self, *args, **kwargs) -> str:
|
|
37
|
+
"""
|
|
38
|
+
Format the error message with the provided arguments.
|
|
39
|
+
|
|
40
|
+
:param args: Positional arguments for string formatting
|
|
41
|
+
:param kwargs: Keyword arguments for string formatting
|
|
42
|
+
:return: Formatted error message with error code and help URL
|
|
43
|
+
:rtype: str
|
|
44
|
+
"""
|
|
45
|
+
# Format the main message
|
|
46
|
+
if args or kwargs:
|
|
47
|
+
message = self.message_template.format(*args, **kwargs)
|
|
48
|
+
else:
|
|
49
|
+
message = self.message_template
|
|
50
|
+
|
|
51
|
+
# Append error code and help URL
|
|
52
|
+
return (
|
|
53
|
+
f"{message}\n\n"
|
|
54
|
+
f"Error Code: {self.error_code}\n"
|
|
55
|
+
f"Help URL: {self.base_url}/#{self.error_code}"
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
def __str__(self) -> str:
|
|
59
|
+
"""Return the formatted error message without any arguments."""
|
|
60
|
+
return self.format()
|
|
61
|
+
|
|
62
|
+
def __repr__(self) -> str:
|
|
63
|
+
"""Return a representation of the ErrorMessage."""
|
|
64
|
+
return f"ErrorMessage(code={self.error_code}, message='{self.message_template[:50]}...')"
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Activity error resources for Microsoft Agents SDK.
|
|
6
|
+
|
|
7
|
+
Error codes are in the range -64000 to -64999.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from .error_message import ErrorMessage
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ActivityErrorResources:
|
|
14
|
+
"""
|
|
15
|
+
Error messages for activity operations.
|
|
16
|
+
|
|
17
|
+
Error codes are organized in the range -64000 to -64999.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
InvalidChannelIdType = ErrorMessage(
|
|
21
|
+
"Invalid type for channel_id: {0}. Expected ChannelId or str.",
|
|
22
|
+
-64000,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
ChannelIdProductInfoConflict = ErrorMessage(
|
|
26
|
+
"Conflict between channel_id.sub_channel and productInfo entity",
|
|
27
|
+
-64001,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
ChannelIdValueConflict = ErrorMessage(
|
|
31
|
+
"If value is provided, channel and sub_channel must be None",
|
|
32
|
+
-64002,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
ChannelIdValueMustBeNonEmpty = ErrorMessage(
|
|
36
|
+
"value must be a non empty string if provided",
|
|
37
|
+
-64003,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
InvalidFromPropertyType = ErrorMessage(
|
|
41
|
+
"Invalid type for from_property: {0}. Expected ChannelAccount or dict.",
|
|
42
|
+
-64004,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
InvalidRecipientType = ErrorMessage(
|
|
46
|
+
"Invalid type for recipient: {0}. Expected ChannelAccount or dict.",
|
|
47
|
+
-64005,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
def __init__(self):
|
|
51
|
+
"""Initialize ActivityErrorResources."""
|
|
52
|
+
pass
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from .activity import Activity
|
|
5
|
+
from .agents_model import AgentsModel
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ExpectedReplies(AgentsModel):
|
|
9
|
+
"""ExpectedReplies.
|
|
10
|
+
|
|
11
|
+
:param activities: A collection of Activities that conforms to the
|
|
12
|
+
ExpectedReplies schema.
|
|
13
|
+
:type activities: list[~microsoft_agents.activity.Activity]
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
activities: list[Activity] = None
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from .agents_model import AgentsModel
|
|
5
|
+
from ._type_aliases import NonEmptyString
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Fact(AgentsModel):
|
|
9
|
+
"""Set of key-value pairs. Advantage of this section is that key and value
|
|
10
|
+
properties will be
|
|
11
|
+
rendered with default style information with some delimiter between them.
|
|
12
|
+
So there is no need for developer to specify style information.
|
|
13
|
+
|
|
14
|
+
:param key: The key for this Fact
|
|
15
|
+
:type key: str
|
|
16
|
+
:param value: The value for this Fact
|
|
17
|
+
:type value: str
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
key: NonEmptyString = None
|
|
21
|
+
value: NonEmptyString = None
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from .card_action import CardAction
|
|
5
|
+
from .card_image import CardImage
|
|
6
|
+
from .agents_model import AgentsModel
|
|
7
|
+
from ._type_aliases import NonEmptyString
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class HeroCard(AgentsModel):
|
|
11
|
+
"""A Hero card (card with a single, large image).
|
|
12
|
+
|
|
13
|
+
:param title: Title of the card
|
|
14
|
+
:type title: str
|
|
15
|
+
:param subtitle: Subtitle of the card
|
|
16
|
+
:type subtitle: str
|
|
17
|
+
:param text: Text for the card
|
|
18
|
+
:type text: str
|
|
19
|
+
:param images: Array of images for the card
|
|
20
|
+
:type images: list[~microsoft_agents.activity.CardImage]
|
|
21
|
+
:param buttons: Set of actions applicable to the current card
|
|
22
|
+
:type buttons: list[~microsoft_agents.activity.CardAction]
|
|
23
|
+
:param tap: This action will be activated when user taps on the card
|
|
24
|
+
itself
|
|
25
|
+
:type tap: ~microsoft_agents.activity.CardAction
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
title: NonEmptyString = None
|
|
29
|
+
subtitle: NonEmptyString = None
|
|
30
|
+
text: str = None
|
|
31
|
+
images: list[CardImage] = None
|
|
32
|
+
buttons: list[CardAction] = None
|
|
33
|
+
tap: CardAction = None
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from .agents_model import AgentsModel
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class InnerHttpError(AgentsModel):
|
|
8
|
+
"""Object representing inner http error.
|
|
9
|
+
|
|
10
|
+
:param status_code: HttpStatusCode from failed request
|
|
11
|
+
:type status_code: int
|
|
12
|
+
:param body: Body from failed request
|
|
13
|
+
:type body: object
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
status_code: int = None
|
|
17
|
+
body: object = None
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from enum import Enum
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class InputHints(str, Enum):
|
|
8
|
+
accepting_input = "acceptingInput"
|
|
9
|
+
ignoring_input = "ignoringInput"
|
|
10
|
+
expecting_input = "expectingInput"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from .agents_model import AgentsModel
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class InvokeResponse(AgentsModel):
|
|
8
|
+
"""
|
|
9
|
+
Tuple class containing an HTTP Status Code and a JSON serializable
|
|
10
|
+
object. The HTTP Status code is, in the invoke activity scenario, what will
|
|
11
|
+
be set in the resulting POST. The Body of the resulting POST will be
|
|
12
|
+
JSON serialized content.
|
|
13
|
+
|
|
14
|
+
The body content is defined by the producer. The caller must know what
|
|
15
|
+
the content is and deserialize as needed.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
status: int = None
|
|
19
|
+
body: object = None
|
|
20
|
+
|
|
21
|
+
def is_successful_status_code(self) -> bool:
|
|
22
|
+
"""
|
|
23
|
+
Gets a value indicating whether the invoke response was successful.
|
|
24
|
+
:return: A value that indicates if the HTTP response was successful. true if status is in
|
|
25
|
+
the Successful range (200-299); otherwise false.
|
|
26
|
+
"""
|
|
27
|
+
return 200 <= self.status <= 299
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from .thumbnail_url import ThumbnailUrl
|
|
5
|
+
from .media_url import MediaUrl
|
|
6
|
+
from .card_action import CardAction
|
|
7
|
+
from .agents_model import AgentsModel
|
|
8
|
+
from ._type_aliases import NonEmptyString
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class MediaCard(AgentsModel):
|
|
12
|
+
"""Media card.
|
|
13
|
+
|
|
14
|
+
:param title: Title of this card
|
|
15
|
+
:type title: str
|
|
16
|
+
:param subtitle: Subtitle of this card
|
|
17
|
+
:type subtitle: str
|
|
18
|
+
:param text: Text of this card
|
|
19
|
+
:type text: str
|
|
20
|
+
:param image: Thumbnail placeholder
|
|
21
|
+
:type image: ~microsoft_agents.activity.ThumbnailUrl
|
|
22
|
+
:param media: Media URLs for this card. When this field contains more than
|
|
23
|
+
one URL, each URL is an alternative format of the same content.
|
|
24
|
+
:type media: list[~microsoft_agents.activity.MediaUrl]
|
|
25
|
+
:param buttons: Actions on this card
|
|
26
|
+
:type buttons: list[~microsoft_agents.activity.CardAction]
|
|
27
|
+
:param shareable: This content may be shared with others (default:true)
|
|
28
|
+
:type shareable: bool
|
|
29
|
+
:param autoloop: Should the client loop playback at end of content
|
|
30
|
+
(default:true)
|
|
31
|
+
:type autoloop: bool
|
|
32
|
+
:param autostart: Should the client automatically start playback of media
|
|
33
|
+
in this card (default:true)
|
|
34
|
+
:type autostart: bool
|
|
35
|
+
:param aspect: Aspect ratio of thumbnail/media placeholder. Allowed values
|
|
36
|
+
are "16:9" and "4:3"
|
|
37
|
+
:type aspect: str
|
|
38
|
+
:param duration: Describes the length of the media content without
|
|
39
|
+
requiring a receiver to open the content. Formatted as an ISO 8601
|
|
40
|
+
Duration field.
|
|
41
|
+
:type duration: str
|
|
42
|
+
:param value: Supplementary parameter for this card
|
|
43
|
+
:type value: object
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
title: NonEmptyString = None
|
|
47
|
+
subtitle: NonEmptyString = None
|
|
48
|
+
text: str = None
|
|
49
|
+
image: ThumbnailUrl = None
|
|
50
|
+
media: list[MediaUrl] = None
|
|
51
|
+
buttons: list[CardAction] = None
|
|
52
|
+
shareable: bool = None
|
|
53
|
+
autoloop: bool = None
|
|
54
|
+
autostart: bool = None
|
|
55
|
+
aspect: NonEmptyString = None
|
|
56
|
+
duration: NonEmptyString = None
|
|
57
|
+
value: object = None
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from .agents_model import AgentsModel
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class MediaEventValue(AgentsModel):
|
|
8
|
+
"""Supplementary parameter for media events.
|
|
9
|
+
|
|
10
|
+
:param card_value: Callback parameter specified in the Value field of the
|
|
11
|
+
MediaCard that originated this event
|
|
12
|
+
:type card_value: object
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
card_value: object = None
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from .agents_model import AgentsModel
|
|
5
|
+
from ._type_aliases import NonEmptyString
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class MediaUrl(AgentsModel):
|
|
9
|
+
"""Media URL.
|
|
10
|
+
|
|
11
|
+
:param url: Url for the media
|
|
12
|
+
:type url: str
|
|
13
|
+
:param profile: Optional profile hint to the client to differentiate
|
|
14
|
+
multiple MediaUrl objects from each other
|
|
15
|
+
:type profile: str
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
url: NonEmptyString = None
|
|
19
|
+
profile: NonEmptyString = None
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from .agents_model import AgentsModel
|
|
5
|
+
from ._type_aliases import NonEmptyString
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class MessageReaction(AgentsModel):
|
|
9
|
+
"""Message reaction object.
|
|
10
|
+
|
|
11
|
+
:param type: Message reaction type. Possible values include: 'like',
|
|
12
|
+
'plusOne'
|
|
13
|
+
:type type: str or ~microsoft_agents.activity.MessageReactionTypes
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
type: NonEmptyString
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from enum import Enum
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class MessageReactionTypes(str, Enum):
|
|
8
|
+
"""MessageReactionType
|
|
9
|
+
|
|
10
|
+
Enum for message reaction types.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
REACTIONS_ADDED = "reactionsAdded"
|
|
14
|
+
REACTIONS_REMOVED = "reactionsRemoved"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from enum import Enum
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class MessageUpdateTypes(str, Enum):
|
|
8
|
+
EDIT_MESSAGE = "editMessage"
|
|
9
|
+
SOFT_DELETE_MESSAGE = "softDeleteMessage"
|
|
10
|
+
UNDELETE_MESSAGE = "undeleteMessage"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from typing import Optional
|
|
5
|
+
from .card_action import CardAction
|
|
6
|
+
from .agents_model import AgentsModel
|
|
7
|
+
from .token_exchange_resource import TokenExchangeResource
|
|
8
|
+
from .token_post_resource import TokenPostResource
|
|
9
|
+
from ._type_aliases import NonEmptyString
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class OAuthCard(AgentsModel):
|
|
13
|
+
"""A card representing a request to perform a sign in via OAuth.
|
|
14
|
+
|
|
15
|
+
:param text: Text for signin request
|
|
16
|
+
:type text: str
|
|
17
|
+
:param connection_name: The name of the registered connection
|
|
18
|
+
:type connection_name: str
|
|
19
|
+
:param buttons: Action to use to perform signin
|
|
20
|
+
:type buttons: list[~microsoft_agents.activity.CardAction]
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
text: str = None
|
|
24
|
+
connection_name: NonEmptyString = None
|
|
25
|
+
buttons: list[CardAction] = None
|
|
26
|
+
token_exchange_resource: Optional[TokenExchangeResource] = None
|
|
27
|
+
token_post_resource: TokenPostResource = None
|