Package facebook4j.internal.http

Examples of facebook4j.internal.http.HttpParameter


        }
    }

    private String _postStatusMessage(String objectId, String message) throws FacebookException {
        JSONObject json = post(buildEndpoint(objectId, "feed"),
                            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 name;
    }

    /*package*/ HttpParameter[] asHttpParameterArray() {
        List<HttpParameter> params = new ArrayList<HttpParameter>();
        params.add(new HttpParameter("name", name));
        if (message != null) {
            params.add(new HttpParameter("message", message));
        }
        if (privacy != null) {
            params.add(new HttpParameter("privacy", privacy.asJSONString()));
        }
        return params.toArray(new HttpParameter[params.size()]);
    }
View Full Code Here

        return coordinates;
    }

    /*package*/ HttpParameter[] asHttpParameterArray() {
        List<HttpParameter> params = new ArrayList<HttpParameter>();
        params.add(new HttpParameter("place", place));
        params.add(new HttpParameter("coordinates", coordinates.asJSONString()));
        if (tags != null) {
            params.add(new HttpParameter("tags", tags));
        }
        if (message != null) {
            params.add(new HttpParameter("message", message));
        }
        if (link != null) {
            params.add(new HttpParameter("link", link.toString()));
        }
        if (picture != null) {
            params.add(new HttpParameter("picture", picture.toString()));
        }
        return params.toArray(new HttpParameter[params.size()]);
    }
View Full Code Here

    }

    /*package*/ HttpParameter[] asHttpParameterArray() {
        List<HttpParameter> params = new ArrayList<HttpParameter>();
        if (position != null) {
            params.add(new HttpParameter("position", position));
        }
        if (customName != null) {
            params.add(new HttpParameter("custom_name", customName));
        }
        if (isNonConnectionLandingTab != null) {
            params.add(new HttpParameter("is_non_connection_landing_tab", isNonConnectionLandingTab));
        }
        if (customImageUrl != null) {
            params.add(new HttpParameter("custom_image_url", customImageUrl.toString()));
        }
        if (customImage != null) {
            params.add(customImage.asHttpParameter("custom_image"));
        }
        return params.toArray(new HttpParameter[params.size()]);
View Full Code Here

    public static class hasPostParameterWithValue {

        @Test
        public void httpParameters() throws Exception {
            HttpParameter[] params = new HttpParameter[2];
            params[0] = new HttpParameter("p1", "v1");
            params[1] = new HttpParameter("p2", "v2");
            assertThat(params, hasPostParameter("p1", "v1"));
            assertThat(params, hasPostParameter("p2", "v2"));

            assertThat(params, not(hasPostParameter("p2", "v3")));
            assertThat(params, not(hasPostParameter("p3", "v3")));
View Full Code Here

    public static class hasPostParameterWithoutValue {

        @Test
        public void httpParameters() throws Exception {
            HttpParameter[] params = new HttpParameter[2];
            params[0] = new HttpParameter("p1", "v1");
            params[1] = new HttpParameter("p2", "v2");
            assertThat(params, hasPostParameter("p1"));
            assertThat(params, hasPostParameter("p2"));

            assertThat(params, not(hasPostParameter("p3")));
            assertThat(params, not(hasPostParameter("")));
View Full Code Here

        return this;
    }

    /*package*/ HttpParameter[] asHttpParameterArray() {
        List<HttpParameter> params = new ArrayList<HttpParameter>();
        params.add(new HttpParameter("title", title));
        params.add(new HttpParameter("expiration_time", z_F4JInternalStringUtil.formatISO8601Datetime(expirationTime)));
        if (terms != null) {
            params.add(new HttpParameter("terms", terms));
        }
        if (imageURL != null) {
            params.add(new HttpParameter("image_url", imageURL.toString()));
        }
        if (image != null) {
            params.add(new HttpParameter("image", image.getMediaFile()));
        }
        if (claimLimit != null) {
            params.add(new HttpParameter("claim_limit", claimLimit));
        }
        if (couponType != null) {
            params.add(new HttpParameter("coupon_type", couponType));
        }
        if (qrcode != null) {
            params.add(new HttpParameter("qrcode", qrcode));
        }
        if (barcode != null) {
            params.add(new HttpParameter("barcode", barcode));
        }
        if (redemptionLink != null) {
            params.add(new HttpParameter("redemption_link", redemptionLink.toString()));
        }
        if (redemptionCode != null) {
            params.add(new HttpParameter("redemption_code", redemptionCode));
        }
        if (isPublished != null) {
            params.add(new HttpParameter("published", isPublished));
        }
        if (scheduledPublishTime != null) {
            params.add(new HttpParameter("scheduled_publish_time", scheduledPublishTime));
        }
        if (reminderTime != null) {
            params.add(new HttpParameter("reminder_time", z_F4JInternalStringUtil.formatISO8601Datetime(reminderTime)));
        }
        return params.toArray(new HttpParameter[params.size()]);
    }
View Full Code Here

    }

    public List<User> getUsers(String... ids) throws FacebookException {
        ensureAuthorizationEnabled();
        return factory.createUserArray(get(conf.getRestBaseURL(), new HttpParameter[] {
                                        new HttpParameter("ids", z_F4JInternalStringUtil.join(ids))}));
    }
View Full Code Here

        return postAchievement("me", achievementURL);
    }
    public String postAchievement(String userId, URL achievementURL) throws FacebookException {
        ensureAuthorizationEnabled();
        JSONObject json = post(buildEndpoint(userId, "achievements"),
                            new HttpParameter[] {new HttpParameter("achievement", achievementURL.toString())}
                          ).asJSONObject();
        try {
            return json.getString("id");
        } catch (JSONException jsone) {
            throw new FacebookException(jsone.getMessage(), jsone);
View Full Code Here

        return deleteAchievement("me", achievementURL);
    }
    public boolean deleteAchievement(String userId, URL achievementURL) throws FacebookException {
        ensureAuthorizationEnabled();
        HttpResponse res = delete(buildEndpoint(userId, "achievements"),
                            new HttpParameter[] {new HttpParameter("achievement", achievementURL.toString())});
        return Boolean.valueOf(res.asString().trim());
    }
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.