Skip to content

Commit

Permalink
Release 0.0.27
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Nov 25, 2023
1 parent 929c5d8 commit 75fffe1
Show file tree
Hide file tree
Showing 27 changed files with 355 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "vocode-api"
version = "0.0.26"
version = "0.0.27"
description = ""
readme = "README.md"
authors = []
Expand Down
24 changes: 24 additions & 0 deletions src/vocode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
AgentUpdateParamsConversationSpeed,
AgentUpdateParamsEndpointingSensitivity,
AgentUpdateParamsInitialMessage,
AgentUpdateParamsInitialMessageDelay,
AgentUpdateParamsInterruptSensitivity,
AgentUpdateParamsIvrNavigationMode,
AgentUpdateParamsLanguage,
Expand All @@ -77,11 +78,14 @@
AzureVoiceUpdateParamsPitch,
AzureVoiceUpdateParamsRate,
AzureVoiceUpdateParamsVoiceName,
BuyPhoneNumberRequest,
BuyPhoneNumberRequestTelephonyProvider,
Call,
CallHumanDetectionResult,
CallOnNoHumanAnswer,
CallPage,
CallStatus,
CallTelephonyProvider,
CollectField,
CreateCallAgentParams,
CreateCallAgentParamsActionsItem,
Expand Down Expand Up @@ -110,6 +114,8 @@
ElevenLabsVoiceParams,
ElevenLabsVoiceUpdateParams,
ElevenLabsVoiceUpdateParamsApiKey,
ElevenLabsVoiceUpdateParamsModelId,
ElevenLabsVoiceUpdateParamsOptimizeStreamingLatency,
ElevenLabsVoiceUpdateParamsSimilarityBoost,
ElevenLabsVoiceUpdateParamsStability,
ElevenLabsVoiceUpdateParamsVoiceId,
Expand All @@ -131,10 +137,14 @@
NormalizedCall,
NormalizedCallHumanDetectionResult,
NormalizedCallOnNoHumanAnswer,
NormalizedCallTelephonyProvider,
NormalizedPhoneNumber,
NormalizedPhoneNumberTelephonyAccountConnection,
NormalizedPhoneNumberTelephonyProvider,
NormalizedPrompt,
PhoneNumber,
PhoneNumberPage,
PhoneNumberTelephonyProvider,
PineconeVectorDatabase,
PineconeVectorDatabaseParams,
PineconeVectorDatabaseUpdateParams,
Expand Down Expand Up @@ -172,6 +182,8 @@
TransferCallActionUpdateParams,
TransferCallActionUpdateParamsConfig,
TransferCallConfig,
TwilioAccountConnection,
TwilioCredentials,
Undefined,
UpdateNumberRequestInboundAgent,
UpdateNumberRequestLabel,
Expand Down Expand Up @@ -265,6 +277,7 @@
"AgentUpdateParamsConversationSpeed",
"AgentUpdateParamsEndpointingSensitivity",
"AgentUpdateParamsInitialMessage",
"AgentUpdateParamsInitialMessageDelay",
"AgentUpdateParamsInterruptSensitivity",
"AgentUpdateParamsIvrNavigationMode",
"AgentUpdateParamsLanguage",
Expand All @@ -289,11 +302,14 @@
"AzureVoiceUpdateParamsPitch",
"AzureVoiceUpdateParamsRate",
"AzureVoiceUpdateParamsVoiceName",
"BuyPhoneNumberRequest",
"BuyPhoneNumberRequestTelephonyProvider",
"Call",
"CallHumanDetectionResult",
"CallOnNoHumanAnswer",
"CallPage",
"CallStatus",
"CallTelephonyProvider",
"CollectField",
"CreateCallAgentParams",
"CreateCallAgentParamsActionsItem",
Expand Down Expand Up @@ -322,6 +338,8 @@
"ElevenLabsVoiceParams",
"ElevenLabsVoiceUpdateParams",
"ElevenLabsVoiceUpdateParamsApiKey",
"ElevenLabsVoiceUpdateParamsModelId",
"ElevenLabsVoiceUpdateParamsOptimizeStreamingLatency",
"ElevenLabsVoiceUpdateParamsSimilarityBoost",
"ElevenLabsVoiceUpdateParamsStability",
"ElevenLabsVoiceUpdateParamsVoiceId",
Expand All @@ -343,10 +361,14 @@
"NormalizedCall",
"NormalizedCallHumanDetectionResult",
"NormalizedCallOnNoHumanAnswer",
"NormalizedCallTelephonyProvider",
"NormalizedPhoneNumber",
"NormalizedPhoneNumberTelephonyAccountConnection",
"NormalizedPhoneNumberTelephonyProvider",
"NormalizedPrompt",
"PhoneNumber",
"PhoneNumberPage",
"PhoneNumberTelephonyProvider",
"PineconeVectorDatabase",
"PineconeVectorDatabaseParams",
"PineconeVectorDatabaseUpdateParams",
Expand Down Expand Up @@ -384,6 +406,8 @@
"TransferCallActionUpdateParams",
"TransferCallActionUpdateParamsConfig",
"TransferCallConfig",
"TwilioAccountConnection",
"TwilioCredentials",
"Undefined",
"UnprocessableEntityError",
"UpdateNumberRequestInboundAgent",
Expand Down
2 changes: 1 addition & 1 deletion src/vocode/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "vocode-api",
"X-Fern-SDK-Version": "0.0.26",
"X-Fern-SDK-Version": "0.0.27",
}
headers["Authorization"] = f"Bearer {self._get_token()}"
return headers
Expand Down
10 changes: 10 additions & 0 deletions src/vocode/resources/agents/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def create_agent(
endpointing_sensitivity: typing.Optional[AgentParamsEndpointingSensitivity] = OMIT,
ivr_navigation_mode: typing.Optional[AgentParamsIvrNavigationMode] = OMIT,
conversation_speed: typing.Optional[float] = OMIT,
initial_message_delay: typing.Optional[float] = OMIT,
) -> Agent:
"""
Parameters:
Expand Down Expand Up @@ -123,6 +124,8 @@ def create_agent(
- ivr_navigation_mode: typing.Optional[AgentParamsIvrNavigationMode].
- conversation_speed: typing.Optional[float].
- initial_message_delay: typing.Optional[float].
"""
_request: typing.Dict[str, typing.Any] = {"prompt": prompt, "voice": voice}
if language is not OMIT:
Expand All @@ -147,6 +150,8 @@ def create_agent(
_request["ivr_navigation_mode"] = ivr_navigation_mode
if conversation_speed is not OMIT:
_request["conversation_speed"] = conversation_speed
if initial_message_delay is not OMIT:
_request["initial_message_delay"] = initial_message_delay
_response = self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/agents/create"),
Expand Down Expand Up @@ -256,6 +261,7 @@ async def create_agent(
endpointing_sensitivity: typing.Optional[AgentParamsEndpointingSensitivity] = OMIT,
ivr_navigation_mode: typing.Optional[AgentParamsIvrNavigationMode] = OMIT,
conversation_speed: typing.Optional[float] = OMIT,
initial_message_delay: typing.Optional[float] = OMIT,
) -> Agent:
"""
Parameters:
Expand Down Expand Up @@ -284,6 +290,8 @@ async def create_agent(
- ivr_navigation_mode: typing.Optional[AgentParamsIvrNavigationMode].
- conversation_speed: typing.Optional[float].
- initial_message_delay: typing.Optional[float].
"""
_request: typing.Dict[str, typing.Any] = {"prompt": prompt, "voice": voice}
if language is not OMIT:
Expand All @@ -308,6 +316,8 @@ async def create_agent(
_request["ivr_navigation_mode"] = ivr_navigation_mode
if conversation_speed is not OMIT:
_request["conversation_speed"] = conversation_speed
if initial_message_delay is not OMIT:
_request["initial_message_delay"] = initial_message_delay
_response = await self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/agents/create"),
Expand Down
87 changes: 75 additions & 12 deletions src/vocode/resources/numbers/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from ...core.jsonable_encoder import jsonable_encoder
from ...core.remove_none_from_dict import remove_none_from_dict
from ...errors.unprocessable_entity_error import UnprocessableEntityError
from ...types.buy_phone_number_request import BuyPhoneNumberRequest
from ...types.http_validation_error import HttpValidationError
from ...types.phone_number import PhoneNumber
from ...types.phone_number_page import PhoneNumberPage
Expand Down Expand Up @@ -71,18 +72,15 @@ def get_number(self, *, phone_number: str) -> PhoneNumber:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

def buy_number(self, *, area_code: typing.Optional[str] = OMIT) -> PhoneNumber:
def buy_number(self, *, request: BuyPhoneNumberRequest) -> PhoneNumber:
"""
Parameters:
- area_code: typing.Optional[str].
- request: BuyPhoneNumberRequest.
"""
_request: typing.Dict[str, typing.Any] = {}
if area_code is not OMIT:
_request["area_code"] = area_code
_response = self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/numbers/buy"),
json=jsonable_encoder(_request),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
Expand Down Expand Up @@ -156,6 +154,40 @@ def cancel_number(self, *, phone_number: str) -> PhoneNumber:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

def link_number(
self, *, phone_number: str, telephony_account_connection: str, outbound_only: typing.Optional[bool] = OMIT
) -> PhoneNumber:
"""
Parameters:
- phone_number: str.
- telephony_account_connection: str.
- outbound_only: typing.Optional[bool].
"""
_request: typing.Dict[str, typing.Any] = {
"phone_number": phone_number,
"telephony_account_connection": telephony_account_connection,
}
if outbound_only is not OMIT:
_request["outbound_only"] = outbound_only
_response = self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/numbers/link"),
json=jsonable_encoder(_request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(PhoneNumber, _response.json()) # type: ignore
if _response.status_code == 422:
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
try:
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)


class AsyncNumbersClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
Expand Down Expand Up @@ -209,18 +241,15 @@ async def get_number(self, *, phone_number: str) -> PhoneNumber:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

async def buy_number(self, *, area_code: typing.Optional[str] = OMIT) -> PhoneNumber:
async def buy_number(self, *, request: BuyPhoneNumberRequest) -> PhoneNumber:
"""
Parameters:
- area_code: typing.Optional[str].
- request: BuyPhoneNumberRequest.
"""
_request: typing.Dict[str, typing.Any] = {}
if area_code is not OMIT:
_request["area_code"] = area_code
_response = await self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/numbers/buy"),
json=jsonable_encoder(_request),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
Expand Down Expand Up @@ -293,3 +322,37 @@ async def cancel_number(self, *, phone_number: str) -> PhoneNumber:
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

async def link_number(
self, *, phone_number: str, telephony_account_connection: str, outbound_only: typing.Optional[bool] = OMIT
) -> PhoneNumber:
"""
Parameters:
- phone_number: str.
- telephony_account_connection: str.
- outbound_only: typing.Optional[bool].
"""
_request: typing.Dict[str, typing.Any] = {
"phone_number": phone_number,
"telephony_account_connection": telephony_account_connection,
}
if outbound_only is not OMIT:
_request["outbound_only"] = outbound_only
_response = await self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/numbers/link"),
json=jsonable_encoder(_request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(PhoneNumber, _response.json()) # type: ignore
if _response.status_code == 422:
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
try:
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
Loading

0 comments on commit 75fffe1

Please sign in to comment.