Skip to content

Commit

Permalink
Merge pull request #13 from Ar3sDevelopment/dev
Browse files Browse the repository at this point in the history
completed all classes for all task requests, not tested yet
  • Loading branch information
matteobruni committed Nov 23, 2015
2 parents 62739dd + a646198 commit dd58aa6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
12 changes: 12 additions & 0 deletions Synology/DownloadStation/TaskMinimalResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;

namespace Synology.DownloadStation
{
public class TaskMinimalResult
{
public string Id { get; set; }

public int Error{ get; set; }
}
}

22 changes: 12 additions & 10 deletions Synology/DownloadStation/TaskRequest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Synology.Classes;
using Synology.Utilities;
using System.Collections;
using System.Collections.Generic;

namespace Synology.DownloadStation
{
Expand All @@ -21,15 +23,15 @@ public ResultData<TaskListResult> List(int offset = 0, int limit = -1, string ad
return Connection.GetDataFromUrl<TaskListResult>(url);
}

public ResultData<object> Info(string[] ids, string additional = null)
public ResultData<IEnumerable<TaskResult>> Info(string[] ids, string additional = null)
{
var additionalParams = new[] {
new QueryStringParameter("id", ids),
new QueryStringParameter("additional", additional)
};
var url = GetApiUrl("getinfo", 1, additionalParams);

return Connection.GetDataFromUrl<object>(url);
return Connection.GetDataFromUrl<IEnumerable<TaskResult>>(url);
}

public ResultData Create(string uri, string file, string username, string password, string unzipPassword, string destination)
Expand All @@ -47,38 +49,38 @@ public ResultData Create(string uri, string file, string username, string passwo
return Connection.GetDataFromUrl(url);
}

public ResultData<object> Delete(string[] ids, bool forceComplete)
public ResultData<IEnumerable<TaskMinimalResult>> Delete(string[] ids, bool forceComplete)
{
var additionalParams = new[] {
new QueryStringParameter("id", ids),
new QueryStringParameter("force_complete", forceComplete)
};
var url = GetApiUrl("delete", 1, additionalParams);

return Connection.GetDataFromUrl<object>(url);
return Connection.GetDataFromUrl<IEnumerable<TaskMinimalResult>>(url);
}

public ResultData<object> Pause(string[] ids)
public ResultData<IEnumerable<TaskMinimalResult>> Pause(string[] ids)
{
var additionalParams = new[] {
new QueryStringParameter("id", ids)
};
var url = GetApiUrl("pause", 1, additionalParams);

return Connection.GetDataFromUrl<object>(url);
return Connection.GetDataFromUrl<IEnumerable<TaskMinimalResult>>(url);
}

public ResultData<object> Resume(string[] ids)
public ResultData<IEnumerable<TaskMinimalResult>> Resume(string[] ids)
{
var additionalParams = new[] {
new QueryStringParameter("id", ids),
};
var url = GetApiUrl("resume", 1, additionalParams);

return Connection.GetDataFromUrl<object>(url);
return Connection.GetDataFromUrl<IEnumerable<TaskMinimalResult>>(url);
}

public ResultData<object> Edit(string[] ids, string destination = null)
public ResultData<IEnumerable<TaskMinimalResult>> Edit(string[] ids, string destination = null)
{
var additionalParams = new[] {
new QueryStringParameter("id", ids),
Expand All @@ -87,7 +89,7 @@ public ResultData<object> Edit(string[] ids, string destination = null)

var url = GetApiUrl("edit", 1, additionalParams);

return Connection.GetDataFromUrl<object>(url);
return Connection.GetDataFromUrl<IEnumerable<TaskMinimalResult>>(url);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions Synology/Synology.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<Compile Include="DownloadStation\TaskRequest.cs" />
<Compile Include="Utilities\QueryStringManager.cs" />
<Compile Include="Utilities\QueryStringParameter.cs" />
<Compile Include="DownloadStation\TaskMinimalResult.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
Expand Down

0 comments on commit dd58aa6

Please sign in to comment.