source: extensions/PiwigoLib/PiwigoLib/Proxy/PwgTagsProxy.cs @ 3819

Last change on this file since 3819 was 3819, checked in by bayral, 15 years ago

pwg.tags.add support

File size: 2.2 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5using Com.Piwigo.Lib.DTO;
6using System.Web;
7using Com.Piwigo.Lib.Proxy.Response;
8
9namespace Com.Piwigo.Lib.Proxy
10{
11    static class PwgTagsProxy
12    {
13        static public PwgTagsProxyResponse pwg_tags_getList(Boolean sortedByCounter)
14        {
15            PwgTagsProxyResponse response = null;
16            try
17            {
18                StringBuilder data = new StringBuilder();
19                data.Append("sort_by_counter=" + HttpUtility.UrlEncode(sortedByCounter.ToString().ToLower()));
20
21                response = PwgGenericProxy<PwgTagsProxyResponse>.Get(
22                                PwgConfigProxy.PwgServeurUriBuilder.Uri,
23                                "pwg.tags.getList", data.ToString());
24            }
25            catch (Exception ex)
26            {
27                throw new PwgProxyException("pwg_tags_getList", ex);
28            }
29            return response;
30
31        }
32
33        static public PwgTagsProxyResponse pwg_tags_getAdminList()
34        {
35            PwgTagsProxyResponse response = null;
36            try
37            {
38                response = PwgGenericProxy<PwgTagsProxyResponse>.Get(
39                                PwgConfigProxy.PwgServeurUriBuilder.Uri,
40                                "pwg.tags.getAdminList", null);
41            }
42            catch (Exception ex)
43            {
44                throw new PwgProxyException("pwg_tags_getAdminList", ex);
45            }
46            return response;
47
48        }
49
50        static public PwgTagsProxyResponse pwg_tag_add(string tagName)
51        {
52            PwgTagsProxyResponse response = null;
53            try
54            {
55                StringBuilder data = new StringBuilder();
56                data.Append("method=pwg.tags.add");
57                data.Append("&name=" + HttpUtility.UrlEncode(tagName));
58
59                response = PwgGenericProxy<PwgTagsProxyResponse>.Post(
60                    PwgConfigProxy.PwgServeurUriBuilder.Uri,
61                    data.ToString());
62            }
63            catch (Exception ex)
64            {
65                throw new PwgProxyException("pwg_tag_add", ex);
66            }
67
68            return response;
69        }
70
71    }
72
73}
74
Note: See TracBrowser for help on using the repository browser.