1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using System.Text; |
---|
4 | |
---|
5 | using Com.Piwigo.Lib.DTO; |
---|
6 | using System.Web; |
---|
7 | using Com.Piwigo.Lib.Proxy.Response; |
---|
8 | using Com.Piwigo.Lib.Proxy.Helper; |
---|
9 | |
---|
10 | namespace Com.Piwigo.Lib.Proxy |
---|
11 | { |
---|
12 | static internal class PwgTagsProxy |
---|
13 | { |
---|
14 | static internal PwgTagsProxyResponse pwg_tags_getList(Boolean? sortedByCounter) |
---|
15 | { |
---|
16 | PwgTagsProxyResponse response = null; |
---|
17 | try |
---|
18 | { |
---|
19 | StringBuilder data = new StringBuilder(); |
---|
20 | Boolean firstOcc = true; |
---|
21 | |
---|
22 | PwgProxyReponseHelper.buildQueryFromValue<Boolean>(sortedByCounter, "sort_by_counter", ref firstOcc, data); |
---|
23 | |
---|
24 | response = PwgGenericProxy<PwgTagsProxyResponse>.Get( |
---|
25 | PwgConfigProxy.PwgServeurUri, |
---|
26 | "pwg.tags.getList", data.ToString()); |
---|
27 | } |
---|
28 | catch (Exception ex) |
---|
29 | { |
---|
30 | throw new PwgProxyException("pwg_tags_getList", ex); |
---|
31 | } |
---|
32 | return response; |
---|
33 | |
---|
34 | } |
---|
35 | |
---|
36 | static internal PwgTagsProxyResponse pwg_tags_getAdminList() |
---|
37 | { |
---|
38 | PwgTagsProxyResponse response = null; |
---|
39 | try |
---|
40 | { |
---|
41 | response = PwgGenericProxy<PwgTagsProxyResponse>.Get( |
---|
42 | PwgConfigProxy.PwgServeurUri, |
---|
43 | "pwg.tags.getAdminList", null); |
---|
44 | } |
---|
45 | catch (Exception ex) |
---|
46 | { |
---|
47 | throw new PwgProxyException("pwg_tags_getAdminList", ex); |
---|
48 | } |
---|
49 | return response; |
---|
50 | |
---|
51 | } |
---|
52 | |
---|
53 | static internal PwgImagesProxyResponse pwg_tags_getImages(List<Int32> tagsId, |
---|
54 | List<String> tagsUrlName, |
---|
55 | List<String> tagsName, |
---|
56 | Boolean? tagModeAnd, |
---|
57 | Int32? perPage, |
---|
58 | Int32? Page, |
---|
59 | Int32? Order, |
---|
60 | Int32? minRate, |
---|
61 | Int32? maxRate, |
---|
62 | Int32? minHit, |
---|
63 | Int32? maxHit, |
---|
64 | DateTime? minDateAvailable, |
---|
65 | DateTime? maxDateAvailable, |
---|
66 | DateTime? minDateCreated, |
---|
67 | DateTime? maxDateCreated, |
---|
68 | Int32? minRatio, |
---|
69 | Int32? maxRatio, |
---|
70 | Boolean? withThumbnail) |
---|
71 | { |
---|
72 | PwgImagesProxyResponse response = null; |
---|
73 | try |
---|
74 | { |
---|
75 | StringBuilder data = new StringBuilder(); |
---|
76 | Boolean firstOcc = true; |
---|
77 | data.AppendFormat("method={0}","pwg.tags.getImages"); |
---|
78 | firstOcc = false; |
---|
79 | PwgProxyReponseHelper.buildQueryFromArray<Int32>(tagsId, "tag_id", ref firstOcc, data); |
---|
80 | PwgProxyReponseHelper.buildQueryFromArray<String>(tagsUrlName, "tag_url_name", ref firstOcc, data); |
---|
81 | PwgProxyReponseHelper.buildQueryFromArray<String>(tagsName, "tag_name", ref firstOcc, data); |
---|
82 | |
---|
83 | PwgProxyReponseHelper.buildQueryFromValue<Boolean>(tagModeAnd, "tag_mode_and", ref firstOcc, data); |
---|
84 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(perPage, "per_page", ref firstOcc, data); |
---|
85 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(Page, "page", ref firstOcc, data); |
---|
86 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(Order, "order", ref firstOcc, data); |
---|
87 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(minRate, "f_min_rate", ref firstOcc, data); |
---|
88 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(maxRate, "f_max_rate", ref firstOcc, data); |
---|
89 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(minHit, "f_min_hit", ref firstOcc, data); |
---|
90 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(maxHit, "f_max_hit", ref firstOcc, data); |
---|
91 | PwgProxyReponseHelper.buildQueryFromValue<DateTime>(minDateAvailable, "f_min_date_available", ref firstOcc, data); |
---|
92 | PwgProxyReponseHelper.buildQueryFromValue<DateTime>(maxDateAvailable, "f_max_date_available", ref firstOcc, data); |
---|
93 | PwgProxyReponseHelper.buildQueryFromValue<DateTime>(minDateCreated, "f_min_date_created", ref firstOcc, data); |
---|
94 | PwgProxyReponseHelper.buildQueryFromValue<DateTime>(maxDateCreated, "f_max_date_created", ref firstOcc, data); |
---|
95 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(minRatio, "f_min_ratio", ref firstOcc, data); |
---|
96 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(maxRatio, "f_max_ratio", ref firstOcc, data); |
---|
97 | PwgProxyReponseHelper.buildQueryFromValue<Boolean>(withThumbnail, "f_with_thumbnail", ref firstOcc, data); |
---|
98 | |
---|
99 | response = PwgGenericProxy<PwgImagesProxyResponse>.Post( |
---|
100 | PwgConfigProxy.PwgServeurUri, |
---|
101 | data.ToString()); |
---|
102 | } |
---|
103 | catch (Exception ex) |
---|
104 | { |
---|
105 | throw new PwgProxyException("pwg_tags_getImages", ex); |
---|
106 | } |
---|
107 | return response; |
---|
108 | |
---|
109 | } |
---|
110 | static internal PwgAddRequestProxyResponse pwg_tag_add(string tagName) |
---|
111 | { |
---|
112 | PwgAddRequestProxyResponse response = null; |
---|
113 | try |
---|
114 | { |
---|
115 | StringBuilder data = new StringBuilder(); |
---|
116 | data.Append("method=pwg.tags.add"); |
---|
117 | data.Append("&name=" + HttpUtility.UrlEncode(tagName)); |
---|
118 | |
---|
119 | response = PwgGenericProxy<PwgAddRequestProxyResponse>.Post( |
---|
120 | PwgConfigProxy.PwgServeurUri, |
---|
121 | data.ToString()); |
---|
122 | } |
---|
123 | catch (Exception ex) |
---|
124 | { |
---|
125 | throw new PwgProxyException("pwg_tag_add", ex); |
---|
126 | } |
---|
127 | |
---|
128 | return response; |
---|
129 | } |
---|
130 | |
---|
131 | } |
---|
132 | |
---|
133 | } |
---|
134 | |
---|