IReportService.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Runtime.Serialization;
  4. using System.ServiceModel;
  5. using System.ServiceModel.Activation;
  6. using System.ServiceModel.Web;
  7. using System.Text;
  8. using System.IO;
  9. using System.Collections;
  10. using System.Net;
  11. namespace FastReport.Service
  12. {
  13. [ServiceContract]
  14. public interface IFastReportService
  15. {
  16. [OperationContract]
  17. [WebGet(ResponseFormat = WebMessageFormat.Json, UriTemplate = "/about/")]
  18. string About();
  19. [OperationContract]
  20. [WebGet(ResponseFormat = WebMessageFormat.Json, UriTemplate = "/reports/{path}")]
  21. List<ReportItem> GetReportsListByPath(string path);
  22. [OperationContract]
  23. [WebGet(ResponseFormat = WebMessageFormat.Xml, UriTemplate = "/reportsxml/{path}")]
  24. List<ReportItem> GetReportsListByPathXml(string path);
  25. [OperationContract]
  26. [WebGet(ResponseFormat = WebMessageFormat.Json, UriTemplate = "/reports/")]
  27. List<ReportItem> GetReportsList();
  28. [OperationContract]
  29. [WebGet(ResponseFormat = WebMessageFormat.Xml, UriTemplate = "/reportsxml/")]
  30. List<ReportItem> GetReportsListXml();
  31. [OperationContract]
  32. [WebGet(ResponseFormat = WebMessageFormat.Json, UriTemplate = "/gears/")]
  33. List<GearItem> GetGearList();
  34. [OperationContract]
  35. [WebGet(ResponseFormat = WebMessageFormat.Xml, UriTemplate = "/gearsxml/")]
  36. List<GearItem> GetGearListXml();
  37. [OperationContract]
  38. [WebInvoke(Method = "POST",
  39. RequestFormat = WebMessageFormat.Json,
  40. ResponseFormat = WebMessageFormat.Json,
  41. UriTemplate = "/getreport/")]
  42. Stream GetReport(ReportRequest request);
  43. [OperationContract]
  44. [WebInvoke(Method = "GET",
  45. RequestFormat = WebMessageFormat.Json,
  46. ResponseFormat = WebMessageFormat.Json,
  47. UriTemplate = "/preparereportbyid/{id}")]
  48. Stream GetPreparedReportByID(string id);
  49. [OperationContract]
  50. [WebInvoke(Method = "POST",
  51. RequestFormat = WebMessageFormat.Xml,
  52. ResponseFormat = WebMessageFormat.Xml,
  53. UriTemplate = "/getreportxml/")]
  54. Stream GetReportXml(ReportRequest request);
  55. [OperationContract]
  56. [WebInvoke(Method = "POST",
  57. UriTemplate = "/gettest/")]
  58. Stream GetTest(Stream preparedReport);
  59. [OperationContract]
  60. [WebInvoke(Method = "GET",
  61. RequestFormat = WebMessageFormat.Json,
  62. ResponseFormat = WebMessageFormat.Json,
  63. UriTemplate = "/checkprepared/{uuid}")]
  64. bool CheckPreparedReport(string uuid);
  65. [OperationContract]
  66. [WebInvoke(Method = "POST",
  67. RequestFormat = WebMessageFormat.Json,
  68. ResponseFormat = WebMessageFormat.Json,
  69. UriTemplate = "/putprepared/")]
  70. string PutPreparedReport(Stream preparedReport);
  71. [OperationContract]
  72. [WebInvoke(Method = "POST",
  73. RequestFormat = WebMessageFormat.Json,
  74. ResponseFormat = WebMessageFormat.Json,
  75. UriTemplate = "/put/")]
  76. string PutReport(Stream report);
  77. [OperationContract]
  78. [WebInvoke(Method = "GET",
  79. RequestFormat = WebMessageFormat.Json,
  80. ResponseFormat = WebMessageFormat.Json,
  81. UriTemplate = "/getprepared/{uuid}")]
  82. Stream GetPreparedByUUID(string uuid);
  83. [OperationContract]
  84. [WebInvoke(Method = "GET",
  85. BodyStyle = WebMessageBodyStyle.WrappedRequest,
  86. ResponseFormat = WebMessageFormat.Json,
  87. UriTemplate = "/getlogo/{uuid}/{width}/{height}")]
  88. Stream GetLogoByUUID(string uuid, string width, string height);
  89. [OperationContract]
  90. [WebInvoke(Method = "GET",
  91. BodyStyle = WebMessageBodyStyle.WrappedRequest,
  92. ResponseFormat = WebMessageFormat.Json,
  93. UriTemplate = "/getlogo/{uuid}")]
  94. Stream GetLogoByUUIDFixed(string uuid);
  95. [OperationContract]
  96. [WebInvoke(Method = "POST",
  97. UriTemplate = "/getfpx/")]
  98. Stream GetFPX(Stream preparedReport);
  99. [OperationContract]
  100. [WebInvoke(Method = "POST",
  101. UriTemplate = "/getpdf/")]
  102. Stream GetPDF(Stream preparedReport);
  103. [OperationContract]
  104. [WebInvoke(Method = "POST",
  105. UriTemplate = "/getxlsx/")]
  106. Stream GetXLSX(Stream preparedReport);
  107. [OperationContract]
  108. [WebInvoke(Method = "POST",
  109. UriTemplate = "/getdocx/")]
  110. Stream GetDOCX(Stream preparedReport);
  111. [OperationContract]
  112. [WebInvoke(Method = "POST",
  113. UriTemplate = "/getpptx/")]
  114. Stream GetPPTX(Stream preparedReport);
  115. [OperationContract]
  116. [WebInvoke(Method = "POST",
  117. UriTemplate = "/getods/")]
  118. Stream GetODS(Stream preparedReport);
  119. [OperationContract]
  120. [WebInvoke(Method = "POST",
  121. UriTemplate = "/getodt/")]
  122. Stream GetODT(Stream preparedReport);
  123. [OperationContract]
  124. [WebInvoke(Method = "POST",
  125. UriTemplate = "/getmht/")]
  126. Stream GetMHT(Stream preparedReport);
  127. [OperationContract]
  128. [WebInvoke(Method = "POST",
  129. UriTemplate = "/getcsv/")]
  130. Stream GetCSV(Stream preparedReport);
  131. [OperationContract]
  132. [WebInvoke(Method = "POST",
  133. UriTemplate = "/getdbf/")]
  134. Stream GetDBF(Stream preparedReport);
  135. [OperationContract]
  136. [WebInvoke(Method = "POST",
  137. UriTemplate = "/getxml/")]
  138. Stream GetXML(Stream preparedReport);
  139. [OperationContract]
  140. [WebInvoke(Method = "POST",
  141. UriTemplate = "/gettxt/")]
  142. Stream GetTXT(Stream preparedReport);
  143. [OperationContract]
  144. [WebInvoke(Method = "POST",
  145. UriTemplate = "/getrtf/")]
  146. Stream GetRTF(Stream preparedReport);
  147. [OperationContract]
  148. [WebInvoke(Method = "POST",
  149. UriTemplate = "/gethtml/")]
  150. Stream GetHTML(Stream preparedReport);
  151. [OperationContract]
  152. [WebInvoke(Method = "GET",
  153. RequestFormat = WebMessageFormat.Json,
  154. ResponseFormat = WebMessageFormat.Json,
  155. UriTemplate = "/getfpx/{uuid}")]
  156. Stream GetFPXByUUID(string uuid);
  157. [OperationContract]
  158. [WebInvoke(Method = "GET",
  159. RequestFormat = WebMessageFormat.Json,
  160. ResponseFormat = WebMessageFormat.Json,
  161. UriTemplate = "/getpdf/{uuid}")]
  162. Stream GetPDFByUUID(string uuid);
  163. [OperationContract]
  164. [WebInvoke(Method = "GET",
  165. RequestFormat = WebMessageFormat.Json,
  166. ResponseFormat = WebMessageFormat.Json,
  167. UriTemplate = "/getxlsx/{uuid}")]
  168. Stream GetXLSXByUUID(string uuid);
  169. [OperationContract]
  170. [WebInvoke(Method = "GET",
  171. RequestFormat = WebMessageFormat.Json,
  172. ResponseFormat = WebMessageFormat.Json,
  173. UriTemplate = "/getdocx/{uuid}")]
  174. Stream GetDOCXByUUID(string uuid);
  175. [OperationContract]
  176. [WebInvoke(Method = "GET",
  177. RequestFormat = WebMessageFormat.Json,
  178. ResponseFormat = WebMessageFormat.Json,
  179. UriTemplate = "/getpptx/{uuid}")]
  180. Stream GetPPTXByUUID(string uuid);
  181. [OperationContract]
  182. [WebInvoke(Method = "GET",
  183. RequestFormat = WebMessageFormat.Json,
  184. ResponseFormat = WebMessageFormat.Json,
  185. UriTemplate = "/getods/{uuid}")]
  186. Stream GetODSByUUID(string uuid);
  187. [OperationContract]
  188. [WebInvoke(Method = "GET",
  189. RequestFormat = WebMessageFormat.Json,
  190. ResponseFormat = WebMessageFormat.Json,
  191. UriTemplate = "/getodt/{uuid}")]
  192. Stream GetODTByUUID(string uuid);
  193. [OperationContract]
  194. [WebInvoke(Method = "GET",
  195. RequestFormat = WebMessageFormat.Json,
  196. ResponseFormat = WebMessageFormat.Json,
  197. UriTemplate = "/getmht/{uuid}")]
  198. Stream GetMHTByUUID(string uuid);
  199. [OperationContract]
  200. [WebInvoke(Method = "GET",
  201. RequestFormat = WebMessageFormat.Json,
  202. ResponseFormat = WebMessageFormat.Json,
  203. UriTemplate = "/getcsv/{uuid}")]
  204. Stream GetCSVByUUID(string uuid);
  205. [OperationContract]
  206. [WebInvoke(Method = "GET",
  207. RequestFormat = WebMessageFormat.Json,
  208. ResponseFormat = WebMessageFormat.Json,
  209. UriTemplate = "/getdbf/{uuid}")]
  210. Stream GetDBFByUUID(string uuid);
  211. [OperationContract]
  212. [WebInvoke(Method = "GET",
  213. RequestFormat = WebMessageFormat.Json,
  214. ResponseFormat = WebMessageFormat.Json,
  215. UriTemplate = "/getxml/{uuid}")]
  216. Stream GetXMLByUUID(string uuid);
  217. [OperationContract]
  218. [WebInvoke(Method = "GET",
  219. RequestFormat = WebMessageFormat.Json,
  220. ResponseFormat = WebMessageFormat.Json,
  221. UriTemplate = "/gettxt/{uuid}")]
  222. Stream GetTXTByUUID(string uuid);
  223. [OperationContract]
  224. [WebInvoke(Method = "GET",
  225. RequestFormat = WebMessageFormat.Json,
  226. ResponseFormat = WebMessageFormat.Json,
  227. UriTemplate = "/getrtf/{uuid}")]
  228. Stream GetRTFByUUID(string uuid);
  229. [OperationContract]
  230. [WebInvoke(Method = "GET",
  231. RequestFormat = WebMessageFormat.Json,
  232. ResponseFormat = WebMessageFormat.Json,
  233. UriTemplate = "/gethtml/{uuid}")]
  234. Stream GetHTMLByUUID(string uuid);
  235. }
  236. [DataContract]
  237. public class ReportRequest
  238. {
  239. [DataMember]
  240. public ReportItem Report { get; set; }
  241. [DataMember]
  242. public GearItem Gear { get; set; }
  243. }
  244. [DataContract]
  245. public class ReportItem
  246. {
  247. private Dictionary<string, string> parameters = new Dictionary<string, string>();
  248. [DataMember]
  249. public string ID { get; set; }
  250. [DataMember]
  251. public string Path { get; set; }
  252. [DataMember]
  253. public string Name { get; set; }
  254. [DataMember]
  255. public string Description { get; set; }
  256. [DataMember]
  257. public Dictionary<string, string> Parameters
  258. {
  259. get
  260. {
  261. return parameters;
  262. }
  263. set
  264. {
  265. parameters = value;
  266. }
  267. }
  268. }
  269. [DataContract]
  270. public class GearItem
  271. {
  272. [DataMember]
  273. public string Name { get; set; }
  274. [DataMember]
  275. public Dictionary<string, string> Properties { get; set; }
  276. [DataMember]
  277. public string Extension { get; set; }
  278. [DataMember]
  279. public string MimeType { get; set; }
  280. }
  281. [DataContract]
  282. public class ErrorHandler
  283. {
  284. [DataMember]
  285. public int ErrorCode { get; set; }
  286. [DataMember]
  287. public string Cause { get; set; }
  288. }
  289. }