KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > blogs > api > BloggerAPI


1 /*
2  * ____.
3  * __/\ ______| |__/\. _______
4  * __ .____| | \ | +----+ \
5  * _______| /--| | | - \ _ | : - \_________
6  * \\______: :---| : : | : | \________>
7  * |__\---\_____________:______: :____|____:_____\
8  * /_____|
9  *
10  * . . . i n j a h i a w e t r u s t . . .
11  *
12  *
13  *
14  * ----- BEGIN LICENSE BLOCK -----
15  * Version: JCSL 1.0
16  *
17  * The contents of this file are subject to the Jahia Community Source License
18  * 1.0 or later (the "License"); you may not use this file except in
19  * compliance with the License. You may obtain a copy of the License at
20  * http://www.jahia.org/license
21  *
22  * Software distributed under the License is distributed on an "AS IS" basis,
23  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
24  * for the rights, obligations and limitations governing use of the contents
25  * of the file. The Original and Upgraded Code is the Jahia CMS and Portal
26  * Server. The developer of the Original and Upgraded Code is JAHIA Ltd. JAHIA
27  * Ltd. owns the copyrights in the portions it created. All Rights Reserved.
28  *
29  * The Shared Modifications are Jahia View Helper.
30  *
31  * The Developer of the Shared Modifications is Jahia Solution Sàrl.
32  * Portions created by the Initial Developer are Copyright (C) 2002 by the
33  * Initial Developer. All Rights Reserved.
34  *
35  * ----- END LICENSE BLOCK -----
36  */

37
38 package org.jahia.blogs.api;
39
40 import org.apache.xmlrpc.XmlRpcException;
41
42 import java.util.Vector JavaDoc;
43 import java.util.Hashtable JavaDoc;
44
45 /**
46  * Blogger 1.0 API interface.
47  *
48  * Blogger API spec can be found at http://plant.blogger.com/api/index.html
49  * See also http://xmlrpc.free-conversant.com/docs/bloggerAPI
50  *
51  * @author Xavier Lawrence
52  */

53 public interface BloggerAPI {
54     
55     /**
56      * Create a new Post for a given blog. Optionally, will publish the blog
57      * after posting.
58      *
59      * @param appKey Unique identifier/passcode of the application sending the post
60      * @param blogID Unique identifier of the blog the post will be added to
61      * @param userName Login for a user who has permission to post to the blog
62      * @param password Password for given userName
63      * @param content Content of the post
64      * @param publish If true, the blog will be published immediately after the
65      * post is made
66      *
67      * @return The Post ID as a String object
68      * @throws XmlRpcException If something goes wrong
69      */

70     public String JavaDoc newPost(
71             final String JavaDoc appKey,
72             final String JavaDoc blogID,
73             final String JavaDoc userName,
74             final String JavaDoc password,
75             final String JavaDoc content,
76             final boolean publish)
77             throws XmlRpcException;
78     
79     /**
80      * Edits a given post. Optionally, will publish the blog after making the
81      * edit.
82      *
83      * @param appKey Unique identifier/passcode of the application sending the post
84      * @param postID Unique identifier of the post to be changed
85      * @param userName Login for a user who has permission to post to the blog
86      * @param password Password for given userName
87      * @param content Content of the post
88      * @param publish If true, the blog will be published immediately after the
89      * post is made
90      *
91      * @return True if the edition was sucessful
92      * @throws XmlRpcException If something goes wrong
93      */

94     public boolean editPost(
95             final String JavaDoc appKey,
96             final String JavaDoc postID,
97             final String JavaDoc userName,
98             final String JavaDoc password,
99             final String JavaDoc content,
100             final boolean publish)
101             throws XmlRpcException;
102     
103     
104     /**
105      * Deletes a given post. Optionally, will publish the blog after making the
106      * delete.
107      *
108      * @param appKey Unique identifier/passcode of the application sending the post
109      * @param postID Unique identifier of the post to be removed
110      * @param userName Login for a user who has permission to post to the blog
111      * @param password Password for given userName
112      * @param publish If true, the blog will be published immediately after the
113      * post is made
114      *
115      * @return True if the edition was sucessful
116      * @throws XmlRpcException If something goes wrong
117      */

118     public boolean deletePost(
119             final String JavaDoc appKey,
120             final String JavaDoc postID,
121             final String JavaDoc userName,
122             final String JavaDoc password,
123             final boolean publish)
124             throws XmlRpcException;
125     
126     /**
127      * Get a particular post for a particular user.
128      *
129      * @param appKey Unique identifier/passcode of the application sending the post
130      * @param postID Unique identifier of the post to be retreive
131      * @param userName Login for a user who has permission to post to the blog
132      * @param password Password for given userName
133      *
134      * @return The queried post in a Hashtable object
135      * @throws XmlRpcException If something goes wrong
136      */

137     public Hashtable JavaDoc getPost(
138             final String JavaDoc appKey,
139             final String JavaDoc postID,
140             final String JavaDoc userName,
141             final String JavaDoc password)
142             throws XmlRpcException;
143     
144     /**
145      * Returns the quantity of most recent posts.
146      * This method was added to the Blogger 1.0 API via an Email from Evan
147      * Williams to the Yahoo Group bloggerDev, see the email message for details
148      * http://groups.yahoo.com/group/bloggerDev/message/225
149      *
150      * @param appKey Unique identifier/passcode of the application sending the post
151      * @param blogID Unique identifier of the blog the post will be added to
152      * @param userName Login for a user who has permission to post to the blog
153      * @param password Password for given userName
154      * @param numberOfPosts Number of Posts to Retrieve
155      *
156      * @return A Vector containing the posts' information
157      * @throws XmlRpcException If something goes wrong
158      */

159     public Vector JavaDoc getRecentPosts(
160             final String JavaDoc appKey,
161             final String JavaDoc blogID,
162             final String JavaDoc userName,
163             final String JavaDoc password,
164             final int numberOfPosts)
165             throws XmlRpcException;
166     
167     /**
168      * Edits the main index template of a given blog.
169      *
170      * @param appKey Unique identifier/passcode of the application sending the post
171      * @param blogID Unique identifier of the blog the post will be added to
172      * @param userName Login for a Blogger user who has permission to post to the blog
173      * @param password Password for said username
174      * @param templateData The text for the new template (usually mostly HTML).
175      * @param templateType Determines which of the blog's templates is to be set.
176      *
177      * @return True if the template was correctly set
178      * @throws XmlRpcException If something goes wrong
179      */

180     public boolean setTemplate(
181             final String JavaDoc appKey,
182             final String JavaDoc blogID,
183             final String JavaDoc userName,
184             final String JavaDoc password,
185             final String JavaDoc templateData,
186             final String JavaDoc templateType)
187             throws XmlRpcException;
188     
189     /**
190      * Returns the main or archive index template of a given blog.
191      *
192      * @param appKey Unique identifier/passcode of the application sending the post
193      * @param blogID Unique identifier of the blog the post will be added to
194      * @param userName Login for a user who has permission to post to the blog
195      * @param password Password for given userName
196      * @param templateType Determines which of the blog's templates will be
197      * returned. Currently, either "main" or "archiveIndex"
198      *
199      * @return The template as a String Object
200      * @throws XmlRpcException If something goes wrong
201      */

202     public String JavaDoc getTemplate(
203             final String JavaDoc appKey,
204             final String JavaDoc blogID,
205             final String JavaDoc userName,
206             final String JavaDoc password,
207             final String JavaDoc templateType)
208             throws XmlRpcException;
209     
210     /**
211      * Authenticates a user and returns basic user info (nickName, firstName,
212      * lastName, url and email).
213      *
214      * @param appKey Unique identifier/passcode of the application sending the post
215      * @param userName Login of the user to authenticate
216      * @param password Password for given userName
217      *
218      * @return The user info in a Hashtable Object
219      * @throws XmlRpcException If something goes wrong
220      */

221     public Hashtable JavaDoc getUserInfo(
222             final String JavaDoc appKey,
223             final String JavaDoc userName,
224             final String JavaDoc password)
225             throws XmlRpcException;
226     
227     /**
228      * Returns information (blogID, blogName and url) of each blog a given user
229      * is a member of.
230      *
231      * @param appKey Unique identifier/passcode of the application sending the post
232      * @param userName Login for a user who has permission to post to the blog
233      * @param password Password for given userName
234      *
235      * @return A Vector of Hashtables containing the blogs' information
236      * @throws XmlRpcException If something goes wrong
237      */

238     public Vector JavaDoc getUsersBlogs(
239             final String JavaDoc appKey,
240             final String JavaDoc userName,
241             final String JavaDoc password)
242             throws XmlRpcException;
243 }
244
Popular Tags