Initial commit: Email alerts application
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from twilio.base.domain import Domain
|
||||
from twilio.rest import Client
|
||||
from twilio.rest.insights.v1 import V1
|
||||
|
||||
|
||||
class InsightsBase(Domain):
|
||||
def __init__(self, twilio: Client):
|
||||
"""
|
||||
Initialize the Insights Domain
|
||||
|
||||
:returns: Domain for Insights
|
||||
"""
|
||||
super().__init__(twilio, "https://insights.twilio.com")
|
||||
self._v1: Optional[V1] = None
|
||||
|
||||
@property
|
||||
def v1(self) -> V1:
|
||||
"""
|
||||
:returns: Versions v1 of Insights
|
||||
"""
|
||||
if self._v1 is None:
|
||||
self._v1 = V1(self)
|
||||
return self._v1
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Insights>"
|
||||
@@ -0,0 +1,55 @@
|
||||
from warnings import warn
|
||||
|
||||
from twilio.rest.insights.InsightsBase import InsightsBase
|
||||
from twilio.rest.insights.v1.call import CallList
|
||||
from twilio.rest.insights.v1.call_summaries import CallSummariesList
|
||||
from twilio.rest.insights.v1.conference import ConferenceList
|
||||
from twilio.rest.insights.v1.room import RoomList
|
||||
from twilio.rest.insights.v1.setting import SettingList
|
||||
|
||||
|
||||
class Insights(InsightsBase):
|
||||
@property
|
||||
def settings(self) -> SettingList:
|
||||
warn(
|
||||
"settings is deprecated. Use v1.settings instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.settings
|
||||
|
||||
@property
|
||||
def calls(self) -> CallList:
|
||||
warn(
|
||||
"calls is deprecated. Use v1.calls instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.calls
|
||||
|
||||
@property
|
||||
def call_summaries(self) -> CallSummariesList:
|
||||
warn(
|
||||
"call_summaries is deprecated. Use v1.call_summaries instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.call_summaries
|
||||
|
||||
@property
|
||||
def conferences(self) -> ConferenceList:
|
||||
warn(
|
||||
"conferences is deprecated. Use v1.conferences instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.conferences
|
||||
|
||||
@property
|
||||
def rooms(self) -> RoomList:
|
||||
warn(
|
||||
"rooms is deprecated. Use v1.rooms instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.rooms
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,74 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Insights
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
from typing import Optional
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.domain import Domain
|
||||
from twilio.rest.insights.v1.call import CallList
|
||||
from twilio.rest.insights.v1.call_summaries import CallSummariesList
|
||||
from twilio.rest.insights.v1.conference import ConferenceList
|
||||
from twilio.rest.insights.v1.room import RoomList
|
||||
from twilio.rest.insights.v1.setting import SettingList
|
||||
|
||||
|
||||
class V1(Version):
|
||||
def __init__(self, domain: Domain):
|
||||
"""
|
||||
Initialize the V1 version of Insights
|
||||
|
||||
:param domain: The Twilio.insights domain
|
||||
"""
|
||||
super().__init__(domain, "v1")
|
||||
self._calls: Optional[CallList] = None
|
||||
self._call_summaries: Optional[CallSummariesList] = None
|
||||
self._conferences: Optional[ConferenceList] = None
|
||||
self._rooms: Optional[RoomList] = None
|
||||
self._settings: Optional[SettingList] = None
|
||||
|
||||
@property
|
||||
def calls(self) -> CallList:
|
||||
if self._calls is None:
|
||||
self._calls = CallList(self)
|
||||
return self._calls
|
||||
|
||||
@property
|
||||
def call_summaries(self) -> CallSummariesList:
|
||||
if self._call_summaries is None:
|
||||
self._call_summaries = CallSummariesList(self)
|
||||
return self._call_summaries
|
||||
|
||||
@property
|
||||
def conferences(self) -> ConferenceList:
|
||||
if self._conferences is None:
|
||||
self._conferences = ConferenceList(self)
|
||||
return self._conferences
|
||||
|
||||
@property
|
||||
def rooms(self) -> RoomList:
|
||||
if self._rooms is None:
|
||||
self._rooms = RoomList(self)
|
||||
return self._rooms
|
||||
|
||||
@property
|
||||
def settings(self) -> SettingList:
|
||||
if self._settings is None:
|
||||
self._settings = SettingList(self)
|
||||
return self._settings
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Insights.V1>"
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,270 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Insights
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from typing import Any, Dict, Optional
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
|
||||
from twilio.rest.insights.v1.call.annotation import AnnotationList
|
||||
from twilio.rest.insights.v1.call.call_summary import CallSummaryList
|
||||
from twilio.rest.insights.v1.call.event import EventList
|
||||
from twilio.rest.insights.v1.call.metric import MetricList
|
||||
|
||||
|
||||
class CallInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar sid:
|
||||
:ivar url:
|
||||
:ivar links:
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
self.links: Optional[Dict[str, object]] = payload.get("links")
|
||||
|
||||
self._solution = {
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[CallContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "CallContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: CallContext for this CallInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = CallContext(
|
||||
self._version,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "CallInstance":
|
||||
"""
|
||||
Fetch the CallInstance
|
||||
|
||||
|
||||
:returns: The fetched CallInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "CallInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the CallInstance
|
||||
|
||||
|
||||
:returns: The fetched CallInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
@property
|
||||
def annotation(self) -> AnnotationList:
|
||||
"""
|
||||
Access the annotation
|
||||
"""
|
||||
return self._proxy.annotation
|
||||
|
||||
@property
|
||||
def summary(self) -> CallSummaryList:
|
||||
"""
|
||||
Access the summary
|
||||
"""
|
||||
return self._proxy.summary
|
||||
|
||||
@property
|
||||
def events(self) -> EventList:
|
||||
"""
|
||||
Access the events
|
||||
"""
|
||||
return self._proxy.events
|
||||
|
||||
@property
|
||||
def metrics(self) -> MetricList:
|
||||
"""
|
||||
Access the metrics
|
||||
"""
|
||||
return self._proxy.metrics
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Insights.V1.CallInstance {}>".format(context)
|
||||
|
||||
|
||||
class CallContext(InstanceContext):
|
||||
def __init__(self, version: Version, sid: str):
|
||||
"""
|
||||
Initialize the CallContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param sid:
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/Voice/{sid}".format(**self._solution)
|
||||
|
||||
self._annotation: Optional[AnnotationList] = None
|
||||
self._summary: Optional[CallSummaryList] = None
|
||||
self._events: Optional[EventList] = None
|
||||
self._metrics: Optional[MetricList] = None
|
||||
|
||||
def fetch(self) -> CallInstance:
|
||||
"""
|
||||
Fetch the CallInstance
|
||||
|
||||
|
||||
:returns: The fetched CallInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return CallInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> CallInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the CallInstance
|
||||
|
||||
|
||||
:returns: The fetched CallInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return CallInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
@property
|
||||
def annotation(self) -> AnnotationList:
|
||||
"""
|
||||
Access the annotation
|
||||
"""
|
||||
if self._annotation is None:
|
||||
self._annotation = AnnotationList(
|
||||
self._version,
|
||||
self._solution["sid"],
|
||||
)
|
||||
return self._annotation
|
||||
|
||||
@property
|
||||
def summary(self) -> CallSummaryList:
|
||||
"""
|
||||
Access the summary
|
||||
"""
|
||||
if self._summary is None:
|
||||
self._summary = CallSummaryList(
|
||||
self._version,
|
||||
self._solution["sid"],
|
||||
)
|
||||
return self._summary
|
||||
|
||||
@property
|
||||
def events(self) -> EventList:
|
||||
"""
|
||||
Access the events
|
||||
"""
|
||||
if self._events is None:
|
||||
self._events = EventList(
|
||||
self._version,
|
||||
self._solution["sid"],
|
||||
)
|
||||
return self._events
|
||||
|
||||
@property
|
||||
def metrics(self) -> MetricList:
|
||||
"""
|
||||
Access the metrics
|
||||
"""
|
||||
if self._metrics is None:
|
||||
self._metrics = MetricList(
|
||||
self._version,
|
||||
self._solution["sid"],
|
||||
)
|
||||
return self._metrics
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Insights.V1.CallContext {}>".format(context)
|
||||
|
||||
|
||||
class CallList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the CallList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
def get(self, sid: str) -> CallContext:
|
||||
"""
|
||||
Constructs a CallContext
|
||||
|
||||
:param sid:
|
||||
"""
|
||||
return CallContext(self._version, sid=sid)
|
||||
|
||||
def __call__(self, sid: str) -> CallContext:
|
||||
"""
|
||||
Constructs a CallContext
|
||||
|
||||
:param sid:
|
||||
"""
|
||||
return CallContext(self._version, sid=sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Insights.V1.CallList>"
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,381 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Insights
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
from twilio.base import deserialize, values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
|
||||
|
||||
class AnnotationInstance(InstanceResource):
|
||||
class AnsweredBy(object):
|
||||
UNKNOWN_ANSWERED_BY = "unknown_answered_by"
|
||||
HUMAN = "human"
|
||||
MACHINE = "machine"
|
||||
|
||||
class ConnectivityIssue(object):
|
||||
UNKNOWN_CONNECTIVITY_ISSUE = "unknown_connectivity_issue"
|
||||
NO_CONNECTIVITY_ISSUE = "no_connectivity_issue"
|
||||
INVALID_NUMBER = "invalid_number"
|
||||
CALLER_ID = "caller_id"
|
||||
DROPPED_CALL = "dropped_call"
|
||||
NUMBER_REACHABILITY = "number_reachability"
|
||||
|
||||
"""
|
||||
:ivar call_sid: The unique SID identifier of the Call.
|
||||
:ivar account_sid: The unique SID identifier of the Account.
|
||||
:ivar answered_by:
|
||||
:ivar connectivity_issue:
|
||||
:ivar quality_issues: Specifies if the call had any subjective quality issues. Possible values are one or more of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, or `static_noise`.
|
||||
:ivar spam: Specifies if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Is of type Boolean: true, false. Use true if the call was a spam call.
|
||||
:ivar call_score: Specifies the Call Score, if available. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad].
|
||||
:ivar comment: Specifies any comments pertaining to the call. Twilio does not treat this field as PII, so no PII should be included in comments.
|
||||
:ivar incident: Incident or support ticket associated with this call. The `incident` property is of type string with a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in `incident`.
|
||||
:ivar url: The URL of this resource.
|
||||
"""
|
||||
|
||||
def __init__(self, version: Version, payload: Dict[str, Any], call_sid: str):
|
||||
super().__init__(version)
|
||||
|
||||
self.call_sid: Optional[str] = payload.get("call_sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.answered_by: Optional["AnnotationInstance.AnsweredBy"] = payload.get(
|
||||
"answered_by"
|
||||
)
|
||||
self.connectivity_issue: Optional[
|
||||
"AnnotationInstance.ConnectivityIssue"
|
||||
] = payload.get("connectivity_issue")
|
||||
self.quality_issues: Optional[List[str]] = payload.get("quality_issues")
|
||||
self.spam: Optional[bool] = payload.get("spam")
|
||||
self.call_score: Optional[int] = deserialize.integer(payload.get("call_score"))
|
||||
self.comment: Optional[str] = payload.get("comment")
|
||||
self.incident: Optional[str] = payload.get("incident")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"call_sid": call_sid,
|
||||
}
|
||||
self._context: Optional[AnnotationContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "AnnotationContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: AnnotationContext for this AnnotationInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = AnnotationContext(
|
||||
self._version,
|
||||
call_sid=self._solution["call_sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "AnnotationInstance":
|
||||
"""
|
||||
Fetch the AnnotationInstance
|
||||
|
||||
|
||||
:returns: The fetched AnnotationInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "AnnotationInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the AnnotationInstance
|
||||
|
||||
|
||||
:returns: The fetched AnnotationInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def update(
|
||||
self,
|
||||
answered_by: Union["AnnotationInstance.AnsweredBy", object] = values.unset,
|
||||
connectivity_issue: Union[
|
||||
"AnnotationInstance.ConnectivityIssue", object
|
||||
] = values.unset,
|
||||
quality_issues: Union[str, object] = values.unset,
|
||||
spam: Union[bool, object] = values.unset,
|
||||
call_score: Union[int, object] = values.unset,
|
||||
comment: Union[str, object] = values.unset,
|
||||
incident: Union[str, object] = values.unset,
|
||||
) -> "AnnotationInstance":
|
||||
"""
|
||||
Update the AnnotationInstance
|
||||
|
||||
:param answered_by:
|
||||
:param connectivity_issue:
|
||||
:param quality_issues: Specify if the call had any subjective quality issues. Possible values, one or more of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. Use comma separated values to indicate multiple quality issues for the same call.
|
||||
:param spam: A boolean flag to indicate if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Use `true` if the call was a spam call.
|
||||
:param call_score: Specify the call score. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad].
|
||||
:param comment: Specify any comments pertaining to the call. `comment` has a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in the `comment`.
|
||||
:param incident: Associate this call with an incident or support ticket. The `incident` parameter is of type string with a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in `incident`.
|
||||
|
||||
:returns: The updated AnnotationInstance
|
||||
"""
|
||||
return self._proxy.update(
|
||||
answered_by=answered_by,
|
||||
connectivity_issue=connectivity_issue,
|
||||
quality_issues=quality_issues,
|
||||
spam=spam,
|
||||
call_score=call_score,
|
||||
comment=comment,
|
||||
incident=incident,
|
||||
)
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
answered_by: Union["AnnotationInstance.AnsweredBy", object] = values.unset,
|
||||
connectivity_issue: Union[
|
||||
"AnnotationInstance.ConnectivityIssue", object
|
||||
] = values.unset,
|
||||
quality_issues: Union[str, object] = values.unset,
|
||||
spam: Union[bool, object] = values.unset,
|
||||
call_score: Union[int, object] = values.unset,
|
||||
comment: Union[str, object] = values.unset,
|
||||
incident: Union[str, object] = values.unset,
|
||||
) -> "AnnotationInstance":
|
||||
"""
|
||||
Asynchronous coroutine to update the AnnotationInstance
|
||||
|
||||
:param answered_by:
|
||||
:param connectivity_issue:
|
||||
:param quality_issues: Specify if the call had any subjective quality issues. Possible values, one or more of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. Use comma separated values to indicate multiple quality issues for the same call.
|
||||
:param spam: A boolean flag to indicate if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Use `true` if the call was a spam call.
|
||||
:param call_score: Specify the call score. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad].
|
||||
:param comment: Specify any comments pertaining to the call. `comment` has a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in the `comment`.
|
||||
:param incident: Associate this call with an incident or support ticket. The `incident` parameter is of type string with a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in `incident`.
|
||||
|
||||
:returns: The updated AnnotationInstance
|
||||
"""
|
||||
return await self._proxy.update_async(
|
||||
answered_by=answered_by,
|
||||
connectivity_issue=connectivity_issue,
|
||||
quality_issues=quality_issues,
|
||||
spam=spam,
|
||||
call_score=call_score,
|
||||
comment=comment,
|
||||
incident=incident,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Insights.V1.AnnotationInstance {}>".format(context)
|
||||
|
||||
|
||||
class AnnotationContext(InstanceContext):
|
||||
def __init__(self, version: Version, call_sid: str):
|
||||
"""
|
||||
Initialize the AnnotationContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param call_sid: The unique string that Twilio created to identify this Call resource. It always starts with a CA.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"call_sid": call_sid,
|
||||
}
|
||||
self._uri = "/Voice/{call_sid}/Annotation".format(**self._solution)
|
||||
|
||||
def fetch(self) -> AnnotationInstance:
|
||||
"""
|
||||
Fetch the AnnotationInstance
|
||||
|
||||
|
||||
:returns: The fetched AnnotationInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return AnnotationInstance(
|
||||
self._version,
|
||||
payload,
|
||||
call_sid=self._solution["call_sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> AnnotationInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the AnnotationInstance
|
||||
|
||||
|
||||
:returns: The fetched AnnotationInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return AnnotationInstance(
|
||||
self._version,
|
||||
payload,
|
||||
call_sid=self._solution["call_sid"],
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
answered_by: Union["AnnotationInstance.AnsweredBy", object] = values.unset,
|
||||
connectivity_issue: Union[
|
||||
"AnnotationInstance.ConnectivityIssue", object
|
||||
] = values.unset,
|
||||
quality_issues: Union[str, object] = values.unset,
|
||||
spam: Union[bool, object] = values.unset,
|
||||
call_score: Union[int, object] = values.unset,
|
||||
comment: Union[str, object] = values.unset,
|
||||
incident: Union[str, object] = values.unset,
|
||||
) -> AnnotationInstance:
|
||||
"""
|
||||
Update the AnnotationInstance
|
||||
|
||||
:param answered_by:
|
||||
:param connectivity_issue:
|
||||
:param quality_issues: Specify if the call had any subjective quality issues. Possible values, one or more of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. Use comma separated values to indicate multiple quality issues for the same call.
|
||||
:param spam: A boolean flag to indicate if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Use `true` if the call was a spam call.
|
||||
:param call_score: Specify the call score. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad].
|
||||
:param comment: Specify any comments pertaining to the call. `comment` has a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in the `comment`.
|
||||
:param incident: Associate this call with an incident or support ticket. The `incident` parameter is of type string with a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in `incident`.
|
||||
|
||||
:returns: The updated AnnotationInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"AnsweredBy": answered_by,
|
||||
"ConnectivityIssue": connectivity_issue,
|
||||
"QualityIssues": quality_issues,
|
||||
"Spam": spam,
|
||||
"CallScore": call_score,
|
||||
"Comment": comment,
|
||||
"Incident": incident,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.update(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return AnnotationInstance(
|
||||
self._version, payload, call_sid=self._solution["call_sid"]
|
||||
)
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
answered_by: Union["AnnotationInstance.AnsweredBy", object] = values.unset,
|
||||
connectivity_issue: Union[
|
||||
"AnnotationInstance.ConnectivityIssue", object
|
||||
] = values.unset,
|
||||
quality_issues: Union[str, object] = values.unset,
|
||||
spam: Union[bool, object] = values.unset,
|
||||
call_score: Union[int, object] = values.unset,
|
||||
comment: Union[str, object] = values.unset,
|
||||
incident: Union[str, object] = values.unset,
|
||||
) -> AnnotationInstance:
|
||||
"""
|
||||
Asynchronous coroutine to update the AnnotationInstance
|
||||
|
||||
:param answered_by:
|
||||
:param connectivity_issue:
|
||||
:param quality_issues: Specify if the call had any subjective quality issues. Possible values, one or more of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. Use comma separated values to indicate multiple quality issues for the same call.
|
||||
:param spam: A boolean flag to indicate if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Use `true` if the call was a spam call.
|
||||
:param call_score: Specify the call score. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad].
|
||||
:param comment: Specify any comments pertaining to the call. `comment` has a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in the `comment`.
|
||||
:param incident: Associate this call with an incident or support ticket. The `incident` parameter is of type string with a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in `incident`.
|
||||
|
||||
:returns: The updated AnnotationInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"AnsweredBy": answered_by,
|
||||
"ConnectivityIssue": connectivity_issue,
|
||||
"QualityIssues": quality_issues,
|
||||
"Spam": spam,
|
||||
"CallScore": call_score,
|
||||
"Comment": comment,
|
||||
"Incident": incident,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.update_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return AnnotationInstance(
|
||||
self._version, payload, call_sid=self._solution["call_sid"]
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Insights.V1.AnnotationContext {}>".format(context)
|
||||
|
||||
|
||||
class AnnotationList(ListResource):
|
||||
def __init__(self, version: Version, call_sid: str):
|
||||
"""
|
||||
Initialize the AnnotationList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param call_sid: The unique SID identifier of the Call.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"call_sid": call_sid,
|
||||
}
|
||||
|
||||
def get(self) -> AnnotationContext:
|
||||
"""
|
||||
Constructs a AnnotationContext
|
||||
|
||||
"""
|
||||
return AnnotationContext(self._version, call_sid=self._solution["call_sid"])
|
||||
|
||||
def __call__(self) -> AnnotationContext:
|
||||
"""
|
||||
Constructs a AnnotationContext
|
||||
|
||||
"""
|
||||
return AnnotationContext(self._version, call_sid=self._solution["call_sid"])
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Insights.V1.AnnotationList>"
|
||||
@@ -0,0 +1,308 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Insights
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
from twilio.base import deserialize, values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
|
||||
|
||||
class CallSummaryInstance(InstanceResource):
|
||||
class AnsweredBy(object):
|
||||
UNKNOWN = "unknown"
|
||||
MACHINE_START = "machine_start"
|
||||
MACHINE_END_BEEP = "machine_end_beep"
|
||||
MACHINE_END_SILENCE = "machine_end_silence"
|
||||
MACHINE_END_OTHER = "machine_end_other"
|
||||
HUMAN = "human"
|
||||
FAX = "fax"
|
||||
|
||||
class CallState(object):
|
||||
RINGING = "ringing"
|
||||
COMPLETED = "completed"
|
||||
BUSY = "busy"
|
||||
FAIL = "fail"
|
||||
NOANSWER = "noanswer"
|
||||
CANCELED = "canceled"
|
||||
ANSWERED = "answered"
|
||||
UNDIALED = "undialed"
|
||||
|
||||
class CallType(object):
|
||||
CARRIER = "carrier"
|
||||
SIP = "sip"
|
||||
TRUNKING = "trunking"
|
||||
CLIENT = "client"
|
||||
|
||||
class ProcessingState(object):
|
||||
COMPLETE = "complete"
|
||||
PARTIAL = "partial"
|
||||
|
||||
"""
|
||||
:ivar account_sid: The unique SID identifier of the Account.
|
||||
:ivar call_sid: The unique SID identifier of the Call.
|
||||
:ivar call_type:
|
||||
:ivar call_state:
|
||||
:ivar answered_by:
|
||||
:ivar processing_state:
|
||||
:ivar created_time: The time at which the Call was created, given in ISO 8601 format. Can be different from `start_time` in the event of queueing due to CPS
|
||||
:ivar start_time: The time at which the Call was started, given in ISO 8601 format.
|
||||
:ivar end_time: The time at which the Call was ended, given in ISO 8601 format.
|
||||
:ivar duration: Duration between when the call was initiated and the call was ended
|
||||
:ivar connect_duration: Duration between when the call was answered and when it ended
|
||||
:ivar _from: The calling party.
|
||||
:ivar to: The called party.
|
||||
:ivar carrier_edge: Contains metrics and properties for the Twilio media gateway of a PSTN call.
|
||||
:ivar client_edge: Contains metrics and properties for the Twilio media gateway of a Client call.
|
||||
:ivar sdk_edge: Contains metrics and properties for the SDK sensor library for Client calls.
|
||||
:ivar sip_edge: Contains metrics and properties for the Twilio media gateway of a SIP Interface or Trunking call.
|
||||
:ivar tags: Tags applied to calls by Voice Insights analysis indicating a condition that could result in subjective degradation of the call quality.
|
||||
:ivar url: The URL of this resource.
|
||||
:ivar attributes: Attributes capturing call-flow-specific details.
|
||||
:ivar properties: Contains edge-agnostic call-level details.
|
||||
:ivar trust: Contains trusted communications details including Branded Call and verified caller ID.
|
||||
:ivar annotation: Programmatically labeled annotations for the Call. Developers can update the Call Summary records with Annotation during or after a Call. Annotations can be updated as long as the Call Summary record is addressable via the API.
|
||||
"""
|
||||
|
||||
def __init__(self, version: Version, payload: Dict[str, Any], call_sid: str):
|
||||
super().__init__(version)
|
||||
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.call_sid: Optional[str] = payload.get("call_sid")
|
||||
self.call_type: Optional["CallSummaryInstance.CallType"] = payload.get(
|
||||
"call_type"
|
||||
)
|
||||
self.call_state: Optional["CallSummaryInstance.CallState"] = payload.get(
|
||||
"call_state"
|
||||
)
|
||||
self.answered_by: Optional["CallSummaryInstance.AnsweredBy"] = payload.get(
|
||||
"answered_by"
|
||||
)
|
||||
self.processing_state: Optional[
|
||||
"CallSummaryInstance.ProcessingState"
|
||||
] = payload.get("processing_state")
|
||||
self.created_time: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("created_time")
|
||||
)
|
||||
self.start_time: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("start_time")
|
||||
)
|
||||
self.end_time: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("end_time")
|
||||
)
|
||||
self.duration: Optional[int] = deserialize.integer(payload.get("duration"))
|
||||
self.connect_duration: Optional[int] = deserialize.integer(
|
||||
payload.get("connect_duration")
|
||||
)
|
||||
self._from: Optional[Dict[str, object]] = payload.get("from")
|
||||
self.to: Optional[Dict[str, object]] = payload.get("to")
|
||||
self.carrier_edge: Optional[Dict[str, object]] = payload.get("carrier_edge")
|
||||
self.client_edge: Optional[Dict[str, object]] = payload.get("client_edge")
|
||||
self.sdk_edge: Optional[Dict[str, object]] = payload.get("sdk_edge")
|
||||
self.sip_edge: Optional[Dict[str, object]] = payload.get("sip_edge")
|
||||
self.tags: Optional[List[str]] = payload.get("tags")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
self.attributes: Optional[Dict[str, object]] = payload.get("attributes")
|
||||
self.properties: Optional[Dict[str, object]] = payload.get("properties")
|
||||
self.trust: Optional[Dict[str, object]] = payload.get("trust")
|
||||
self.annotation: Optional[Dict[str, object]] = payload.get("annotation")
|
||||
|
||||
self._solution = {
|
||||
"call_sid": call_sid,
|
||||
}
|
||||
self._context: Optional[CallSummaryContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "CallSummaryContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: CallSummaryContext for this CallSummaryInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = CallSummaryContext(
|
||||
self._version,
|
||||
call_sid=self._solution["call_sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(
|
||||
self,
|
||||
processing_state: Union[
|
||||
"CallSummaryInstance.ProcessingState", object
|
||||
] = values.unset,
|
||||
) -> "CallSummaryInstance":
|
||||
"""
|
||||
Fetch the CallSummaryInstance
|
||||
|
||||
:param processing_state: The Processing State of this Call Summary. One of `complete`, `partial` or `all`.
|
||||
|
||||
:returns: The fetched CallSummaryInstance
|
||||
"""
|
||||
return self._proxy.fetch(
|
||||
processing_state=processing_state,
|
||||
)
|
||||
|
||||
async def fetch_async(
|
||||
self,
|
||||
processing_state: Union[
|
||||
"CallSummaryInstance.ProcessingState", object
|
||||
] = values.unset,
|
||||
) -> "CallSummaryInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the CallSummaryInstance
|
||||
|
||||
:param processing_state: The Processing State of this Call Summary. One of `complete`, `partial` or `all`.
|
||||
|
||||
:returns: The fetched CallSummaryInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async(
|
||||
processing_state=processing_state,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Insights.V1.CallSummaryInstance {}>".format(context)
|
||||
|
||||
|
||||
class CallSummaryContext(InstanceContext):
|
||||
def __init__(self, version: Version, call_sid: str):
|
||||
"""
|
||||
Initialize the CallSummaryContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param call_sid: The unique SID identifier of the Call.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"call_sid": call_sid,
|
||||
}
|
||||
self._uri = "/Voice/{call_sid}/Summary".format(**self._solution)
|
||||
|
||||
def fetch(
|
||||
self,
|
||||
processing_state: Union[
|
||||
"CallSummaryInstance.ProcessingState", object
|
||||
] = values.unset,
|
||||
) -> CallSummaryInstance:
|
||||
"""
|
||||
Fetch the CallSummaryInstance
|
||||
|
||||
:param processing_state: The Processing State of this Call Summary. One of `complete`, `partial` or `all`.
|
||||
|
||||
:returns: The fetched CallSummaryInstance
|
||||
"""
|
||||
|
||||
data = values.of(
|
||||
{
|
||||
"ProcessingState": processing_state,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.fetch(method="GET", uri=self._uri, params=data)
|
||||
|
||||
return CallSummaryInstance(
|
||||
self._version,
|
||||
payload,
|
||||
call_sid=self._solution["call_sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(
|
||||
self,
|
||||
processing_state: Union[
|
||||
"CallSummaryInstance.ProcessingState", object
|
||||
] = values.unset,
|
||||
) -> CallSummaryInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the CallSummaryInstance
|
||||
|
||||
:param processing_state: The Processing State of this Call Summary. One of `complete`, `partial` or `all`.
|
||||
|
||||
:returns: The fetched CallSummaryInstance
|
||||
"""
|
||||
|
||||
data = values.of(
|
||||
{
|
||||
"ProcessingState": processing_state,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
|
||||
return CallSummaryInstance(
|
||||
self._version,
|
||||
payload,
|
||||
call_sid=self._solution["call_sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Insights.V1.CallSummaryContext {}>".format(context)
|
||||
|
||||
|
||||
class CallSummaryList(ListResource):
|
||||
def __init__(self, version: Version, call_sid: str):
|
||||
"""
|
||||
Initialize the CallSummaryList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param call_sid: The unique SID identifier of the Call.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"call_sid": call_sid,
|
||||
}
|
||||
|
||||
def get(self) -> CallSummaryContext:
|
||||
"""
|
||||
Constructs a CallSummaryContext
|
||||
|
||||
"""
|
||||
return CallSummaryContext(self._version, call_sid=self._solution["call_sid"])
|
||||
|
||||
def __call__(self) -> CallSummaryContext:
|
||||
"""
|
||||
Constructs a CallSummaryContext
|
||||
|
||||
"""
|
||||
return CallSummaryContext(self._version, call_sid=self._solution["call_sid"])
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Insights.V1.CallSummaryList>"
|
||||
@@ -0,0 +1,325 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Insights
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import values
|
||||
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
|
||||
|
||||
class EventInstance(InstanceResource):
|
||||
class Level(object):
|
||||
UNKNOWN = "UNKNOWN"
|
||||
DEBUG = "DEBUG"
|
||||
INFO = "INFO"
|
||||
WARNING = "WARNING"
|
||||
ERROR = "ERROR"
|
||||
|
||||
class TwilioEdge(object):
|
||||
UNKNOWN_EDGE = "unknown_edge"
|
||||
CARRIER_EDGE = "carrier_edge"
|
||||
SIP_EDGE = "sip_edge"
|
||||
SDK_EDGE = "sdk_edge"
|
||||
CLIENT_EDGE = "client_edge"
|
||||
|
||||
"""
|
||||
:ivar timestamp: Event time.
|
||||
:ivar call_sid: The unique SID identifier of the Call.
|
||||
:ivar account_sid: The unique SID identifier of the Account.
|
||||
:ivar edge:
|
||||
:ivar group: Event group.
|
||||
:ivar level:
|
||||
:ivar name: Event name.
|
||||
:ivar carrier_edge: Represents the connection between Twilio and our immediate carrier partners. The events here describe the call lifecycle as reported by Twilio's carrier media gateways.
|
||||
:ivar sip_edge: Represents the Twilio media gateway for SIP interface and SIP trunking calls. The events here describe the call lifecycle as reported by Twilio's public media gateways.
|
||||
:ivar sdk_edge: Represents the Voice SDK running locally in the browser or in the Android/iOS application. The events here are emitted by the Voice SDK in response to certain call progress events, network changes, or call quality conditions.
|
||||
:ivar client_edge: Represents the Twilio media gateway for Client calls. The events here describe the call lifecycle as reported by Twilio's Voice SDK media gateways.
|
||||
"""
|
||||
|
||||
def __init__(self, version: Version, payload: Dict[str, Any], call_sid: str):
|
||||
super().__init__(version)
|
||||
|
||||
self.timestamp: Optional[str] = payload.get("timestamp")
|
||||
self.call_sid: Optional[str] = payload.get("call_sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.edge: Optional["EventInstance.TwilioEdge"] = payload.get("edge")
|
||||
self.group: Optional[str] = payload.get("group")
|
||||
self.level: Optional["EventInstance.Level"] = payload.get("level")
|
||||
self.name: Optional[str] = payload.get("name")
|
||||
self.carrier_edge: Optional[Dict[str, object]] = payload.get("carrier_edge")
|
||||
self.sip_edge: Optional[Dict[str, object]] = payload.get("sip_edge")
|
||||
self.sdk_edge: Optional[Dict[str, object]] = payload.get("sdk_edge")
|
||||
self.client_edge: Optional[Dict[str, object]] = payload.get("client_edge")
|
||||
|
||||
self._solution = {
|
||||
"call_sid": call_sid,
|
||||
}
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Insights.V1.EventInstance {}>".format(context)
|
||||
|
||||
|
||||
class EventPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> EventInstance:
|
||||
"""
|
||||
Build an instance of EventInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return EventInstance(
|
||||
self._version, payload, call_sid=self._solution["call_sid"]
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Insights.V1.EventPage>"
|
||||
|
||||
|
||||
class EventList(ListResource):
|
||||
def __init__(self, version: Version, call_sid: str):
|
||||
"""
|
||||
Initialize the EventList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param call_sid: The unique SID identifier of the Call.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"call_sid": call_sid,
|
||||
}
|
||||
self._uri = "/Voice/{call_sid}/Events".format(**self._solution)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
edge: Union["EventInstance.TwilioEdge", object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[EventInstance]:
|
||||
"""
|
||||
Streams EventInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param "EventInstance.TwilioEdge" edge: The Edge of this Event. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(edge=edge, page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
edge: Union["EventInstance.TwilioEdge", object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[EventInstance]:
|
||||
"""
|
||||
Asynchronously streams EventInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param "EventInstance.TwilioEdge" edge: The Edge of this Event. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(edge=edge, page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
edge: Union["EventInstance.TwilioEdge", object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[EventInstance]:
|
||||
"""
|
||||
Lists EventInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param "EventInstance.TwilioEdge" edge: The Edge of this Event. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
edge=edge,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
edge: Union["EventInstance.TwilioEdge", object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[EventInstance]:
|
||||
"""
|
||||
Asynchronously lists EventInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param "EventInstance.TwilioEdge" edge: The Edge of this Event. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
edge=edge,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
edge: Union["EventInstance.TwilioEdge", object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> EventPage:
|
||||
"""
|
||||
Retrieve a single page of EventInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param edge: The Edge of this Event. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`.
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of EventInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Edge": edge,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return EventPage(self._version, response, self._solution)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
edge: Union["EventInstance.TwilioEdge", object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> EventPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of EventInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param edge: The Edge of this Event. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`.
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of EventInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Edge": edge,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return EventPage(self._version, response, self._solution)
|
||||
|
||||
def get_page(self, target_url: str) -> EventPage:
|
||||
"""
|
||||
Retrieve a specific page of EventInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of EventInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return EventPage(self._version, response, self._solution)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> EventPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of EventInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of EventInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return EventPage(self._version, response, self._solution)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Insights.V1.EventList>"
|
||||
@@ -0,0 +1,340 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Insights
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import values
|
||||
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
|
||||
|
||||
class MetricInstance(InstanceResource):
|
||||
class StreamDirection(object):
|
||||
UNKNOWN = "unknown"
|
||||
INBOUND = "inbound"
|
||||
OUTBOUND = "outbound"
|
||||
BOTH = "both"
|
||||
|
||||
class TwilioEdge(object):
|
||||
UNKNOWN_EDGE = "unknown_edge"
|
||||
CARRIER_EDGE = "carrier_edge"
|
||||
SIP_EDGE = "sip_edge"
|
||||
SDK_EDGE = "sdk_edge"
|
||||
CLIENT_EDGE = "client_edge"
|
||||
|
||||
"""
|
||||
:ivar timestamp: Timestamp of metric sample. Samples are taken every 10 seconds and contain the metrics for the previous 10 seconds.
|
||||
:ivar call_sid: The unique SID identifier of the Call.
|
||||
:ivar account_sid: The unique SID identifier of the Account.
|
||||
:ivar edge:
|
||||
:ivar direction:
|
||||
:ivar carrier_edge: Contains metrics and properties for the Twilio media gateway of a PSTN call.
|
||||
:ivar sip_edge: Contains metrics and properties for the Twilio media gateway of a SIP Interface or Trunking call.
|
||||
:ivar sdk_edge: Contains metrics and properties for the SDK sensor library for Client calls.
|
||||
:ivar client_edge: Contains metrics and properties for the Twilio media gateway of a Client call.
|
||||
"""
|
||||
|
||||
def __init__(self, version: Version, payload: Dict[str, Any], call_sid: str):
|
||||
super().__init__(version)
|
||||
|
||||
self.timestamp: Optional[str] = payload.get("timestamp")
|
||||
self.call_sid: Optional[str] = payload.get("call_sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.edge: Optional["MetricInstance.TwilioEdge"] = payload.get("edge")
|
||||
self.direction: Optional["MetricInstance.StreamDirection"] = payload.get(
|
||||
"direction"
|
||||
)
|
||||
self.carrier_edge: Optional[Dict[str, object]] = payload.get("carrier_edge")
|
||||
self.sip_edge: Optional[Dict[str, object]] = payload.get("sip_edge")
|
||||
self.sdk_edge: Optional[Dict[str, object]] = payload.get("sdk_edge")
|
||||
self.client_edge: Optional[Dict[str, object]] = payload.get("client_edge")
|
||||
|
||||
self._solution = {
|
||||
"call_sid": call_sid,
|
||||
}
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Insights.V1.MetricInstance {}>".format(context)
|
||||
|
||||
|
||||
class MetricPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> MetricInstance:
|
||||
"""
|
||||
Build an instance of MetricInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return MetricInstance(
|
||||
self._version, payload, call_sid=self._solution["call_sid"]
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Insights.V1.MetricPage>"
|
||||
|
||||
|
||||
class MetricList(ListResource):
|
||||
def __init__(self, version: Version, call_sid: str):
|
||||
"""
|
||||
Initialize the MetricList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param call_sid: The unique SID identifier of the Call.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"call_sid": call_sid,
|
||||
}
|
||||
self._uri = "/Voice/{call_sid}/Metrics".format(**self._solution)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
edge: Union["MetricInstance.TwilioEdge", object] = values.unset,
|
||||
direction: Union["MetricInstance.StreamDirection", object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[MetricInstance]:
|
||||
"""
|
||||
Streams MetricInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param "MetricInstance.TwilioEdge" edge: The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`.
|
||||
:param "MetricInstance.StreamDirection" direction: The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(edge=edge, direction=direction, page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
edge: Union["MetricInstance.TwilioEdge", object] = values.unset,
|
||||
direction: Union["MetricInstance.StreamDirection", object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[MetricInstance]:
|
||||
"""
|
||||
Asynchronously streams MetricInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param "MetricInstance.TwilioEdge" edge: The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`.
|
||||
:param "MetricInstance.StreamDirection" direction: The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(
|
||||
edge=edge, direction=direction, page_size=limits["page_size"]
|
||||
)
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
edge: Union["MetricInstance.TwilioEdge", object] = values.unset,
|
||||
direction: Union["MetricInstance.StreamDirection", object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[MetricInstance]:
|
||||
"""
|
||||
Lists MetricInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param "MetricInstance.TwilioEdge" edge: The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`.
|
||||
:param "MetricInstance.StreamDirection" direction: The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
edge=edge,
|
||||
direction=direction,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
edge: Union["MetricInstance.TwilioEdge", object] = values.unset,
|
||||
direction: Union["MetricInstance.StreamDirection", object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[MetricInstance]:
|
||||
"""
|
||||
Asynchronously lists MetricInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param "MetricInstance.TwilioEdge" edge: The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`.
|
||||
:param "MetricInstance.StreamDirection" direction: The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
edge=edge,
|
||||
direction=direction,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
edge: Union["MetricInstance.TwilioEdge", object] = values.unset,
|
||||
direction: Union["MetricInstance.StreamDirection", object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> MetricPage:
|
||||
"""
|
||||
Retrieve a single page of MetricInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param edge: The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`.
|
||||
:param direction: The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`.
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of MetricInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Edge": edge,
|
||||
"Direction": direction,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return MetricPage(self._version, response, self._solution)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
edge: Union["MetricInstance.TwilioEdge", object] = values.unset,
|
||||
direction: Union["MetricInstance.StreamDirection", object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> MetricPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of MetricInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param edge: The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`.
|
||||
:param direction: The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`.
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of MetricInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Edge": edge,
|
||||
"Direction": direction,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return MetricPage(self._version, response, self._solution)
|
||||
|
||||
def get_page(self, target_url: str) -> MetricPage:
|
||||
"""
|
||||
Retrieve a specific page of MetricInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of MetricInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return MetricPage(self._version, response, self._solution)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> MetricPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of MetricInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of MetricInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return MetricPage(self._version, response, self._solution)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Insights.V1.MetricList>"
|
||||
@@ -0,0 +1,812 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Insights
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import deserialize, values
|
||||
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
|
||||
|
||||
class CallSummariesInstance(InstanceResource):
|
||||
class AnsweredBy(object):
|
||||
UNKNOWN = "unknown"
|
||||
MACHINE_START = "machine_start"
|
||||
MACHINE_END_BEEP = "machine_end_beep"
|
||||
MACHINE_END_SILENCE = "machine_end_silence"
|
||||
MACHINE_END_OTHER = "machine_end_other"
|
||||
HUMAN = "human"
|
||||
FAX = "fax"
|
||||
|
||||
class CallState(object):
|
||||
RINGING = "ringing"
|
||||
COMPLETED = "completed"
|
||||
BUSY = "busy"
|
||||
FAIL = "fail"
|
||||
NOANSWER = "noanswer"
|
||||
CANCELED = "canceled"
|
||||
ANSWERED = "answered"
|
||||
UNDIALED = "undialed"
|
||||
|
||||
class CallType(object):
|
||||
CARRIER = "carrier"
|
||||
SIP = "sip"
|
||||
TRUNKING = "trunking"
|
||||
CLIENT = "client"
|
||||
|
||||
class ProcessingState(object):
|
||||
COMPLETE = "complete"
|
||||
PARTIAL = "partial"
|
||||
|
||||
class ProcessingStateRequest(object):
|
||||
COMPLETED = "completed"
|
||||
STARTED = "started"
|
||||
PARTIAL = "partial"
|
||||
ALL = "all"
|
||||
|
||||
class SortBy(object):
|
||||
START_TIME = "start_time"
|
||||
END_TIME = "end_time"
|
||||
|
||||
"""
|
||||
:ivar account_sid: The unique SID identifier of the Account.
|
||||
:ivar call_sid: The unique SID identifier of the Call.
|
||||
:ivar answered_by:
|
||||
:ivar call_type:
|
||||
:ivar call_state:
|
||||
:ivar processing_state:
|
||||
:ivar created_time: The time at which the Call was created, given in ISO 8601 format. Can be different from `start_time` in the event of queueing due to CPS
|
||||
:ivar start_time: The time at which the Call was started, given in ISO 8601 format.
|
||||
:ivar end_time: The time at which the Call was ended, given in ISO 8601 format.
|
||||
:ivar duration: Duration between when the call was initiated and the call was ended
|
||||
:ivar connect_duration: Duration between when the call was answered and when it ended
|
||||
:ivar _from: The calling party.
|
||||
:ivar to: The called party.
|
||||
:ivar carrier_edge: Contains metrics and properties for the Twilio media gateway of a PSTN call.
|
||||
:ivar client_edge: Contains metrics and properties for the Twilio media gateway of a Client call.
|
||||
:ivar sdk_edge: Contains metrics and properties for the SDK sensor library for Client calls.
|
||||
:ivar sip_edge: Contains metrics and properties for the Twilio media gateway of a SIP Interface or Trunking call.
|
||||
:ivar tags: Tags applied to calls by Voice Insights analysis indicating a condition that could result in subjective degradation of the call quality.
|
||||
:ivar url: The URL of this resource.
|
||||
:ivar attributes: Attributes capturing call-flow-specific details.
|
||||
:ivar properties: Contains edge-agnostic call-level details.
|
||||
:ivar trust: Contains trusted communications details including Branded Call and verified caller ID.
|
||||
:ivar annotation:
|
||||
"""
|
||||
|
||||
def __init__(self, version: Version, payload: Dict[str, Any]):
|
||||
super().__init__(version)
|
||||
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.call_sid: Optional[str] = payload.get("call_sid")
|
||||
self.answered_by: Optional["CallSummariesInstance.AnsweredBy"] = payload.get(
|
||||
"answered_by"
|
||||
)
|
||||
self.call_type: Optional["CallSummariesInstance.CallType"] = payload.get(
|
||||
"call_type"
|
||||
)
|
||||
self.call_state: Optional["CallSummariesInstance.CallState"] = payload.get(
|
||||
"call_state"
|
||||
)
|
||||
self.processing_state: Optional[
|
||||
"CallSummariesInstance.ProcessingState"
|
||||
] = payload.get("processing_state")
|
||||
self.created_time: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("created_time")
|
||||
)
|
||||
self.start_time: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("start_time")
|
||||
)
|
||||
self.end_time: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("end_time")
|
||||
)
|
||||
self.duration: Optional[int] = deserialize.integer(payload.get("duration"))
|
||||
self.connect_duration: Optional[int] = deserialize.integer(
|
||||
payload.get("connect_duration")
|
||||
)
|
||||
self._from: Optional[Dict[str, object]] = payload.get("from")
|
||||
self.to: Optional[Dict[str, object]] = payload.get("to")
|
||||
self.carrier_edge: Optional[Dict[str, object]] = payload.get("carrier_edge")
|
||||
self.client_edge: Optional[Dict[str, object]] = payload.get("client_edge")
|
||||
self.sdk_edge: Optional[Dict[str, object]] = payload.get("sdk_edge")
|
||||
self.sip_edge: Optional[Dict[str, object]] = payload.get("sip_edge")
|
||||
self.tags: Optional[List[str]] = payload.get("tags")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
self.attributes: Optional[Dict[str, object]] = payload.get("attributes")
|
||||
self.properties: Optional[Dict[str, object]] = payload.get("properties")
|
||||
self.trust: Optional[Dict[str, object]] = payload.get("trust")
|
||||
self.annotation: Optional[Dict[str, object]] = payload.get("annotation")
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
|
||||
return "<Twilio.Insights.V1.CallSummariesInstance>"
|
||||
|
||||
|
||||
class CallSummariesPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> CallSummariesInstance:
|
||||
"""
|
||||
Build an instance of CallSummariesInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return CallSummariesInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Insights.V1.CallSummariesPage>"
|
||||
|
||||
|
||||
class CallSummariesList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the CallSummariesList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/Voice/Summaries"
|
||||
|
||||
def stream(
|
||||
self,
|
||||
from_: Union[str, object] = values.unset,
|
||||
to: Union[str, object] = values.unset,
|
||||
from_carrier: Union[str, object] = values.unset,
|
||||
to_carrier: Union[str, object] = values.unset,
|
||||
from_country_code: Union[str, object] = values.unset,
|
||||
to_country_code: Union[str, object] = values.unset,
|
||||
branded: Union[bool, object] = values.unset,
|
||||
verified_caller: Union[bool, object] = values.unset,
|
||||
has_tag: Union[bool, object] = values.unset,
|
||||
start_time: Union[str, object] = values.unset,
|
||||
end_time: Union[str, object] = values.unset,
|
||||
call_type: Union[str, object] = values.unset,
|
||||
call_state: Union[str, object] = values.unset,
|
||||
direction: Union[str, object] = values.unset,
|
||||
processing_state: Union[
|
||||
"CallSummariesInstance.ProcessingStateRequest", object
|
||||
] = values.unset,
|
||||
sort_by: Union["CallSummariesInstance.SortBy", object] = values.unset,
|
||||
subaccount: Union[str, object] = values.unset,
|
||||
abnormal_session: Union[bool, object] = values.unset,
|
||||
answered_by: Union["CallSummariesInstance.AnsweredBy", object] = values.unset,
|
||||
answered_by_annotation: Union[str, object] = values.unset,
|
||||
connectivity_issue_annotation: Union[str, object] = values.unset,
|
||||
quality_issue_annotation: Union[str, object] = values.unset,
|
||||
spam_annotation: Union[bool, object] = values.unset,
|
||||
call_score_annotation: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[CallSummariesInstance]:
|
||||
"""
|
||||
Streams CallSummariesInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param str from_: A calling party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name.
|
||||
:param str to: A called party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name.
|
||||
:param str from_carrier: An origination carrier.
|
||||
:param str to_carrier: A destination carrier.
|
||||
:param str from_country_code: A source country code based on phone number in From.
|
||||
:param str to_country_code: A destination country code. Based on phone number in To.
|
||||
:param bool branded: A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls.
|
||||
:param bool verified_caller: A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR.
|
||||
:param bool has_tag: A boolean flag indicating the presence of one or more [Voice Insights Call Tags](https://www.twilio.com/docs/voice/voice-insights/api/call/details-call-tags).
|
||||
:param str start_time: A Start time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 4h.
|
||||
:param str end_time: An End Time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 0m.
|
||||
:param str call_type: A Call Type of the calls. One of `carrier`, `sip`, `trunking` or `client`.
|
||||
:param str call_state: A Call State of the calls. One of `ringing`, `completed`, `busy`, `fail`, `noanswer`, `canceled`, `answered`, `undialed`.
|
||||
:param str direction: A Direction of the calls. One of `outbound_api`, `outbound_dial`, `inbound`, `trunking_originating`, `trunking_terminating`.
|
||||
:param "CallSummariesInstance.ProcessingStateRequest" processing_state: A Processing State of the Call Summaries. One of `completed`, `partial` or `all`.
|
||||
:param "CallSummariesInstance.SortBy" sort_by: A Sort By criterion for the returned list of Call Summaries. One of `start_time` or `end_time`.
|
||||
:param str subaccount: A unique SID identifier of a Subaccount.
|
||||
:param bool abnormal_session: A boolean flag indicating an abnormal session where the last SIP response was not 200 OK.
|
||||
:param "CallSummariesInstance.AnsweredBy" answered_by: An Answered By value for the calls based on `Answering Machine Detection (AMD)`. One of `unknown`, `machine_start`, `machine_end_beep`, `machine_end_silence`, `machine_end_other`, `human` or `fax`.
|
||||
:param str answered_by_annotation: Either machine or human.
|
||||
:param str connectivity_issue_annotation: A Connectivity Issue with the calls. One of `no_connectivity_issue`, `invalid_number`, `caller_id`, `dropped_call`, or `number_reachability`.
|
||||
:param str quality_issue_annotation: A subjective Quality Issue with the calls. One of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`.
|
||||
:param bool spam_annotation: A boolean flag indicating spam calls.
|
||||
:param str call_score_annotation: A Call Score of the calls. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for the rated call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad].
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(
|
||||
from_=from_,
|
||||
to=to,
|
||||
from_carrier=from_carrier,
|
||||
to_carrier=to_carrier,
|
||||
from_country_code=from_country_code,
|
||||
to_country_code=to_country_code,
|
||||
branded=branded,
|
||||
verified_caller=verified_caller,
|
||||
has_tag=has_tag,
|
||||
start_time=start_time,
|
||||
end_time=end_time,
|
||||
call_type=call_type,
|
||||
call_state=call_state,
|
||||
direction=direction,
|
||||
processing_state=processing_state,
|
||||
sort_by=sort_by,
|
||||
subaccount=subaccount,
|
||||
abnormal_session=abnormal_session,
|
||||
answered_by=answered_by,
|
||||
answered_by_annotation=answered_by_annotation,
|
||||
connectivity_issue_annotation=connectivity_issue_annotation,
|
||||
quality_issue_annotation=quality_issue_annotation,
|
||||
spam_annotation=spam_annotation,
|
||||
call_score_annotation=call_score_annotation,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
from_: Union[str, object] = values.unset,
|
||||
to: Union[str, object] = values.unset,
|
||||
from_carrier: Union[str, object] = values.unset,
|
||||
to_carrier: Union[str, object] = values.unset,
|
||||
from_country_code: Union[str, object] = values.unset,
|
||||
to_country_code: Union[str, object] = values.unset,
|
||||
branded: Union[bool, object] = values.unset,
|
||||
verified_caller: Union[bool, object] = values.unset,
|
||||
has_tag: Union[bool, object] = values.unset,
|
||||
start_time: Union[str, object] = values.unset,
|
||||
end_time: Union[str, object] = values.unset,
|
||||
call_type: Union[str, object] = values.unset,
|
||||
call_state: Union[str, object] = values.unset,
|
||||
direction: Union[str, object] = values.unset,
|
||||
processing_state: Union[
|
||||
"CallSummariesInstance.ProcessingStateRequest", object
|
||||
] = values.unset,
|
||||
sort_by: Union["CallSummariesInstance.SortBy", object] = values.unset,
|
||||
subaccount: Union[str, object] = values.unset,
|
||||
abnormal_session: Union[bool, object] = values.unset,
|
||||
answered_by: Union["CallSummariesInstance.AnsweredBy", object] = values.unset,
|
||||
answered_by_annotation: Union[str, object] = values.unset,
|
||||
connectivity_issue_annotation: Union[str, object] = values.unset,
|
||||
quality_issue_annotation: Union[str, object] = values.unset,
|
||||
spam_annotation: Union[bool, object] = values.unset,
|
||||
call_score_annotation: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[CallSummariesInstance]:
|
||||
"""
|
||||
Asynchronously streams CallSummariesInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param str from_: A calling party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name.
|
||||
:param str to: A called party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name.
|
||||
:param str from_carrier: An origination carrier.
|
||||
:param str to_carrier: A destination carrier.
|
||||
:param str from_country_code: A source country code based on phone number in From.
|
||||
:param str to_country_code: A destination country code. Based on phone number in To.
|
||||
:param bool branded: A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls.
|
||||
:param bool verified_caller: A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR.
|
||||
:param bool has_tag: A boolean flag indicating the presence of one or more [Voice Insights Call Tags](https://www.twilio.com/docs/voice/voice-insights/api/call/details-call-tags).
|
||||
:param str start_time: A Start time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 4h.
|
||||
:param str end_time: An End Time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 0m.
|
||||
:param str call_type: A Call Type of the calls. One of `carrier`, `sip`, `trunking` or `client`.
|
||||
:param str call_state: A Call State of the calls. One of `ringing`, `completed`, `busy`, `fail`, `noanswer`, `canceled`, `answered`, `undialed`.
|
||||
:param str direction: A Direction of the calls. One of `outbound_api`, `outbound_dial`, `inbound`, `trunking_originating`, `trunking_terminating`.
|
||||
:param "CallSummariesInstance.ProcessingStateRequest" processing_state: A Processing State of the Call Summaries. One of `completed`, `partial` or `all`.
|
||||
:param "CallSummariesInstance.SortBy" sort_by: A Sort By criterion for the returned list of Call Summaries. One of `start_time` or `end_time`.
|
||||
:param str subaccount: A unique SID identifier of a Subaccount.
|
||||
:param bool abnormal_session: A boolean flag indicating an abnormal session where the last SIP response was not 200 OK.
|
||||
:param "CallSummariesInstance.AnsweredBy" answered_by: An Answered By value for the calls based on `Answering Machine Detection (AMD)`. One of `unknown`, `machine_start`, `machine_end_beep`, `machine_end_silence`, `machine_end_other`, `human` or `fax`.
|
||||
:param str answered_by_annotation: Either machine or human.
|
||||
:param str connectivity_issue_annotation: A Connectivity Issue with the calls. One of `no_connectivity_issue`, `invalid_number`, `caller_id`, `dropped_call`, or `number_reachability`.
|
||||
:param str quality_issue_annotation: A subjective Quality Issue with the calls. One of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`.
|
||||
:param bool spam_annotation: A boolean flag indicating spam calls.
|
||||
:param str call_score_annotation: A Call Score of the calls. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for the rated call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad].
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(
|
||||
from_=from_,
|
||||
to=to,
|
||||
from_carrier=from_carrier,
|
||||
to_carrier=to_carrier,
|
||||
from_country_code=from_country_code,
|
||||
to_country_code=to_country_code,
|
||||
branded=branded,
|
||||
verified_caller=verified_caller,
|
||||
has_tag=has_tag,
|
||||
start_time=start_time,
|
||||
end_time=end_time,
|
||||
call_type=call_type,
|
||||
call_state=call_state,
|
||||
direction=direction,
|
||||
processing_state=processing_state,
|
||||
sort_by=sort_by,
|
||||
subaccount=subaccount,
|
||||
abnormal_session=abnormal_session,
|
||||
answered_by=answered_by,
|
||||
answered_by_annotation=answered_by_annotation,
|
||||
connectivity_issue_annotation=connectivity_issue_annotation,
|
||||
quality_issue_annotation=quality_issue_annotation,
|
||||
spam_annotation=spam_annotation,
|
||||
call_score_annotation=call_score_annotation,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
from_: Union[str, object] = values.unset,
|
||||
to: Union[str, object] = values.unset,
|
||||
from_carrier: Union[str, object] = values.unset,
|
||||
to_carrier: Union[str, object] = values.unset,
|
||||
from_country_code: Union[str, object] = values.unset,
|
||||
to_country_code: Union[str, object] = values.unset,
|
||||
branded: Union[bool, object] = values.unset,
|
||||
verified_caller: Union[bool, object] = values.unset,
|
||||
has_tag: Union[bool, object] = values.unset,
|
||||
start_time: Union[str, object] = values.unset,
|
||||
end_time: Union[str, object] = values.unset,
|
||||
call_type: Union[str, object] = values.unset,
|
||||
call_state: Union[str, object] = values.unset,
|
||||
direction: Union[str, object] = values.unset,
|
||||
processing_state: Union[
|
||||
"CallSummariesInstance.ProcessingStateRequest", object
|
||||
] = values.unset,
|
||||
sort_by: Union["CallSummariesInstance.SortBy", object] = values.unset,
|
||||
subaccount: Union[str, object] = values.unset,
|
||||
abnormal_session: Union[bool, object] = values.unset,
|
||||
answered_by: Union["CallSummariesInstance.AnsweredBy", object] = values.unset,
|
||||
answered_by_annotation: Union[str, object] = values.unset,
|
||||
connectivity_issue_annotation: Union[str, object] = values.unset,
|
||||
quality_issue_annotation: Union[str, object] = values.unset,
|
||||
spam_annotation: Union[bool, object] = values.unset,
|
||||
call_score_annotation: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[CallSummariesInstance]:
|
||||
"""
|
||||
Lists CallSummariesInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param str from_: A calling party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name.
|
||||
:param str to: A called party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name.
|
||||
:param str from_carrier: An origination carrier.
|
||||
:param str to_carrier: A destination carrier.
|
||||
:param str from_country_code: A source country code based on phone number in From.
|
||||
:param str to_country_code: A destination country code. Based on phone number in To.
|
||||
:param bool branded: A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls.
|
||||
:param bool verified_caller: A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR.
|
||||
:param bool has_tag: A boolean flag indicating the presence of one or more [Voice Insights Call Tags](https://www.twilio.com/docs/voice/voice-insights/api/call/details-call-tags).
|
||||
:param str start_time: A Start time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 4h.
|
||||
:param str end_time: An End Time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 0m.
|
||||
:param str call_type: A Call Type of the calls. One of `carrier`, `sip`, `trunking` or `client`.
|
||||
:param str call_state: A Call State of the calls. One of `ringing`, `completed`, `busy`, `fail`, `noanswer`, `canceled`, `answered`, `undialed`.
|
||||
:param str direction: A Direction of the calls. One of `outbound_api`, `outbound_dial`, `inbound`, `trunking_originating`, `trunking_terminating`.
|
||||
:param "CallSummariesInstance.ProcessingStateRequest" processing_state: A Processing State of the Call Summaries. One of `completed`, `partial` or `all`.
|
||||
:param "CallSummariesInstance.SortBy" sort_by: A Sort By criterion for the returned list of Call Summaries. One of `start_time` or `end_time`.
|
||||
:param str subaccount: A unique SID identifier of a Subaccount.
|
||||
:param bool abnormal_session: A boolean flag indicating an abnormal session where the last SIP response was not 200 OK.
|
||||
:param "CallSummariesInstance.AnsweredBy" answered_by: An Answered By value for the calls based on `Answering Machine Detection (AMD)`. One of `unknown`, `machine_start`, `machine_end_beep`, `machine_end_silence`, `machine_end_other`, `human` or `fax`.
|
||||
:param str answered_by_annotation: Either machine or human.
|
||||
:param str connectivity_issue_annotation: A Connectivity Issue with the calls. One of `no_connectivity_issue`, `invalid_number`, `caller_id`, `dropped_call`, or `number_reachability`.
|
||||
:param str quality_issue_annotation: A subjective Quality Issue with the calls. One of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`.
|
||||
:param bool spam_annotation: A boolean flag indicating spam calls.
|
||||
:param str call_score_annotation: A Call Score of the calls. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for the rated call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad].
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
from_=from_,
|
||||
to=to,
|
||||
from_carrier=from_carrier,
|
||||
to_carrier=to_carrier,
|
||||
from_country_code=from_country_code,
|
||||
to_country_code=to_country_code,
|
||||
branded=branded,
|
||||
verified_caller=verified_caller,
|
||||
has_tag=has_tag,
|
||||
start_time=start_time,
|
||||
end_time=end_time,
|
||||
call_type=call_type,
|
||||
call_state=call_state,
|
||||
direction=direction,
|
||||
processing_state=processing_state,
|
||||
sort_by=sort_by,
|
||||
subaccount=subaccount,
|
||||
abnormal_session=abnormal_session,
|
||||
answered_by=answered_by,
|
||||
answered_by_annotation=answered_by_annotation,
|
||||
connectivity_issue_annotation=connectivity_issue_annotation,
|
||||
quality_issue_annotation=quality_issue_annotation,
|
||||
spam_annotation=spam_annotation,
|
||||
call_score_annotation=call_score_annotation,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
from_: Union[str, object] = values.unset,
|
||||
to: Union[str, object] = values.unset,
|
||||
from_carrier: Union[str, object] = values.unset,
|
||||
to_carrier: Union[str, object] = values.unset,
|
||||
from_country_code: Union[str, object] = values.unset,
|
||||
to_country_code: Union[str, object] = values.unset,
|
||||
branded: Union[bool, object] = values.unset,
|
||||
verified_caller: Union[bool, object] = values.unset,
|
||||
has_tag: Union[bool, object] = values.unset,
|
||||
start_time: Union[str, object] = values.unset,
|
||||
end_time: Union[str, object] = values.unset,
|
||||
call_type: Union[str, object] = values.unset,
|
||||
call_state: Union[str, object] = values.unset,
|
||||
direction: Union[str, object] = values.unset,
|
||||
processing_state: Union[
|
||||
"CallSummariesInstance.ProcessingStateRequest", object
|
||||
] = values.unset,
|
||||
sort_by: Union["CallSummariesInstance.SortBy", object] = values.unset,
|
||||
subaccount: Union[str, object] = values.unset,
|
||||
abnormal_session: Union[bool, object] = values.unset,
|
||||
answered_by: Union["CallSummariesInstance.AnsweredBy", object] = values.unset,
|
||||
answered_by_annotation: Union[str, object] = values.unset,
|
||||
connectivity_issue_annotation: Union[str, object] = values.unset,
|
||||
quality_issue_annotation: Union[str, object] = values.unset,
|
||||
spam_annotation: Union[bool, object] = values.unset,
|
||||
call_score_annotation: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[CallSummariesInstance]:
|
||||
"""
|
||||
Asynchronously lists CallSummariesInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param str from_: A calling party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name.
|
||||
:param str to: A called party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name.
|
||||
:param str from_carrier: An origination carrier.
|
||||
:param str to_carrier: A destination carrier.
|
||||
:param str from_country_code: A source country code based on phone number in From.
|
||||
:param str to_country_code: A destination country code. Based on phone number in To.
|
||||
:param bool branded: A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls.
|
||||
:param bool verified_caller: A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR.
|
||||
:param bool has_tag: A boolean flag indicating the presence of one or more [Voice Insights Call Tags](https://www.twilio.com/docs/voice/voice-insights/api/call/details-call-tags).
|
||||
:param str start_time: A Start time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 4h.
|
||||
:param str end_time: An End Time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 0m.
|
||||
:param str call_type: A Call Type of the calls. One of `carrier`, `sip`, `trunking` or `client`.
|
||||
:param str call_state: A Call State of the calls. One of `ringing`, `completed`, `busy`, `fail`, `noanswer`, `canceled`, `answered`, `undialed`.
|
||||
:param str direction: A Direction of the calls. One of `outbound_api`, `outbound_dial`, `inbound`, `trunking_originating`, `trunking_terminating`.
|
||||
:param "CallSummariesInstance.ProcessingStateRequest" processing_state: A Processing State of the Call Summaries. One of `completed`, `partial` or `all`.
|
||||
:param "CallSummariesInstance.SortBy" sort_by: A Sort By criterion for the returned list of Call Summaries. One of `start_time` or `end_time`.
|
||||
:param str subaccount: A unique SID identifier of a Subaccount.
|
||||
:param bool abnormal_session: A boolean flag indicating an abnormal session where the last SIP response was not 200 OK.
|
||||
:param "CallSummariesInstance.AnsweredBy" answered_by: An Answered By value for the calls based on `Answering Machine Detection (AMD)`. One of `unknown`, `machine_start`, `machine_end_beep`, `machine_end_silence`, `machine_end_other`, `human` or `fax`.
|
||||
:param str answered_by_annotation: Either machine or human.
|
||||
:param str connectivity_issue_annotation: A Connectivity Issue with the calls. One of `no_connectivity_issue`, `invalid_number`, `caller_id`, `dropped_call`, or `number_reachability`.
|
||||
:param str quality_issue_annotation: A subjective Quality Issue with the calls. One of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`.
|
||||
:param bool spam_annotation: A boolean flag indicating spam calls.
|
||||
:param str call_score_annotation: A Call Score of the calls. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for the rated call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad].
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
from_=from_,
|
||||
to=to,
|
||||
from_carrier=from_carrier,
|
||||
to_carrier=to_carrier,
|
||||
from_country_code=from_country_code,
|
||||
to_country_code=to_country_code,
|
||||
branded=branded,
|
||||
verified_caller=verified_caller,
|
||||
has_tag=has_tag,
|
||||
start_time=start_time,
|
||||
end_time=end_time,
|
||||
call_type=call_type,
|
||||
call_state=call_state,
|
||||
direction=direction,
|
||||
processing_state=processing_state,
|
||||
sort_by=sort_by,
|
||||
subaccount=subaccount,
|
||||
abnormal_session=abnormal_session,
|
||||
answered_by=answered_by,
|
||||
answered_by_annotation=answered_by_annotation,
|
||||
connectivity_issue_annotation=connectivity_issue_annotation,
|
||||
quality_issue_annotation=quality_issue_annotation,
|
||||
spam_annotation=spam_annotation,
|
||||
call_score_annotation=call_score_annotation,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
from_: Union[str, object] = values.unset,
|
||||
to: Union[str, object] = values.unset,
|
||||
from_carrier: Union[str, object] = values.unset,
|
||||
to_carrier: Union[str, object] = values.unset,
|
||||
from_country_code: Union[str, object] = values.unset,
|
||||
to_country_code: Union[str, object] = values.unset,
|
||||
branded: Union[bool, object] = values.unset,
|
||||
verified_caller: Union[bool, object] = values.unset,
|
||||
has_tag: Union[bool, object] = values.unset,
|
||||
start_time: Union[str, object] = values.unset,
|
||||
end_time: Union[str, object] = values.unset,
|
||||
call_type: Union[str, object] = values.unset,
|
||||
call_state: Union[str, object] = values.unset,
|
||||
direction: Union[str, object] = values.unset,
|
||||
processing_state: Union[
|
||||
"CallSummariesInstance.ProcessingStateRequest", object
|
||||
] = values.unset,
|
||||
sort_by: Union["CallSummariesInstance.SortBy", object] = values.unset,
|
||||
subaccount: Union[str, object] = values.unset,
|
||||
abnormal_session: Union[bool, object] = values.unset,
|
||||
answered_by: Union["CallSummariesInstance.AnsweredBy", object] = values.unset,
|
||||
answered_by_annotation: Union[str, object] = values.unset,
|
||||
connectivity_issue_annotation: Union[str, object] = values.unset,
|
||||
quality_issue_annotation: Union[str, object] = values.unset,
|
||||
spam_annotation: Union[bool, object] = values.unset,
|
||||
call_score_annotation: Union[str, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> CallSummariesPage:
|
||||
"""
|
||||
Retrieve a single page of CallSummariesInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param from_: A calling party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name.
|
||||
:param to: A called party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name.
|
||||
:param from_carrier: An origination carrier.
|
||||
:param to_carrier: A destination carrier.
|
||||
:param from_country_code: A source country code based on phone number in From.
|
||||
:param to_country_code: A destination country code. Based on phone number in To.
|
||||
:param branded: A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls.
|
||||
:param verified_caller: A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR.
|
||||
:param has_tag: A boolean flag indicating the presence of one or more [Voice Insights Call Tags](https://www.twilio.com/docs/voice/voice-insights/api/call/details-call-tags).
|
||||
:param start_time: A Start time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 4h.
|
||||
:param end_time: An End Time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 0m.
|
||||
:param call_type: A Call Type of the calls. One of `carrier`, `sip`, `trunking` or `client`.
|
||||
:param call_state: A Call State of the calls. One of `ringing`, `completed`, `busy`, `fail`, `noanswer`, `canceled`, `answered`, `undialed`.
|
||||
:param direction: A Direction of the calls. One of `outbound_api`, `outbound_dial`, `inbound`, `trunking_originating`, `trunking_terminating`.
|
||||
:param processing_state: A Processing State of the Call Summaries. One of `completed`, `partial` or `all`.
|
||||
:param sort_by: A Sort By criterion for the returned list of Call Summaries. One of `start_time` or `end_time`.
|
||||
:param subaccount: A unique SID identifier of a Subaccount.
|
||||
:param abnormal_session: A boolean flag indicating an abnormal session where the last SIP response was not 200 OK.
|
||||
:param answered_by: An Answered By value for the calls based on `Answering Machine Detection (AMD)`. One of `unknown`, `machine_start`, `machine_end_beep`, `machine_end_silence`, `machine_end_other`, `human` or `fax`.
|
||||
:param answered_by_annotation: Either machine or human.
|
||||
:param connectivity_issue_annotation: A Connectivity Issue with the calls. One of `no_connectivity_issue`, `invalid_number`, `caller_id`, `dropped_call`, or `number_reachability`.
|
||||
:param quality_issue_annotation: A subjective Quality Issue with the calls. One of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`.
|
||||
:param spam_annotation: A boolean flag indicating spam calls.
|
||||
:param call_score_annotation: A Call Score of the calls. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for the rated call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad].
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of CallSummariesInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"From": from_,
|
||||
"To": to,
|
||||
"FromCarrier": from_carrier,
|
||||
"ToCarrier": to_carrier,
|
||||
"FromCountryCode": from_country_code,
|
||||
"ToCountryCode": to_country_code,
|
||||
"Branded": branded,
|
||||
"VerifiedCaller": verified_caller,
|
||||
"HasTag": has_tag,
|
||||
"StartTime": start_time,
|
||||
"EndTime": end_time,
|
||||
"CallType": call_type,
|
||||
"CallState": call_state,
|
||||
"Direction": direction,
|
||||
"ProcessingState": processing_state,
|
||||
"SortBy": sort_by,
|
||||
"Subaccount": subaccount,
|
||||
"AbnormalSession": abnormal_session,
|
||||
"AnsweredBy": answered_by,
|
||||
"AnsweredByAnnotation": answered_by_annotation,
|
||||
"ConnectivityIssueAnnotation": connectivity_issue_annotation,
|
||||
"QualityIssueAnnotation": quality_issue_annotation,
|
||||
"SpamAnnotation": spam_annotation,
|
||||
"CallScoreAnnotation": call_score_annotation,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return CallSummariesPage(self._version, response)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
from_: Union[str, object] = values.unset,
|
||||
to: Union[str, object] = values.unset,
|
||||
from_carrier: Union[str, object] = values.unset,
|
||||
to_carrier: Union[str, object] = values.unset,
|
||||
from_country_code: Union[str, object] = values.unset,
|
||||
to_country_code: Union[str, object] = values.unset,
|
||||
branded: Union[bool, object] = values.unset,
|
||||
verified_caller: Union[bool, object] = values.unset,
|
||||
has_tag: Union[bool, object] = values.unset,
|
||||
start_time: Union[str, object] = values.unset,
|
||||
end_time: Union[str, object] = values.unset,
|
||||
call_type: Union[str, object] = values.unset,
|
||||
call_state: Union[str, object] = values.unset,
|
||||
direction: Union[str, object] = values.unset,
|
||||
processing_state: Union[
|
||||
"CallSummariesInstance.ProcessingStateRequest", object
|
||||
] = values.unset,
|
||||
sort_by: Union["CallSummariesInstance.SortBy", object] = values.unset,
|
||||
subaccount: Union[str, object] = values.unset,
|
||||
abnormal_session: Union[bool, object] = values.unset,
|
||||
answered_by: Union["CallSummariesInstance.AnsweredBy", object] = values.unset,
|
||||
answered_by_annotation: Union[str, object] = values.unset,
|
||||
connectivity_issue_annotation: Union[str, object] = values.unset,
|
||||
quality_issue_annotation: Union[str, object] = values.unset,
|
||||
spam_annotation: Union[bool, object] = values.unset,
|
||||
call_score_annotation: Union[str, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> CallSummariesPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of CallSummariesInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param from_: A calling party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name.
|
||||
:param to: A called party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name.
|
||||
:param from_carrier: An origination carrier.
|
||||
:param to_carrier: A destination carrier.
|
||||
:param from_country_code: A source country code based on phone number in From.
|
||||
:param to_country_code: A destination country code. Based on phone number in To.
|
||||
:param branded: A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls.
|
||||
:param verified_caller: A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR.
|
||||
:param has_tag: A boolean flag indicating the presence of one or more [Voice Insights Call Tags](https://www.twilio.com/docs/voice/voice-insights/api/call/details-call-tags).
|
||||
:param start_time: A Start time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 4h.
|
||||
:param end_time: An End Time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 0m.
|
||||
:param call_type: A Call Type of the calls. One of `carrier`, `sip`, `trunking` or `client`.
|
||||
:param call_state: A Call State of the calls. One of `ringing`, `completed`, `busy`, `fail`, `noanswer`, `canceled`, `answered`, `undialed`.
|
||||
:param direction: A Direction of the calls. One of `outbound_api`, `outbound_dial`, `inbound`, `trunking_originating`, `trunking_terminating`.
|
||||
:param processing_state: A Processing State of the Call Summaries. One of `completed`, `partial` or `all`.
|
||||
:param sort_by: A Sort By criterion for the returned list of Call Summaries. One of `start_time` or `end_time`.
|
||||
:param subaccount: A unique SID identifier of a Subaccount.
|
||||
:param abnormal_session: A boolean flag indicating an abnormal session where the last SIP response was not 200 OK.
|
||||
:param answered_by: An Answered By value for the calls based on `Answering Machine Detection (AMD)`. One of `unknown`, `machine_start`, `machine_end_beep`, `machine_end_silence`, `machine_end_other`, `human` or `fax`.
|
||||
:param answered_by_annotation: Either machine or human.
|
||||
:param connectivity_issue_annotation: A Connectivity Issue with the calls. One of `no_connectivity_issue`, `invalid_number`, `caller_id`, `dropped_call`, or `number_reachability`.
|
||||
:param quality_issue_annotation: A subjective Quality Issue with the calls. One of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`.
|
||||
:param spam_annotation: A boolean flag indicating spam calls.
|
||||
:param call_score_annotation: A Call Score of the calls. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for the rated call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad].
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of CallSummariesInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"From": from_,
|
||||
"To": to,
|
||||
"FromCarrier": from_carrier,
|
||||
"ToCarrier": to_carrier,
|
||||
"FromCountryCode": from_country_code,
|
||||
"ToCountryCode": to_country_code,
|
||||
"Branded": branded,
|
||||
"VerifiedCaller": verified_caller,
|
||||
"HasTag": has_tag,
|
||||
"StartTime": start_time,
|
||||
"EndTime": end_time,
|
||||
"CallType": call_type,
|
||||
"CallState": call_state,
|
||||
"Direction": direction,
|
||||
"ProcessingState": processing_state,
|
||||
"SortBy": sort_by,
|
||||
"Subaccount": subaccount,
|
||||
"AbnormalSession": abnormal_session,
|
||||
"AnsweredBy": answered_by,
|
||||
"AnsweredByAnnotation": answered_by_annotation,
|
||||
"ConnectivityIssueAnnotation": connectivity_issue_annotation,
|
||||
"QualityIssueAnnotation": quality_issue_annotation,
|
||||
"SpamAnnotation": spam_annotation,
|
||||
"CallScoreAnnotation": call_score_annotation,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return CallSummariesPage(self._version, response)
|
||||
|
||||
def get_page(self, target_url: str) -> CallSummariesPage:
|
||||
"""
|
||||
Retrieve a specific page of CallSummariesInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of CallSummariesInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return CallSummariesPage(self._version, response)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> CallSummariesPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of CallSummariesInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of CallSummariesInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return CallSummariesPage(self._version, response)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Insights.V1.CallSummariesList>"
|
||||
@@ -0,0 +1,712 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Insights
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import deserialize, values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
from twilio.rest.insights.v1.conference.conference_participant import (
|
||||
ConferenceParticipantList,
|
||||
)
|
||||
|
||||
|
||||
class ConferenceInstance(InstanceResource):
|
||||
class ConferenceEndReason(object):
|
||||
LAST_PARTICIPANT_LEFT = "last_participant_left"
|
||||
CONFERENCE_ENDED_VIA_API = "conference_ended_via_api"
|
||||
PARTICIPANT_WITH_END_CONFERENCE_ON_EXIT_LEFT = (
|
||||
"participant_with_end_conference_on_exit_left"
|
||||
)
|
||||
LAST_PARTICIPANT_KICKED = "last_participant_kicked"
|
||||
PARTICIPANT_WITH_END_CONFERENCE_ON_EXIT_KICKED = (
|
||||
"participant_with_end_conference_on_exit_kicked"
|
||||
)
|
||||
|
||||
class ConferenceStatus(object):
|
||||
IN_PROGRESS = "in_progress"
|
||||
NOT_STARTED = "not_started"
|
||||
COMPLETED = "completed"
|
||||
SUMMARY_TIMEOUT = "summary_timeout"
|
||||
|
||||
class ProcessingState(object):
|
||||
COMPLETE = "complete"
|
||||
IN_PROGRESS = "in_progress"
|
||||
TIMEOUT = "timeout"
|
||||
|
||||
class Region(object):
|
||||
US1 = "us1"
|
||||
AU1 = "au1"
|
||||
BR1 = "br1"
|
||||
IE1 = "ie1"
|
||||
JP1 = "jp1"
|
||||
SG1 = "sg1"
|
||||
DE1 = "de1"
|
||||
|
||||
class Tag(object):
|
||||
INVALID_REQUESTED_REGION = "invalid_requested_region"
|
||||
DUPLICATE_IDENTITY = "duplicate_identity"
|
||||
START_FAILURE = "start_failure"
|
||||
REGION_CONFIGURATION_ISSUES = "region_configuration_issues"
|
||||
QUALITY_WARNINGS = "quality_warnings"
|
||||
PARTICIPANT_BEHAVIOR_ISSUES = "participant_behavior_issues"
|
||||
HIGH_PACKET_LOSS = "high_packet_loss"
|
||||
HIGH_JITTER = "high_jitter"
|
||||
HIGH_LATENCY = "high_latency"
|
||||
LOW_MOS = "low_mos"
|
||||
DETECTED_SILENCE = "detected_silence"
|
||||
|
||||
"""
|
||||
:ivar conference_sid: The unique SID identifier of the Conference.
|
||||
:ivar account_sid: The unique SID identifier of the Account.
|
||||
:ivar friendly_name: Custom label for the conference resource, up to 64 characters.
|
||||
:ivar create_time: Conference creation date and time in ISO 8601 format.
|
||||
:ivar start_time: Timestamp in ISO 8601 format when the conference started. Conferences do not start until at least two participants join, at least one of whom has startConferenceOnEnter=true.
|
||||
:ivar end_time: Conference end date and time in ISO 8601 format.
|
||||
:ivar duration_seconds: Conference duration in seconds.
|
||||
:ivar connect_duration_seconds: Duration of the between conference start event and conference end event in seconds.
|
||||
:ivar status:
|
||||
:ivar max_participants: Maximum number of concurrent participants as specified by the configuration.
|
||||
:ivar max_concurrent_participants: Actual maximum number of concurrent participants in the conference.
|
||||
:ivar unique_participants: Unique conference participants based on caller ID.
|
||||
:ivar end_reason:
|
||||
:ivar ended_by: Call SID of the participant whose actions ended the conference.
|
||||
:ivar mixer_region:
|
||||
:ivar mixer_region_requested:
|
||||
:ivar recording_enabled: Boolean. Indicates whether recording was enabled at the conference mixer.
|
||||
:ivar detected_issues: Potential issues detected by Twilio during the conference.
|
||||
:ivar tags: Tags for detected conference conditions and participant behaviors which may be of interest.
|
||||
:ivar tag_info: Object. Contains details about conference tags including severity.
|
||||
:ivar processing_state:
|
||||
:ivar url: The URL of this resource.
|
||||
:ivar links: Contains a dictionary of URL links to nested resources of this Conference.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
conference_sid: Optional[str] = None,
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.conference_sid: Optional[str] = payload.get("conference_sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.friendly_name: Optional[str] = payload.get("friendly_name")
|
||||
self.create_time: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("create_time")
|
||||
)
|
||||
self.start_time: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("start_time")
|
||||
)
|
||||
self.end_time: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("end_time")
|
||||
)
|
||||
self.duration_seconds: Optional[int] = deserialize.integer(
|
||||
payload.get("duration_seconds")
|
||||
)
|
||||
self.connect_duration_seconds: Optional[int] = deserialize.integer(
|
||||
payload.get("connect_duration_seconds")
|
||||
)
|
||||
self.status: Optional["ConferenceInstance.ConferenceStatus"] = payload.get(
|
||||
"status"
|
||||
)
|
||||
self.max_participants: Optional[int] = deserialize.integer(
|
||||
payload.get("max_participants")
|
||||
)
|
||||
self.max_concurrent_participants: Optional[int] = deserialize.integer(
|
||||
payload.get("max_concurrent_participants")
|
||||
)
|
||||
self.unique_participants: Optional[int] = deserialize.integer(
|
||||
payload.get("unique_participants")
|
||||
)
|
||||
self.end_reason: Optional[
|
||||
"ConferenceInstance.ConferenceEndReason"
|
||||
] = payload.get("end_reason")
|
||||
self.ended_by: Optional[str] = payload.get("ended_by")
|
||||
self.mixer_region: Optional["ConferenceInstance.Region"] = payload.get(
|
||||
"mixer_region"
|
||||
)
|
||||
self.mixer_region_requested: Optional[
|
||||
"ConferenceInstance.Region"
|
||||
] = payload.get("mixer_region_requested")
|
||||
self.recording_enabled: Optional[bool] = payload.get("recording_enabled")
|
||||
self.detected_issues: Optional[Dict[str, object]] = payload.get(
|
||||
"detected_issues"
|
||||
)
|
||||
self.tags: Optional[List["ConferenceInstance.Tag"]] = payload.get("tags")
|
||||
self.tag_info: Optional[Dict[str, object]] = payload.get("tag_info")
|
||||
self.processing_state: Optional[
|
||||
"ConferenceInstance.ProcessingState"
|
||||
] = payload.get("processing_state")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
self.links: Optional[Dict[str, object]] = payload.get("links")
|
||||
|
||||
self._solution = {
|
||||
"conference_sid": conference_sid or self.conference_sid,
|
||||
}
|
||||
self._context: Optional[ConferenceContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "ConferenceContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: ConferenceContext for this ConferenceInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = ConferenceContext(
|
||||
self._version,
|
||||
conference_sid=self._solution["conference_sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "ConferenceInstance":
|
||||
"""
|
||||
Fetch the ConferenceInstance
|
||||
|
||||
|
||||
:returns: The fetched ConferenceInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "ConferenceInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the ConferenceInstance
|
||||
|
||||
|
||||
:returns: The fetched ConferenceInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
@property
|
||||
def conference_participants(self) -> ConferenceParticipantList:
|
||||
"""
|
||||
Access the conference_participants
|
||||
"""
|
||||
return self._proxy.conference_participants
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Insights.V1.ConferenceInstance {}>".format(context)
|
||||
|
||||
|
||||
class ConferenceContext(InstanceContext):
|
||||
def __init__(self, version: Version, conference_sid: str):
|
||||
"""
|
||||
Initialize the ConferenceContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param conference_sid: The unique SID identifier of the Conference.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"conference_sid": conference_sid,
|
||||
}
|
||||
self._uri = "/Conferences/{conference_sid}".format(**self._solution)
|
||||
|
||||
self._conference_participants: Optional[ConferenceParticipantList] = None
|
||||
|
||||
def fetch(self) -> ConferenceInstance:
|
||||
"""
|
||||
Fetch the ConferenceInstance
|
||||
|
||||
|
||||
:returns: The fetched ConferenceInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return ConferenceInstance(
|
||||
self._version,
|
||||
payload,
|
||||
conference_sid=self._solution["conference_sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> ConferenceInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the ConferenceInstance
|
||||
|
||||
|
||||
:returns: The fetched ConferenceInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return ConferenceInstance(
|
||||
self._version,
|
||||
payload,
|
||||
conference_sid=self._solution["conference_sid"],
|
||||
)
|
||||
|
||||
@property
|
||||
def conference_participants(self) -> ConferenceParticipantList:
|
||||
"""
|
||||
Access the conference_participants
|
||||
"""
|
||||
if self._conference_participants is None:
|
||||
self._conference_participants = ConferenceParticipantList(
|
||||
self._version,
|
||||
self._solution["conference_sid"],
|
||||
)
|
||||
return self._conference_participants
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Insights.V1.ConferenceContext {}>".format(context)
|
||||
|
||||
|
||||
class ConferencePage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> ConferenceInstance:
|
||||
"""
|
||||
Build an instance of ConferenceInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return ConferenceInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Insights.V1.ConferencePage>"
|
||||
|
||||
|
||||
class ConferenceList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the ConferenceList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/Conferences"
|
||||
|
||||
def stream(
|
||||
self,
|
||||
conference_sid: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
status: Union[str, object] = values.unset,
|
||||
created_after: Union[str, object] = values.unset,
|
||||
created_before: Union[str, object] = values.unset,
|
||||
mixer_region: Union[str, object] = values.unset,
|
||||
tags: Union[str, object] = values.unset,
|
||||
subaccount: Union[str, object] = values.unset,
|
||||
detected_issues: Union[str, object] = values.unset,
|
||||
end_reason: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[ConferenceInstance]:
|
||||
"""
|
||||
Streams ConferenceInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param str conference_sid: The SID of the conference.
|
||||
:param str friendly_name: Custom label for the conference resource, up to 64 characters.
|
||||
:param str status: Conference status.
|
||||
:param str created_after: Conferences created after the provided timestamp specified in ISO 8601 format
|
||||
:param str created_before: Conferences created before the provided timestamp specified in ISO 8601 format.
|
||||
:param str mixer_region: Twilio region where the conference media was mixed.
|
||||
:param str tags: Tags applied by Twilio for common potential configuration, quality, or performance issues.
|
||||
:param str subaccount: Account SID for the subaccount whose resources you wish to retrieve.
|
||||
:param str detected_issues: Potential configuration, behavior, or performance issues detected during the conference.
|
||||
:param str end_reason: Conference end reason; e.g. last participant left, modified by API, etc.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(
|
||||
conference_sid=conference_sid,
|
||||
friendly_name=friendly_name,
|
||||
status=status,
|
||||
created_after=created_after,
|
||||
created_before=created_before,
|
||||
mixer_region=mixer_region,
|
||||
tags=tags,
|
||||
subaccount=subaccount,
|
||||
detected_issues=detected_issues,
|
||||
end_reason=end_reason,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
conference_sid: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
status: Union[str, object] = values.unset,
|
||||
created_after: Union[str, object] = values.unset,
|
||||
created_before: Union[str, object] = values.unset,
|
||||
mixer_region: Union[str, object] = values.unset,
|
||||
tags: Union[str, object] = values.unset,
|
||||
subaccount: Union[str, object] = values.unset,
|
||||
detected_issues: Union[str, object] = values.unset,
|
||||
end_reason: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[ConferenceInstance]:
|
||||
"""
|
||||
Asynchronously streams ConferenceInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param str conference_sid: The SID of the conference.
|
||||
:param str friendly_name: Custom label for the conference resource, up to 64 characters.
|
||||
:param str status: Conference status.
|
||||
:param str created_after: Conferences created after the provided timestamp specified in ISO 8601 format
|
||||
:param str created_before: Conferences created before the provided timestamp specified in ISO 8601 format.
|
||||
:param str mixer_region: Twilio region where the conference media was mixed.
|
||||
:param str tags: Tags applied by Twilio for common potential configuration, quality, or performance issues.
|
||||
:param str subaccount: Account SID for the subaccount whose resources you wish to retrieve.
|
||||
:param str detected_issues: Potential configuration, behavior, or performance issues detected during the conference.
|
||||
:param str end_reason: Conference end reason; e.g. last participant left, modified by API, etc.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(
|
||||
conference_sid=conference_sid,
|
||||
friendly_name=friendly_name,
|
||||
status=status,
|
||||
created_after=created_after,
|
||||
created_before=created_before,
|
||||
mixer_region=mixer_region,
|
||||
tags=tags,
|
||||
subaccount=subaccount,
|
||||
detected_issues=detected_issues,
|
||||
end_reason=end_reason,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
conference_sid: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
status: Union[str, object] = values.unset,
|
||||
created_after: Union[str, object] = values.unset,
|
||||
created_before: Union[str, object] = values.unset,
|
||||
mixer_region: Union[str, object] = values.unset,
|
||||
tags: Union[str, object] = values.unset,
|
||||
subaccount: Union[str, object] = values.unset,
|
||||
detected_issues: Union[str, object] = values.unset,
|
||||
end_reason: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[ConferenceInstance]:
|
||||
"""
|
||||
Lists ConferenceInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param str conference_sid: The SID of the conference.
|
||||
:param str friendly_name: Custom label for the conference resource, up to 64 characters.
|
||||
:param str status: Conference status.
|
||||
:param str created_after: Conferences created after the provided timestamp specified in ISO 8601 format
|
||||
:param str created_before: Conferences created before the provided timestamp specified in ISO 8601 format.
|
||||
:param str mixer_region: Twilio region where the conference media was mixed.
|
||||
:param str tags: Tags applied by Twilio for common potential configuration, quality, or performance issues.
|
||||
:param str subaccount: Account SID for the subaccount whose resources you wish to retrieve.
|
||||
:param str detected_issues: Potential configuration, behavior, or performance issues detected during the conference.
|
||||
:param str end_reason: Conference end reason; e.g. last participant left, modified by API, etc.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
conference_sid=conference_sid,
|
||||
friendly_name=friendly_name,
|
||||
status=status,
|
||||
created_after=created_after,
|
||||
created_before=created_before,
|
||||
mixer_region=mixer_region,
|
||||
tags=tags,
|
||||
subaccount=subaccount,
|
||||
detected_issues=detected_issues,
|
||||
end_reason=end_reason,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
conference_sid: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
status: Union[str, object] = values.unset,
|
||||
created_after: Union[str, object] = values.unset,
|
||||
created_before: Union[str, object] = values.unset,
|
||||
mixer_region: Union[str, object] = values.unset,
|
||||
tags: Union[str, object] = values.unset,
|
||||
subaccount: Union[str, object] = values.unset,
|
||||
detected_issues: Union[str, object] = values.unset,
|
||||
end_reason: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[ConferenceInstance]:
|
||||
"""
|
||||
Asynchronously lists ConferenceInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param str conference_sid: The SID of the conference.
|
||||
:param str friendly_name: Custom label for the conference resource, up to 64 characters.
|
||||
:param str status: Conference status.
|
||||
:param str created_after: Conferences created after the provided timestamp specified in ISO 8601 format
|
||||
:param str created_before: Conferences created before the provided timestamp specified in ISO 8601 format.
|
||||
:param str mixer_region: Twilio region where the conference media was mixed.
|
||||
:param str tags: Tags applied by Twilio for common potential configuration, quality, or performance issues.
|
||||
:param str subaccount: Account SID for the subaccount whose resources you wish to retrieve.
|
||||
:param str detected_issues: Potential configuration, behavior, or performance issues detected during the conference.
|
||||
:param str end_reason: Conference end reason; e.g. last participant left, modified by API, etc.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
conference_sid=conference_sid,
|
||||
friendly_name=friendly_name,
|
||||
status=status,
|
||||
created_after=created_after,
|
||||
created_before=created_before,
|
||||
mixer_region=mixer_region,
|
||||
tags=tags,
|
||||
subaccount=subaccount,
|
||||
detected_issues=detected_issues,
|
||||
end_reason=end_reason,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
conference_sid: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
status: Union[str, object] = values.unset,
|
||||
created_after: Union[str, object] = values.unset,
|
||||
created_before: Union[str, object] = values.unset,
|
||||
mixer_region: Union[str, object] = values.unset,
|
||||
tags: Union[str, object] = values.unset,
|
||||
subaccount: Union[str, object] = values.unset,
|
||||
detected_issues: Union[str, object] = values.unset,
|
||||
end_reason: Union[str, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> ConferencePage:
|
||||
"""
|
||||
Retrieve a single page of ConferenceInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param conference_sid: The SID of the conference.
|
||||
:param friendly_name: Custom label for the conference resource, up to 64 characters.
|
||||
:param status: Conference status.
|
||||
:param created_after: Conferences created after the provided timestamp specified in ISO 8601 format
|
||||
:param created_before: Conferences created before the provided timestamp specified in ISO 8601 format.
|
||||
:param mixer_region: Twilio region where the conference media was mixed.
|
||||
:param tags: Tags applied by Twilio for common potential configuration, quality, or performance issues.
|
||||
:param subaccount: Account SID for the subaccount whose resources you wish to retrieve.
|
||||
:param detected_issues: Potential configuration, behavior, or performance issues detected during the conference.
|
||||
:param end_reason: Conference end reason; e.g. last participant left, modified by API, etc.
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of ConferenceInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ConferenceSid": conference_sid,
|
||||
"FriendlyName": friendly_name,
|
||||
"Status": status,
|
||||
"CreatedAfter": created_after,
|
||||
"CreatedBefore": created_before,
|
||||
"MixerRegion": mixer_region,
|
||||
"Tags": tags,
|
||||
"Subaccount": subaccount,
|
||||
"DetectedIssues": detected_issues,
|
||||
"EndReason": end_reason,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return ConferencePage(self._version, response)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
conference_sid: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
status: Union[str, object] = values.unset,
|
||||
created_after: Union[str, object] = values.unset,
|
||||
created_before: Union[str, object] = values.unset,
|
||||
mixer_region: Union[str, object] = values.unset,
|
||||
tags: Union[str, object] = values.unset,
|
||||
subaccount: Union[str, object] = values.unset,
|
||||
detected_issues: Union[str, object] = values.unset,
|
||||
end_reason: Union[str, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> ConferencePage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of ConferenceInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param conference_sid: The SID of the conference.
|
||||
:param friendly_name: Custom label for the conference resource, up to 64 characters.
|
||||
:param status: Conference status.
|
||||
:param created_after: Conferences created after the provided timestamp specified in ISO 8601 format
|
||||
:param created_before: Conferences created before the provided timestamp specified in ISO 8601 format.
|
||||
:param mixer_region: Twilio region where the conference media was mixed.
|
||||
:param tags: Tags applied by Twilio for common potential configuration, quality, or performance issues.
|
||||
:param subaccount: Account SID for the subaccount whose resources you wish to retrieve.
|
||||
:param detected_issues: Potential configuration, behavior, or performance issues detected during the conference.
|
||||
:param end_reason: Conference end reason; e.g. last participant left, modified by API, etc.
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of ConferenceInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ConferenceSid": conference_sid,
|
||||
"FriendlyName": friendly_name,
|
||||
"Status": status,
|
||||
"CreatedAfter": created_after,
|
||||
"CreatedBefore": created_before,
|
||||
"MixerRegion": mixer_region,
|
||||
"Tags": tags,
|
||||
"Subaccount": subaccount,
|
||||
"DetectedIssues": detected_issues,
|
||||
"EndReason": end_reason,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return ConferencePage(self._version, response)
|
||||
|
||||
def get_page(self, target_url: str) -> ConferencePage:
|
||||
"""
|
||||
Retrieve a specific page of ConferenceInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of ConferenceInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return ConferencePage(self._version, response)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> ConferencePage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of ConferenceInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of ConferenceInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return ConferencePage(self._version, response)
|
||||
|
||||
def get(self, conference_sid: str) -> ConferenceContext:
|
||||
"""
|
||||
Constructs a ConferenceContext
|
||||
|
||||
:param conference_sid: The unique SID identifier of the Conference.
|
||||
"""
|
||||
return ConferenceContext(self._version, conference_sid=conference_sid)
|
||||
|
||||
def __call__(self, conference_sid: str) -> ConferenceContext:
|
||||
"""
|
||||
Constructs a ConferenceContext
|
||||
|
||||
:param conference_sid: The unique SID identifier of the Conference.
|
||||
"""
|
||||
return ConferenceContext(self._version, conference_sid=conference_sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Insights.V1.ConferenceList>"
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+631
@@ -0,0 +1,631 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Insights
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import deserialize, values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
|
||||
|
||||
class ConferenceParticipantInstance(InstanceResource):
|
||||
class CallDirection(object):
|
||||
INBOUND = "inbound"
|
||||
OUTBOUND = "outbound"
|
||||
|
||||
class CallStatus(object):
|
||||
ANSWERED = "answered"
|
||||
COMPLETED = "completed"
|
||||
BUSY = "busy"
|
||||
FAIL = "fail"
|
||||
NOANSWER = "noanswer"
|
||||
RINGING = "ringing"
|
||||
CANCELED = "canceled"
|
||||
|
||||
class CallType(object):
|
||||
CARRIER = "carrier"
|
||||
CLIENT = "client"
|
||||
SIP = "sip"
|
||||
|
||||
class JitterBufferSize(object):
|
||||
LARGE = "large"
|
||||
SMALL = "small"
|
||||
MEDIUM = "medium"
|
||||
OFF = "off"
|
||||
|
||||
class ProcessingState(object):
|
||||
COMPLETE = "complete"
|
||||
IN_PROGRESS = "in_progress"
|
||||
TIMEOUT = "timeout"
|
||||
|
||||
class Region(object):
|
||||
US1 = "us1"
|
||||
US2 = "us2"
|
||||
AU1 = "au1"
|
||||
BR1 = "br1"
|
||||
IE1 = "ie1"
|
||||
JP1 = "jp1"
|
||||
SG1 = "sg1"
|
||||
DE1 = "de1"
|
||||
|
||||
"""
|
||||
:ivar participant_sid: SID for this participant.
|
||||
:ivar label: The user-specified label of this participant.
|
||||
:ivar conference_sid: The unique SID identifier of the Conference.
|
||||
:ivar call_sid: Unique SID identifier of the call that generated the Participant resource.
|
||||
:ivar account_sid: The unique SID identifier of the Account.
|
||||
:ivar call_direction:
|
||||
:ivar _from: Caller ID of the calling party.
|
||||
:ivar to: Called party.
|
||||
:ivar call_status:
|
||||
:ivar country_code: ISO alpha-2 country code of the participant based on caller ID or called number.
|
||||
:ivar is_moderator: Boolean. Indicates whether participant had startConferenceOnEnter=true or endConferenceOnExit=true.
|
||||
:ivar join_time: ISO 8601 timestamp of participant join event.
|
||||
:ivar leave_time: ISO 8601 timestamp of participant leave event.
|
||||
:ivar duration_seconds: Participant durations in seconds.
|
||||
:ivar outbound_queue_length: Add Participant API only. Estimated time in queue at call creation.
|
||||
:ivar outbound_time_in_queue: Add Participant API only. Actual time in queue in seconds.
|
||||
:ivar jitter_buffer_size:
|
||||
:ivar is_coach: Boolean. Indicated whether participant was a coach.
|
||||
:ivar coached_participants: Call SIDs coached by this participant.
|
||||
:ivar participant_region:
|
||||
:ivar conference_region:
|
||||
:ivar call_type:
|
||||
:ivar processing_state:
|
||||
:ivar properties: Participant properties and metadata.
|
||||
:ivar events: Object containing information of actions taken by participants. Contains a dictionary of URL links to nested resources of this Conference Participant.
|
||||
:ivar metrics: Object. Contains participant call quality metrics.
|
||||
:ivar url: The URL of this resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
conference_sid: str,
|
||||
participant_sid: Optional[str] = None,
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.participant_sid: Optional[str] = payload.get("participant_sid")
|
||||
self.label: Optional[str] = payload.get("label")
|
||||
self.conference_sid: Optional[str] = payload.get("conference_sid")
|
||||
self.call_sid: Optional[str] = payload.get("call_sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.call_direction: Optional[
|
||||
"ConferenceParticipantInstance.CallDirection"
|
||||
] = payload.get("call_direction")
|
||||
self._from: Optional[str] = payload.get("from")
|
||||
self.to: Optional[str] = payload.get("to")
|
||||
self.call_status: Optional[
|
||||
"ConferenceParticipantInstance.CallStatus"
|
||||
] = payload.get("call_status")
|
||||
self.country_code: Optional[str] = payload.get("country_code")
|
||||
self.is_moderator: Optional[bool] = payload.get("is_moderator")
|
||||
self.join_time: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("join_time")
|
||||
)
|
||||
self.leave_time: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("leave_time")
|
||||
)
|
||||
self.duration_seconds: Optional[int] = deserialize.integer(
|
||||
payload.get("duration_seconds")
|
||||
)
|
||||
self.outbound_queue_length: Optional[int] = deserialize.integer(
|
||||
payload.get("outbound_queue_length")
|
||||
)
|
||||
self.outbound_time_in_queue: Optional[int] = deserialize.integer(
|
||||
payload.get("outbound_time_in_queue")
|
||||
)
|
||||
self.jitter_buffer_size: Optional[
|
||||
"ConferenceParticipantInstance.JitterBufferSize"
|
||||
] = payload.get("jitter_buffer_size")
|
||||
self.is_coach: Optional[bool] = payload.get("is_coach")
|
||||
self.coached_participants: Optional[List[str]] = payload.get(
|
||||
"coached_participants"
|
||||
)
|
||||
self.participant_region: Optional[
|
||||
"ConferenceParticipantInstance.Region"
|
||||
] = payload.get("participant_region")
|
||||
self.conference_region: Optional[
|
||||
"ConferenceParticipantInstance.Region"
|
||||
] = payload.get("conference_region")
|
||||
self.call_type: Optional[
|
||||
"ConferenceParticipantInstance.CallType"
|
||||
] = payload.get("call_type")
|
||||
self.processing_state: Optional[
|
||||
"ConferenceParticipantInstance.ProcessingState"
|
||||
] = payload.get("processing_state")
|
||||
self.properties: Optional[Dict[str, object]] = payload.get("properties")
|
||||
self.events: Optional[Dict[str, object]] = payload.get("events")
|
||||
self.metrics: Optional[Dict[str, object]] = payload.get("metrics")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"conference_sid": conference_sid,
|
||||
"participant_sid": participant_sid or self.participant_sid,
|
||||
}
|
||||
self._context: Optional[ConferenceParticipantContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "ConferenceParticipantContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: ConferenceParticipantContext for this ConferenceParticipantInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = ConferenceParticipantContext(
|
||||
self._version,
|
||||
conference_sid=self._solution["conference_sid"],
|
||||
participant_sid=self._solution["participant_sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(
|
||||
self,
|
||||
events: Union[str, object] = values.unset,
|
||||
metrics: Union[str, object] = values.unset,
|
||||
) -> "ConferenceParticipantInstance":
|
||||
"""
|
||||
Fetch the ConferenceParticipantInstance
|
||||
|
||||
:param events: Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc.
|
||||
:param metrics: Object. Contains participant call quality metrics.
|
||||
|
||||
:returns: The fetched ConferenceParticipantInstance
|
||||
"""
|
||||
return self._proxy.fetch(
|
||||
events=events,
|
||||
metrics=metrics,
|
||||
)
|
||||
|
||||
async def fetch_async(
|
||||
self,
|
||||
events: Union[str, object] = values.unset,
|
||||
metrics: Union[str, object] = values.unset,
|
||||
) -> "ConferenceParticipantInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the ConferenceParticipantInstance
|
||||
|
||||
:param events: Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc.
|
||||
:param metrics: Object. Contains participant call quality metrics.
|
||||
|
||||
:returns: The fetched ConferenceParticipantInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async(
|
||||
events=events,
|
||||
metrics=metrics,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Insights.V1.ConferenceParticipantInstance {}>".format(context)
|
||||
|
||||
|
||||
class ConferenceParticipantContext(InstanceContext):
|
||||
def __init__(self, version: Version, conference_sid: str, participant_sid: str):
|
||||
"""
|
||||
Initialize the ConferenceParticipantContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param conference_sid: The unique SID identifier of the Conference.
|
||||
:param participant_sid: The unique SID identifier of the Participant.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"conference_sid": conference_sid,
|
||||
"participant_sid": participant_sid,
|
||||
}
|
||||
self._uri = (
|
||||
"/Conferences/{conference_sid}/Participants/{participant_sid}".format(
|
||||
**self._solution
|
||||
)
|
||||
)
|
||||
|
||||
def fetch(
|
||||
self,
|
||||
events: Union[str, object] = values.unset,
|
||||
metrics: Union[str, object] = values.unset,
|
||||
) -> ConferenceParticipantInstance:
|
||||
"""
|
||||
Fetch the ConferenceParticipantInstance
|
||||
|
||||
:param events: Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc.
|
||||
:param metrics: Object. Contains participant call quality metrics.
|
||||
|
||||
:returns: The fetched ConferenceParticipantInstance
|
||||
"""
|
||||
|
||||
data = values.of(
|
||||
{
|
||||
"Events": events,
|
||||
"Metrics": metrics,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.fetch(method="GET", uri=self._uri, params=data)
|
||||
|
||||
return ConferenceParticipantInstance(
|
||||
self._version,
|
||||
payload,
|
||||
conference_sid=self._solution["conference_sid"],
|
||||
participant_sid=self._solution["participant_sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(
|
||||
self,
|
||||
events: Union[str, object] = values.unset,
|
||||
metrics: Union[str, object] = values.unset,
|
||||
) -> ConferenceParticipantInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the ConferenceParticipantInstance
|
||||
|
||||
:param events: Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc.
|
||||
:param metrics: Object. Contains participant call quality metrics.
|
||||
|
||||
:returns: The fetched ConferenceParticipantInstance
|
||||
"""
|
||||
|
||||
data = values.of(
|
||||
{
|
||||
"Events": events,
|
||||
"Metrics": metrics,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
|
||||
return ConferenceParticipantInstance(
|
||||
self._version,
|
||||
payload,
|
||||
conference_sid=self._solution["conference_sid"],
|
||||
participant_sid=self._solution["participant_sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Insights.V1.ConferenceParticipantContext {}>".format(context)
|
||||
|
||||
|
||||
class ConferenceParticipantPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> ConferenceParticipantInstance:
|
||||
"""
|
||||
Build an instance of ConferenceParticipantInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return ConferenceParticipantInstance(
|
||||
self._version, payload, conference_sid=self._solution["conference_sid"]
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Insights.V1.ConferenceParticipantPage>"
|
||||
|
||||
|
||||
class ConferenceParticipantList(ListResource):
|
||||
def __init__(self, version: Version, conference_sid: str):
|
||||
"""
|
||||
Initialize the ConferenceParticipantList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param conference_sid: The unique SID identifier of the Conference.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"conference_sid": conference_sid,
|
||||
}
|
||||
self._uri = "/Conferences/{conference_sid}/Participants".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
participant_sid: Union[str, object] = values.unset,
|
||||
label: Union[str, object] = values.unset,
|
||||
events: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[ConferenceParticipantInstance]:
|
||||
"""
|
||||
Streams ConferenceParticipantInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param str participant_sid: The unique SID identifier of the Participant.
|
||||
:param str label: User-specified label for a participant.
|
||||
:param str events: Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(
|
||||
participant_sid=participant_sid,
|
||||
label=label,
|
||||
events=events,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
participant_sid: Union[str, object] = values.unset,
|
||||
label: Union[str, object] = values.unset,
|
||||
events: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[ConferenceParticipantInstance]:
|
||||
"""
|
||||
Asynchronously streams ConferenceParticipantInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param str participant_sid: The unique SID identifier of the Participant.
|
||||
:param str label: User-specified label for a participant.
|
||||
:param str events: Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(
|
||||
participant_sid=participant_sid,
|
||||
label=label,
|
||||
events=events,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
participant_sid: Union[str, object] = values.unset,
|
||||
label: Union[str, object] = values.unset,
|
||||
events: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[ConferenceParticipantInstance]:
|
||||
"""
|
||||
Lists ConferenceParticipantInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param str participant_sid: The unique SID identifier of the Participant.
|
||||
:param str label: User-specified label for a participant.
|
||||
:param str events: Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
participant_sid=participant_sid,
|
||||
label=label,
|
||||
events=events,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
participant_sid: Union[str, object] = values.unset,
|
||||
label: Union[str, object] = values.unset,
|
||||
events: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[ConferenceParticipantInstance]:
|
||||
"""
|
||||
Asynchronously lists ConferenceParticipantInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param str participant_sid: The unique SID identifier of the Participant.
|
||||
:param str label: User-specified label for a participant.
|
||||
:param str events: Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
participant_sid=participant_sid,
|
||||
label=label,
|
||||
events=events,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
participant_sid: Union[str, object] = values.unset,
|
||||
label: Union[str, object] = values.unset,
|
||||
events: Union[str, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> ConferenceParticipantPage:
|
||||
"""
|
||||
Retrieve a single page of ConferenceParticipantInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param participant_sid: The unique SID identifier of the Participant.
|
||||
:param label: User-specified label for a participant.
|
||||
:param events: Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc.
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of ConferenceParticipantInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ParticipantSid": participant_sid,
|
||||
"Label": label,
|
||||
"Events": events,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return ConferenceParticipantPage(self._version, response, self._solution)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
participant_sid: Union[str, object] = values.unset,
|
||||
label: Union[str, object] = values.unset,
|
||||
events: Union[str, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> ConferenceParticipantPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of ConferenceParticipantInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param participant_sid: The unique SID identifier of the Participant.
|
||||
:param label: User-specified label for a participant.
|
||||
:param events: Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc.
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of ConferenceParticipantInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ParticipantSid": participant_sid,
|
||||
"Label": label,
|
||||
"Events": events,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return ConferenceParticipantPage(self._version, response, self._solution)
|
||||
|
||||
def get_page(self, target_url: str) -> ConferenceParticipantPage:
|
||||
"""
|
||||
Retrieve a specific page of ConferenceParticipantInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of ConferenceParticipantInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return ConferenceParticipantPage(self._version, response, self._solution)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> ConferenceParticipantPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of ConferenceParticipantInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of ConferenceParticipantInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return ConferenceParticipantPage(self._version, response, self._solution)
|
||||
|
||||
def get(self, participant_sid: str) -> ConferenceParticipantContext:
|
||||
"""
|
||||
Constructs a ConferenceParticipantContext
|
||||
|
||||
:param participant_sid: The unique SID identifier of the Participant.
|
||||
"""
|
||||
return ConferenceParticipantContext(
|
||||
self._version,
|
||||
conference_sid=self._solution["conference_sid"],
|
||||
participant_sid=participant_sid,
|
||||
)
|
||||
|
||||
def __call__(self, participant_sid: str) -> ConferenceParticipantContext:
|
||||
"""
|
||||
Constructs a ConferenceParticipantContext
|
||||
|
||||
:param participant_sid: The unique SID identifier of the Participant.
|
||||
"""
|
||||
return ConferenceParticipantContext(
|
||||
self._version,
|
||||
conference_sid=self._solution["conference_sid"],
|
||||
participant_sid=participant_sid,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Insights.V1.ConferenceParticipantList>"
|
||||
@@ -0,0 +1,632 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Insights
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import deserialize, serialize, values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
from twilio.rest.insights.v1.room.participant import ParticipantList
|
||||
|
||||
|
||||
class RoomInstance(InstanceResource):
|
||||
class Codec(object):
|
||||
VP8 = "VP8"
|
||||
H264 = "H264"
|
||||
VP9 = "VP9"
|
||||
|
||||
class CreatedMethod(object):
|
||||
SDK = "sdk"
|
||||
AD_HOC = "ad_hoc"
|
||||
API = "api"
|
||||
|
||||
class EdgeLocation(object):
|
||||
ASHBURN = "ashburn"
|
||||
DUBLIN = "dublin"
|
||||
FRANKFURT = "frankfurt"
|
||||
SINGAPORE = "singapore"
|
||||
SYDNEY = "sydney"
|
||||
SAO_PAULO = "sao_paulo"
|
||||
ROAMING = "roaming"
|
||||
UMATILLA = "umatilla"
|
||||
TOKYO = "tokyo"
|
||||
|
||||
class EndReason(object):
|
||||
ROOM_ENDED_VIA_API = "room_ended_via_api"
|
||||
TIMEOUT = "timeout"
|
||||
|
||||
class ProcessingState(object):
|
||||
COMPLETE = "complete"
|
||||
IN_PROGRESS = "in_progress"
|
||||
|
||||
class RoomStatus(object):
|
||||
IN_PROGRESS = "in_progress"
|
||||
COMPLETED = "completed"
|
||||
|
||||
class RoomType(object):
|
||||
GO = "go"
|
||||
PEER_TO_PEER = "peer_to_peer"
|
||||
GROUP = "group"
|
||||
GROUP_SMALL = "group_small"
|
||||
|
||||
class TwilioRealm(object):
|
||||
US1 = "us1"
|
||||
US2 = "us2"
|
||||
AU1 = "au1"
|
||||
BR1 = "br1"
|
||||
IE1 = "ie1"
|
||||
JP1 = "jp1"
|
||||
SG1 = "sg1"
|
||||
IN1 = "in1"
|
||||
DE1 = "de1"
|
||||
GLL = "gll"
|
||||
|
||||
"""
|
||||
:ivar account_sid: Account SID associated with this room.
|
||||
:ivar room_sid: Unique identifier for the room.
|
||||
:ivar room_name: Room friendly name.
|
||||
:ivar create_time: Creation time of the room.
|
||||
:ivar end_time: End time for the room.
|
||||
:ivar room_type:
|
||||
:ivar room_status:
|
||||
:ivar status_callback: Webhook provided for status callbacks.
|
||||
:ivar status_callback_method: HTTP method provided for status callback URL.
|
||||
:ivar created_method:
|
||||
:ivar end_reason:
|
||||
:ivar max_participants: Max number of total participants allowed by the application settings.
|
||||
:ivar unique_participants: Number of participants. May include duplicate identities for participants who left and rejoined.
|
||||
:ivar unique_participant_identities: Unique number of participant identities.
|
||||
:ivar concurrent_participants: Actual number of concurrent participants.
|
||||
:ivar max_concurrent_participants: Maximum number of participants allowed in the room at the same time allowed by the application settings.
|
||||
:ivar codecs: Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`.
|
||||
:ivar media_region:
|
||||
:ivar duration_sec: Total room duration from create time to end time.
|
||||
:ivar total_participant_duration_sec: Combined amount of participant time in the room.
|
||||
:ivar total_recording_duration_sec: Combined amount of recorded seconds for participants in the room.
|
||||
:ivar processing_state:
|
||||
:ivar recording_enabled: Boolean indicating if recording is enabled for the room.
|
||||
:ivar edge_location:
|
||||
:ivar url: URL for the room resource.
|
||||
:ivar links: Room subresources.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], room_sid: Optional[str] = None
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.room_sid: Optional[str] = payload.get("room_sid")
|
||||
self.room_name: Optional[str] = payload.get("room_name")
|
||||
self.create_time: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("create_time")
|
||||
)
|
||||
self.end_time: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("end_time")
|
||||
)
|
||||
self.room_type: Optional["RoomInstance.RoomType"] = payload.get("room_type")
|
||||
self.room_status: Optional["RoomInstance.RoomStatus"] = payload.get(
|
||||
"room_status"
|
||||
)
|
||||
self.status_callback: Optional[str] = payload.get("status_callback")
|
||||
self.status_callback_method: Optional[str] = payload.get(
|
||||
"status_callback_method"
|
||||
)
|
||||
self.created_method: Optional["RoomInstance.CreatedMethod"] = payload.get(
|
||||
"created_method"
|
||||
)
|
||||
self.end_reason: Optional["RoomInstance.EndReason"] = payload.get("end_reason")
|
||||
self.max_participants: Optional[int] = deserialize.integer(
|
||||
payload.get("max_participants")
|
||||
)
|
||||
self.unique_participants: Optional[int] = deserialize.integer(
|
||||
payload.get("unique_participants")
|
||||
)
|
||||
self.unique_participant_identities: Optional[int] = deserialize.integer(
|
||||
payload.get("unique_participant_identities")
|
||||
)
|
||||
self.concurrent_participants: Optional[int] = deserialize.integer(
|
||||
payload.get("concurrent_participants")
|
||||
)
|
||||
self.max_concurrent_participants: Optional[int] = deserialize.integer(
|
||||
payload.get("max_concurrent_participants")
|
||||
)
|
||||
self.codecs: Optional[List["RoomInstance.Codec"]] = payload.get("codecs")
|
||||
self.media_region: Optional["RoomInstance.TwilioRealm"] = payload.get(
|
||||
"media_region"
|
||||
)
|
||||
self.duration_sec: Optional[int] = payload.get("duration_sec")
|
||||
self.total_participant_duration_sec: Optional[int] = payload.get(
|
||||
"total_participant_duration_sec"
|
||||
)
|
||||
self.total_recording_duration_sec: Optional[int] = payload.get(
|
||||
"total_recording_duration_sec"
|
||||
)
|
||||
self.processing_state: Optional["RoomInstance.ProcessingState"] = payload.get(
|
||||
"processing_state"
|
||||
)
|
||||
self.recording_enabled: Optional[bool] = payload.get("recording_enabled")
|
||||
self.edge_location: Optional["RoomInstance.EdgeLocation"] = payload.get(
|
||||
"edge_location"
|
||||
)
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
self.links: Optional[Dict[str, object]] = payload.get("links")
|
||||
|
||||
self._solution = {
|
||||
"room_sid": room_sid or self.room_sid,
|
||||
}
|
||||
self._context: Optional[RoomContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "RoomContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: RoomContext for this RoomInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = RoomContext(
|
||||
self._version,
|
||||
room_sid=self._solution["room_sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "RoomInstance":
|
||||
"""
|
||||
Fetch the RoomInstance
|
||||
|
||||
|
||||
:returns: The fetched RoomInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "RoomInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the RoomInstance
|
||||
|
||||
|
||||
:returns: The fetched RoomInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
@property
|
||||
def participants(self) -> ParticipantList:
|
||||
"""
|
||||
Access the participants
|
||||
"""
|
||||
return self._proxy.participants
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Insights.V1.RoomInstance {}>".format(context)
|
||||
|
||||
|
||||
class RoomContext(InstanceContext):
|
||||
def __init__(self, version: Version, room_sid: str):
|
||||
"""
|
||||
Initialize the RoomContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param room_sid: The SID of the Room resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"room_sid": room_sid,
|
||||
}
|
||||
self._uri = "/Video/Rooms/{room_sid}".format(**self._solution)
|
||||
|
||||
self._participants: Optional[ParticipantList] = None
|
||||
|
||||
def fetch(self) -> RoomInstance:
|
||||
"""
|
||||
Fetch the RoomInstance
|
||||
|
||||
|
||||
:returns: The fetched RoomInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return RoomInstance(
|
||||
self._version,
|
||||
payload,
|
||||
room_sid=self._solution["room_sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> RoomInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the RoomInstance
|
||||
|
||||
|
||||
:returns: The fetched RoomInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return RoomInstance(
|
||||
self._version,
|
||||
payload,
|
||||
room_sid=self._solution["room_sid"],
|
||||
)
|
||||
|
||||
@property
|
||||
def participants(self) -> ParticipantList:
|
||||
"""
|
||||
Access the participants
|
||||
"""
|
||||
if self._participants is None:
|
||||
self._participants = ParticipantList(
|
||||
self._version,
|
||||
self._solution["room_sid"],
|
||||
)
|
||||
return self._participants
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Insights.V1.RoomContext {}>".format(context)
|
||||
|
||||
|
||||
class RoomPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> RoomInstance:
|
||||
"""
|
||||
Build an instance of RoomInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return RoomInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Insights.V1.RoomPage>"
|
||||
|
||||
|
||||
class RoomList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the RoomList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/Video/Rooms"
|
||||
|
||||
def stream(
|
||||
self,
|
||||
room_type: Union[List["RoomInstance.RoomType"], object] = values.unset,
|
||||
codec: Union[List["RoomInstance.Codec"], object] = values.unset,
|
||||
room_name: Union[str, object] = values.unset,
|
||||
created_after: Union[datetime, object] = values.unset,
|
||||
created_before: Union[datetime, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[RoomInstance]:
|
||||
"""
|
||||
Streams RoomInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param List["RoomInstance.RoomType"] room_type: Type of room. Can be `go`, `peer_to_peer`, `group`, or `group_small`.
|
||||
:param List["RoomInstance.Codec"] codec: Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`.
|
||||
:param str room_name: Room friendly name.
|
||||
:param datetime created_after: Only read rooms that started on or after this ISO 8601 timestamp.
|
||||
:param datetime created_before: Only read rooms that started before this ISO 8601 timestamp.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(
|
||||
room_type=room_type,
|
||||
codec=codec,
|
||||
room_name=room_name,
|
||||
created_after=created_after,
|
||||
created_before=created_before,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
room_type: Union[List["RoomInstance.RoomType"], object] = values.unset,
|
||||
codec: Union[List["RoomInstance.Codec"], object] = values.unset,
|
||||
room_name: Union[str, object] = values.unset,
|
||||
created_after: Union[datetime, object] = values.unset,
|
||||
created_before: Union[datetime, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[RoomInstance]:
|
||||
"""
|
||||
Asynchronously streams RoomInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param List["RoomInstance.RoomType"] room_type: Type of room. Can be `go`, `peer_to_peer`, `group`, or `group_small`.
|
||||
:param List["RoomInstance.Codec"] codec: Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`.
|
||||
:param str room_name: Room friendly name.
|
||||
:param datetime created_after: Only read rooms that started on or after this ISO 8601 timestamp.
|
||||
:param datetime created_before: Only read rooms that started before this ISO 8601 timestamp.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(
|
||||
room_type=room_type,
|
||||
codec=codec,
|
||||
room_name=room_name,
|
||||
created_after=created_after,
|
||||
created_before=created_before,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
room_type: Union[List["RoomInstance.RoomType"], object] = values.unset,
|
||||
codec: Union[List["RoomInstance.Codec"], object] = values.unset,
|
||||
room_name: Union[str, object] = values.unset,
|
||||
created_after: Union[datetime, object] = values.unset,
|
||||
created_before: Union[datetime, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[RoomInstance]:
|
||||
"""
|
||||
Lists RoomInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param List["RoomInstance.RoomType"] room_type: Type of room. Can be `go`, `peer_to_peer`, `group`, or `group_small`.
|
||||
:param List["RoomInstance.Codec"] codec: Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`.
|
||||
:param str room_name: Room friendly name.
|
||||
:param datetime created_after: Only read rooms that started on or after this ISO 8601 timestamp.
|
||||
:param datetime created_before: Only read rooms that started before this ISO 8601 timestamp.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
room_type=room_type,
|
||||
codec=codec,
|
||||
room_name=room_name,
|
||||
created_after=created_after,
|
||||
created_before=created_before,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
room_type: Union[List["RoomInstance.RoomType"], object] = values.unset,
|
||||
codec: Union[List["RoomInstance.Codec"], object] = values.unset,
|
||||
room_name: Union[str, object] = values.unset,
|
||||
created_after: Union[datetime, object] = values.unset,
|
||||
created_before: Union[datetime, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[RoomInstance]:
|
||||
"""
|
||||
Asynchronously lists RoomInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param List["RoomInstance.RoomType"] room_type: Type of room. Can be `go`, `peer_to_peer`, `group`, or `group_small`.
|
||||
:param List["RoomInstance.Codec"] codec: Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`.
|
||||
:param str room_name: Room friendly name.
|
||||
:param datetime created_after: Only read rooms that started on or after this ISO 8601 timestamp.
|
||||
:param datetime created_before: Only read rooms that started before this ISO 8601 timestamp.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
room_type=room_type,
|
||||
codec=codec,
|
||||
room_name=room_name,
|
||||
created_after=created_after,
|
||||
created_before=created_before,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
room_type: Union[List["RoomInstance.RoomType"], object] = values.unset,
|
||||
codec: Union[List["RoomInstance.Codec"], object] = values.unset,
|
||||
room_name: Union[str, object] = values.unset,
|
||||
created_after: Union[datetime, object] = values.unset,
|
||||
created_before: Union[datetime, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> RoomPage:
|
||||
"""
|
||||
Retrieve a single page of RoomInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param room_type: Type of room. Can be `go`, `peer_to_peer`, `group`, or `group_small`.
|
||||
:param codec: Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`.
|
||||
:param room_name: Room friendly name.
|
||||
:param created_after: Only read rooms that started on or after this ISO 8601 timestamp.
|
||||
:param created_before: Only read rooms that started before this ISO 8601 timestamp.
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of RoomInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"RoomType": serialize.map(room_type, lambda e: e),
|
||||
"Codec": serialize.map(codec, lambda e: e),
|
||||
"RoomName": room_name,
|
||||
"CreatedAfter": serialize.iso8601_datetime(created_after),
|
||||
"CreatedBefore": serialize.iso8601_datetime(created_before),
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return RoomPage(self._version, response)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
room_type: Union[List["RoomInstance.RoomType"], object] = values.unset,
|
||||
codec: Union[List["RoomInstance.Codec"], object] = values.unset,
|
||||
room_name: Union[str, object] = values.unset,
|
||||
created_after: Union[datetime, object] = values.unset,
|
||||
created_before: Union[datetime, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> RoomPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of RoomInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param room_type: Type of room. Can be `go`, `peer_to_peer`, `group`, or `group_small`.
|
||||
:param codec: Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`.
|
||||
:param room_name: Room friendly name.
|
||||
:param created_after: Only read rooms that started on or after this ISO 8601 timestamp.
|
||||
:param created_before: Only read rooms that started before this ISO 8601 timestamp.
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of RoomInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"RoomType": serialize.map(room_type, lambda e: e),
|
||||
"Codec": serialize.map(codec, lambda e: e),
|
||||
"RoomName": room_name,
|
||||
"CreatedAfter": serialize.iso8601_datetime(created_after),
|
||||
"CreatedBefore": serialize.iso8601_datetime(created_before),
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return RoomPage(self._version, response)
|
||||
|
||||
def get_page(self, target_url: str) -> RoomPage:
|
||||
"""
|
||||
Retrieve a specific page of RoomInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of RoomInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return RoomPage(self._version, response)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> RoomPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of RoomInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of RoomInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return RoomPage(self._version, response)
|
||||
|
||||
def get(self, room_sid: str) -> RoomContext:
|
||||
"""
|
||||
Constructs a RoomContext
|
||||
|
||||
:param room_sid: The SID of the Room resource.
|
||||
"""
|
||||
return RoomContext(self._version, room_sid=room_sid)
|
||||
|
||||
def __call__(self, room_sid: str) -> RoomContext:
|
||||
"""
|
||||
Constructs a RoomContext
|
||||
|
||||
:param room_sid: The SID of the Room resource.
|
||||
"""
|
||||
return RoomContext(self._version, room_sid=room_sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Insights.V1.RoomList>"
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,484 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Insights
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import deserialize, values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
|
||||
|
||||
class ParticipantInstance(InstanceResource):
|
||||
class Codec(object):
|
||||
VP8 = "VP8"
|
||||
H264 = "H264"
|
||||
VP9 = "VP9"
|
||||
|
||||
class EdgeLocation(object):
|
||||
ASHBURN = "ashburn"
|
||||
DUBLIN = "dublin"
|
||||
FRANKFURT = "frankfurt"
|
||||
SINGAPORE = "singapore"
|
||||
SYDNEY = "sydney"
|
||||
SAO_PAULO = "sao_paulo"
|
||||
ROAMING = "roaming"
|
||||
UMATILLA = "umatilla"
|
||||
TOKYO = "tokyo"
|
||||
|
||||
class RoomStatus(object):
|
||||
IN_PROGRESS = "in_progress"
|
||||
COMPLETED = "completed"
|
||||
|
||||
class TwilioRealm(object):
|
||||
US1 = "us1"
|
||||
US2 = "us2"
|
||||
AU1 = "au1"
|
||||
BR1 = "br1"
|
||||
IE1 = "ie1"
|
||||
JP1 = "jp1"
|
||||
SG1 = "sg1"
|
||||
IN1 = "in1"
|
||||
DE1 = "de1"
|
||||
GLL = "gll"
|
||||
|
||||
"""
|
||||
:ivar participant_sid: Unique identifier for the participant.
|
||||
:ivar participant_identity: The application-defined string that uniquely identifies the participant within a Room.
|
||||
:ivar join_time: When the participant joined the room.
|
||||
:ivar leave_time: When the participant left the room.
|
||||
:ivar duration_sec: Amount of time in seconds the participant was in the room.
|
||||
:ivar account_sid: Account SID associated with the room.
|
||||
:ivar room_sid: Unique identifier for the room.
|
||||
:ivar status:
|
||||
:ivar codecs: Codecs detected from the participant. Can be `VP8`, `H264`, or `VP9`.
|
||||
:ivar end_reason: Reason the participant left the room. See [the list of possible values here](https://www.twilio.com/docs/video/troubleshooting/video-log-analyzer-api#end_reason).
|
||||
:ivar error_code: Errors encountered by the participant.
|
||||
:ivar error_code_url: Twilio error code dictionary link.
|
||||
:ivar media_region:
|
||||
:ivar properties: Object containing information about the participant's data from the room. See [below](https://www.twilio.com/docs/video/troubleshooting/video-log-analyzer-api#properties) for more information.
|
||||
:ivar edge_location:
|
||||
:ivar publisher_info: Object containing information about the SDK name and version. See [below](https://www.twilio.com/docs/video/troubleshooting/video-log-analyzer-api#publisher_info) for more information.
|
||||
:ivar url: URL of the participant resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
room_sid: str,
|
||||
participant_sid: Optional[str] = None,
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.participant_sid: Optional[str] = payload.get("participant_sid")
|
||||
self.participant_identity: Optional[str] = payload.get("participant_identity")
|
||||
self.join_time: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("join_time")
|
||||
)
|
||||
self.leave_time: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("leave_time")
|
||||
)
|
||||
self.duration_sec: Optional[int] = payload.get("duration_sec")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.room_sid: Optional[str] = payload.get("room_sid")
|
||||
self.status: Optional["ParticipantInstance.RoomStatus"] = payload.get("status")
|
||||
self.codecs: Optional[List["ParticipantInstance.Codec"]] = payload.get("codecs")
|
||||
self.end_reason: Optional[str] = payload.get("end_reason")
|
||||
self.error_code: Optional[int] = deserialize.integer(payload.get("error_code"))
|
||||
self.error_code_url: Optional[str] = payload.get("error_code_url")
|
||||
self.media_region: Optional["ParticipantInstance.TwilioRealm"] = payload.get(
|
||||
"media_region"
|
||||
)
|
||||
self.properties: Optional[Dict[str, object]] = payload.get("properties")
|
||||
self.edge_location: Optional["ParticipantInstance.EdgeLocation"] = payload.get(
|
||||
"edge_location"
|
||||
)
|
||||
self.publisher_info: Optional[Dict[str, object]] = payload.get("publisher_info")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"room_sid": room_sid,
|
||||
"participant_sid": participant_sid or self.participant_sid,
|
||||
}
|
||||
self._context: Optional[ParticipantContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "ParticipantContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: ParticipantContext for this ParticipantInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = ParticipantContext(
|
||||
self._version,
|
||||
room_sid=self._solution["room_sid"],
|
||||
participant_sid=self._solution["participant_sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "ParticipantInstance":
|
||||
"""
|
||||
Fetch the ParticipantInstance
|
||||
|
||||
|
||||
:returns: The fetched ParticipantInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "ParticipantInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the ParticipantInstance
|
||||
|
||||
|
||||
:returns: The fetched ParticipantInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Insights.V1.ParticipantInstance {}>".format(context)
|
||||
|
||||
|
||||
class ParticipantContext(InstanceContext):
|
||||
def __init__(self, version: Version, room_sid: str, participant_sid: str):
|
||||
"""
|
||||
Initialize the ParticipantContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param room_sid: The SID of the Room resource.
|
||||
:param participant_sid: The SID of the Participant resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"room_sid": room_sid,
|
||||
"participant_sid": participant_sid,
|
||||
}
|
||||
self._uri = "/Video/Rooms/{room_sid}/Participants/{participant_sid}".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def fetch(self) -> ParticipantInstance:
|
||||
"""
|
||||
Fetch the ParticipantInstance
|
||||
|
||||
|
||||
:returns: The fetched ParticipantInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return ParticipantInstance(
|
||||
self._version,
|
||||
payload,
|
||||
room_sid=self._solution["room_sid"],
|
||||
participant_sid=self._solution["participant_sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> ParticipantInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the ParticipantInstance
|
||||
|
||||
|
||||
:returns: The fetched ParticipantInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return ParticipantInstance(
|
||||
self._version,
|
||||
payload,
|
||||
room_sid=self._solution["room_sid"],
|
||||
participant_sid=self._solution["participant_sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Insights.V1.ParticipantContext {}>".format(context)
|
||||
|
||||
|
||||
class ParticipantPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> ParticipantInstance:
|
||||
"""
|
||||
Build an instance of ParticipantInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return ParticipantInstance(
|
||||
self._version, payload, room_sid=self._solution["room_sid"]
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Insights.V1.ParticipantPage>"
|
||||
|
||||
|
||||
class ParticipantList(ListResource):
|
||||
def __init__(self, version: Version, room_sid: str):
|
||||
"""
|
||||
Initialize the ParticipantList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param room_sid: The SID of the Room resource.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"room_sid": room_sid,
|
||||
}
|
||||
self._uri = "/Video/Rooms/{room_sid}/Participants".format(**self._solution)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[ParticipantInstance]:
|
||||
"""
|
||||
Streams ParticipantInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[ParticipantInstance]:
|
||||
"""
|
||||
Asynchronously streams ParticipantInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[ParticipantInstance]:
|
||||
"""
|
||||
Lists ParticipantInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[ParticipantInstance]:
|
||||
"""
|
||||
Asynchronously lists ParticipantInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> ParticipantPage:
|
||||
"""
|
||||
Retrieve a single page of ParticipantInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of ParticipantInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return ParticipantPage(self._version, response, self._solution)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> ParticipantPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of ParticipantInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of ParticipantInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return ParticipantPage(self._version, response, self._solution)
|
||||
|
||||
def get_page(self, target_url: str) -> ParticipantPage:
|
||||
"""
|
||||
Retrieve a specific page of ParticipantInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of ParticipantInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return ParticipantPage(self._version, response, self._solution)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> ParticipantPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of ParticipantInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of ParticipantInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return ParticipantPage(self._version, response, self._solution)
|
||||
|
||||
def get(self, participant_sid: str) -> ParticipantContext:
|
||||
"""
|
||||
Constructs a ParticipantContext
|
||||
|
||||
:param participant_sid: The SID of the Participant resource.
|
||||
"""
|
||||
return ParticipantContext(
|
||||
self._version,
|
||||
room_sid=self._solution["room_sid"],
|
||||
participant_sid=participant_sid,
|
||||
)
|
||||
|
||||
def __call__(self, participant_sid: str) -> ParticipantContext:
|
||||
"""
|
||||
Constructs a ParticipantContext
|
||||
|
||||
:param participant_sid: The SID of the Participant resource.
|
||||
"""
|
||||
return ParticipantContext(
|
||||
self._version,
|
||||
room_sid=self._solution["room_sid"],
|
||||
participant_sid=participant_sid,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Insights.V1.ParticipantList>"
|
||||
@@ -0,0 +1,300 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Insights
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from typing import Any, Dict, Optional, Union
|
||||
from twilio.base import values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
|
||||
|
||||
class SettingInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar account_sid: The unique SID identifier of the Account.
|
||||
:ivar advanced_features: A boolean flag indicating whether Advanced Features for Voice Insights are enabled.
|
||||
:ivar voice_trace: A boolean flag indicating whether Voice Trace is enabled.
|
||||
:ivar url: The URL of this resource.
|
||||
"""
|
||||
|
||||
def __init__(self, version: Version, payload: Dict[str, Any]):
|
||||
super().__init__(version)
|
||||
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.advanced_features: Optional[bool] = payload.get("advanced_features")
|
||||
self.voice_trace: Optional[bool] = payload.get("voice_trace")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._context: Optional[SettingContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "SettingContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: SettingContext for this SettingInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = SettingContext(
|
||||
self._version,
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(
|
||||
self, subaccount_sid: Union[str, object] = values.unset
|
||||
) -> "SettingInstance":
|
||||
"""
|
||||
Fetch the SettingInstance
|
||||
|
||||
:param subaccount_sid: The unique SID identifier of the Subaccount.
|
||||
|
||||
:returns: The fetched SettingInstance
|
||||
"""
|
||||
return self._proxy.fetch(
|
||||
subaccount_sid=subaccount_sid,
|
||||
)
|
||||
|
||||
async def fetch_async(
|
||||
self, subaccount_sid: Union[str, object] = values.unset
|
||||
) -> "SettingInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the SettingInstance
|
||||
|
||||
:param subaccount_sid: The unique SID identifier of the Subaccount.
|
||||
|
||||
:returns: The fetched SettingInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async(
|
||||
subaccount_sid=subaccount_sid,
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
advanced_features: Union[bool, object] = values.unset,
|
||||
voice_trace: Union[bool, object] = values.unset,
|
||||
subaccount_sid: Union[str, object] = values.unset,
|
||||
) -> "SettingInstance":
|
||||
"""
|
||||
Update the SettingInstance
|
||||
|
||||
:param advanced_features: A boolean flag to enable Advanced Features for Voice Insights.
|
||||
:param voice_trace: A boolean flag to enable Voice Trace.
|
||||
:param subaccount_sid: The unique SID identifier of the Subaccount.
|
||||
|
||||
:returns: The updated SettingInstance
|
||||
"""
|
||||
return self._proxy.update(
|
||||
advanced_features=advanced_features,
|
||||
voice_trace=voice_trace,
|
||||
subaccount_sid=subaccount_sid,
|
||||
)
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
advanced_features: Union[bool, object] = values.unset,
|
||||
voice_trace: Union[bool, object] = values.unset,
|
||||
subaccount_sid: Union[str, object] = values.unset,
|
||||
) -> "SettingInstance":
|
||||
"""
|
||||
Asynchronous coroutine to update the SettingInstance
|
||||
|
||||
:param advanced_features: A boolean flag to enable Advanced Features for Voice Insights.
|
||||
:param voice_trace: A boolean flag to enable Voice Trace.
|
||||
:param subaccount_sid: The unique SID identifier of the Subaccount.
|
||||
|
||||
:returns: The updated SettingInstance
|
||||
"""
|
||||
return await self._proxy.update_async(
|
||||
advanced_features=advanced_features,
|
||||
voice_trace=voice_trace,
|
||||
subaccount_sid=subaccount_sid,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
|
||||
return "<Twilio.Insights.V1.SettingInstance>"
|
||||
|
||||
|
||||
class SettingContext(InstanceContext):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the SettingContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/Voice/Settings"
|
||||
|
||||
def fetch(
|
||||
self, subaccount_sid: Union[str, object] = values.unset
|
||||
) -> SettingInstance:
|
||||
"""
|
||||
Fetch the SettingInstance
|
||||
|
||||
:param subaccount_sid: The unique SID identifier of the Subaccount.
|
||||
|
||||
:returns: The fetched SettingInstance
|
||||
"""
|
||||
|
||||
data = values.of(
|
||||
{
|
||||
"SubaccountSid": subaccount_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.fetch(method="GET", uri=self._uri, params=data)
|
||||
|
||||
return SettingInstance(
|
||||
self._version,
|
||||
payload,
|
||||
)
|
||||
|
||||
async def fetch_async(
|
||||
self, subaccount_sid: Union[str, object] = values.unset
|
||||
) -> SettingInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the SettingInstance
|
||||
|
||||
:param subaccount_sid: The unique SID identifier of the Subaccount.
|
||||
|
||||
:returns: The fetched SettingInstance
|
||||
"""
|
||||
|
||||
data = values.of(
|
||||
{
|
||||
"SubaccountSid": subaccount_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
|
||||
return SettingInstance(
|
||||
self._version,
|
||||
payload,
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
advanced_features: Union[bool, object] = values.unset,
|
||||
voice_trace: Union[bool, object] = values.unset,
|
||||
subaccount_sid: Union[str, object] = values.unset,
|
||||
) -> SettingInstance:
|
||||
"""
|
||||
Update the SettingInstance
|
||||
|
||||
:param advanced_features: A boolean flag to enable Advanced Features for Voice Insights.
|
||||
:param voice_trace: A boolean flag to enable Voice Trace.
|
||||
:param subaccount_sid: The unique SID identifier of the Subaccount.
|
||||
|
||||
:returns: The updated SettingInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"AdvancedFeatures": advanced_features,
|
||||
"VoiceTrace": voice_trace,
|
||||
"SubaccountSid": subaccount_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.update(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return SettingInstance(self._version, payload)
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
advanced_features: Union[bool, object] = values.unset,
|
||||
voice_trace: Union[bool, object] = values.unset,
|
||||
subaccount_sid: Union[str, object] = values.unset,
|
||||
) -> SettingInstance:
|
||||
"""
|
||||
Asynchronous coroutine to update the SettingInstance
|
||||
|
||||
:param advanced_features: A boolean flag to enable Advanced Features for Voice Insights.
|
||||
:param voice_trace: A boolean flag to enable Voice Trace.
|
||||
:param subaccount_sid: The unique SID identifier of the Subaccount.
|
||||
|
||||
:returns: The updated SettingInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"AdvancedFeatures": advanced_features,
|
||||
"VoiceTrace": voice_trace,
|
||||
"SubaccountSid": subaccount_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.update_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return SettingInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
|
||||
return "<Twilio.Insights.V1.SettingContext>"
|
||||
|
||||
|
||||
class SettingList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the SettingList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
def get(self) -> SettingContext:
|
||||
"""
|
||||
Constructs a SettingContext
|
||||
|
||||
"""
|
||||
return SettingContext(self._version)
|
||||
|
||||
def __call__(self) -> SettingContext:
|
||||
"""
|
||||
Constructs a SettingContext
|
||||
|
||||
"""
|
||||
return SettingContext(self._version)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Insights.V1.SettingList>"
|
||||
Reference in New Issue
Block a user