Tabnine Logo
NetworkUtils
Code IndexAdd Tabnine to your IDE (free)

How to use
NetworkUtils
in
co.aurasphere.botmill.core.internal.util.network

Best Java code snippets using co.aurasphere.botmill.core.internal.util.network.NetworkUtils (Showing top 11 results out of 315)

origin: BotMill/fb-botmill

/**
 * Performs a POST and propagates it to the registered monitors.
 * 
 * @param url
 *            the URL where to post.
 * @param input
 *            the object to send.
 * @return the response.
 */
private static BotMillNetworkResponse postInternal(String url,
    StringEntity input) {
  BotMillNetworkResponse response = NetworkUtils.post(url, input);
  propagateResponse(response);
  return response;
}
origin: co.aurasphere.botmill/botmill-core

/**
 * Sends a DELETE request.
 * 
 * @param url
 *            the url where to send the DELETE request.
 * @return the delete response.
 */
public static BotMillNetworkResponse delete(String url) {
  HttpDelete delete = new HttpDelete(url);
  return send(delete);
}
origin: BotMill/fb-botmill

/**
 * GETs the daily unique active thread counts.
 * 
 * @return the daily unique active thread counts.
 */
public static DailyUniqueActiveThreadCounts getDailyUniqueActiveThreadCounts() {
  String pageToken = FbBotMillContext.getInstance().getPageToken();
  BotMillNetworkResponse response = NetworkUtils
      .get(FbBotMillNetworkConstants.FACEBOOK_BASE_URL
          + FbBotMillNetworkConstants.FACEBOOK_MESSAGING_INSIGHT_ACTIVE_THREADS_URL
          + pageToken);
  return FbBotMillJsonUtils.fromJson(response.getResponse(),
      DailyUniqueActiveThreadCounts.class);
}
origin: BotMill/fb-botmill

/**
 * DELETEs a JSON string as a Facebook's Messenger Profile.
 * 
 * @param input
 *            the JSON data to send.
 */
public static void deleteMessengerProfile(StringEntity input) {
  String pageToken = FbBotMillContext.getInstance().getPageToken();
  // If the page token is invalid, returns.
  if (!validatePageToken(pageToken)) {
    return;
  }
  String url = FbBotMillNetworkConstants.FACEBOOK_BASE_URL
      + FbBotMillNetworkConstants.FACEBOOK_MESSENGER_PROFILE
      + pageToken;
  BotMillNetworkResponse response = NetworkUtils.delete(url, input);
  propagateResponse(response);
}
origin: co.aurasphere.botmill/botmill-core

responseContent = getResponseContent(httpResponse);
origin: BotMill/fb-botmill

/**
 * GETs the daily unique conversation counts.
 * 
 * @return the daily unique conversation counts.
 */
public static DailyUniqueConversationCounts getDailyUniqueConversationCounts() {
  String pageToken = FbBotMillContext.getInstance().getPageToken();
  BotMillNetworkResponse response = NetworkUtils
      .get(FbBotMillNetworkConstants.FACEBOOK_BASE_URL
          + FbBotMillNetworkConstants.FACEBOOK_MESSAGING_INSIGHT_CONVERSATION_URL
          + pageToken);
  return FbBotMillJsonUtils.fromJson(response.getResponse(),
      DailyUniqueConversationCounts.class);
}
origin: BotMill/fb-botmill

/**
 * DELETEs a JSON string as a Facebook's Thread Setting.
 * 
 * @param input
 *            the JSON data to send.
 */
public static void deleteThreadSetting(StringEntity input) {
  String pageToken = FbBotMillContext.getInstance().getPageToken();
  // If the page token is invalid, returns.
  if (!validatePageToken(pageToken)) {
    return;
  }
  String url = FbBotMillNetworkConstants.FACEBOOK_BASE_URL
      + FbBotMillNetworkConstants.FACEBOOK_THREAD_SETTINGS_URL
      + pageToken;
  BotMillNetworkResponse response = NetworkUtils.delete(url, input);
  propagateResponse(response);
}
origin: co.aurasphere.botmill/botmill-core

/**
 * Utility to send a GET request.
 * 
 * @param url
 *            the url we need to send the get request to.
 * @return the get response.
 */
public static BotMillNetworkResponse get(String url) {
  HttpGet get = new HttpGet(url);
  return send(get);
}
origin: BotMill/fb-botmill

/**
 * Method used to retrieve a {@link FacebookUserProfile} from an ID using
 * the GET method.
 * 
 * @param userId
 *            the ID of the user to retrieve.
 * @return the user profile info.
 */
public static FacebookUserProfile getUserProfile(String userId) {
  String pageToken = FbBotMillContext.getInstance().getPageToken();
  BotMillNetworkResponse response = NetworkUtils
      .get(FbBotMillNetworkConstants.FACEBOOK_BASE_URL + userId
          + FbBotMillNetworkConstants.USER_PROFILE_FIELDS
          + pageToken);
  FacebookUserProfile user = FbBotMillJsonUtils.fromJson(
      response.getResponse(), FacebookUserProfile.class);
  return user;
}
origin: co.aurasphere.botmill/botmill-core

/**
 * Utility to send a POST request.
 * 
 * @param url
 *            the url we need to send the post request to.
 * @param entity
 *            the entity that containts the object we need to pass as part
 *            of the post request.
 * @return the post response.
 */
public static BotMillNetworkResponse post(String url, StringEntity entity) {
  HttpPost post = new HttpPost(url);
  //post.setHeader("Content-Type", "application/x-www-form-urlencoded");
  post.setHeader("Content-Type","application/json");
  post.setEntity(entity);
  return send(post);
}
origin: co.aurasphere.botmill/botmill-core

/**
 * Sends a DELETE request with a body.
 * 
 * @param url
 *            the url where to send the DELETE request.
 * @param entity
 *            the entity to DELETE.
 * @return the delete response.
 */
public static BotMillNetworkResponse delete(String url, StringEntity entity) {
  HttpDeleteWithBody delete = new HttpDeleteWithBody(url);
  delete.setEntity(entity);
  return send(delete);
}
 
co.aurasphere.botmill.core.internal.util.networkNetworkUtils

Javadoc

Class that contains methods that allows BotMill to communicate through the network.

Most used methods

  • delete
    Sends a DELETE request with a body.
  • get
    Utility to send a GET request.
  • getResponseContent
    Utility method that converts an HttpResponse to a String.
  • post
    Utility to send a POST request.
  • send
    Sends a request.

Popular in Java

  • Making http requests using okhttp
  • getSharedPreferences (Context)
  • runOnUiThread (Activity)
  • getResourceAsStream (ClassLoader)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • JPanel (javax.swing)
  • JTextField (javax.swing)
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now