-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathNotification.cs
79 lines (62 loc) · 2.89 KB
/
Notification.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license.
* See LICENSE in the source repository root for complete license information.
*/
using System;
using Newtonsoft.Json;
namespace MicrosoftGraph_Security_API_Sample.Models
{
// A change notification.
public class Notification
{
// The type of change.
[JsonProperty(PropertyName = "changeType")]
public string ChangeType { get; set; }
// The client state used to verify that the notification is from Microsoft Graph. Compare the value received with the notification to the value you sent with the subscription request.
[JsonProperty(PropertyName = "clientState")]
public string ClientState { get; set; }
// The endpoint of the resource that changed. For example, a message uses the format ../Users/{user-id}/Messages/{message-id}
[JsonProperty(PropertyName = "resource")]
public string Resource { get; set; }
// The UTC date and time when the webhooks subscription expires.
[JsonProperty(PropertyName = "subscriptionExpirationDateTime")]
public DateTimeOffset SubscriptionExpirationDateTime { get; set; }
// The unique identifier for the webhooks subscription.
[JsonProperty(PropertyName = "subscriptionId")]
public string SubscriptionId { get; set; }
// The unique identifier for the webhooks subscription.
[JsonProperty(PropertyName = "entityId")]
public string EntityId { get; set; }
// Properties of the changed resource.
[JsonProperty(PropertyName = "resourceData")]
public ResourceData ResourceData { get; set; }
}
public class ResourceData
{
// The ID of the resource.
[JsonProperty(PropertyName = "id")]
public string Id { get; set; }
// The OData etag property.
[JsonProperty(PropertyName = "@odata.etag")]
public string ODataEtag { get; set; }
// The OData ID of the resource. This is the same value as the resource property.
[JsonProperty(PropertyName = "@odata.id")]
public string ODataId { get; set; }
// The OData type of the resource: "#Microsoft.Graph.Message", "#Microsoft.Graph.Event", or "#Microsoft.Graph.Contact".
[JsonProperty(PropertyName = "@odata.type")]
public string ODataType { get; set; }
}
// The data that displays in the Notification view.
public class NotificationViewModel
{
public Notification Message { get; set; }
// The ID of the user associated with the subscription.
// Used to filter messages to display in the client.
public string id { get; set; }
public NotificationViewModel(Notification message, string sid)
{
Message = message;
id = sid;
}
}
}