|
| 1 | +package com.sendgrid; |
| 2 | + |
| 3 | +import java.io.IOException; |
| 4 | +import java.util.Map; |
| 5 | + |
| 6 | +public interface SendGridAPI { |
| 7 | + |
| 8 | + /** |
| 9 | + * Initializes SendGrid |
| 10 | + * |
| 11 | + * @param apiKey is your SendGrid API Key: https://app.sendgrid.com/settings/api_keys |
| 12 | + */ |
| 13 | + public void initializeSendGrid(String apiKey); |
| 14 | + |
| 15 | + /** |
| 16 | + * Returns the library version |
| 17 | + * |
| 18 | + * @param apiKey is your SendGrid API Key: https://app.sendgrid.com/settings/api_keys |
| 19 | + * @return the library version. |
| 20 | + */ |
| 21 | + public String getLibraryVersion(); |
| 22 | + |
| 23 | + /** |
| 24 | + * Gets the version. |
| 25 | + * |
| 26 | + * @return returns the version. |
| 27 | + */ |
| 28 | + public String getVersion(); |
| 29 | + |
| 30 | + /** |
| 31 | + * Sets the version. |
| 32 | + * |
| 33 | + * @param version the SendGrid version. |
| 34 | + */ |
| 35 | + public void setVersion(String version); |
| 36 | + |
| 37 | + /** |
| 38 | + * Gets the request headers. |
| 39 | + * @return returns a map of request headers. |
| 40 | + */ |
| 41 | + public Map<String, String> getRequestHeaders(); |
| 42 | + |
| 43 | + /** |
| 44 | + * Adds a request headers. |
| 45 | + * |
| 46 | + * @param key the key |
| 47 | + * @param value the value |
| 48 | + * @return returns a map of request headers. |
| 49 | + */ |
| 50 | + public Map<String, String> addRequestHeader(String key, String value); |
| 51 | + |
| 52 | + /** |
| 53 | + * Removes a request headers. |
| 54 | + * |
| 55 | + * @param key the key |
| 56 | + * @return returns a map of request headers. |
| 57 | + */ |
| 58 | + public Map<String, String> removeRequestHeader(String key); |
| 59 | + |
| 60 | + /** |
| 61 | + * Gets the host. |
| 62 | + * |
| 63 | + * @return returns the host. |
| 64 | + */ |
| 65 | + public String getHost(); |
| 66 | + |
| 67 | + /** |
| 68 | + * Sets the host. |
| 69 | + * |
| 70 | + * @param host the host to set |
| 71 | + */ |
| 72 | + public void setHost(String host); |
| 73 | + |
| 74 | + /** |
| 75 | + * Class makeCall makes the call to the SendGrid API, override this method for |
| 76 | + * testing. |
| 77 | + * |
| 78 | + * @param request the request |
| 79 | + * @return returns a response. |
| 80 | + * @throws IOException in case of network or marshal error. |
| 81 | + */ |
| 82 | + public Response makeCall(Request request) throws IOException; |
| 83 | + |
| 84 | + /** |
| 85 | + * Class api sets up the request to the SendGrid API, this is main interface. |
| 86 | + * |
| 87 | + * @param request the request |
| 88 | + * @return returns a response. |
| 89 | + * @throws IOException in case of network or marshal error. |
| 90 | + */ |
| 91 | + public Response api(Request request) throws IOException; |
| 92 | +} |
0 commit comments