Package org.opensocial

Examples of org.opensocial.Request


   *
   * @param  albumId ID of album to delete
   * @return         new Request object to delete an existing album
   */
  public static Request deleteAlbum(String albumId) {
    Request request = new Request(restTemplate, "albums.delete", "DELETE");
    request.addComponent(Request.ALBUM_ID, albumId);
    request.setGroupId(SELF);
    request.setGuid(ME);

    return request;
  }
View Full Code Here


   * @param  guid OpenSocial ID of user whose groups are to be fetched
   * @return      new Request object to fetch the specified user's groups
   * @see         Group
   */
  public static Request getGroups(String guid) {
    Request request = new Request(restTemplate, "groups.get", "GET");
    request.setModelClass(Group.class);
    request.setGuid(guid);

    return request;
  }
View Full Code Here

   * @param  guid OpenSocial ID of the user whose activities are to be fetched
   * @return      new Request object to fetch the specified user's activities
   * @see         Activity
   */
  public static Request getActivities(String guid) {
    Request request = new Request(restTemplate, "activities.get", "GET");
    request.setModelClass(Activity.class);
    request.setSelector(SELF);
    request.setAppId(APP);
    request.setGuid(guid);

    return request;
  }
View Full Code Here

   * @return      new Request object to fetch the specified user's friends'
   *              activities
   * @see         Activity
   */
  public static Request getFriendActivities(String guid) {
    Request request = new Request(restTemplate, "activities.get", "GET");
    request.setModelClass(Activity.class);
    request.setSelector(FRIENDS);
    request.setAppId(APP);
    request.setGuid(guid);

    return request;
  }
View Full Code Here

   * @return          new Request object o create a new activity for the
   *                  current viewer
   * @see             Activity
   */
  public static Request createActivity(Activity activity) {
    Request request = new Request(restTemplate, "activities.create", "POST");
    request.setSelector(SELF);
    request.setAppId(APP);
    request.setGuid(ME);

    // Add RPC payload parameters
    Map activityParameter = new HashMap();
    activityParameter.put("body", activity.getBody());
    activityParameter.put("title", activity.getTitle());

    request.addRpcPayloadParameter("activity", activityParameter);

    // Add REST payload parameters
    request.addRestPayloadParameters(activity);

    return request;
  }
View Full Code Here

  public static Request getFriends(String guid) {
    return get(guid, FRIENDS);
  }

  private static Request get(String guid, String selector) {
    Request request = new Request(restTemplate, "people.get", "GET");
    request.setModelClass(Person.class);
    request.setSelector(selector);
    request.setGuid(guid);

    return request;
  }
View Full Code Here

   * @return              new Request object to create a new MySpace
   *                      notification
   * @see                 Notification
   */
  public static Request createNotification(Notification notification) {
    Request request = new Request(restTemplate, null, "POST");
    request.setModelClass(Notification.class);
    request.setGroupId(SELF);
    request.setGuid(ME);

    // Add REST payload parameters
    request.addRestPayloadParameters(notification);

    return request;
  }
View Full Code Here

  @Test
  public void retrieveMediaItems() {
    try {
      Client client = new Client(new MySpaceProvider(),
          new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));
      Request request = MediaItemsService.getMediaItems(
          "myspace.com.album.81886");
      Response response = client.send(request);

      List<MediaItem> mediaItems = response.getEntries();
      assertTrue(mediaItems != null);
View Full Code Here

  @Test
  public void retrieveMediaItem() {
    try {
      Client client = new Client(new MySpaceProvider(),
          new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));
      Request request = MediaItemsService.getMediaItem(
          "myspace.com.mediaItem.image.646364", "myspace.com.album.81886");
      Response response = client.send(request);

      MediaItem mediaItem = response.getEntry();
      assertTrue(mediaItem != null);
View Full Code Here

  @Test
  public void getSupportedVideoCategories() {
    try {
      Client client = new Client(new MySpaceProvider(),
          new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));
      Request request = MediaItemsService.getSupportedVideoCategories();
      Response response = client.send(request);

      List<Model> categories = response.getEntries();
      assertTrue(categories != null);
      assertTrue(categories.size() > 0);
View Full Code Here

TOP

Related Classes of org.opensocial.Request

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.