import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

import com.sendgrid.*;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

//////////////////////////////////////////////////////////////////
// Create an IP whitelabel
// POST /whitelabel/ips


public class Example {
  public static void main(String[] args) throws IOException {
    try {
      SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY"));
      Request request = new Request();
      request.setMethod(Method.POST);
      request.setEndpoint("whitelabel/ips");
      request.setBody("{\"ip\":\"192.168.1.1\",\"domain\":\"example.com\",\"subdomain\":\"email\"}");
      Response response = sg.api(request);
      System.out.println(response.getStatusCode());
      System.out.println(response.getBody());
      System.out.println(response.getHeaders());
    } catch (IOException ex) {
      throw ex;
    }
  }
}

//////////////////////////////////////////////////////////////////
// Retrieve all IP whitelabels
// GET /whitelabel/ips


public class Example {
  public static void main(String[] args) throws IOException {
    try {
      SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY"));
      Request request = new Request();
      request.setMethod(Method.GET);
      request.setEndpoint("whitelabel/ips");
      request.addQueryParam("ip", "test_string");
      request.addQueryParam("limit", "1");
      request.addQueryParam("offset", "1");
      Response response = sg.api(request);
      System.out.println(response.getStatusCode());
      System.out.println(response.getBody());
      System.out.println(response.getHeaders());
    } catch (IOException ex) {
      throw ex;
    }
  }
}

//////////////////////////////////////////////////////////////////
// Retrieve an IP whitelabel
// GET /whitelabel/ips/{id}


public class Example {
  public static void main(String[] args) throws IOException {
    try {
      SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY"));
      Request request = new Request();
      request.setMethod(Method.GET);
      request.setEndpoint("whitelabel/ips/{id}");
      Response response = sg.api(request);
      System.out.println(response.getStatusCode());
      System.out.println(response.getBody());
      System.out.println(response.getHeaders());
    } catch (IOException ex) {
      throw ex;
    }
  }
}

//////////////////////////////////////////////////////////////////
// Delete an IP whitelabel
// DELETE /whitelabel/ips/{id}


public class Example {
  public static void main(String[] args) throws IOException {
    try {
      SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY"));
      Request request = new Request();
      request.setMethod(Method.DELETE);
      request.setEndpoint("whitelabel/ips/{id}");
      Response response = sg.api(request);
      System.out.println(response.getStatusCode());
      System.out.println(response.getBody());
      System.out.println(response.getHeaders());
    } catch (IOException ex) {
      throw ex;
    }
  }
}

//////////////////////////////////////////////////////////////////
// Validate an IP whitelabel
// POST /whitelabel/ips/{id}/validate


public class Example {
  public static void main(String[] args) throws IOException {
    try {
      SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY"));
      Request request = new Request();
      request.setMethod(Method.POST);
      request.setEndpoint("whitelabel/ips/{id}/validate");
      Response response = sg.api(request);
      System.out.println(response.getStatusCode());
      System.out.println(response.getBody());
      System.out.println(response.getHeaders());
    } catch (IOException ex) {
      throw ex;
    }
  }
}

@@ -195,16 +195,237 @@
 l.Map;%0A%0A
+public class CommonExample %7B%0A  protected SendGrid sg;%0A  protected Request request;%0A%0A  protected static void init() %7B%0A    this.sg = new SendGrid(System.getenv(%22SENDGRID_API_KEY%22));%0A    this.request = new Request();%0A  %7D%0A%7D%0A%0A
 ////////
@@ -549,32 +549,54 @@
 c class Example 
+extends CommonExample 
 %7B%0A  public stati
@@ -663,105 +663,11 @@
     
-SendGrid sg = new SendGrid(System.getenv(%22SENDGRID_API_KEY%22));%0A      Request request = new Reques
+ini
 t();
@@ -1238,32 +1238,54 @@
 c class Example 
+extends CommonExample 
 %7B%0A  public stati
@@ -1352,105 +1352,11 @@
     
-SendGrid sg = new SendGrid(System.getenv(%22SENDGRID_API_KEY%22));%0A      Request request = new Reques
+ini
 t();
@@ -1964,32 +1964,54 @@
 c class Example 
+extends CommonExample 
 %7B%0A  public stati
@@ -2078,105 +2078,11 @@
     
-SendGrid sg = new SendGrid(System.getenv(%22SENDGRID_API_KEY%22));%0A      Request request = new Reques
+ini
 t();
@@ -2559,32 +2559,54 @@
 c class Example 
+extends CommonExample 
 %7B%0A  public stati
@@ -2673,105 +2673,11 @@
     
-SendGrid sg = new SendGrid(System.getenv(%22SENDGRID_API_KEY%22));%0A      Request request = new Reques
+ini
 t();
@@ -3166,32 +3166,54 @@
 c class Example 
+extends CommonExample 
 %7B%0A  public stati
@@ -3280,105 +3280,11 @@
     
-SendGrid sg = new SendGrid(System.getenv(%22SENDGRID_API_KEY%22));%0A      Request request = new Reques
+ini
 t();

Fix "similar-code" issue in examples/whitelabel/ips.java