Skip to content

Commit

Permalink
Merge pull request #224 from sccalabr/api
Browse files Browse the repository at this point in the history
Adding SendGridApi interface.
  • Loading branch information
thinkingserious authored Oct 31, 2017
2 parents 82b2867 + 3e54539 commit 7637df1
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/com/sendgrid/SendGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import java.util.Map;

/**
* Class SendGrid allows for quick and easy access to the SendGrid API.
*/
public class SendGrid {
/** The current library version. */
* Class SendGrid allows for quick and easy access to the SendGrid API.
*/
public class SendGrid implements SendGridAPI {

private static final String VERSION = "3.0.0";

/** The user agent string to return to SendGrid. */
Expand Down
92 changes: 92 additions & 0 deletions src/main/java/com/sendgrid/SendGridAPI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package com.sendgrid;

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

public interface SendGridAPI {

/**
* Initializes SendGrid
*
* @param apiKey is your SendGrid API Key: https://app.sendgrid.com/settings/api_keys
*/
public void initializeSendGrid(String apiKey);

/**
* Returns the library version
*
* @param apiKey is your SendGrid API Key: https://app.sendgrid.com/settings/api_keys
* @return the library version.
*/
public String getLibraryVersion();

/**
* Gets the version.
*
* @return returns the version.
*/
public String getVersion();

/**
* Sets the version.
*
* @param version the SendGrid version.
*/
public void setVersion(String version);

/**
* Gets the request headers.
* @return returns a map of request headers.
*/
public Map<String, String> getRequestHeaders();

/**
* Adds a request headers.
*
* @param key the key
* @param value the value
* @return returns a map of request headers.
*/
public Map<String, String> addRequestHeader(String key, String value);

/**
* Removes a request headers.
*
* @param key the key
* @return returns a map of request headers.
*/
public Map<String, String> removeRequestHeader(String key);

/**
* Gets the host.
*
* @return returns the host.
*/
public String getHost();

/**
* Sets the host.
*
* @param host the host to set
*/
public void setHost(String host);

/**
* Class makeCall makes the call to the SendGrid API, override this method for
* testing.
*
* @param request the request
* @return returns a response.
* @throws IOException in case of network or marshal error.
*/
public Response makeCall(Request request) throws IOException;

/**
* Class api sets up the request to the SendGrid API, this is main interface.
*
* @param request the request
* @return returns a response.
* @throws IOException in case of network or marshal error.
*/
public Response api(Request request) throws IOException;
}

0 comments on commit 7637df1

Please sign in to comment.