Skip to content

VAPI-2700 Add Endpoint Event Model and Related Enums#173

Open
smoghe-bw wants to merge 21 commits intomainfrom
brtc-sdk-2
Open

VAPI-2700 Add Endpoint Event Model and Related Enums#173
smoghe-bw wants to merge 21 commits intomainfrom
brtc-sdk-2

Conversation

@smoghe-bw
Copy link

  • 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.
@smoghe-bw smoghe-bw changed the title Add Endpoint Event Model and Related Enums VAPI-2700 Add Endpoint Event Model and Related Enums Jan 20, 2026
@bwappsec
Copy link

bwappsec commented Jan 20, 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 ready for review January 22, 2026 19:43
@smoghe-bw smoghe-bw requested review from a team as code owners January 22, 2026 19:43
smoghe-bw and others added 13 commits January 27, 2026 10:31
- 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()
Copy link
Contributor

Choose a reason for hiding this comment

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

this test is essentially testing the JSON library we use, which is unnecessary, it can be removed here and in the other tests

Comment on lines +61 to +63
EndpointEventTypeEnum connected = EndpointEventTypeEnum.CONNECTED;
Assert.Equal(EndpointEventTypeEnum.CONNECTED, connected);
Assert.Equal(1, (int)connected);
Copy link
Contributor

Choose a reason for hiding this comment

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

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);
Copy link
Contributor

Choose a reason for hiding this comment

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

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\"");
Copy link
Contributor

Choose a reason for hiding this comment

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

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);
Copy link
Contributor

Choose a reason for hiding this comment

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

can be removed

[Fact]
public void ConnectedEnumTest()
{
Assert.Equal(1, (int)EndpointStatusEnum.CONNECTED);
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

[Fact]
public void WebRtcEnumTest()
{
Assert.Equal(1, (int)EndpointTypeEnum.WEBRTC);
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

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);
Copy link
Contributor

Choose a reason for hiding this comment

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

we can assert on the first element in the list since we know we've just created one

Comment on lines +73 to +79
// 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);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

this test can be removed

Comment on lines +19 to +21
_accountId = Environment.GetEnvironmentVariable("BW_ACCOUNT_ID");
var clientId = Environment.GetEnvironmentVariable("BW_CLIENT_ID");
var clientSecret = Environment.GetEnvironmentVariable("BW_CLIENT_SECRET");
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 redo this to make it more like the client initialization in the other smoke tests, just for consistency

@ckoegel
Copy link
Contributor

ckoegel commented Mar 24, 2026

This PR is also missing some unit tests for some of the new models, make sure to generate them and add those too

Copy link
Contributor

Choose a reason for hiding this comment

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

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]>
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