Package facebook4j.internal.http

Examples of facebook4j.internal.http.HttpParameter


    /*package*/ HttpParameter[] asHttpParameterArray() {
        List<HttpParameter> params = new ArrayList<HttpParameter>();

        if (includeHeaders != null) {
            params.add(new HttpParameter("include_headers", includeHeaders));
        }

        List<String> jsons = new ArrayList<String>();
        for (int i = 0; i < size(); i++) {
            T batch = get(i);
            jsons.add(batch.asJSONString());
            if (batch.getAttachedFiles() != null) {
                for (BatchAttachment attachedFile : batch.getAttachedFiles()) {
                    params.add(attachedFile.asHttpParameter());
                }
            }
        }
        String batchJSONString = "[" + z_F4JInternalStringUtil.join((String[]) jsons.toArray(new String[jsons.size()])) + "]";
        params.add(new HttpParameter("batch", batchJSONString));

        return params.toArray(new HttpParameter[params.size()]);
    }
View Full Code Here


        return this;
    }

    /*package*/ HttpParameter[] asHttpParameterArray() {
        List<HttpParameter> params = new ArrayList<HttpParameter>();
        params.add(new HttpParameter("cover", photoId));
        if (offsetY != null) {
            params.add(new HttpParameter("offset_y", offsetY));
        }
        if (noFeedStory != null) {
            params.add(new HttpParameter("no_feed_story", noFeedStory));
        }
        return params.toArray(new HttpParameter[params.size()]);
    }
View Full Code Here

    /*package*/ HttpParameter[] asHttpParameterArray() {
        List<HttpParameter> params = new ArrayList<HttpParameter>();
        params.add(source.asHttpParameter("source"));
        if (message != null) {
            params.add(new HttpParameter("message", message));
        }
        if (place != null) {
            params.add(new HttpParameter("place", place));
        }
        if (noStory != null) {
            if (noStory) {
                params.add(new HttpParameter("no_story", 1));
            }
        }
        return params.toArray(new HttpParameter[params.size()]);
    }
View Full Code Here

        return scheduledPublishTime(Long.valueOf(time).intValue());
    }

    /*package*/ HttpParameter[] asHttpParameterArray() {
        List<HttpParameter> params = new ArrayList<HttpParameter>();
        params.add(new HttpParameter("question", question));
        if (options != null && options.size() != 0) {
            params.add(new HttpParameter("options", new JSONArray(options).toString()));
        }
        if (allowNewOptions != null) {
            params.add(new HttpParameter("allow_new_options", allowNewOptions));
        }
        if (published != null) {
            params.add(new HttpParameter("published", published));
        }
        if (scheduledPublishTime != null) {
            params.add(new HttpParameter("scheduled_publish_time", scheduledPublishTime));
        }
        return params.toArray(new HttpParameter[params.size()]);
    }
View Full Code Here

    }

    /*package*/ HttpParameter[] asHttpParameterArray() {
        List<HttpParameter> params = new ArrayList<HttpParameter>();
        if (name != null) {
            params.add(new HttpParameter("name", name));
        }
        if (startTime != null) {
            params.add(new HttpParameter("start_time", z_F4JInternalStringUtil.formatISO8601Datetime(startTime)));
        }
        if (endTime != null) {
            params.add(new HttpParameter("end_time", z_F4JInternalStringUtil.formatISO8601Datetime(endTime)));
        }
        if (description != null) {
            params.add(new HttpParameter("description", description));
        }
        if (location != null) {
            params.add(new HttpParameter("location", location));
        }
        if (locationId != null) {
            params.add(new HttpParameter("location_id", locationId));
        }
        if (privacyType != null) {
            params.add(new HttpParameter("privacy_type", privacyType.toString()));
        }
        if (ticketURI != null) {
            params.add(new HttpParameter("ticket_uri", ticketURI.toString()));
        }
        if (noFeedStory != null) {
            params.add(new HttpParameter("no_feed_story", noFeedStory));
        }
        return params.toArray(new HttpParameter[params.size()]);
    }
View Full Code Here

    @Override
    HttpParameter[] asHttpParameterArray() {
        List<HttpParameter> params = new ArrayList<HttpParameter>(Arrays.asList(super.asHttpParameterArray()));
        if (backdatedTime != null) {
            params.add(new HttpParameter("backdated_time", backdatedTime));
        }
        String _backdatedTimeGranularity;
        if (backdatedTimeGranularity != null) {
            _backdatedTimeGranularity = backdatedTimeGranularity.toString();
        } else {
            _backdatedTimeGranularity = BackdatedTimeGranularity.none.toString();
        }
        params.add(new HttpParameter("backdated_time_granularity", _backdatedTimeGranularity));
        return params.toArray(new HttpParameter[params.size()]);
    }
View Full Code Here

    public String postEventPhoto(String eventId, Media source, String message) throws FacebookException {
        ensureAuthorizationEnabled();
        HttpParameter[] httpParameters = new HttpParameter[] {source.asHttpParameter("source")};
        if (message != null) {
            httpParameters = HttpParameter.merge(httpParameters,
                                new HttpParameter[]{new HttpParameter("message", message)});
        }
        JSONObject json = post(buildEndpoint(eventId, "photos"), httpParameters).asJSONObject();
        return getRawString("id", json);
    }
View Full Code Here

    public String postEventVideo(String eventId, Media source, String title, String description) throws FacebookException {
        ensureAuthorizationEnabled();
        HttpParameter[] httpParameters = new HttpParameter[] {source.asHttpParameter("source")};
        if (title != null) {
            httpParameters = HttpParameter.merge(httpParameters,
                                new HttpParameter[]{new HttpParameter("title", title)});
        }
        if (description != null) {
            httpParameters = HttpParameter.merge(httpParameters,
                    new HttpParameter[]{new HttpParameter("description", description)});
        }
        JSONObject json = post(buildVideoEndpoint(eventId, "videos"), httpParameters).asJSONObject();
        return getRawString("id", json);
    }
View Full Code Here

    }
    public String createFriendlist(String userId, String friendlistName) throws FacebookException {
        ensureAuthorizationEnabled();
        JSONObject json = post(buildEndpoint(userId, "friendlists"),
                                new HttpParameter[]{
                                    new HttpParameter("name", friendlistName)
                                })
                          .asJSONObject();
        return getRawString("id", json);
    }
View Full Code Here

    public String postGroupLink(String groupId, URL linkURL) throws FacebookException {
        return postGroupLink(groupId, linkURL, null);
    }
    public String postGroupLink(String groupId, URL linkURL, String message) throws FacebookException {
        ensureAuthorizationEnabled();
        HttpParameter[] httpParameters = new HttpParameter[]{new HttpParameter("link", linkURL.toString())};
        if (message != null) {
            httpParameters = HttpParameter.merge(httpParameters,
                                new HttpParameter[] {new HttpParameter("message", message)});
        }
        JSONObject json = post(buildEndpoint(groupId, "feed"), httpParameters).asJSONObject();
        return getRawString("id", json);
    }
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.