diff --git a/Octokit.Tests/Clients/EventsClientTests.cs b/Octokit.Tests/Clients/EventsClientTests.cs
index 8be648f6f6..ccce328bbf 100644
--- a/Octokit.Tests/Clients/EventsClientTests.cs
+++ b/Octokit.Tests/Clients/EventsClientTests.cs
@@ -560,6 +560,7 @@ public async Task EnsuresNonNullArguments()
{"PullRequestEvent", typeof(PullRequestEventPayload)},
{"PullRequestReviewCommentEvent", typeof(PullRequestCommentPayload)},
{"PushEvent", typeof(PushEventPayload)},
+ {"StatusEvent", typeof(StatusEventPayload)},
{"WatchEvent", typeof(StarredEventPayload)},
{"unknown", typeof(ActivityPayload)}
};
@@ -810,6 +811,55 @@ public async Task DeserializesPushEventCorrectly()
Assert.Equal("message", payload.Commits.FirstOrDefault().Message);
}
+ [Fact]
+ public async Task DeserializesStatusEventCorrectly()
+ {
+ var jsonObj = new JsonObject
+ {
+ { "type", "StatusEvent" },
+ {
+ "payload", new
+ {
+ id = 214015194,
+ sha = "9049f1265b7d61be4a8904a9a27120d2064dab3b",
+ name = "baxterthehacker/public-repo",
+ target_url = "https://www.some_target_url.com",
+ context = "default",
+ description = "some human readable text",
+ state = "success",
+ branches = new []
+ {
+ new
+ {
+ name = "master",
+ commit = new
+ {
+ sha = "9049f1265b7d61be4a8904a9a27120d2064dab3b",
+ url = "https://api.github.com/repos/baxterthehacker/public-repo/commits/9049f1265b7d61be4a8904a9a27120d2064dab3b"
+ }
+ }
+ },
+ created_at = "2015-05-05T23:40:39Z"
+ }
+ }
+ };
+
+ var client = GetTestingEventsClient(jsonObj);
+ var activities = await client.GetAll();
+ Assert.Equal(1, activities.Count);
+
+ var payload = activities.FirstOrDefault().Payload as StatusEventPayload;
+ Assert.Equal(214015194, payload.Id);
+ Assert.Equal("9049f1265b7d61be4a8904a9a27120d2064dab3b", payload.Sha);
+ Assert.Equal("baxterthehacker/public-repo", payload.Name);
+ Assert.Equal("https://www.some_target_url.com", payload.TargetUrl);
+ Assert.Equal("default", payload.Context);
+ Assert.Equal("some human readable text", payload.Description);
+ Assert.Equal(CommitState.Success, payload.State.Value);
+ Assert.Equal(1, payload.Branches.Count);
+ Assert.Equal(new DateTimeOffset(2015, 05, 05, 23, 40, 39, TimeSpan.Zero), payload.CreatedAt);
+ }
+
[Fact]
public async Task DeserializesStarredEventCorrectly()
{
diff --git a/Octokit/Http/SimpleJsonSerializer.cs b/Octokit/Http/SimpleJsonSerializer.cs
index 429e9d4090..e450d66c1f 100644
--- a/Octokit/Http/SimpleJsonSerializer.cs
+++ b/Octokit/Http/SimpleJsonSerializer.cs
@@ -225,6 +225,8 @@ private static Type GetPayloadType(string activityType)
return typeof(PullRequestCommentPayload);
case "PushEvent":
return typeof(PushEventPayload);
+ case "StatusEvent":
+ return typeof(StatusEventPayload);
case "WatchEvent":
return typeof(StarredEventPayload);
}
diff --git a/Octokit/Models/Response/ActivityPayloads/StatusEventPayload.cs b/Octokit/Models/Response/ActivityPayloads/StatusEventPayload.cs
new file mode 100644
index 0000000000..f3e39749b9
--- /dev/null
+++ b/Octokit/Models/Response/ActivityPayloads/StatusEventPayload.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+
+namespace Octokit
+{
+ [DebuggerDisplay("{DebuggerDisplay,nq}")]
+ public class StatusEventPayload : ActivityPayload
+ {
+ ///
+ /// The name of the repository.
+ ///
+ public string Name { get; protected set; }
+
+ ///
+ /// The SHA of the reference.
+ ///
+ public string Sha { get; protected set; }
+
+ ///
+ /// The date the commit status was created.
+ ///
+ public DateTimeOffset CreatedAt { get; protected set; }
+
+ ///
+ /// The date the commit status was updated.
+ ///
+ public DateTimeOffset UpdatedAt { get; protected set; }
+
+ ///
+ /// The state of the commit
+ ///
+ public StringEnum State { get; protected set; }
+
+ ///
+ /// URL associated with this status. GitHub.com displays this URL as a link to allow users to easily see the
+ /// ‘source’ of the Status.
+ ///
+ public string TargetUrl { get; protected set; }
+
+ ///
+ /// Short description of the status.
+ ///
+ public string Description { get; protected set; }
+
+ ///
+ /// A string label to differentiate this status from the status of other systems.
+ ///
+ public string Context { get; protected set; }
+
+ ///
+ /// The unique identifier of the status.
+ ///
+ public long Id { get; protected set; }
+
+ ///
+ /// The relevant commit.
+ ///
+ public GitHubCommit Commit { get; protected set; }
+
+ ///
+ /// The organization associated with the event.
+ ///
+ public Organization Organization { get; protected set; }
+
+ ///
+ /// The branches involved.
+ ///
+ public IReadOnlyList Branches { get; protected set; }
+
+ }
+}