start async + pcl implementation
This commit is contained in:
@@ -47,14 +47,5 @@ namespace PocketSharp
|
||||
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param>
|
||||
public APIException(string message, Exception innerException)
|
||||
: base(message, innerException) { }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="APIException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param>
|
||||
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param>
|
||||
protected APIException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context) { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,10 @@ namespace PocketSharp
|
||||
Title = title,
|
||||
TweetID = tweetID
|
||||
};
|
||||
return await Request<Add>("add", parameters.Convert(), true).Item;
|
||||
|
||||
Add response = await Request<Add>("add", parameters.Convert(), true);
|
||||
|
||||
return response.Item;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +40,7 @@ namespace PocketSharp
|
||||
/// <returns></returns>
|
||||
public async Task<PocketItem> Add(Uri uri)
|
||||
{
|
||||
return await Add(uri, null, null, null);
|
||||
return await Add(uri, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,9 @@ namespace PocketSharp
|
||||
/// <returns></returns>
|
||||
public async Task<List<PocketItem>> Retrieve(RetrieveParameters parameters)
|
||||
{
|
||||
return await Request<Retrieve>("get", parameters.Convert(), true).Items;
|
||||
Retrieve response = await Request<Retrieve>("get", parameters.Convert(), true);
|
||||
|
||||
return response.Items;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +55,9 @@ namespace PocketSharp
|
||||
|
||||
parameters.DetailType = DetailType.complete;
|
||||
|
||||
return await Request<Retrieve>("get", parameters.Convert(), true).Items;
|
||||
Retrieve response = await Request<Retrieve>("get", parameters.Convert(), true);
|
||||
|
||||
return response.Items;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +73,10 @@ namespace PocketSharp
|
||||
Tag = tag,
|
||||
DetailType = DetailType.complete
|
||||
};
|
||||
return await Request<Retrieve>("get", parameters.Convert(), true).Items;
|
||||
|
||||
Retrieve response = await Request<Retrieve>("get", parameters.Convert(), true);
|
||||
|
||||
return response.Items;
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +92,10 @@ namespace PocketSharp
|
||||
Search = searchString,
|
||||
DetailType = DetailType.complete
|
||||
};
|
||||
return await Request<Retrieve>("get", parameters.Convert(), true).Items;
|
||||
|
||||
Retrieve response = await Request<Retrieve>("get", parameters.Convert(), true);
|
||||
|
||||
return response.Items;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,90 +1,90 @@
|
||||
using RestSharp;
|
||||
using RestSharp.Deserializers;
|
||||
using ServiceStack.Text;
|
||||
using System;
|
||||
//using RestSharp;
|
||||
//using RestSharp.Deserializers;
|
||||
//using ServiceStack.Text;
|
||||
//using System;
|
||||
|
||||
namespace PocketSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Custom JSON Deserializer which implements ServiceStack.Text
|
||||
/// </summary>
|
||||
internal class JsonDeserializer : IDeserializer
|
||||
{
|
||||
public const string JsonContentType = "application/json";
|
||||
//namespace PocketSharp
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Custom JSON Deserializer which implements ServiceStack.Text
|
||||
// /// </summary>
|
||||
// internal class JsonDeserializer : IDeserializer
|
||||
// {
|
||||
// public const string JsonContentType = "application/json";
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes the specified response.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="response">The response.</param>
|
||||
/// <returns></returns>
|
||||
public T Deserialize<T>(IRestResponse response)
|
||||
{
|
||||
return JsonSerializer.DeserializeFromString<T>(response.Content);
|
||||
}
|
||||
// /// <summary>
|
||||
// /// Deserializes the specified response.
|
||||
// /// </summary>
|
||||
// /// <typeparam name="T"></typeparam>
|
||||
// /// <param name="response">The response.</param>
|
||||
// /// <returns></returns>
|
||||
// public T Deserialize<T>(IRestResponse response)
|
||||
// {
|
||||
// return JsonSerializer.DeserializeFromString<T>(response.Content);
|
||||
// }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Adds custom deserialization for specific types.
|
||||
/// </summary>
|
||||
public static void AddCustomDeserialization()
|
||||
{
|
||||
// generate correct Uri format
|
||||
JsConfig<Uri>.DeSerializeFn = value =>
|
||||
{
|
||||
Uri result = null;
|
||||
try
|
||||
{
|
||||
result = new Uri(value);
|
||||
}
|
||||
catch(ArgumentNullException e) {}
|
||||
catch(UriFormatException e) {}
|
||||
// /// <summary>
|
||||
// /// Adds custom deserialization for specific types.
|
||||
// /// </summary>
|
||||
// public static void AddCustomDeserialization()
|
||||
// {
|
||||
// // generate correct Uri format
|
||||
// JsConfig<Uri>.DeSerializeFn = value =>
|
||||
// {
|
||||
// Uri result = null;
|
||||
// try
|
||||
// {
|
||||
// result = new Uri(value);
|
||||
// }
|
||||
// catch(ArgumentNullException e) {}
|
||||
// catch(UriFormatException e) {}
|
||||
|
||||
return result;
|
||||
};
|
||||
// return result;
|
||||
// };
|
||||
|
||||
// create DateTime from UNIX timestamp input
|
||||
JsConfig<DateTime?>.DeSerializeFn = value =>
|
||||
{
|
||||
if (value == "0") return null;
|
||||
return new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Convert.ToDouble(value)).ToLocalTime();
|
||||
};
|
||||
}
|
||||
// // create DateTime from UNIX timestamp input
|
||||
// JsConfig<DateTime?>.DeSerializeFn = value =>
|
||||
// {
|
||||
// if (value == "0") return null;
|
||||
// return new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Convert.ToDouble(value)).ToLocalTime();
|
||||
// };
|
||||
// }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date format.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The date format.
|
||||
/// </value>
|
||||
public string DateFormat { get; set; }
|
||||
// /// <summary>
|
||||
// /// Gets or sets the date format.
|
||||
// /// </summary>
|
||||
// /// <value>
|
||||
// /// The date format.
|
||||
// /// </value>
|
||||
// public string DateFormat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the namespace.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The namespace.
|
||||
/// </value>
|
||||
public string Namespace { get; set; }
|
||||
// /// <summary>
|
||||
// /// Gets or sets the namespace.
|
||||
// /// </summary>
|
||||
// /// <value>
|
||||
// /// The namespace.
|
||||
// /// </value>
|
||||
// public string Namespace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the root element.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The root element.
|
||||
/// </value>
|
||||
public string RootElement { get; set; }
|
||||
// /// <summary>
|
||||
// /// Gets or sets the root element.
|
||||
// /// </summary>
|
||||
// /// <value>
|
||||
// /// The root element.
|
||||
// /// </value>
|
||||
// public string RootElement { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of the content.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The type of the content.
|
||||
/// </value>
|
||||
public string ContentType
|
||||
{
|
||||
get { return JsonContentType; }
|
||||
}
|
||||
}
|
||||
}
|
||||
// /// <summary>
|
||||
// /// Gets the type of the content.
|
||||
// /// </summary>
|
||||
// /// <value>
|
||||
// /// The type of the content.
|
||||
// /// </value>
|
||||
// public string ContentType
|
||||
// {
|
||||
// get { return JsonContentType; }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace PocketSharp
|
||||
{
|
||||
//public class UnixDateTimeConverter : DateTimeConverterBase
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Writes the JSON representation of the object.
|
||||
// /// </summary>
|
||||
// /// <param name="writer">The <see cref="T:Newtonsoft.Json.JsonWriter"/> to write to.</param><param name="value">The value.</param><param name="serializer">The calling serializer.</param>
|
||||
// //public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
// //{
|
||||
// // DateTime epoc = new DateTime(1970, 1, 1);
|
||||
// // var delta = (DateTime)value - epoc;
|
||||
|
||||
// // writer.WriteValue((long)delta.TotalSeconds);
|
||||
// //}
|
||||
|
||||
|
||||
// ///// <summary>
|
||||
// ///// Reads the JSON representation of the object.
|
||||
// ///// </summary>
|
||||
// ///// <param name="reader">The <see cref = "JsonReader" /> to read from.</param>
|
||||
// ///// <param name="objectType">Type of the object.</param>
|
||||
// ///// <param name="existingValue">The existing value of object being read.</param>
|
||||
// ///// <param name="serializer">The calling serializer.</param>
|
||||
// ///// <returns>The object value.</returns>
|
||||
// //public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
// //{
|
||||
// // return existingValue == "0" ? null : new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Convert.ToDouble(existingValue)).ToLocalTime();
|
||||
// //}
|
||||
//}
|
||||
}
|
||||
@@ -25,4 +25,4 @@ namespace PocketSharp.Models
|
||||
return string.Format("{0}={1}", Name, Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+87
-95
@@ -1,9 +1,11 @@
|
||||
using PocketSharp.Models;
|
||||
using RestSharp;
|
||||
using RestSharp.Contrib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace PocketSharp
|
||||
{
|
||||
@@ -15,7 +17,7 @@ namespace PocketSharp
|
||||
/// <summary>
|
||||
/// REST client used for the API communication
|
||||
/// </summary>
|
||||
protected readonly RestClient _restClient;
|
||||
protected readonly HttpClient _restClient;
|
||||
|
||||
/// <summary>
|
||||
/// The base URL for the Pocket API
|
||||
@@ -38,11 +40,6 @@ namespace PocketSharp
|
||||
/// </summary>
|
||||
public string ConsumerKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns all associated data from the last request
|
||||
/// </summary>
|
||||
public IRestResponse LastRequestData { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Code retrieved on authentification
|
||||
/// </summary>
|
||||
@@ -74,58 +71,29 @@ namespace PocketSharp
|
||||
// assign callback uri if submitted
|
||||
if (callbackUri != null)
|
||||
{
|
||||
CallbackUri = HttpUtility.UrlEncode(callbackUri.ToString());
|
||||
CallbackUri = Uri.EscapeUriString(callbackUri.ToString());
|
||||
}
|
||||
|
||||
// initialize REST client
|
||||
_restClient = new RestClient(baseUri.ToString());
|
||||
_restClient = new HttpClient(new HttpClientHandler()
|
||||
{
|
||||
AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip
|
||||
});
|
||||
|
||||
// add default parameters to each request
|
||||
_restClient.AddDefaultParameter("consumer_key", ConsumerKey);
|
||||
// set base uri
|
||||
_restClient.BaseAddress = baseUri;
|
||||
|
||||
// Pocket needs this specific Accept header :-S
|
||||
_restClient.AddDefaultHeader("Accept", "*/*");
|
||||
_restClient.DefaultRequestHeaders.Add("Accept", "*/*");
|
||||
|
||||
// defines the response format (according to the Pocket docs)
|
||||
_restClient.AddDefaultHeader("X-Accept", "application/json");
|
||||
_restClient.DefaultRequestHeaders.Add("X-Accept", "application/json");
|
||||
|
||||
// custom JSON deserializer (ServiceStack.Text)
|
||||
_restClient.AddHandler("application/json", new JsonDeserializer());
|
||||
//_restClient.AddHandler("application/json", new JsonDeserializer());
|
||||
|
||||
// add custom deserialization lambdas
|
||||
JsonDeserializer.AddCustomDeserialization();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Makes a HTTP REST request to the API
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <returns></returns>
|
||||
protected string Request(RestRequest request)
|
||||
{
|
||||
IRestResponse response = _restClient.Execute(request);
|
||||
|
||||
LastRequestData = response;
|
||||
ValidateResponse(response);
|
||||
|
||||
return response.Content;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Makes a typed HTTP REST request to the API
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <returns></returns>
|
||||
protected T Request<T>(RestRequest request) where T : new()
|
||||
{
|
||||
IRestResponse<T> response = _restClient.Execute<T>(request);
|
||||
|
||||
LastRequestData = response;
|
||||
ValidateResponse(response);
|
||||
|
||||
return response.Data;
|
||||
//JsonDeserializer.AddCustomDeserialization();
|
||||
}
|
||||
|
||||
|
||||
@@ -138,33 +106,55 @@ namespace PocketSharp
|
||||
/// <param name="requireAuth">if set to <c>true</c> [require auth].</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="APIException">No access token available. Use authentification first.</exception>
|
||||
protected T Get<T>(string method, List<Parameter> parameters = null, bool requireAuth = false) where T : class, new()
|
||||
protected async Task<T> Request<T>(string method, List<Parameter> parameters = null, bool requireAuth = false) where T : class, new()
|
||||
{
|
||||
if (requireAuth && AccessCode == null)
|
||||
{
|
||||
throw new APIException("No access token available. Use authentification first.");
|
||||
}
|
||||
|
||||
// convert parameters
|
||||
List<KeyValuePair<string, string>> kvParameters = new List<KeyValuePair<string, string>>();
|
||||
|
||||
if (parameters != null)
|
||||
{
|
||||
foreach (Parameter item in parameters)
|
||||
{
|
||||
if (item.Value != null)
|
||||
{
|
||||
kvParameters.Add(new KeyValuePair<string, string>(item.Name, item.Value.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// every single Pocket API endpoint requires HTTP POST data
|
||||
var request = new RestRequest(method, Method.POST);
|
||||
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, method);
|
||||
|
||||
// add consumer key to each request
|
||||
kvParameters.Add(new KeyValuePair<string, string>("consumer_key", ConsumerKey));
|
||||
|
||||
// add access token (necessary for all requests except authentification)
|
||||
if (AccessCode != null)
|
||||
{
|
||||
request.AddParameter("access_token", AccessCode);
|
||||
kvParameters.Add(new KeyValuePair<string, string>("access_token", AccessCode));
|
||||
}
|
||||
|
||||
// enumeration for params
|
||||
if (parameters != null)
|
||||
{
|
||||
parameters.ForEach(delegate(Parameter param)
|
||||
{
|
||||
request.AddParameter(param);
|
||||
});
|
||||
}
|
||||
// content of the request
|
||||
request.Content = new FormUrlEncodedContent(kvParameters);
|
||||
|
||||
// do the request
|
||||
return Request<T>(request);
|
||||
// make async request
|
||||
HttpResponseMessage response = await _restClient.SendAsync(request);
|
||||
|
||||
// throw exception if no valid response
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
// read response
|
||||
string responseString = response.Content.ReadAsStringAsync().Result;
|
||||
|
||||
// deserialize object
|
||||
return JsonConvert.DeserializeObject<T>(responseString);
|
||||
|
||||
//ValidateResponse(response);
|
||||
}
|
||||
|
||||
|
||||
@@ -173,14 +163,16 @@ namespace PocketSharp
|
||||
/// </summary>
|
||||
/// <param name="actionParameter">The action parameter.</param>
|
||||
/// <returns></returns>
|
||||
protected bool PutSendAction(ActionParameter actionParameter)
|
||||
protected async Task<bool> PutSendAction(ActionParameter actionParameter)
|
||||
{
|
||||
ModifyParameters parameters = new ModifyParameters()
|
||||
{
|
||||
Actions = new List<ActionParameter>() { actionParameter }
|
||||
};
|
||||
|
||||
return Get<Modify>("send", parameters.Convert(), true).Status;
|
||||
Modify response = await Request<Modify>("send", parameters.Convert(), true);
|
||||
|
||||
return response.Status;
|
||||
}
|
||||
|
||||
|
||||
@@ -192,44 +184,44 @@ namespace PocketSharp
|
||||
/// <exception cref="APIException">
|
||||
/// Error retrieving response
|
||||
/// </exception>
|
||||
protected void ValidateResponse(IRestResponse response)
|
||||
{
|
||||
if (response.StatusCode != HttpStatusCode.OK)
|
||||
{
|
||||
// get pocket error headers
|
||||
Parameter error = response.Headers[1];
|
||||
Parameter errorCode = response.Headers[2];
|
||||
//protected void ValidateResponse(IRestResponse response)
|
||||
//{
|
||||
// if (response.StatusCode != HttpStatusCode.OK)
|
||||
// {
|
||||
// // get pocket error headers
|
||||
// Parameter error = response.Headers[1];
|
||||
// Parameter errorCode = response.Headers[2];
|
||||
|
||||
string exceptionString = response.Content;
|
||||
// string exceptionString = response.Content;
|
||||
|
||||
bool isPocketError = error.Name == "X-Error";
|
||||
// bool isPocketError = error.Name == "X-Error";
|
||||
|
||||
// update message to include pocket response data
|
||||
if (isPocketError)
|
||||
{
|
||||
exceptionString = exceptionString + "\nPocketResponse: (" + errorCode.Value + ") " + error.Value;
|
||||
}
|
||||
// // update message to include pocket response data
|
||||
// if (isPocketError)
|
||||
// {
|
||||
// exceptionString = exceptionString + "\nPocketResponse: (" + errorCode.Value + ") " + error.Value;
|
||||
// }
|
||||
|
||||
// create exception
|
||||
APIException exception = new APIException(exceptionString, response.ErrorException);
|
||||
// // create exception
|
||||
// APIException exception = new APIException(exceptionString, response.ErrorException);
|
||||
|
||||
if (isPocketError)
|
||||
{
|
||||
// add custom pocket fields
|
||||
exception.PocketError = error.Value.ToString();
|
||||
exception.PocketErrorCode = Convert.ToInt32(errorCode.Value);
|
||||
// if (isPocketError)
|
||||
// {
|
||||
// // add custom pocket fields
|
||||
// exception.PocketError = error.Value.ToString();
|
||||
// exception.PocketErrorCode = Convert.ToInt32(errorCode.Value);
|
||||
|
||||
// add to generic exception data
|
||||
exception.Data.Add(error.Name, error.Value);
|
||||
exception.Data.Add(errorCode.Name, errorCode.Value);
|
||||
}
|
||||
// // add to generic exception data
|
||||
// exception.Data.Add(error.Name, error.Value);
|
||||
// exception.Data.Add(errorCode.Name, errorCode.Value);
|
||||
// }
|
||||
|
||||
throw exception;
|
||||
}
|
||||
else if (response.ErrorException != null)
|
||||
{
|
||||
throw new APIException("Error retrieving response", response.ErrorException);
|
||||
}
|
||||
}
|
||||
// throw exception;
|
||||
// }
|
||||
// else if (response.ErrorException != null)
|
||||
// {
|
||||
// throw new APIException("Error retrieving response", response.ErrorException);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,14 @@
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile>Profile88</TargetFrameworkProfile>
|
||||
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>4.0</OldToolsVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -33,20 +41,36 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="RestSharp">
|
||||
<HintPath>..\packages\RestSharp.104.1\lib\net4\RestSharp.dll</HintPath>
|
||||
<Reference Include="Microsoft.Threading.Tasks">
|
||||
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.16\lib\portable-net40+sl4+win8+wp71\Microsoft.Threading.Tasks.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ServiceStack.Text, Version=3.9.58.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\ServiceStack.Text.3.9.58\lib\net35\ServiceStack.Text.dll</HintPath>
|
||||
<Reference Include="Microsoft.Threading.Tasks.Extensions">
|
||||
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.16\lib\portable-net40+sl4+win8+wp71\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\packages\Newtonsoft.Json.5.0.6\lib\portable-net40+sl4+wp7+win8\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.IO">
|
||||
<HintPath>..\packages\Microsoft.Bcl.1.1.3\lib\portable-net40+sl4+win8+wp71\System.IO.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.13\lib\portable-net40+sl4+win8+wp71\System.Net.Http.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Extensions">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.13\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Primitives">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.13\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime">
|
||||
<HintPath>..\packages\Microsoft.Bcl.1.1.3\lib\portable-net40+sl4+win8+wp71\System.Runtime.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Threading.Tasks">
|
||||
<HintPath>..\packages\Microsoft.Bcl.1.1.3\lib\portable-net40+sl4+win8+wp71\System.Threading.Tasks.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -57,6 +81,8 @@
|
||||
<Compile Include="Components\ModifyTags.cs" />
|
||||
<Compile Include="Components\Retrieve.cs" />
|
||||
<Compile Include="JsonDeserializer.cs" />
|
||||
<Compile Include="JsonExtensions.cs" />
|
||||
<Compile Include="Models\Parameters\Parameter.cs" />
|
||||
<Compile Include="Models\Response\AccessCode.cs" />
|
||||
<Compile Include="Models\Response\RequestCode.cs" />
|
||||
<Compile Include="Models\Parameters\AddParameters.cs" />
|
||||
@@ -82,9 +108,14 @@
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.10\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.10\tools\Microsoft.Bcl.Build.targets')" />
|
||||
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.10\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
|
||||
<Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.10\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
|
||||
@@ -1,36 +1,28 @@
|
||||
using System.Reflection;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("PocketSharp")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyCompany("cee")]
|
||||
[assembly: AssemblyProduct("PocketSharp")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("fe3e33ad-074a-44fa-99a5-a8bf13837301")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("0.4.0")]
|
||||
[assembly: AssemblyFileVersion("0.4.0")]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
using RestSharp;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using PocketSharp.Models;
|
||||
|
||||
namespace PocketSharp
|
||||
{
|
||||
/// <summary>
|
||||
@@ -32,9 +32,9 @@ namespace PocketSharp
|
||||
/// <param name="value">The value.</param>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <returns></returns>
|
||||
public static Parameter CreateParam(string name, object value, ParameterType type = ParameterType.GetOrPost)
|
||||
public static Parameter CreateParam(string name, object value)
|
||||
{
|
||||
return new Parameter() { Name = name, Value = value, Type = type };
|
||||
return new Parameter() { Name = name, Value = value };
|
||||
}
|
||||
|
||||
|
||||
@@ -45,9 +45,9 @@ namespace PocketSharp
|
||||
/// <param name="value">The value.</param>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <returns></returns>
|
||||
public static List<Parameter> CreateParamInList(string name, object value, ParameterType type = ParameterType.GetOrPost)
|
||||
public static List<Parameter> CreateParamInList(string name, object value)
|
||||
{
|
||||
return new List<Parameter>() { CreateParam(name, value, type) };
|
||||
return new List<Parameter>() { CreateParam(name, value) };
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="RestSharp" version="104.1" targetFramework="net40" />
|
||||
<package id="ServiceStack.Text" version="3.9.58" targetFramework="net40" />
|
||||
<package id="Microsoft.Bcl" version="1.1.3" targetFramework="portable-net45+sl40+wp71+win" />
|
||||
<package id="Microsoft.Bcl.Async" version="1.0.16" targetFramework="portable-net45+sl40+wp71+win" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.10" targetFramework="portable-net45+sl40+wp71+win" />
|
||||
<package id="Microsoft.Net.Http" version="2.2.13" targetFramework="portable-net45+sl40+wp71+win" />
|
||||
<package id="Newtonsoft.Json" version="5.0.6" targetFramework="portable-net40+sl40+wp71+win" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user