Skip to content

Commit

Permalink
feat(api): api update (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Nov 29, 2024
1 parent 1ab168b commit c8933f1
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 28
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/retell%2Ftoddlzt-f9afbee66b5cb96ef5f86e97b31b71ebd4b097d837284acbc226fb83e0019cb0.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/retell%2Ftoddlzt-6b7ec2315ab362e6294b7a7cbfb7adcdcb209fd34d92fe45102da89e7841b718.yml
84 changes: 73 additions & 11 deletions src/retell/types/call_list_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

from __future__ import annotations

from typing import List
from typing import List, Iterable
from typing_extensions import Literal, TypedDict

__all__ = ["CallListParams", "FilterCriteria"]
__all__ = ["CallListParams", "FilterCriteria", "FilterCriteriaDurationMs", "FilterCriteriaStartTimestamp"]


class CallListParams(TypedDict, total=False):
Expand All @@ -29,18 +29,80 @@ class CallListParams(TypedDict, total=False):
"""


class FilterCriteria(TypedDict, total=False):
after_end_timestamp: int
"""Inclusive. Filter calls that end on or after this timestamp."""
class FilterCriteriaDurationMs(TypedDict, total=False):
lower_threshold: int

upper_threshold: int


class FilterCriteriaStartTimestamp(TypedDict, total=False):
lower_threshold: int

after_start_timestamp: int
"""Inclusive. Filter calls that start on or after this timestamp."""
upper_threshold: int


class FilterCriteria(TypedDict, total=False):
agent_id: List[str]
"""Only retrieve calls that are made with specific agent(s)."""

before_end_timestamp: int
"""Exclusive. Filter calls that end before this timestamp."""
call_status: List[Literal["registered", "ongoing", "ended", "error"]]
"""Only retrieve calls with specific call status(es)."""

call_successful: Iterable[bool]
"""Only retrieve calls with specific call successful(s)."""

call_type: List[Literal["web_call", "phone_call"]]
"""Only retrieve calls with specific call type(s)."""

direction: List[Literal["inbound", "outbound"]]
"""Only retrieve calls with specific direction(s)."""

disconnection_reason: List[
Literal[
"user_hangup",
"agent_hangup",
"call_transfer",
"voicemail_reached",
"inactivity",
"machine_detected",
"max_duration_reached",
"concurrency_limit_reached",
"no_valid_payment",
"scam_detected",
"error_inbound_webhook",
"dial_busy",
"dial_failed",
"dial_no_answer",
"error_llm_websocket_open",
"error_llm_websocket_lost_connection",
"error_llm_websocket_runtime",
"error_llm_websocket_corrupt_payload",
"error_frontend_corrupted_payload",
"error_twilio",
"error_no_audio_received",
"error_asr",
"error_retell",
"error_unknown",
"error_user_not_joined",
"registered_call_timeout",
]
]
"""Only retrieve calls with specific disconnection reason(s)."""

duration_ms: FilterCriteriaDurationMs
"""Only retrieve calls with specific range of duration(s)."""

from_number: List[str]
"""Only retrieve calls with specific from number(s)."""

in_voicemail: Iterable[bool]
"""Only retrieve calls that are in voicemail or not in voicemail."""

start_timestamp: FilterCriteriaStartTimestamp
"""Only retrieve calls with specific range of start timestamp(s)."""

to_number: List[str]
"""Only retrieve calls with specific to number(s)."""

before_start_timestamp: int
"""Exclusive. Filter calls that start before this timestamp."""
user_sentiment: List[Literal["Negative", "Positive", "Neutral", "Unknown"]]
"""Only retrieve calls with specific user sentiment(s)."""
46 changes: 36 additions & 10 deletions tests/api_resources/test_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,24 @@ def test_method_list(self, client: Retell) -> None:
def test_method_list_with_all_params(self, client: Retell) -> None:
call = client.call.list(
filter_criteria={
"after_end_timestamp": 1703302428800,
"after_start_timestamp": 1703302407300,
"agent_id": ["oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD"],
"before_end_timestamp": 1703302428899,
"before_start_timestamp": 1703302407399,
"agent_id": ["agent_oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD"],
"call_status": ["registered"],
"call_successful": [True],
"call_type": ["web_call"],
"direction": ["inbound"],
"disconnection_reason": ["user_hangup"],
"duration_ms": {
"lower_threshold": 0,
"upper_threshold": 172800000,
},
"from_number": ["+14157774444"],
"in_voicemail": [True],
"start_timestamp": {
"lower_threshold": 0,
"upper_threshold": 172800000,
},
"to_number": ["+12137774445"],
"user_sentiment": ["Negative"],
},
limit=0,
pagination_key="pagination_key",
Expand Down Expand Up @@ -280,11 +293,24 @@ async def test_method_list(self, async_client: AsyncRetell) -> None:
async def test_method_list_with_all_params(self, async_client: AsyncRetell) -> None:
call = await async_client.call.list(
filter_criteria={
"after_end_timestamp": 1703302428800,
"after_start_timestamp": 1703302407300,
"agent_id": ["oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD"],
"before_end_timestamp": 1703302428899,
"before_start_timestamp": 1703302407399,
"agent_id": ["agent_oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD"],
"call_status": ["registered"],
"call_successful": [True],
"call_type": ["web_call"],
"direction": ["inbound"],
"disconnection_reason": ["user_hangup"],
"duration_ms": {
"lower_threshold": 0,
"upper_threshold": 172800000,
},
"from_number": ["+14157774444"],
"in_voicemail": [True],
"start_timestamp": {
"lower_threshold": 0,
"upper_threshold": 172800000,
},
"to_number": ["+12137774445"],
"user_sentiment": ["Negative"],
},
limit=0,
pagination_key="pagination_key",
Expand Down

0 comments on commit c8933f1

Please sign in to comment.