Skip to content

Commit

Permalink
Merge branch 'release/0.61.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jericho committed May 1, 2023
2 parents 1297dc3 + b62d007 commit d4295a4
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
38 changes: 38 additions & 0 deletions Source/ZoomNet.UnitTests/WebhookParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,26 @@ public class WebhookParserTests
}
}";

private const string WEBINAR_ENDED_WEBHOOK = @"
{
""event"": ""webinar.ended"",
""event_ts"": 1626230691572,
""payload"": {
""account_id"": ""AAAAAABBBB"",
""object"": {
""id"": ""1234567890"",
""uuid"": ""4444AAAiAAAAAiAiAiiAii=="",
""host_id"": ""x1yCzABCDEfg23HiJKl4mN"",
""topic"": ""My Webinar"",
""type"": 5,
""start_time"": ""2021-07-13T21:44:51Z"",
""timezone"": ""America/Los_Angeles"",
""duration"": 60,
""end_time"": ""2021-07-13T23:00:51Z""
}
}
}";

#endregion

[Fact]
Expand Down Expand Up @@ -323,5 +343,23 @@ public void MeetingServiceIssue()
parsedMeeting.Duration.ShouldBe(60);
parsedMeeting.Timezone.ShouldBe("America/Los_Angeles");
}

[Fact]
public void WebinarEnded()
{
var parsedEvent = (WebinarEndedEvent)new WebhookParser().ParseEventWebhook(WEBINAR_ENDED_WEBHOOK);

parsedEvent.EventType.ShouldBe(EventType.WebinarEnded);
parsedEvent.Timestamp.ShouldBe(1626230691572.FromUnixTime(Internal.UnixTimePrecision.Milliseconds));
parsedEvent.Webinar.ShouldNotBeNull();
parsedEvent.Webinar.Uuid.ShouldBe("4444AAAiAAAAAiAiAiiAii==");
parsedEvent.Webinar.Id.ShouldBe(1234567890);
parsedEvent.Webinar.HostId.ShouldBe("x1yCzABCDEfg23HiJKl4mN");
parsedEvent.Webinar.Topic.ShouldBe("My Webinar");
parsedEvent.Webinar.Type.ShouldBe(WebinarType.Regular);
parsedEvent.Webinar.JoinUrl.ShouldBeNull();
parsedEvent.Webinar.Password.ShouldBeNull();
parsedEvent.Webinar.Settings.ShouldBeNull();
}
}
}
2 changes: 1 addition & 1 deletion Source/ZoomNet.UnitTests/ZoomNet.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="RichardSzalay.MockHttp" Version="6.0.0" />
<PackageReference Include="Shouldly" Version="4.1.0" />
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
Expand Down
5 changes: 5 additions & 0 deletions Source/ZoomNet/Models/Webinar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ public abstract class Webinar
/// The id.
/// </value>
[JsonPropertyName("id")]

// This allows us to overcome the fact that "id" is sometimes a string and sometimes a number
// See: https://devforum.zoom.us/t/the-data-type-of-meetingid-is-inconsistent-in-webhook-documentation/70090
// Also, see: https://github.com/Jericho/ZoomNet/issues/228
[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString)]
public long Id { get; set; }

/// <summary>
Expand Down

0 comments on commit d4295a4

Please sign in to comment.