Package com.restfb.types

Examples of com.restfb.types.FacebookType


    Player player = DatastoreHelper.getPlayer(username);
   
    String accessToken = player.getAccessToken();
   
    FacebookClient facebookClient = new DefaultFacebookClient(accessToken);
    FacebookType postScoreToWallResponse = facebookClient.publish("me/feed", FacebookType.class,
        Parameter.with("message", "just scored " + score + " on stewiemaze"));
   
  }
View Full Code Here


   
    String accessToken = player.getAccessToken();
    String score = player.getHighscore() + "";
   
    FacebookClient facebookClient = new DefaultFacebookClient(accessToken);
    FacebookType postScoreToWallResponse = facebookClient.publish("me/feed", FacebookType.class,
        Parameter.with("message", message));
   
  }
View Full Code Here

  }

  String publishMessage() {
    out.println("* Feed publishing *");

    FacebookType publishMessageResponse =
        facebookClient.publish("me/feed", FacebookType.class, Parameter.with("message", "RestFB test"));

    out.println("Published message ID: " + publishMessageResponse.getId());
    return publishMessageResponse.getId();
  }
View Full Code Here

    out.println("* Event publishing *");

    Date tomorrow = new Date(currentTimeMillis() + 1000L * 60L * 60L * 24L);
    Date twoDaysFromNow = new Date(currentTimeMillis() + 1000L * 60L * 60L * 48L);

    FacebookType publishEventResponse =
        facebookClient.publish("me/events", FacebookType.class, Parameter.with("name", "Party"),
          Parameter.with("start_time", tomorrow), Parameter.with("end_time", twoDaysFromNow));

    out.println("Published event ID: " + publishEventResponse.getId());
    return publishEventResponse.getId();
  }
View Full Code Here

  }

  String publishPhoto() {
    out.println("* Binary file publishing *");

    FacebookType publishPhotoResponse =
        facebookClient.publish("me/photos", FacebookType.class,
          BinaryAttachment.with("cat.png", getClass().getResourceAsStream("/cat.png")),
          Parameter.with("message", "Test cat"));

    out.println("Published photo ID: " + publishPhotoResponse.getId());
    return publishPhotoResponse.getId();
  }
View Full Code Here

    String eventName = content.getAttributeByName("name").getValue();
    String eventStartDate = content.getAttributeByName("startTime")
        .getValue();
    String eventEndDate = content.getAttributeByName("endTime").getValue();

    FacebookType postedEvent = getFbClient().publishObject(endPoint,
        FacebookType.class, Parameter.with("name", eventName),
        Parameter.with("start_time", Long.parseLong(eventStartDate)),
        Parameter.with("end_time", Long.parseLong(eventEndDate)));

    // update graph
    String contentURL = URLUtils.makeContentURL(postedEvent.getId(), ContentTypeEnum.EVENT.name());

    // fetch newly created object
    Content newContent = getContent(contentURL);

    // add object to graph
View Full Code Here

   */
  protected void performPostAction(Content content) throws IQserException {
    String endPoint = "me/feed";
    String messageValue = content.getAttributeByName("message").getValue();
    Parameter parameter = Parameter.with("message", messageValue);
    FacebookType postMessage = getFbClient().publishObject(endPoint, FacebookType.class, parameter);
   
    // update graph with new content
    String contentURL = URLUtils.makeContentURL(postMessage.getId(), ContentTypeEnum.STATUS.name());
   
    // fetch object from Facebook
    Content newContent = getContent(contentURL);
   
    // add object to graph
View Full Code Here

   
    String connection = "me/notes";
    Parameter[] arrayParams = new Parameter[2];
    arrayParams[0] = Parameter.with("subject","note subject");
    arrayParams[1] = Parameter.with("message","note message");   
    FacebookType mockFbType = EasyMock.createMock(FacebookType.class);
    expect(mockFbClient.publishObject(connection, FacebookType.class, arrayParams)).andReturn(mockFbType);   
    expect(mockFbType.getId()).andReturn("122788341354");
   
    Note expectedNote = loadObjectFromJSON("/examples/note.json",Note.class);
    expect(mockFbClient.getFacebookObjectByID("122788341354", Note.class)).andReturn(expectedNote);
    //note comments   
    expect(mockFbClient.getFacebookConnectionByID("122788341354/comments", Comment.class)).andReturn(new ArrayList<Comment>());
View Full Code Here

    }

    Parameter[] arrayParams = new Parameter[paramList.size()];
    paramList.toArray(arrayParams);
    // this will return only the object ID;
    FacebookType resp = getFbClient().publishObject(connection,
        FacebookType.class, arrayParams);
    String fbid = resp.getId();

    String contentURL = URLUtils.makeContentURL(fbid, "post");

    // get object from facebook
    Content newContent = getContent(contentURL);
View Full Code Here

        content.getAttributeByName("message").getValue()));

    Parameter[] arrayParams = new Parameter[paramList.size()];
    paramList.toArray(arrayParams);
    // this will return only the object ID;
    FacebookType resp = getFbClient().publishObject(connection,
        FacebookType.class, arrayParams);
    String fbid = resp.getId();

    String contentURL = URLUtils.makeContentURL(fbid, "note");

    // get object from facebook
    Content newContent = getContent(contentURL);
View Full Code Here

TOP

Related Classes of com.restfb.types.FacebookType

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.