Skip to content

Commit 9a37972

Browse files
committed
Merge branch 'release/0.103.0'
2 parents aff0c5d + 3c72b42 commit 9a37972

File tree

48 files changed

+1511
-67
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1511
-67
lines changed

Source/ZoomNet.IntegrationTests/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private static void ConfigureServices(IServiceCollection services)
119119
// This is to ensure that we don't get overwhelmed by too many debug messages in the console.
120120
LogLevelSuccessfulCalls = LogLevel.Trace,
121121
LogLevelFailedCalls = LogLevel.Error,
122-
};
122+
}.WithCanadaBaseUrl();
123123

124124
// Get the connection info
125125
var connectionInfo = GetConnectionInfo(_connectionType, _testType);

Source/ZoomNet.IntegrationTests/Tests/Contacts.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@ public async Task RunAsync(User myUser, string[] myPermissions, IZoomClient clie
1111
{
1212
await log.WriteLineAsync("\n***** CONTACTS *****\n").ConfigureAwait(false);
1313

14-
var paginatedSearchedContacts = await client.Contacts.SearchAsync("zzz", true, 1, null, cancellationToken).ConfigureAwait(false);
15-
await log.WriteLineAsync($"Found {paginatedSearchedContacts.TotalRecords} contacts").ConfigureAwait(false);
14+
var keyword = "zzz";
15+
var paginatedSearchedContacts = await client.Contacts.SearchAsync(keyword, true, 1, null, cancellationToken).ConfigureAwait(false);
16+
await log.WriteLineAsync($"Found {paginatedSearchedContacts.TotalRecords} contacts containing the keyword: {keyword}").ConfigureAwait(false);
17+
18+
/*
19+
* ===============================================================================
20+
* The `GetAsync` and `GetAllAsync` methods cannot be used by a S2S OAuth app.
21+
* ===============================================================================
1622
1723
var contact = await client.Contacts.GetAsync(myUser.Id, true, cancellationToken).ConfigureAwait(false);
1824
await log.WriteLineAsync($"{contact.EmailAddress} is {contact.PresenceStatus}").ConfigureAwait(false);
@@ -22,6 +28,7 @@ public async Task RunAsync(User myUser, string[] myPermissions, IZoomClient clie
2228
2329
var paginatedExternalContacts = await client.Contacts.GetAllAsync(ContactType.External, 50, null, cancellationToken).ConfigureAwait(false);
2430
await log.WriteLineAsync($"There are {paginatedExternalContacts.TotalRecords} external contacts for user {myUser.Id}").ConfigureAwait(false);
31+
*/
2532
}
2633
}
2734
}

Source/ZoomNet.UnitTests/PhoneWebhookParserTests.cs

Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,116 @@ public void PhoneWarmTransferInitiated()
767767
parsedEvent.TransferCallId.ShouldBe("6986878782238080584");
768768
}
769769

770+
[Fact]
771+
public void PhoneAiCallSummaryChanged()
772+
{
773+
var parsedEvent = ParseWebhookEvent<PhoneAiCallSummaryChangedEvent>(Resource.phone_ai_call_summary_changed_webhook);
774+
775+
parsedEvent.EventType.ShouldBe(ZoomNet.Models.Webhooks.EventType.PhoneAiCallSummaryChanged);
776+
parsedEvent.Timestamp.ShouldBe(eventTimestamp);
777+
parsedEvent.AccountId.ShouldBe(AccountId);
778+
779+
VerifyAiCallSummary(parsedEvent.CallSummary);
780+
}
781+
782+
[Fact]
783+
public void PhoneConferenceStarted()
784+
{
785+
var parsedEvent = ParseWebhookEvent<PhoneConferenceStartedEvent>(Resource.phone_conference_started_webhook);
786+
787+
parsedEvent.EventType.ShouldBe(ZoomNet.Models.Webhooks.EventType.PhoneConferenceStarted);
788+
parsedEvent.Timestamp.ShouldBe(eventTimestamp);
789+
parsedEvent.AccountId.ShouldBe(AccountId);
790+
791+
parsedEvent.ConferenceCall.ShouldNotBeNull();
792+
parsedEvent.ConferenceCall.Id.ShouldBe("2074969d-621f-41d3-890c-8a44a03fa3e0");
793+
parsedEvent.ConferenceCall.CallId.ShouldBe(CallId);
794+
parsedEvent.ConferenceCall.StartedOn.ShouldBe(timestamp);
795+
parsedEvent.ConferenceCall.EnableMultiplePartyConference.ShouldBeTrue();
796+
parsedEvent.ConferenceCall.FailureReason.ShouldBeEmpty();
797+
798+
VerifyCallOwnerInfo(parsedEvent.ConferenceCall.Owner);
799+
}
800+
801+
[Fact]
802+
public void PhoneDeviceRegistration()
803+
{
804+
var parsedEvent = ParseWebhookEvent<PhoneDeviceRegistrationEvent>(Resource.phone_device_registration_webhook);
805+
806+
parsedEvent.EventType.ShouldBe(ZoomNet.Models.Webhooks.EventType.PhoneDeviceRegistration);
807+
parsedEvent.Timestamp.ShouldBe(eventTimestamp);
808+
parsedEvent.AccountId.ShouldBe(AccountId);
809+
810+
parsedEvent.Device.ShouldNotBeNull();
811+
parsedEvent.Device.Id.ShouldBe("JOZmuJ30Spyrw-v9vUzIrA");
812+
parsedEvent.Device.Name.ShouldBe("New_DeskPhone");
813+
parsedEvent.Device.MacAddress.ShouldBe("012345678912");
814+
}
815+
816+
[Fact]
817+
public void PhoneEmergencyAlert()
818+
{
819+
var parsedEvent = ParseWebhookEvent<PhoneEmergencyAlertEvent>(Resource.phone_emergency_alert_webhook);
820+
821+
parsedEvent.EventType.ShouldBe(ZoomNet.Models.Webhooks.EventType.PhoneEmergencyAlert);
822+
parsedEvent.Timestamp.ShouldBe(eventTimestamp);
823+
parsedEvent.AccountId.ShouldBe(AccountId);
824+
825+
VerifyEmergencyCallAlert(parsedEvent.Alert);
826+
}
827+
828+
[Fact]
829+
public void PhoneGenericDeviceProvision()
830+
{
831+
var parsedEvent = ParseWebhookEvent<PhoneGenericDeviceProvisionEvent>(Resource.phone_generic_device_provision_webhook);
832+
833+
parsedEvent.EventType.ShouldBe(ZoomNet.Models.Webhooks.EventType.PhoneGenericDeviceProvision);
834+
parsedEvent.Timestamp.ShouldBe(eventTimestamp);
835+
parsedEvent.AccountId.ShouldBe(AccountId);
836+
837+
VerifyPhoneDevice(parsedEvent.Device);
838+
}
839+
840+
[Fact]
841+
public void PhonePeeringNumberCallerIdNameUpdated()
842+
{
843+
var parsedEvent = ParseWebhookEvent<PhonePeeringNumberCallerIdNameUpdatedEvent>(Resource.phone_peering_number_cnam_updated_webhook);
844+
845+
VerifyPeeringNumberUpdatedEvent(parsedEvent, ZoomNet.Models.Webhooks.EventType.PhonePeeringNumberCallerIdNameUpdated);
846+
847+
VerifyWebhookPeeringNumberUpdate(parsedEvent.PeeringNumber);
848+
}
849+
850+
[Fact]
851+
public void PhonePeeringNumberEmergencyAddressUpdated()
852+
{
853+
var parsedEvent = ParseWebhookEvent<PhonePeeringNumberEmergencyAddressUpdatedEvent>(Resource.phone_peering_number_emergency_address_updated_webhook);
854+
855+
VerifyPeeringNumberUpdatedEvent(parsedEvent, ZoomNet.Models.Webhooks.EventType.PhonePeeringNumberEmergencyAddressUpdated);
856+
857+
VerifyWebhookPeeringNumberUpdate(parsedEvent.PeeringNumber, callerIdName: null);
858+
}
859+
860+
[Fact]
861+
public void NumberManagementPeeringNumberCallerIdNameUpdated()
862+
{
863+
var parsedEvent = ParseWebhookEvent<NumberManagementPeeringNumberCallerIdNameUpdatedEvent>(Resource.number_management_peering_number_cnam_updated_webhook);
864+
865+
VerifyPeeringNumberUpdatedEvent(parsedEvent, ZoomNet.Models.Webhooks.EventType.NumberManagementPeeringNumberCallerIdNameUpdated);
866+
867+
VerifyWebhookPeeringNumberUpdate(parsedEvent.PeeringNumber);
868+
}
869+
870+
[Fact]
871+
public void NumberManagementPeeringNumberEmergencyAddressUpdated()
872+
{
873+
var parsedEvent = ParseWebhookEvent<NumberManagementPeeringNumberEmergencyAddressUpdatedEvent>(Resource.number_management_peering_number_emergency_address_updated_webhook);
874+
875+
VerifyPeeringNumberUpdatedEvent(parsedEvent, ZoomNet.Models.Webhooks.EventType.NumberManagementPeeringNumberEmergencyAddressUpdated);
876+
877+
VerifyWebhookPeeringNumberUpdate(parsedEvent.PeeringNumber, callerIdName: null);
878+
}
879+
770880
#endregion
771881

772882
#region private methods
@@ -1294,6 +1404,151 @@ private static void VerifyCallTransferRecipient(WebhookCallTransferRecipient inf
12941404
info.Name.ShouldBe("Jane Smith");
12951405
}
12961406

1407+
/// <summary>
1408+
/// Verify <see cref="AiCallSummary"/> properties.
1409+
/// </summary>
1410+
private static void VerifyAiCallSummary(AiCallSummary summary)
1411+
{
1412+
summary.ShouldNotBeNull();
1413+
summary.Id.ShouldBe("iNsfqK6gQOCiILiKhrlLqQ");
1414+
summary.CallId.ShouldBe(CallId);
1415+
summary.UserId.ShouldBe("FvB3CRfOQUuhF1IOB176Tg");
1416+
summary.CreatedOn.ShouldBe(new DateTime(2023, 10, 8, 16, 12, 4));
1417+
summary.ModifiedOn.ShouldBe(new DateTime(2023, 10, 8, 16, 13, 5));
1418+
summary.IsModified.ShouldBeTrue();
1419+
summary.IsDeleted.ShouldBeFalse();
1420+
1421+
summary.CallLogIds.ShouldNotBeNull();
1422+
summary.CallLogIds.Length.ShouldBe(2);
1423+
summary.CallLogIds.ShouldBeSubsetOf(new[] { "6afdf3e3-87e3-47d0-834c-6ee3598e3b96", "6afdf3e3-87e3-47d0-834c-6ee3598e3b00" });
1424+
}
1425+
1426+
/// <summary>
1427+
/// Verify <see cref="EmergencyCallAlert"/> properties.
1428+
/// </summary>
1429+
private static void VerifyEmergencyCallAlert(EmergencyCallAlert alert)
1430+
{
1431+
alert.ShouldNotBeNull();
1432+
alert.CallId.ShouldBe(CallId);
1433+
alert.Router.ShouldBe(EmergencyCallSource.Zoom);
1434+
alert.DeliverTo.ShouldBe(EmergencyCallDestination.SafetyTeam);
1435+
alert.RingingStartedOn.ShouldBe(ringingStartedTimestamp);
1436+
1437+
alert.Callee.ShouldNotBeNull();
1438+
alert.Callee.PhoneNumber.ShouldBe("933");
1439+
1440+
alert.Caller.ShouldNotBeNull();
1441+
alert.Caller.UserId.ShouldBe("DnEopNmXQEGU2uvvzjgojw");
1442+
alert.Caller.ExtensionNumber.ShouldBe("1002");
1443+
alert.Caller.ExtensionType.ShouldBe(EmergencyCallExtensionType.User);
1444+
alert.Caller.DisplayName.ShouldBe("pbxta api");
1445+
alert.Caller.SiteId.ShouldBe(SiteId);
1446+
alert.Caller.SiteName.ShouldBe("Main Site");
1447+
alert.Caller.PhoneNumber.ShouldBe("+12192818492");
1448+
alert.Caller.Timezone.ShouldBe(TimeZones.America_Los_Angeles);
1449+
1450+
alert.Location.ShouldNotBeNull();
1451+
alert.Location.BssId.ShouldNotBeNull();
1452+
alert.Location.BssId.ShouldHaveSingleItem();
1453+
alert.Location.BssId[0].ShouldBe("fc:7f:49:12:45:01");
1454+
alert.Location.Gps.ShouldNotBeNull();
1455+
alert.Location.Gps.ShouldHaveSingleItem();
1456+
alert.Location.Gps[0].ShouldBe("31.29846,120.6645");
1457+
alert.Location.IpAddress.ShouldNotBeNull();
1458+
alert.Location.IpAddress.ShouldHaveSingleItem();
1459+
alert.Location.IpAddress[0].ShouldBe("192.0.2.1,192.0.2.2");
1460+
1461+
VerifyEmergencyAddress(alert.EmergencyAddress);
1462+
}
1463+
1464+
/// <summary>
1465+
/// Verify <see cref="EmergencyAddress"/> properties.
1466+
/// </summary>
1467+
private static void VerifyEmergencyAddress(EmergencyAddress address)
1468+
{
1469+
address.ShouldNotBeNull();
1470+
address.AddressLine1.ShouldBe("55 ALMADEN BLVD");
1471+
address.AddressLine2.ShouldBe("8 Floor");
1472+
address.City.ShouldBe("San Jose");
1473+
address.Country.ShouldBe("US");
1474+
address.StateCode.ShouldBe("CA");
1475+
address.Zip.ShouldBe("95113");
1476+
}
1477+
1478+
/// <summary>
1479+
/// Verify <see cref="PhoneDevice"/> properties.
1480+
/// </summary>
1481+
private static void VerifyPhoneDevice(PhoneDevice device)
1482+
{
1483+
device.ShouldNotBeNull();
1484+
device.Id.ShouldBe("JOZmuJ30Spyrw-v9vUzIrA");
1485+
device.DisplayName.ShouldBe("test_cap");
1486+
device.Type.ShouldBe("Other");
1487+
device.MacAddress.ShouldBe("012345678912");
1488+
1489+
device.Site.ShouldNotBeNull();
1490+
device.Site.Id.ShouldBe(SiteId);
1491+
device.Site.Name.ShouldBe("Main Site");
1492+
1493+
device.Provision.ShouldNotBeNull();
1494+
device.Provision.Type.ShouldBe(DeviceProvisioningType.Manual);
1495+
device.Provision.SipAccounts.ShouldNotBeNull();
1496+
device.Provision.SipAccounts.ShouldHaveSingleItem();
1497+
1498+
SipAccount sipAccount = device.Provision.SipAccounts[0];
1499+
1500+
sipAccount.AuthorizationId.ShouldBe("875586205903");
1501+
sipAccount.OutboundProxy.ShouldBe("example.com");
1502+
sipAccount.Password.ShouldBe("4dL09r0H");
1503+
sipAccount.SecondaryOutboundProxy.ShouldBe("example.com");
1504+
sipAccount.SipDomain.ShouldBe("example.com");
1505+
sipAccount.UserName.ShouldBe("83600015247557791369");
1506+
1507+
SharedLine sharedLine = sipAccount.SharedLine;
1508+
1509+
sharedLine.ShouldNotBeNull();
1510+
sharedLine.Alias.ShouldBe("Example line");
1511+
sharedLine.OutboundCallerId.ShouldBe(PhoneNumberB);
1512+
sharedLine.LineSubscription.ShouldNotBeNull();
1513+
sharedLine.LineSubscription.PhoneNumber.ShouldBe(PhoneNumberA);
1514+
sharedLine.LineSubscription.ExtensionNumber.ShouldBe(1040);
1515+
sharedLine.LineSubscription.DisplayName.ShouldBe("test_cap");
1516+
}
1517+
1518+
/// <summary>
1519+
/// Verify <see cref="PeeringNumberUpdatedEvent"/> properties.
1520+
/// </summary>
1521+
private static void VerifyPeeringNumberUpdatedEvent(PeeringNumberUpdatedEvent parsedEvent, ZoomNet.Models.Webhooks.EventType eventType)
1522+
{
1523+
parsedEvent.EventType.ShouldBe(eventType);
1524+
parsedEvent.Timestamp.ShouldBe(eventTimestamp);
1525+
parsedEvent.AccountId.ShouldBe(AccountId);
1526+
}
1527+
1528+
/// <summary>
1529+
/// Verify <see cref="WebhookPeeringNumberUpdate"/> properties.
1530+
/// </summary>
1531+
private static void VerifyWebhookPeeringNumberUpdate(WebhookPeeringNumberUpdate info, string callerIdName = "name")
1532+
{
1533+
info.ShouldNotBeNull();
1534+
info.CarrierCode.ShouldBe(3457);
1535+
info.PhoneNumbers.ShouldNotBeNull();
1536+
info.PhoneNumbers.ShouldHaveSingleItem();
1537+
info.PhoneNumbers[0].ShouldBe("+18008001000");
1538+
1539+
if (!string.IsNullOrEmpty(callerIdName))
1540+
{
1541+
info.CallerIdName.ShouldBe(callerIdName);
1542+
info.EmergencyAddress.ShouldBeNull();
1543+
}
1544+
else
1545+
{
1546+
VerifyEmergencyAddress(info.EmergencyAddress);
1547+
1548+
info.CallerIdName.ShouldBeNull();
1549+
}
1550+
}
1551+
12971552
#endregion
12981553
}
12991554
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
using Shouldly;
2+
using System;
3+
using Xunit;
4+
using ZoomNet.Utilities;
5+
6+
namespace ZoomNet.UnitTests.Utilities
7+
{
8+
public class ZoomClientOptionsTests
9+
{
10+
[Fact]
11+
public void Uses_global_url_by_default()
12+
{
13+
// Arrange
14+
var options = new ZoomClientOptions();
15+
16+
// Assert
17+
options.ApiBaseUrl.Host.ShouldBe("api.zoom.us");
18+
}
19+
20+
[Fact]
21+
public void Can_use_australia_url()
22+
{
23+
// Arrange
24+
var options = new ZoomClientOptions().WithAustraliaBaseUrl();
25+
26+
// Assert
27+
options.ApiBaseUrl.Host.ShouldBe("api-au.zoom.us");
28+
}
29+
30+
[Fact]
31+
public void Can_use_canada_url()
32+
{
33+
// Arrange
34+
var options = new ZoomClientOptions().WithCanadaBaseUrl();
35+
36+
// Assert
37+
options.ApiBaseUrl.Host.ShouldBe("api-ca.zoom.us");
38+
}
39+
40+
[Fact]
41+
public void Can_use_europe_url()
42+
{
43+
// Arrange
44+
var options = new ZoomClientOptions().WithEuropeanUnionBaseUrl();
45+
46+
// Assert
47+
options.ApiBaseUrl.Host.ShouldBe("api-eu.zoom.us");
48+
}
49+
50+
[Fact]
51+
public void Can_use_india_url()
52+
{
53+
// Arrange
54+
var options = new ZoomClientOptions().WithIndiaBaseUrl();
55+
56+
// Assert
57+
options.ApiBaseUrl.Host.ShouldBe("api-in.zoom.us");
58+
}
59+
60+
[Fact]
61+
public void Can_use_saudi_arabia_url()
62+
{
63+
// Arrange
64+
var options = new ZoomClientOptions().WithSaudiArabiaBaseUrl();
65+
66+
// Assert
67+
options.ApiBaseUrl.Host.ShouldBe("api-sa.zoom.us");
68+
}
69+
70+
[Fact]
71+
public void Can_use_singapore_url()
72+
{
73+
// Arrange
74+
var options = new ZoomClientOptions().WithSingaporeBaseUrl();
75+
76+
// Assert
77+
options.ApiBaseUrl.Host.ShouldBe("api-sg.zoom.us");
78+
}
79+
80+
[Fact]
81+
public void Can_use_united_states_url()
82+
{
83+
// Arrange
84+
var options = new ZoomClientOptions().WithUnitedStatesBaseUrl();
85+
86+
// Assert
87+
options.ApiBaseUrl.Host.ShouldBe("api-us.zoom.us");
88+
}
89+
}
90+
}

0 commit comments

Comments
 (0)