-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added events - Added device events - Added user notifications (internal) - Moved to 1.0.3
- Loading branch information
1 parent
559dbeb
commit 4dc2416
Showing
13 changed files
with
268 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace WifiPlug.Api.Entities | ||
{ | ||
/// <summary> | ||
/// Represents an event. | ||
/// </summary> | ||
public class EventEntity | ||
{ | ||
/// <summary> | ||
/// Gets or sets the timestamp. | ||
/// </summary> | ||
[JsonProperty("time_created")] | ||
public DateTime Timestamp { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the timestamp. | ||
/// </summary> | ||
[JsonProperty("data_format")] | ||
public string DataFormat { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the timestamp. | ||
/// </summary> | ||
[JsonProperty("data")] | ||
public object Data { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the timestamp. | ||
/// </summary> | ||
[JsonProperty("type")] | ||
public string Type { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the timestamp. | ||
/// </summary> | ||
[JsonProperty("uuid")] | ||
public Guid UUID { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the timestamp. | ||
/// </summary> | ||
[JsonProperty("resource_uuid")] | ||
public Guid ResourceUUID { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the resource type. | ||
/// </summary> | ||
[JsonProperty("resource_type")] | ||
public string ResourceType { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace WifiPlug.Api.Entities | ||
{ | ||
/// <summary> | ||
/// Represents the result of a event scan. | ||
/// </summary> | ||
public class EventResultsEntity | ||
{ | ||
/// <summary> | ||
/// Gets or sets the events. | ||
/// </summary> | ||
[JsonProperty(PropertyName = "events")] | ||
public EventEntity[] Events { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the next cursor. | ||
/// </summary> | ||
[JsonProperty(PropertyName = "cursor")] | ||
public string Cursor { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the total number of events. | ||
/// </summary> | ||
[JsonProperty(PropertyName = "total_event_count")] | ||
public int TotalEvents { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace WifiPlug.Api.Entities | ||
{ | ||
/// <summary> | ||
/// Represents a request to add a notification token. | ||
/// </summary> | ||
public class UserNotificationAddEntity | ||
{ | ||
/// <summary> | ||
/// Gets or sets the token. | ||
/// </summary> | ||
[JsonProperty(PropertyName = "token")] | ||
public string Token { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the device type. | ||
/// </summary> | ||
[JsonProperty(PropertyName = "device_type")] | ||
public string DeviceType { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Net.Http; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using WifiPlug.Api.Entities; | ||
|
||
namespace WifiPlug.Api.Operations | ||
{ | ||
/// <summary> | ||
/// Provides operations for event resources. | ||
/// </summary> | ||
public class EventOperations : IEventOperations | ||
{ | ||
/// <summary> | ||
/// The API client. | ||
/// </summary> | ||
protected ApiClient _client; | ||
|
||
/// <summary> | ||
/// Gets a event by UUID. | ||
/// </summary> | ||
/// <param name="eventUuid">The UUID.</param> | ||
/// <param name="cancellationToken">The cancellation token.</param> | ||
/// <returns>The event.</returns> | ||
public Task<EventEntity> GetEventAsync(Guid eventUuid, CancellationToken cancellationToken = default(CancellationToken)) { | ||
return _client.RequestJsonSerializedAsync<EventEntity>(HttpMethod.Get, $"event/{eventUuid}", cancellationToken); | ||
} | ||
|
||
internal EventOperations(ApiClient client) { | ||
_client = client; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using WifiPlug.Api.Entities; | ||
|
||
namespace WifiPlug.Api.Operations | ||
{ | ||
/// <summary> | ||
/// Defines an interface for performing event operations. | ||
/// </summary> | ||
public interface IEventOperations | ||
{ | ||
/// <summary> | ||
/// Gets a event by UUID. | ||
/// </summary> | ||
/// <param name="eventUuid">The UUID.</param> | ||
/// <param name="cancellationToken">The cancellation token.</param> | ||
/// <returns>The event.</returns> | ||
Task<EventEntity> GetEventAsync(Guid eventUuid, CancellationToken cancellationToken = default(CancellationToken)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters