Package facebook4j.internal.http

Examples of facebook4j.internal.http.HttpParameter


        for (String toUserId : toUserIds) {
            Map<String, String> map = new HashMap<String, String>(1);
            map.put("tag_uid", toUserId);
            tags.add(map);
        }
        HttpResponse res = post(buildEndpoint(photoId, "tags"), new HttpParameter[]{new HttpParameter("tags", new JSONArray(tags).toString())});
        return Boolean.valueOf(res.asString().trim());
    }
View Full Code Here


        return addTagToPhoto(photoId, tagUpdate);
    }

    public boolean deleteTagOnPhoto(String photoId, String toUserId) throws FacebookException {
        ensureAuthorizationEnabled();
        HttpResponse res = delete(buildEndpoint(photoId, "tags"), new HttpParameter[]{new HttpParameter("to", toUserId)});
        return Boolean.valueOf(res.asString().trim());
    }
View Full Code Here

    }

    public String addQuestionOption(String questionId, String optionDescription) throws FacebookException {
        ensureAuthorizationEnabled();
        JSONObject json = post(buildEndpoint(questionId, "options"),
                                new HttpParameter[]{new HttpParameter("option", optionDescription)})
                          .asJSONObject();
        try {
            return json.getString("id");
        } catch (JSONException jsone) {
            throw new FacebookException(jsone.getMessage(), jsone);
View Full Code Here

        return postScore("me", scoreValue);
    }
    public boolean postScore(String userId, int scoreValue) throws FacebookException {
        ensureAuthorizationEnabled();
        HttpResponse res = post(buildEndpoint(userId, "scores"),
                            new HttpParameter[] {new HttpParameter("score", scoreValue)});
        return Boolean.valueOf(res.asString().trim());
    }
View Full Code Here

    }

    public boolean makeFriendTestUser(TestUser testUser1, TestUser testUser2) throws FacebookException {
        ensureAuthorizationEnabled();
        HttpResponse res = post(buildEndpoint(testUser1.getId(), "friends/" + testUser2.getId()),
                                new HttpParameter[]{new HttpParameter("access_token", testUser1.getAccessToken())});
        if (!Boolean.valueOf(res.asString().trim())) {
            return false;
        }
        res = post(buildEndpoint(testUser2.getId(), "friends/" + testUser1.getId()),
                                new HttpParameter[]{new HttpParameter("access_token", testUser2.getAccessToken())});
        return Boolean.valueOf(res.asString().trim());
    }
View Full Code Here

        HttpResponse res;
        if (parameters != null && parameters.size() > 0) {
            final HttpParameter[] httpParameters = new HttpParameter[parameters.size()];
            int i = 0;
            for (final String p : parameters.keySet()) {
                httpParameters[i++] = new HttpParameter(p, parameters.get(p));
            }
            res = post(buildEndpoint(path), httpParameters);
        } else {
            res = post(buildEndpoint(path));
        }
View Full Code Here

    private URL _getPictureURL(String objectId, PictureSize size) throws FacebookException {
        String url = buildEndpoint(objectId, "picture");
        HttpResponse res;
        if (size != null) {
            res = get(url, new HttpParameter[]{new HttpParameter("type", size.toString())});
        } else {
            res = get(url);
        }
        try {
            return new URL(res.getResponseHeader("Location"));
View Full Code Here

    }

    private URL _getSSLPictureURL(String objectId, PictureSize size) throws FacebookException {
        String url = buildEndpoint(objectId, "picture");
        HttpResponse res;
        HttpParameter[] params = new HttpParameter[]{new HttpParameter("return_ssl_resources", "1")};
        if (size != null) {
            params = HttpParameter.merge(params, new HttpParameter("type", size.toString()));
        }
        res = get(url, params);
        try {
            return new URL(res.getResponseHeader("Location"));
        } catch (MalformedURLException urle) {
View Full Code Here

    }

    private String _comment(String objectId, String message) throws FacebookException {
        ensureAuthorizationEnabled();
        JSONObject json = post(buildEndpoint(objectId, "comments"),
                                new HttpParameter[]{new HttpParameter("message", message)})
                          .asJSONObject();
        try {
            return json.getString("id");
        } catch (JSONException jsone) {
            throw new FacebookException(jsone.getMessage(), jsone);
View Full Code Here

        return Boolean.valueOf(res.asString().trim());
    }

    private String _postLink(String objectId, URL link, String message)
            throws FacebookException {
        HttpParameter[] httpParameters = {new HttpParameter("link", link.toString())};
        if (message != null) {
            httpParameters = HttpParameter.merge(
                                httpParameters,
                                new HttpParameter[]{new HttpParameter("message", message)}
                             );
        }
        JSONObject json = post(buildEndpoint(objectId, "feed"), httpParameters)
                          .asJSONObject();
        try {
View Full Code Here

TOP

Related Classes of facebook4j.internal.http.HttpParameter

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.