Skip to content

VAPI-2714 Update the python SDK to include BRTC endpoint APIs#280

Open
smoghe-bw wants to merge 28 commits intomainfrom
brtc-python-sdk
Open

VAPI-2714 Update the python SDK to include BRTC endpoint APIs#280
smoghe-bw wants to merge 28 commits intomainfrom
brtc-python-sdk

Conversation

@smoghe-bw
Copy link

No description provided.

- Introduced `SipCredentials` model for managing SIP connection credentials.
- Added documentation for `CreateEndpointRequestBase`, `CreateEndpointResponse`, `CreateEndpointResponseObject`, `CreateWebRtcConnectionRequest`, `Device`, `DeviceStatusEnum`, `Endpoint`, `EndpointDirectionEnum`, `EndpointEvent`, `EndpointEventTypeEnum`, `EndpointResponse`, `EndpointStatusEnum`, `EndpointTypeEnum`, `Endpoints`, `EndpointsApi`, `ErrorResponse`, `ListEndpointsResponse`, `Page`, `SipConnectionMetadata`, and `SipCredentials`.
- Implemented example usage in the documentation for each model.
- Implement integration tests for creating, retrieving, listing, and deleting WebRTC endpoints in `test/smoke/test_endpoints_api.py`.
- Add unit tests for models related to endpoint requests and responses, including `CreateEndpointRequestBase`, `CreateEndpointResponse`, `CreateEndpointResponseObject`, `Device`, and their respective enums in the `test/unit/models` directory.
- Ensure tests cover various scenarios including unauthorized and forbidden access attempts.
- Validate the functionality of endpoint events and status enums with dedicated unit tests.
@smoghe-bw smoghe-bw requested review from a team as code owners January 15, 2026 21:43
@bwappsec
Copy link

bwappsec commented Jan 15, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@smoghe-bw smoghe-bw marked this pull request as draft January 15, 2026 21:44
@smoghe-bw smoghe-bw marked this pull request as ready for review January 22, 2026 00:27
@smoghe-bw smoghe-bw changed the title VAPI-2694 Update the python SDK to include BRTC endpoint APIs VAPI-2714 Update the python SDK to include BRTC endpoint APIs Jan 22, 2026

def test_create_endpoint(self):
"""Test creating a new WebRTC endpoint with all parameters"""
time.sleep(self.TEST_SLEEP)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to sleep before every test? this seems like its just making the smoke tests take longer for no reason

time.sleep(self.TEST_SLEEP)

# First create an endpoint
create_request = CreateWebRtcConnectionRequest(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to create a new one or can we just use the endpoint id from the create test?

# Store endpoint ID for cleanup
self.endpoint_id_array.append(response.data.data.endpoint_id)

def test_create_endpoint_minimal(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typically we try to smoke test using as much of the SDK as possible, since the tests in here are meant to test SDK functionality, this test can probably be removed.

endpoint_id = create_response.data.endpoint_id
self.endpoint_id_array.append(endpoint_id)

time.sleep(self.TEST_SLEEP)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a delay on these? all of these sleeps seem like they're mimicking the calls api tests, which need to wait due to latency issues, is that the case here as well?


assert_that(response.status_code, equal_to(201))
assert_that(response.data, instance_of(CreateEndpointResponse))
assert_that(response.data.data, has_properties(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add more assertions here? specifically testing all of links, data, and errors, as well as the properties on those. There are also some other properties on CreateEndpointResponseData we could be asserting here

#
# assert_that(response.status_code, equal_to(204))

def test_create_endpoint_minimal(self) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary test

assert_that(response.status_code, equal_to(201))
assert_that(response.data, instance_of(CreateEndpointResponse))

def test_create_endpoint_sip(self) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also unnecessary, this may be something we want to test in the smoke tests to make sure the API behaves properly, but IMO we shouldnt be testing API functionality in the SDKs, so we can just leave this out

assert instance.event_fallback_url == 'https://example.com/fallback'
assert instance.tag == 'test-request'

def testCreateEndpointRequestBaseRequiredOnly(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we really only care that all of the fields can be serialized, testing the required only props does nothing the full test doesn't already do, this can be removed

assert instance.status == DeviceStatusEnum.CONNECTED
assert isinstance(instance.creation_timestamp, datetime)

def testDeviceRequiredOnly(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be removed, see my comment about it in the create_endpoint_base test
it can also be removed from any following model tests

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only some of the new models added by this PR are unit tested here, we need to have tests for all of the new models. If you remove test/* temporarily from the openpi-generator-ignore it'll generate test files for all of the models, and you can pick out the new ones as a base for the ones still missing here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants