Skip to content

Commit

Permalink
Fix compatibility issue with properties (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
kewynakshlley committed Oct 24, 2023
1 parent c2dbb59 commit 6ddd769
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 36 deletions.
11 changes: 5 additions & 6 deletions src/main/java/com/resend/core/net/impl/HttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.resend.core.net.HttpMethod;
import com.resend.core.net.IHttpClient;

import com.resend.core.util.PropertiesReader;
import okhttp3.*;

import java.io.IOException;
Expand All @@ -18,21 +17,21 @@ public class HttpClient implements IHttpClient<Response> {
/** The base URL for the API. */
public static final String BASE_API = "https://api.resend.com";

/** The version of the API */
private static final String VERSION_NAME = "2.2.1";

/** The User-Agent header value for HTTP requests. */
public static final String USER_AGENT = "resend-java/";
public static final String USER_AGENT = "resend-java/" + VERSION_NAME;

/** The OkHttpClient instance for handling HTTP requests. */
private final OkHttpClient httpClient;

private final PropertiesReader propertiesReader;

/**
* Constructs an instance of the HttpClient with the provided API key.
*
*/
public HttpClient() {
this.httpClient = new OkHttpClient();
this.propertiesReader = new PropertiesReader();
}

/**
Expand All @@ -54,7 +53,7 @@ public AbstractHttpResponse perform(final String path, final String apiKey, fina
Request request = new Request.Builder()
.url(BASE_API + path)
.addHeader("Accept", "application/json")
.addHeader("User-Agent", USER_AGENT + propertiesReader.retrieveProperty("VERSION_NAME"))
.addHeader("User-Agent", USER_AGENT)
.addHeader("Authorization", "Bearer " + apiKey)
.method(method.name(), requestBody)
.build();
Expand Down
28 changes: 0 additions & 28 deletions src/main/java/com/resend/core/util/PropertiesReader.java

This file was deleted.

13 changes: 12 additions & 1 deletion src/main/java/com/resend/services/batch/Batch.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

import java.util.List;

/**
* Represents the Resend Batch module.
*/
public class Batch extends BaseService {
/**
* Constructsan instance of the {@code Batch} class.
Expand Down Expand Up @@ -43,8 +46,16 @@ public CreateBatchEmailsResponse send(List<SendEmailRequest> emails) throws Rese

return createBatchEmailsResponse;
}


/**
* Creates and sends a batch of email messages based on the provided list of email requests.
*
* @param emails A list of {@link SendEmailRequest} objects representing the email messages to be sent.
* @return A {@link CreateBatchEmailsResponse} containing information about the created batch of emails.
* @throws ResendException if an error occurs during the creation and sending of the emails.
*/
public CreateBatchEmailsResponse create(List<SendEmailRequest> emails) throws ResendException {
return this.send(emails);
}

}
3 changes: 3 additions & 0 deletions src/main/java/com/resend/services/domains/model/Domain.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public class Domain extends AbstractDomain {
@JsonProperty("dnsProvider")
private String dnsProvider;

/**
* Empty constructor.
*/
public Domain() {

}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/resend/services/domains/model/Record.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ public class Record {
@JsonProperty("priority")
private int priority;


/**
* Empty constructor.
*/
public Record() {
}

Expand Down

0 comments on commit 6ddd769

Please sign in to comment.