[3816] | 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; |
---|
[3827] | 8 | using Com.Piwigo.Lib.Proxy.Helper; |
---|
[3816] | 9 | |
---|
| 10 | namespace Com.Piwigo.Lib.Proxy |
---|
| 11 | { |
---|
[3834] | 12 | static class PwgCategoriesProxy |
---|
[3816] | 13 | { |
---|
[3835] | 14 | /// <summary> |
---|
| 15 | /// pwg.categories.getList |
---|
| 16 | /// </summary> |
---|
| 17 | /// <param name="CategoryId"></param> |
---|
| 18 | /// <param name="Recursive"></param> |
---|
| 19 | /// <param name="PublicOnly"></param> |
---|
| 20 | /// <returns></returns> |
---|
[3834] | 21 | static public PwgCategoriesProxyResponse pwg_categories_getList(Int32? CategoryId, |
---|
| 22 | Boolean? Recursive, Boolean? PublicOnly) |
---|
[3816] | 23 | { |
---|
[3834] | 24 | PwgCategoriesProxyResponse response = null; |
---|
[3816] | 25 | try |
---|
| 26 | { |
---|
| 27 | StringBuilder data = new StringBuilder(); |
---|
[3834] | 28 | Boolean firstOcc = true; |
---|
[3816] | 29 | |
---|
[3834] | 30 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(CategoryId, "cat_id", ref firstOcc, data); |
---|
| 31 | PwgProxyReponseHelper.buildQueryFromValue<Boolean>(Recursive, "recursive", ref firstOcc, data); |
---|
| 32 | PwgProxyReponseHelper.buildQueryFromValue<Boolean>(PublicOnly, "public", ref firstOcc, data); |
---|
| 33 | |
---|
| 34 | response = PwgGenericProxy<PwgCategoriesProxyResponse>.Get( |
---|
[3816] | 35 | PwgConfigProxy.PwgServeurUriBuilder.Uri, |
---|
[3834] | 36 | "pwg.categories.getList", data.ToString()); |
---|
[3816] | 37 | } |
---|
| 38 | catch (Exception ex) |
---|
| 39 | { |
---|
[3834] | 40 | throw new PwgProxyException("pwg_categories_getList", ex); |
---|
[3816] | 41 | } |
---|
| 42 | return response; |
---|
| 43 | |
---|
| 44 | } |
---|
[3818] | 45 | |
---|
[3835] | 46 | /// <summary> |
---|
| 47 | /// pwg.categories.getAdminList |
---|
| 48 | /// </summary> |
---|
| 49 | /// <returns></returns> |
---|
[3834] | 50 | static public PwgCategoriesProxyResponse pwg_categories_getAdminList() |
---|
[3818] | 51 | { |
---|
[3834] | 52 | PwgCategoriesProxyResponse response = null; |
---|
[3818] | 53 | try |
---|
| 54 | { |
---|
[3834] | 55 | response = PwgGenericProxy<PwgCategoriesProxyResponse>.Get( |
---|
[3818] | 56 | PwgConfigProxy.PwgServeurUriBuilder.Uri, |
---|
[3834] | 57 | "pwg.categories.getAdminList", null); |
---|
[3818] | 58 | } |
---|
| 59 | catch (Exception ex) |
---|
| 60 | { |
---|
[3834] | 61 | throw new PwgProxyException("pwg_categories_getAdminList", ex); |
---|
[3818] | 62 | } |
---|
| 63 | return response; |
---|
| 64 | |
---|
| 65 | } |
---|
| 66 | |
---|
[3835] | 67 | /// <summary> |
---|
| 68 | /// pwg.categories.add |
---|
| 69 | /// </summary> |
---|
| 70 | /// <param name="categorieName"></param> |
---|
| 71 | /// <param name="IdUpperCat"></param> |
---|
| 72 | /// <returns></returns> |
---|
[3834] | 73 | static public PwgAddRequestProxyResponse pwg_categories_add(String categorieName, Int32? IdUpperCat) |
---|
[3827] | 74 | { |
---|
[3834] | 75 | PwgAddRequestProxyResponse response = null; |
---|
[3827] | 76 | try |
---|
| 77 | { |
---|
| 78 | StringBuilder data = new StringBuilder(); |
---|
[3834] | 79 | data.Append("method=pwg.categories.add"); |
---|
| 80 | Boolean firstOcc = false; |
---|
| 81 | PwgProxyReponseHelper.buildQueryFromValue<String>(categorieName, "name", ref firstOcc, data); |
---|
| 82 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(IdUpperCat, "parent", ref firstOcc, data); |
---|
[3827] | 83 | |
---|
[3834] | 84 | response = PwgGenericProxy<PwgAddRequestProxyResponse>.Post( |
---|
[3819] | 85 | PwgConfigProxy.PwgServeurUriBuilder.Uri, |
---|
| 86 | data.ToString()); |
---|
| 87 | } |
---|
| 88 | catch (Exception ex) |
---|
| 89 | { |
---|
[3834] | 90 | throw new PwgProxyException("pwg_categories_add", ex); |
---|
[3819] | 91 | } |
---|
| 92 | |
---|
| 93 | return response; |
---|
| 94 | } |
---|
| 95 | |
---|
[3835] | 96 | /// <summary> |
---|
| 97 | /// pwg.categories.setInfo |
---|
| 98 | /// </summary> |
---|
| 99 | /// <param name="IdCat"></param> |
---|
| 100 | /// <param name="categorieName"></param> |
---|
| 101 | /// <param name="categorieComment"></param> |
---|
| 102 | /// <returns></returns> |
---|
| 103 | static public PwgBaseProxyReponse pwg_categories_setInfo(Int32 IdCat, String categorieName, String categorieComment) |
---|
| 104 | { |
---|
| 105 | PwgBaseProxyReponse response = null; |
---|
| 106 | try |
---|
| 107 | { |
---|
| 108 | StringBuilder data = new StringBuilder(); |
---|
| 109 | data.Append("method=pwg.categories.setInfo"); |
---|
| 110 | Boolean firstOcc = false; |
---|
| 111 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(IdCat, "category_id", ref firstOcc, data); |
---|
| 112 | PwgProxyReponseHelper.buildQueryFromValue<String>(categorieName, "name", ref firstOcc, data); |
---|
| 113 | PwgProxyReponseHelper.buildQueryFromValue<String>(categorieComment, "comment", ref firstOcc, data); |
---|
[3834] | 114 | |
---|
[3835] | 115 | response = PwgGenericProxy<PwgAddRequestProxyResponse>.Post( |
---|
| 116 | PwgConfigProxy.PwgServeurUriBuilder.Uri, |
---|
| 117 | data.ToString()); |
---|
| 118 | } |
---|
| 119 | catch (Exception ex) |
---|
| 120 | { |
---|
| 121 | throw new PwgProxyException("pwg_categories_setInfo", ex); |
---|
| 122 | } |
---|
| 123 | |
---|
| 124 | return response; |
---|
| 125 | } |
---|
| 126 | |
---|
| 127 | /// <summary> |
---|
| 128 | /// pwg.categories.getImages |
---|
| 129 | /// </summary> |
---|
| 130 | /// <param name="catId"></param> |
---|
| 131 | /// <param name="recursive"></param> |
---|
| 132 | /// <param name="perPage"></param> |
---|
| 133 | /// <param name="Page"></param> |
---|
| 134 | /// <param name="Order"></param> |
---|
| 135 | /// <param name="minRate"></param> |
---|
| 136 | /// <param name="maxRate"></param> |
---|
| 137 | /// <param name="minHit"></param> |
---|
| 138 | /// <param name="maxHit"></param> |
---|
| 139 | /// <param name="minDateAvailable"></param> |
---|
| 140 | /// <param name="maxDateAvailable"></param> |
---|
| 141 | /// <param name="minDateCreated"></param> |
---|
| 142 | /// <param name="maxDateCreated"></param> |
---|
| 143 | /// <param name="minRatio"></param> |
---|
| 144 | /// <param name="maxRatio"></param> |
---|
| 145 | /// <param name="withThumbnail"></param> |
---|
| 146 | /// <returns></returns> |
---|
| 147 | static public PwgImagesProxyResponse pwg_categories_getImages(Int32 catId, |
---|
| 148 | Boolean? recursive, |
---|
| 149 | Int32? perPage, |
---|
| 150 | Int32? Page, |
---|
| 151 | Int32? Order, |
---|
| 152 | Int32? minRate, |
---|
| 153 | Int32? maxRate, |
---|
| 154 | Int32? minHit, |
---|
| 155 | Int32? maxHit, |
---|
| 156 | DateTime? minDateAvailable, |
---|
| 157 | DateTime? maxDateAvailable, |
---|
| 158 | DateTime? minDateCreated, |
---|
| 159 | DateTime? maxDateCreated, |
---|
| 160 | Int32? minRatio, |
---|
| 161 | Int32? maxRatio, |
---|
| 162 | Boolean? withThumbnail) |
---|
| 163 | { |
---|
| 164 | PwgImagesProxyResponse response = null; |
---|
| 165 | try |
---|
| 166 | { |
---|
| 167 | StringBuilder data = new StringBuilder(); |
---|
| 168 | Boolean firstOcc = true; |
---|
| 169 | data.AppendFormat("method={0}", "pwg.categories.getImages"); |
---|
| 170 | firstOcc = false; |
---|
| 171 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(catId, "cat_id", ref firstOcc, data); |
---|
| 172 | |
---|
| 173 | PwgProxyReponseHelper.buildQueryFromValue<Boolean>(recursive, "recursive", ref firstOcc, data); |
---|
| 174 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(perPage, "per_page", ref firstOcc, data); |
---|
| 175 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(Page, "page", ref firstOcc, data); |
---|
| 176 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(Order, "order", ref firstOcc, data); |
---|
| 177 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(minRate, "f_min_rate", ref firstOcc, data); |
---|
| 178 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(maxRate, "f_max_rate", ref firstOcc, data); |
---|
| 179 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(minHit, "f_min_hit", ref firstOcc, data); |
---|
| 180 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(maxHit, "f_max_hit", ref firstOcc, data); |
---|
| 181 | PwgProxyReponseHelper.buildQueryFromValue<DateTime>(minDateAvailable, "f_min_date_available", ref firstOcc, data); |
---|
| 182 | PwgProxyReponseHelper.buildQueryFromValue<DateTime>(maxDateAvailable, "f_max_date_available", ref firstOcc, data); |
---|
| 183 | PwgProxyReponseHelper.buildQueryFromValue<DateTime>(minDateCreated, "f_min_date_created", ref firstOcc, data); |
---|
| 184 | PwgProxyReponseHelper.buildQueryFromValue<DateTime>(maxDateCreated, "f_max_date_created", ref firstOcc, data); |
---|
| 185 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(minRatio, "f_min_ratio", ref firstOcc, data); |
---|
| 186 | PwgProxyReponseHelper.buildQueryFromValue<Int32>(maxRatio, "f_max_ratio", ref firstOcc, data); |
---|
| 187 | PwgProxyReponseHelper.buildQueryFromValue<Boolean>(withThumbnail, "f_with_thumbnail", ref firstOcc, data); |
---|
| 188 | |
---|
| 189 | response = PwgGenericProxy<PwgImagesProxyResponse>.Post( |
---|
| 190 | PwgConfigProxy.PwgServeurUriBuilder.Uri, |
---|
| 191 | data.ToString()); |
---|
| 192 | } |
---|
| 193 | catch (Exception ex) |
---|
| 194 | { |
---|
| 195 | throw new PwgProxyException("pwg_categories_getImages", ex); |
---|
| 196 | } |
---|
| 197 | return response; |
---|
| 198 | |
---|
| 199 | } |
---|
| 200 | |
---|
| 201 | /// <summary> |
---|
| 202 | /// |
---|
| 203 | /// </summary> |
---|
| 204 | /// <param name="tagName"></param> |
---|
| 205 | /// <returns></returns> |
---|
| 206 | static public PwgAddRequestProxyResponse pwg_tag_add(string tagName) |
---|
| 207 | { |
---|
| 208 | PwgAddRequestProxyResponse response = null; |
---|
| 209 | try |
---|
| 210 | { |
---|
| 211 | StringBuilder data = new StringBuilder(); |
---|
| 212 | data.Append("method=pwg.tags.add"); |
---|
| 213 | data.Append("&name=" + HttpUtility.UrlEncode(tagName)); |
---|
| 214 | |
---|
| 215 | response = PwgGenericProxy<PwgAddRequestProxyResponse>.Post( |
---|
| 216 | PwgConfigProxy.PwgServeurUriBuilder.Uri, |
---|
| 217 | data.ToString()); |
---|
| 218 | } |
---|
| 219 | catch (Exception ex) |
---|
| 220 | { |
---|
| 221 | throw new PwgProxyException("pwg_tag_add", ex); |
---|
| 222 | } |
---|
| 223 | |
---|
| 224 | return response; |
---|
| 225 | } |
---|
| 226 | |
---|
[3816] | 227 | } |
---|
| 228 | |
---|
| 229 | } |
---|
| 230 | |
---|