diff --git a/PocketSharp/Components/Account.cs b/PocketSharp/Components/Account.cs index d194aac..60e0c14 100644 --- a/PocketSharp/Components/Account.cs +++ b/PocketSharp/Components/Account.cs @@ -1,4 +1,4 @@ -using PocketSharp.Models; +using PocketSharp.Models; using System; using System.Collections.Generic; using System.Threading; @@ -124,5 +124,19 @@ namespace PocketSharp return response; } + + + /// + /// Get a new GUID from the Pocket API. + /// + /// The cancellation token. + /// + /// The GUID + /// + public async Task GetGuid(CancellationToken cancellationToken = default(CancellationToken)) + { + GuidResponse response = await Request("guid", cancellationToken, requireAuth: false); + return response.Guid; + } } } diff --git a/PocketSharp/IPocketClient.cs b/PocketSharp/IPocketClient.cs index 5bc1d48..feb0b61 100644 --- a/PocketSharp/IPocketClient.cs +++ b/PocketSharp/IPocketClient.cs @@ -1,4 +1,4 @@ -using PocketSharp.Models; +using PocketSharp.Models; using System; using System.Collections.Generic; using System.Threading; @@ -90,6 +90,15 @@ namespace PocketSharp /// A valid URI to redirect the user to. /// Call GetRequestCode() first to receive a request_code Uri GenerateRegistrationUri(string requestCode = null); + + /// + /// Get a new GUID from the Pocket API. + /// + /// The cancellation token. + /// + /// The GUID + /// + Task GetGuid(CancellationToken cancellationToken = default(CancellationToken)); #endregion #region add methods @@ -461,4 +470,4 @@ namespace PocketSharp /// void Dispose(); } -} \ No newline at end of file +} diff --git a/PocketSharp/Models/Response/Guid.cs b/PocketSharp/Models/Response/Guid.cs new file mode 100644 index 0000000..d448461 --- /dev/null +++ b/PocketSharp/Models/Response/Guid.cs @@ -0,0 +1,20 @@ +using Newtonsoft.Json; + +namespace PocketSharp.Models +{ + /// + /// Guid + /// + [JsonObject] + internal class GuidResponse + { + /// + /// Gets or sets the GUID. + /// + /// + /// The GUID. + /// + [JsonProperty] + public string Guid { get; set; } + } +}