2014-07-07 23:05:06 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Windows.Documents;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Wox.Plugin;
|
2014-07-05 23:10:34 +08:00
|
|
|
|
|
|
|
|
|
namespace Wox.RPC
|
|
|
|
|
{
|
2014-07-07 23:05:06 +08:00
|
|
|
|
public class JsonRPCErrorModel
|
2014-07-05 23:10:34 +08:00
|
|
|
|
{
|
2014-07-07 23:05:06 +08:00
|
|
|
|
public int Code { get; set; }
|
2014-07-05 23:10:34 +08:00
|
|
|
|
|
2014-07-07 23:05:06 +08:00
|
|
|
|
public string Message { get; set; }
|
|
|
|
|
|
|
|
|
|
public string Data { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class JsonRPCModelBase
|
|
|
|
|
{
|
|
|
|
|
public int Id { get; set; }
|
|
|
|
|
|
|
|
|
|
public string JsonRPC { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class JsonRPCResponseModel : JsonRPCModelBase
|
|
|
|
|
{
|
|
|
|
|
public string Result { get; set; }
|
|
|
|
|
|
|
|
|
|
public JsonRPCErrorModel Error { get; set; }
|
2014-07-05 23:10:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
2014-07-07 23:05:06 +08:00
|
|
|
|
public class JsonRPCQueryResponseModel : JsonRPCResponseModel
|
2014-07-05 23:10:34 +08:00
|
|
|
|
{
|
2014-07-07 23:05:06 +08:00
|
|
|
|
public List<JsonRPCResult> QueryResults
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return JsonConvert.DeserializeObject<List<JsonRPCResult>>(Result);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class JsonRPCRequestModel : JsonRPCModelBase
|
|
|
|
|
{
|
|
|
|
|
public string Method { get; set; }
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* 1. c# can't use params as the variable name
|
|
|
|
|
* 2. all prarmeter should be string type
|
|
|
|
|
*/
|
|
|
|
|
public List<string> Parameters { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class JsonRPCResult : Result
|
|
|
|
|
{
|
|
|
|
|
public string JSONRPCAction { get; set; }
|
|
|
|
|
|
|
|
|
|
public JsonRPCRequestModel JSONRPCActionModel
|
|
|
|
|
{
|
|
|
|
|
get { return null; }
|
|
|
|
|
}
|
2014-07-05 23:10:34 +08:00
|
|
|
|
}
|
|
|
|
|
}
|