using System; using System.Collections.Generic; using System.Text; using Com.Piwigo.Lib.DTO; using System.Web; using Com.Piwigo.Lib.Proxy.Response; using Com.Piwigo.Lib.Proxy.Helper; namespace Com.Piwigo.Lib.Proxy { static internal class PwgTagsProxy { /* pwg.tags.add pwg_tag_add * pwg.tags.getAdminList pwg_tags_getAdminList * pwg.tags.getImages pwg_tags_getImages * pwg.tags.getList pwg_tags_getList * */ static internal PwgTagsProxyResponse pwg_tags_getList(Boolean? sortedByCounter) { PwgTagsProxyResponse response = null; try { StringBuilder data = new StringBuilder(); Boolean firstOcc = true; PwgProxyReponseHelper.buildQueryFromValue(sortedByCounter, "sort_by_counter", ref firstOcc, data); response = PwgGenericProxy.Get( PwgConfigProxy.PwgServeurUri, "pwg.tags.getList", data.ToString()); } catch (Exception ex) { throw new PwgProxyException("pwg_tags_getList", ex); } return response; } static internal PwgTagsProxyResponse pwg_tags_getAdminList() { PwgTagsProxyResponse response = null; try { response = PwgGenericProxy.Get( PwgConfigProxy.PwgServeurUri, "pwg.tags.getAdminList", null); } catch (Exception ex) { throw new PwgProxyException("pwg_tags_getAdminList", ex); } return response; } static internal PwgImagesProxyResponse pwg_tags_getImages(List tagsId, List tagsUrlName, List tagsName, Boolean? tagModeAnd, Int32? perPage, Int32? Page, Int32? Order, Int32? minRate, Int32? maxRate, Int32? minHit, Int32? maxHit, DateTime? minDateAvailable, DateTime? maxDateAvailable, DateTime? minDateCreated, DateTime? maxDateCreated, Int32? minRatio, Int32? maxRatio, Boolean? withThumbnail) { PwgImagesProxyResponse response = null; try { StringBuilder data = new StringBuilder(); Boolean firstOcc = true; data.AppendFormat("method={0}","pwg.tags.getImages"); firstOcc = false; PwgProxyReponseHelper.buildQueryFromArray(tagsId, "tag_id", ref firstOcc, data); PwgProxyReponseHelper.buildQueryFromArray(tagsUrlName, "tag_url_name", ref firstOcc, data); PwgProxyReponseHelper.buildQueryFromArray(tagsName, "tag_name", ref firstOcc, data); PwgProxyReponseHelper.buildQueryFromValue(tagModeAnd, "tag_mode_and", ref firstOcc, data); PwgProxyReponseHelper.buildQueryFromValue(perPage, "per_page", ref firstOcc, data); PwgProxyReponseHelper.buildQueryFromValue(Page, "page", ref firstOcc, data); PwgProxyReponseHelper.buildQueryFromValue(Order, "order", ref firstOcc, data); PwgProxyReponseHelper.buildQueryFromValue(minRate, "f_min_rate", ref firstOcc, data); PwgProxyReponseHelper.buildQueryFromValue(maxRate, "f_max_rate", ref firstOcc, data); PwgProxyReponseHelper.buildQueryFromValue(minHit, "f_min_hit", ref firstOcc, data); PwgProxyReponseHelper.buildQueryFromValue(maxHit, "f_max_hit", ref firstOcc, data); PwgProxyReponseHelper.buildQueryFromValue(minDateAvailable, "f_min_date_available", ref firstOcc, data); PwgProxyReponseHelper.buildQueryFromValue(maxDateAvailable, "f_max_date_available", ref firstOcc, data); PwgProxyReponseHelper.buildQueryFromValue(minDateCreated, "f_min_date_created", ref firstOcc, data); PwgProxyReponseHelper.buildQueryFromValue(maxDateCreated, "f_max_date_created", ref firstOcc, data); PwgProxyReponseHelper.buildQueryFromValue(minRatio, "f_min_ratio", ref firstOcc, data); PwgProxyReponseHelper.buildQueryFromValue(maxRatio, "f_max_ratio", ref firstOcc, data); PwgProxyReponseHelper.buildQueryFromValue(withThumbnail, "f_with_thumbnail", ref firstOcc, data); response = PwgGenericProxy.Post( PwgConfigProxy.PwgServeurUri, data.ToString()); } catch (Exception ex) { throw new PwgProxyException("pwg_tags_getImages", ex); } return response; } static internal PwgAddRequestProxyResponse pwg_tag_add(String tagName) { PwgAddRequestProxyResponse response = null; try { StringBuilder data = new StringBuilder(); data.Append("method=pwg.tags.add"); data.Append("&name=" + Uri.EscapeUriString(tagName)); response = PwgGenericProxy.Post( PwgConfigProxy.PwgServeurUri, data.ToString()); } catch (Exception ex) { throw new PwgProxyException("pwg_tag_add", ex); } return response; } } }