Ignore:
Timestamp:
Aug 2, 2011, 4:50:49 PM (13 years ago)
Author:
bayral
Message:

First draw of pwg.image.add and pwg.imae.addtrunck.
addtrunck seem to be ok, but image.add return server error 500.

Location:
extensions/PiwigoLib/PiwigoLib/Proxy
Files:
1 added
2 edited

Legend:

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

    r11872 r11890  
    1515
    1616        /*
    17          * pwg.images.add
    18          * pwg.images.addChunk
     17         * pwg.images.add                   pwg_images_add
     18         * pwg.images.addChunk              pwg_images_addChunk
    1919         * pwg.images.addComment
    2020         * pwg.images.addFile               
    21          * pwg.images.addSimple            pwg_images_addSimple
     21         * pwg.images.addSimple             pwg_images_addSimple
    2222         * pwg.images.checkFiles
    2323         * pwg.images.checkUpload
    24          * pwg.images.delete               pwg_images_delete
     24         * pwg.images.delete                pwg_images_delete
    2525         * pwg.images.exist
    26          * pwg.images.getInfo
     26         * pwg.images.getInfo               pwg_images_getInfos
    2727         * pwg.images.rate                  pwg_images_rate
    2828         * pwg.images.regenerateThumbnail
     
    3131         * pwg.images.setPrivacyLevel
    3232 * */
     33
     34        static internal PwgBaseProxyReponse pwg_images_add(String fileGuid, String thunbGuid, String HighresGuid,
     35            String imageGuid,  String imageFilename, String imageName, String imageAuthor, DateTime creationDate, 
     36            String authorComment,List<String> lstCategories, List<String> lstTags, PwgConfidentLevelEnum? confidentLevel)
     37        {
     38            PwgBaseProxyReponse response = null;
     39            try
     40            {           
     41                StringBuilder data = new StringBuilder();
     42                data.Append("method=pwg.images.add");
     43                Boolean firstOcc = false;
     44                PwgProxyReponseHelper.buildQueryFromValue<String>(fileGuid, "file_sum", ref firstOcc, data);
     45                PwgProxyReponseHelper.buildQueryFromValue<String>(thunbGuid, "thumbnail_sum", ref firstOcc, data);
     46                PwgProxyReponseHelper.buildQueryFromValue<String>(HighresGuid, "high_sum", ref firstOcc, data);
     47                PwgProxyReponseHelper.buildQueryFromValue<String>(imageGuid, "original_sum", ref firstOcc, data);
     48                PwgProxyReponseHelper.buildQueryFromValue<String>(imageFilename, "original_filename", ref firstOcc, data);
     49                PwgProxyReponseHelper.buildQueryFromValue<String>(imageName, "name", ref firstOcc, data);
     50                PwgProxyReponseHelper.buildQueryFromValue<String>(imageAuthor, "author", ref firstOcc, data);
     51                PwgProxyReponseHelper.buildQueryFromValue<String>(authorComment, "comment", ref firstOcc, data);
     52                PwgProxyReponseHelper.buildQueryFromArray<String>(lstCategories, "categories", ref firstOcc, data);
     53                PwgProxyReponseHelper.buildQueryFromArray<String>(lstTags, "tag_ids", ref firstOcc, data);
     54                PwgProxyReponseHelper.buildQueryFromValue<Int32>((int?)confidentLevel, "level", ref firstOcc, data);
     55                PwgProxyReponseHelper.buildQueryFromValue<DateTime>(creationDate, "date_creation", ref firstOcc, data);
     56
     57                response = PwgGenericProxy<PwgBaseProxyReponse>.Post(
     58                    PwgConfigProxy.PwgServeurUri,
     59                    data.ToString());
     60            }
     61            catch (Exception ex)
     62            {
     63                throw new PwgProxyException("pwg_images_rate", ex);
     64            }
     65
     66            return response;
     67        }
     68
     69       /// <summary>
     70       /// pwg.images.addChunk
     71       /// </summary>
     72       /// <param name="strb64Data"></param>
     73       /// <param name="uniqueId"></param>
     74       /// <param name="fileType"></param>
     75       /// <param name="?"></param>
     76       /// <param name="chunckNumber"></param>
     77       /// <returns></returns>
     78        static internal PwgBaseProxyReponse pwg_images_addChunk(String strb64Data, String uniqueId, PwgFileTypeEnum fileType, Int32 chunckNumber )
     79        {
     80            PwgBaseProxyReponse response = null;
     81            try
     82            {
     83               
     84                StringBuilder data = new StringBuilder();
     85                data.Append("method=pwg.images.addChunk");
     86                Boolean firstOcc = false;
     87                PwgProxyReponseHelper.buildQueryFromValue<String>(strb64Data, "data", ref firstOcc, data);
     88                PwgProxyReponseHelper.buildQueryFromValue<String>(uniqueId, "original_sum", ref firstOcc, data);
     89                PwgProxyReponseHelper.buildQueryFromValue<PwgFileTypeEnum>(fileType, "type", ref firstOcc, data);
     90                PwgProxyReponseHelper.buildQueryFromValue<Int32>(chunckNumber, "position", ref firstOcc, data);
     91
     92                response = PwgGenericProxy<PwgBaseProxyReponse>.Post(
     93                    PwgConfigProxy.PwgServeurUri,
     94                    data.ToString());
     95            }
     96            catch (Exception ex)
     97            {
     98                throw new PwgProxyException("pwg_images_rate", ex);
     99            }
     100
     101            return response;
     102        }
    33103
    34104        /// <summary>
  • extensions/PiwigoLib/PiwigoLib/Proxy/Response/PwgImagesProxyResponse.cs

    r11872 r11890  
    2929        public String Stdev { get; set; }
    3030    }
     31     
    3132
    3233    [Serializable()]
     
    6263        [XmlArrayItem("category")]
    6364        public PwgCategoryProxyResponse[] Categories { get; set; }
    64 
    6565    }
    6666
     
    7575    [Serializable()]
    7676    [XmlRoot(ElementName = "image")]
    77     public class PwgImageInfoImageProxyResponse
     77    public class PwgImageInfoImageProxyResponse : PwgImageProxyResponse
    7878    {
    79         [XmlAttribute(AttributeName = "id")]
    80         public Int32 Id { get; set; }
    81         [XmlAttribute(AttributeName = "width")]
    82         public Int32 Width { get; set; }
    83         [XmlAttribute(AttributeName = "height")]
    84         public Int32 Height { get; set; }
    85         [XmlAttribute(AttributeName = "file")]
    86         public String File { get; set; }
    87         [XmlAttribute(AttributeName = "tn_url")]
    88         public String UrlThunb { get; set; }
    89         [XmlAttribute(AttributeName = "element_url")]
    90         public String UrlElement { get; set; }
    91         [XmlAttribute(AttributeName = "high_url")]
    92         public String UrlHighDef { get; set; }
    93         [XmlAttribute(AttributeName = "hit")]
    94         public Int64 Counter { get; set; }
    95         [XmlAttribute(AttributeName = "date_creation")]
    96         public String CreatingDate { get; set; }
    97         [XmlAttribute(AttributeName = "date_available")]
    98         public String AvailableDate { get; set; }
    99         [XmlAttribute(AttributeName = "tn_ext")]
    10079        public String ExtThumbail { get; set; }
    10180        [XmlAttribute(AttributeName = "author")]
     
    11291        public Int32 ConfidentialLevel { get; set; }
    11392        [XmlAttribute(AttributeName = "md5sum")]
    114         public String mdSum { get; set; }
     93        public String md5Sum { get; set; }
    11594        [XmlAttribute(AttributeName = "added_by")]
    11695        public Int32 UserIdAddedBy { get; set; }
     
    11897        [XmlElement("name")]
    11998        public String Name { get; set; }
    120 
    121         [XmlArray("tags")]
    122         [XmlArrayItem("tag")]
    123         public PwgTagProxyResponse[] Tags { get; set; }
    124 
    125         [XmlArray("categories")]
    126         [XmlArrayItem("category")]
    127         public PwgCategoryProxyResponse[] Categories { get; set; }
    12899
    129100        [XmlElement("rates")]
     
    134105
    135106        [XmlElement("comment_post")]
    136         public PwgPostCommentSecurityInfo PostCommenSecurityData { get; set; }
     107        public PwgPostCommentSecurityInfo PostCommentSecurityData { get; set; }
    137108    }
    138109
Note: See TracChangeset for help on using the changeset viewer.