add Add method to add new PocketItem;

This commit is contained in:
2013-06-26 17:41:18 +02:00
parent 315f24f1f6
commit a320f18f24
8 changed files with 114 additions and 46 deletions
+11 -38
View File
@@ -183,54 +183,27 @@ namespace PocketSharp
}
/// <summary>
/// Puts/Updates a typed resource
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="method">Requested method (path after /v3/)</param>
/// <param name="actions">Additional action parameters</param>
/// <returns></returns>
protected T Put<T>(string method, List<ActionParameter> actions) where T : class, new()
{
// put requests only with authentification
ExpectAuthentification();
ModifyParameters parameters = new ModifyParameters()
{
Actions = actions
};
return Get<T>(method, parameters.Convert());
}
/// <summary>
/// Puts/Updates a typed resource
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="method">Requested method (path after /v3/)</param>
/// <param name="action">action parameter</param>
/// <returns></returns>
protected T Put<T>(string method, ActionParameter action) where T : class, new()
{
return Put<T>(method, new List<ActionParameter>() { action });
}
/// <summary>
/// Puts an action
/// </summary>
/// <param name="itemID">The item ID.</param>
/// <param name="action">The action.</param>
/// <returns></returns>
protected bool PutAction(int itemID, string action)
protected bool PutSendAction(int itemID, string action)
{
ActionParameter actionParam = new ActionParameter()
ModifyParameters parameters = new ModifyParameters()
{
Action = action,
ID = itemID
Actions = new List<ActionParameter>()
{
new ActionParameter()
{
Action = action,
ID = itemID
}
}
};
return Put<Modify>("send", actionParam).Status == 1;
return Get<Modify>("send", parameters.Convert()).Status;
}