Spring Social Facebook

org.springframework.social.facebook.api
Interface EventOperations


public interface EventOperations

Defines operations for creating and reading event data as well as RSVP'ing to events on behalf of a user.

Author:
Craig Walls

Method Summary
 void acceptInvitation(java.lang.String eventId)
          Accepts an invitation to an event.
 java.lang.String createEvent(java.lang.String name, java.lang.String startTime, java.lang.String endTime)
          Creates an event.
 void declineInvitation(java.lang.String eventId)
          Declines an invitation to an event.
 void deleteEvent(java.lang.String eventId)
          Deletes an event.
 java.util.List<EventInvitee> getAttending(java.lang.String eventId)
          Retrieves the list of an event's invitees who have accepted the invitation.
 java.util.List<EventInvitee> getDeclined(java.lang.String eventId)
          Retrieves the list of an event's invitees who have declined the invitation.
 Event getEvent(java.lang.String eventId)
          Retrieves event data for a specified event.
 byte[] getEventImage(java.lang.String eventId)
          Retrieves an event's image as an array of bytes.
 byte[] getEventImage(java.lang.String eventId, ImageType imageType)
          Retrieves an event's image as an array of bytes.
 java.util.List<Invitation> getInvitations()
          Retrieves a list of up to 25 events that the authenticated user has been invited to.
 java.util.List<Invitation> getInvitations(int offset, int limit)
          Retrieves a list of events that the authenticated user has been invited to.
 java.util.List<Invitation> getInvitations(java.lang.String userId)
          Retrieves a list of events that the specified user has been invited to.
 java.util.List<Invitation> getInvitations(java.lang.String userId, int offset, int limit)
          Retrieves a list of events that the specified user has been invited to.
 java.util.List<EventInvitee> getInvited(java.lang.String eventId)
          Retrieves the list of an event's invitees.
 java.util.List<EventInvitee> getMaybeAttending(java.lang.String eventId)
          Retrieves the list of an event's invitees who have indicated that they may attend the event.
 java.util.List<EventInvitee> getNoReplies(java.lang.String eventId)
          Retrieves the list of an event's invitees who have not yet RSVP'd.
 void maybeInvitation(java.lang.String eventId)
          RSVPs to an event with a maybe.
 java.util.List<Event> search(java.lang.String query)
          Search for events.
 java.util.List<Event> search(java.lang.String query, int offset, int limit)
          Search for events.
 

Method Detail

getInvitations

java.util.List<Invitation> getInvitations()
Retrieves a list of up to 25 events that the authenticated user has been invited to. Requires "user_events" or "friends_events" permission.

Returns:
a list Invitations for the user, or an empty list if not available.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "user_events" or "friends_events" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getInvitations

java.util.List<Invitation> getInvitations(int offset,
                                          int limit)
Retrieves a list of events that the authenticated user has been invited to. Requires "user_events" or "friends_events" permission.

Parameters:
offset - the offset into the list of events
limit - the maximum number of events to return
Returns:
a list Invitations for the user, or an empty list if not available.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "user_events" or "friends_events" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getInvitations

java.util.List<Invitation> getInvitations(java.lang.String userId)
Retrieves a list of events that the specified user has been invited to. Requires "user_events" or "friends_events" permission.

Parameters:
userId - the user's ID
Returns:
a list Invitations for the user, or an empty list if not available.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "user_events" or "friends_events" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getInvitations

java.util.List<Invitation> getInvitations(java.lang.String userId,
                                          int offset,
                                          int limit)
Retrieves a list of events that the specified user has been invited to. Requires "user_events" or "friends_events" permission.

Parameters:
userId - the user's ID
offset - the offset into the list of events
limit - the maximum number of events to return
Returns:
a list Invitations for the user, or an empty list if not available.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "user_events" or "friends_events" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getEvent

Event getEvent(java.lang.String eventId)
Retrieves event data for a specified event.

Parameters:
eventId - the event ID
Returns:
an Event object
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.

getEventImage

byte[] getEventImage(java.lang.String eventId)
Retrieves an event's image as an array of bytes. Returns the image in Facebook's "normal" type.

Parameters:
eventId - the event ID
Returns:
an array of bytes containing the event's image.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.

getEventImage

byte[] getEventImage(java.lang.String eventId,
                     ImageType imageType)
Retrieves an event's image as an array of bytes.

Parameters:
eventId - the event ID
imageType - the image type (eg., small, normal, large. square)
Returns:
an array of bytes containing the event's image.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.

createEvent

java.lang.String createEvent(java.lang.String name,
                             java.lang.String startTime,
                             java.lang.String endTime)
Creates an event. Requires "create_event" permission. The String passed in for start time and end time is flexible in regard to format. Some valid examples are:

Parameters:
name - the name of the event
startTime - the start time of the event.
endTime - the end time of the event.
Returns:
the newly created event's ID
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "create_event" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

deleteEvent

void deleteEvent(java.lang.String eventId)
Deletes an event. Requires "create_event" permission.

Parameters:
eventId - the ID of the event
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "create_event" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getInvited

java.util.List<EventInvitee> getInvited(java.lang.String eventId)
Retrieves the list of an event's invitees.

Parameters:
eventId - the event ID.
Returns:
a list of EventInvitees for the event.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.

getAttending

java.util.List<EventInvitee> getAttending(java.lang.String eventId)
Retrieves the list of an event's invitees who have accepted the invitation.

Parameters:
eventId - the event ID.
Returns:
a list of EventInvitees for the event.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.

getMaybeAttending

java.util.List<EventInvitee> getMaybeAttending(java.lang.String eventId)
Retrieves the list of an event's invitees who have indicated that they may attend the event.

Parameters:
eventId - the event ID.
Returns:
a list of EventInvitees for the event.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.

getNoReplies

java.util.List<EventInvitee> getNoReplies(java.lang.String eventId)
Retrieves the list of an event's invitees who have not yet RSVP'd.

Parameters:
eventId - the event ID.
Returns:
a list of EventInvitees for the event.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.

getDeclined

java.util.List<EventInvitee> getDeclined(java.lang.String eventId)
Retrieves the list of an event's invitees who have declined the invitation.

Parameters:
eventId - the event ID.
Returns:
a list of EventInvitees for the event.
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.

acceptInvitation

void acceptInvitation(java.lang.String eventId)
Accepts an invitation to an event. Requires "rsvp_event" permission.

Parameters:
eventId - the event ID
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "rsvp_event" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

maybeInvitation

void maybeInvitation(java.lang.String eventId)
RSVPs to an event with a maybe. Requires "rsvp_event" permission.

Parameters:
eventId - the event ID
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "rsvp_event" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

declineInvitation

void declineInvitation(java.lang.String eventId)
Declines an invitation to an event. Requires "rsvp_event" permission.

Parameters:
eventId - the event ID
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "rsvp_event" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

search

java.util.List<Event> search(java.lang.String query)
Search for events.

Parameters:
query - the search query (e.g., "Spring User Group")
Returns:
a list of Events matching the search query
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.

search

java.util.List<Event> search(java.lang.String query,
                             int offset,
                             int limit)
Search for events.

Parameters:
query - the search query (e.g., "Spring User Group")
offset - the offset into the list of events
limit - the maximum number of events to return
Returns:
a list of Events matching the search query
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.

Spring Social Facebook