VAPI-2700 Add Endpoint Event Model and Related Enums#173
VAPI-2700 Add Endpoint Event Model and Related Enums#173
Conversation
smoghe-bw
commented
Jan 20, 2026
- Created EndpointEvent class to represent events occurring on endpoints.
- Introduced EndpointEventTypeEnum to define event types (DEVICE_CONNECTED, DEVICE_DISCONNECTED).
- Added EndpointResponse class for handling responses related to endpoints.
- Implemented EndpointStatusEnum to represent endpoint statuses (CONNECTED, DISCONNECTED).
- Added EndpointTypeEnum for defining endpoint types (WEBRTC).
- Created Endpoints class to encapsulate endpoint details.
- Introduced ErrorResponse class for managing error responses.
- Added ListEndpointsResponse class for handling lists of endpoints.
- Implemented Page class for pagination support in endpoint listings.
- Created SipConnectionMetadata class to manage SIP connection details.
- Added SipCredentials class for handling SIP authentication credentials.
- Created EndpointEvent class to represent events occurring on endpoints. - Introduced EndpointEventTypeEnum to define event types (DEVICE_CONNECTED, DEVICE_DISCONNECTED). - Added EndpointResponse class for handling responses related to endpoints. - Implemented EndpointStatusEnum to represent endpoint statuses (CONNECTED, DISCONNECTED). - Added EndpointTypeEnum for defining endpoint types (WEBRTC). - Created Endpoints class to encapsulate endpoint details. - Introduced ErrorResponse class for managing error responses. - Added ListEndpointsResponse class for handling lists of endpoints. - Implemented Page class for pagination support in endpoint listings. - Created SipConnectionMetadata class to manage SIP connection details. - Added SipCredentials class for handling SIP authentication credentials.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
…mprove API client configuration
…update status code assertions
…stead of expected 400
…into brtc-sdk-2
…CreateEndpointTest
- Created tests for CreateEndpointRequestBase, CreateEndpointResponseData, CreateEndpointResponse, CreateWebRtcConnectionRequest, Device, Endpoint, and Endpoints classes. - Implemented serialization and deserialization tests for various models. - Added tests for enum values and their serialization/deserialization for DeviceStatusEnum, EndpointDirectionEnum, EndpointStatusEnum, and EndpointTypeEnum. - Included validation tests to ensure required fields throw exceptions when null. - Enhanced coverage for ListEndpointsResponse and its associated properties.
| } | ||
|
|
||
| [Fact] | ||
| public void SerializationTest() |
There was a problem hiding this comment.
this test is essentially testing the JSON library we use, which is unnecessary, it can be removed here and in the other tests
| EndpointEventTypeEnum connected = EndpointEventTypeEnum.CONNECTED; | ||
| Assert.Equal(EndpointEventTypeEnum.CONNECTED, connected); | ||
| Assert.Equal(1, (int)connected); |
There was a problem hiding this comment.
the integer test isn't helpful here, and just creating an enum twice and asserting they match isnt a real test imo, these tests can be removed
| [Fact] | ||
| public void ConnectedEnumTest() | ||
| { | ||
| Assert.Equal(1, (int)DeviceStatusEnum.CONNECTED); |
There was a problem hiding this comment.
this and the other integer tests for the enums are unnecessary and can be removed
| [Fact] | ||
| public void ConnectedDeserializationTest() | ||
| { | ||
| DeviceStatusEnum result = JsonConvert.DeserializeObject<DeviceStatusEnum>("\"CONNECTED\""); |
There was a problem hiding this comment.
this is essentially testing the JsonConvert library, not testing the enum, it can be removed
| [Fact] | ||
| public void InboundEnumTest() | ||
| { | ||
| Assert.Equal(1, (int)EndpointDirectionEnum.INBOUND); |
| [Fact] | ||
| public void ConnectedEnumTest() | ||
| { | ||
| Assert.Equal(1, (int)EndpointStatusEnum.CONNECTED); |
| [Fact] | ||
| public void WebRtcEnumTest() | ||
| { | ||
| Assert.Equal(1, (int)EndpointTypeEnum.WEBRTC); |
| Assert.IsType<ListEndpointsResponse>(listResponse.Data); | ||
| Assert.IsType<List<Link>>(listResponse.Data.Links); | ||
| Assert.IsType<List<Error>>(listResponse.Data.Errors); | ||
| Assert.IsType<List<Endpoints>>(listResponse.Data.Data); |
There was a problem hiding this comment.
we can assert on the first element in the list since we know we've just created one
| // List with filter | ||
| var filteredResponse = _api.ListEndpoints(_accountId, type: EndpointTypeEnum.WEBRTC, limit: 5); | ||
| Assert.IsType<List<Endpoints>>(filteredResponse.Data); | ||
| foreach (var endpoint in filteredResponse.Data) | ||
| { | ||
| Assert.Equal(EndpointTypeEnum.WEBRTC, endpoint.Type); | ||
| } |
| _accountId = Environment.GetEnvironmentVariable("BW_ACCOUNT_ID"); | ||
| var clientId = Environment.GetEnvironmentVariable("BW_CLIENT_ID"); | ||
| var clientSecret = Environment.GetEnvironmentVariable("BW_CLIENT_SECRET"); |
There was a problem hiding this comment.
can we redo this to make it more like the client initialization in the other smoke tests, just for consistency
|
This PR is also missing some unit tests for some of the new models, make sure to generate them and add those too |
There was a problem hiding this comment.
missing unit tests for this and the endpoint verb
- Remove JSON serialization/deserialization tests from model test files (tests the JSON library, not the model) - Remove integer value tests and JsonConvert tests from enum test files - Remove duplicate enum creation tests from EndpointEventTypeEnumTests - Standardize enum tests to use concise assertion style - Simplify smoke test list assertion to check first element - Remove filter test from smoke tests - Make smoke test client initialization consistent with other smoke tests - Add missing BXML verb tests for Connect and Endpoint - Add missing model unit tests for CreateEndpointRequest, ErrorResponse, Page, SipConnectionMetadata, and SipCredentials Generated from Claude9 with Claude Code Co-Authored-By: Claude Opus 4.6 <[email protected]>