FileDocCategorySizeDatePackage
CalendarClient.javaAPI DocAndroid 1.5 API3975Wed May 06 22:41:16 BST 2009com.google.wireless.gdata.calendar.client

CalendarClient

public class CalendarClient extends com.google.wireless.gdata.client.GDataServiceClient
GDataServiceClient for accessing Google Calendar. This client can access and parse both the meta feed (list of calendars for a user) and events feeds (calendar entries for a specific user). The parsers this class uses handle the XML version of feeds.

Fields Summary
public static final String
SERVICE
Service value for calendar.
public static final String
PROJECTION_PRIVATE_FULL
public static final String
PROJECTION_PRIVATE_SELF_ATTENDANCE
private static final String
CALENDAR_BASE_FEED_URL
Standard base url for a calendar feed.
Constructors Summary
public CalendarClient(com.google.wireless.gdata.client.GDataClient client, com.google.wireless.gdata.client.GDataParserFactory factory)
Create a new CalendarClient. Uses the standard base URL for calendar feeds.

param
client The GDataClient that should be used to authenticate requests, retrieve feeds, etc.
param
factory The factory that should be used to obtain {@link GDataParser}s used by this client.


                                                    
         
        super(client, factory);
    
Methods Summary
public java.lang.StringgetDefaultCalendarUrl(java.lang.String username, java.lang.String projection, com.google.wireless.gdata.client.QueryParams params)
Returns the url for the default feed for a user, after applying the provided QueryParams.

param
username The username for this user.
param
projection the projection to use
param
params The QueryParams that should be applied to the default feed.
return
The url that should be used to retrieve a user's default feed.

        String feedUrl = CALENDAR_BASE_FEED_URL + getGDataClient().encodeUri(username);
        feedUrl += projection;
        if (params == null) {
            return feedUrl;
        }
        return params.generateQueryUrl(feedUrl);
    
public com.google.wireless.gdata.parser.GDataParsergetParserForUserCalendars(java.lang.String feedUrl, java.lang.String authToken)
Fetches the meta feed containing the list of calendars for a user. The caller is responsible for closing the returned {@link GDataParser}.

param
feedUrl the URL of the user calendars feed
param
authToken The authentication token for this user
return
A GDataParser with the meta feed containing the list of calendars for this user.
throws
ParseException Thrown if the feed could not be fetched.

        GDataClient gDataClient = getGDataClient();
        InputStream is = gDataClient.getFeedAsStream(feedUrl, authToken);
        return getGDataParserFactory().createParser(CalendarEntry.class, is);
    
public java.lang.StringgetServiceName()

        return SERVICE;
    
public java.lang.StringgetUserCalendarsUrl(java.lang.String username)
Returns the url for the metafeed for user, which contains the information about the user's calendars.

param
username The username for this user.
return
The url that should be used to retrieve a user's default feed.

        return CALENDAR_BASE_FEED_URL + getGDataClient().encodeUri(username);