Skip to content

Commit

Permalink
feat: Support for TLS (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
kewynakshlley committed Jun 11, 2024
1 parent 4de175e commit ad8ca47
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/main/java/com/resend/services/domains/model/Tls.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.resend.services.domains.model;

/**
* Enum representing the TLS settings for a domain.
*/
public enum Tls {
/**
* Represents an enforced TLS setting.
*/
ENFORCED("enforced"),
/**
* Represents an opportunistic TLS setting.
*/
OPPORTUNISTIC("opportunistic");

/**
* Holds the string representation of the enum value.
*/
private final String value;

/**
* Constructor for the Tls enum.
*
* @param value The string representation of the TLS setting.
*/
Tls(String value) {
this.value = value;
}

/**
* Retrieves the string representation of the TLS setting.
*
* @return The string representation of the TLS setting.
*/
public String getValue() {
return value;
}

/**
* Returns the string representation of the TLS setting.
*
* @return The string representation of the TLS setting.
*/
@Override
public String toString() {
return this.value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class UpdateDomainOptions {
@JsonProperty("open_tracking")
private final boolean openTracking;

@JsonProperty("tls")
private final Tls tls;
/**
* Constructs a UpdateDomainOptions object using the provided builder.
*
Expand All @@ -24,6 +26,7 @@ public UpdateDomainOptions(Builder builder) {
this.id = builder.id;
this.clickTracking = builder.clickTracking;
this.openTracking = builder.openTracking;
this.tls = builder.tls;
}

/**
Expand Down Expand Up @@ -53,6 +56,15 @@ public boolean getOpenTracking() {
return openTracking;
}

/**
* Get the TLS setting for the domain.
*
* @return The TLS setting for the domain.
*/
public Tls getTls() {
return tls;
}

/**
* Create a new builder instance for constructing UpdateDomainOptions objects.
*
Expand All @@ -69,6 +81,7 @@ public static class Builder {
private String id;
private boolean clickTracking;
private boolean openTracking;
private Tls tls;

/**
* Set the id of the domain.
Expand Down Expand Up @@ -103,6 +116,17 @@ public Builder openTracking(boolean openTracking) {
return this;
}

/**
* Set the TLS setting for the domain.
*
* @param tls The TLS setting for the domain.
* @return The builder instance.
*/
public Builder tls(Tls tls) {
this.tls = tls;
return this;
}

/**
* Build a new UpdateDomainOptions object.
*
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/resend/services/util/DomainsUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static final UpdateDomainOptions updateDomainRequest() {
return UpdateDomainOptions.builder()
.openTracking(true)
.clickTracking(true)
.tls(Tls.OPPORTUNISTIC)
.id("2c64b27c-6237-4626-85d2-a0a8b5832070")
.build();
}
Expand Down

0 comments on commit ad8ca47

Please sign in to comment.