Ignore:
Timestamp:
Sep 7, 2009, 3:54:31 PM (15 years ago)
Author:
bayral
Message:

Complete pwg.categories.* support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/PiwigoLib/PiwigoLib/Proxy/PwgCategoriesProxy.cs

    r3834 r3835  
    1212    static class PwgCategoriesProxy
    1313    {
     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>
    1421        static public PwgCategoriesProxyResponse pwg_categories_getList(Int32? CategoryId,
    1522            Boolean? Recursive, Boolean? PublicOnly)
     
    3744        }
    3845
     46        /// <summary>
     47        /// pwg.categories.getAdminList
     48        /// </summary>
     49        /// <returns></returns>
    3950        static public PwgCategoriesProxyResponse pwg_categories_getAdminList()
    4051        {
     
    5465        }
    5566
     67        /// <summary>
     68        /// pwg.categories.add
     69        /// </summary>
     70        /// <param name="categorieName"></param>
     71        /// <param name="IdUpperCat"></param>
     72        /// <returns></returns>
    5673        static public PwgAddRequestProxyResponse pwg_categories_add(String categorieName, Int32? IdUpperCat)
    5774        {
     
    7794        }
    7895
     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);
     114
     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        }
    79226
    80227    }
Note: See TracChangeset for help on using the changeset viewer.