Add description to the previously committed patch
[debian/pino.git] / src / rest_urls.vala
1 /* rest_urls.vala
2  *
3  * Copyright (C) 2009-2010  troorl
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  *
18  * Author:
19  *      troorl <troorl@gmail.com>
20  */
21
22 namespace RestAPI {
23
24 public class RestUrls : Object {
25         
26         private ServiceType stype;
27         
28         
29         private string prefix = "";
30         
31         public string home() {
32                 return prefix + "statuses/home_timeline.xml";
33         }
34         
35         public string status_update() {
36                 return prefix + "statuses/update.xml";
37         }
38         
39         public string destroy_status() {
40                 return prefix + "statuses/destroy/%s.xml";
41         }
42         
43         public string destroy_direct() {
44                 return prefix + "direct_messages/destroy/%s.xml";
45         }
46         
47         public string direct_new() {
48                 return prefix + "direct_messages/new.xml";
49         }
50         
51         public string mentions() {
52                 return prefix + "statuses/mentions.xml";
53         }
54         
55         public string direct_in() {
56                 return prefix + "direct_messages.xml";
57         }
58                 
59         public string user() {
60                 return prefix + "users/show/%s.xml";
61         }
62         
63         public string friendship() {
64                 return prefix + "friendships/show.xml";
65         }
66         
67         public string status() {
68                 return prefix + "statuses/show/%s.xml";
69         }
70         
71         public string users_timeline() {
72                 return prefix + "statuses/user_timeline/%s.xml";
73         }
74         
75         public string follow_create() {
76                 return prefix + "friendships/create/%s.xml";
77         }
78         
79         public string follow_destroy() {
80                 return prefix + "friendships/destroy/%s.xml";
81         }
82         
83         public string favorites() {
84                 return prefix + "favorites.xml";
85         }
86         
87         public string favorite_create() {
88                 return prefix + "favorites/create/%s.xml";
89         }
90         
91         public string favorite_destroy() {
92                 return prefix + "favorites/destroy/%s.xml";
93         }
94                 
95         public RestUrls(ServiceType _stype, string _prefix = "") {
96                 set_prefix(_stype, _prefix);
97         }
98         
99         public void set_prefix(ServiceType _stype, string _prefix = "") {
100                 stype = _stype;
101                 
102                 switch(_stype) {
103                         case ServiceType.TWITTER:
104                                 prefix = "http://api.twitter.com/";
105                                 break;
106                         
107                         case ServiceType.IDENTICA:
108                                 prefix = "http://identi.ca/api/";
109                                 break;
110                         
111                         case ServiceType.UNKNOWN:
112                                 prefix = _prefix;
113                                 break;
114                 }
115         }
116 }
117
118 }