method to get a new GUID from Pocket
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get a new GUID from the Pocket API.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>
|
||||
/// The GUID
|
||||
/// </returns>
|
||||
public async Task<string> GetGuid(CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
GuidResponse response = await Request<GuidResponse>("guid", cancellationToken, requireAuth: false);
|
||||
return response.Guid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
/// <returns>A valid URI to redirect the user to.</returns>
|
||||
/// <exception cref="System.NullReferenceException">Call GetRequestCode() first to receive a request_code</exception>
|
||||
Uri GenerateRegistrationUri(string requestCode = null);
|
||||
|
||||
/// <summary>
|
||||
/// Get a new GUID from the Pocket API.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>
|
||||
/// The GUID
|
||||
/// </returns>
|
||||
Task<string> GetGuid(CancellationToken cancellationToken = default(CancellationToken));
|
||||
#endregion
|
||||
|
||||
#region add methods
|
||||
@@ -461,4 +470,4 @@ namespace PocketSharp
|
||||
/// </summary>
|
||||
void Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PocketSharp.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Guid
|
||||
/// </summary>
|
||||
[JsonObject]
|
||||
internal class GuidResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the GUID.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The GUID.
|
||||
/// </value>
|
||||
[JsonProperty]
|
||||
public string Guid { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user