Skip to content

Commit

Permalink
Release 3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Dec 4, 2024
1 parent 2cd7dac commit 43810a2
Show file tree
Hide file tree
Showing 35 changed files with 2,571 additions and 95 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.courier'
artifactId = 'courier-java'
version = '3.2.1'
version = '3.3.0'
from components.java
pom {
name = 'courier'
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/courier/api/core/ClientOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private ClientOptions(
{
put("X-Fern-Language", "JAVA");
put("X-Fern-SDK-Name", "com.courier.fern:api-sdk");
put("X-Fern-SDK-Version", "3.2.1");
put("X-Fern-SDK-Version", "3.3.0");
}
});
this.headerSuppliers = headerSuppliers;
Expand Down
28 changes: 19 additions & 9 deletions src/main/java/com/courier/api/resources/bulk/BulkClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.courier.api.core.ObjectMappers;
import com.courier.api.core.RequestOptions;
import com.courier.api.resources.bulk.requests.BulkCreateJobParams;
import com.courier.api.resources.bulk.requests.BulkGetUsersParams;
import com.courier.api.resources.bulk.types.BulkCreateJobResponse;
import com.courier.api.resources.bulk.types.BulkGetJobResponse;
import com.courier.api.resources.bulk.types.BulkGetJobUsersResponse;
Expand Down Expand Up @@ -233,25 +234,34 @@ public BulkGetJobResponse getJob(String jobId, RequestOptions requestOptions) {
* Get Bulk Job Users
*/
public BulkGetJobUsersResponse getUsers(String jobId) {
return getUsers(jobId, null);
return getUsers(jobId, BulkGetUsersParams.builder().build());
}

/**
* Get Bulk Job Users
*/
public BulkGetJobUsersResponse getUsers(String jobId, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
public BulkGetJobUsersResponse getUsers(String jobId, BulkGetUsersParams request) {
return getUsers(jobId, request, null);
}

/**
* Get Bulk Job Users
*/
public BulkGetJobUsersResponse getUsers(String jobId, BulkGetUsersParams request, RequestOptions requestOptions) {
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("bulk")
.addPathSegment(jobId)
.addPathSegments("users")
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.addPathSegments("users");
if (request.getCursor().isPresent()) {
httpUrl.addQueryParameter("cursor", request.getCursor().get());
}
Request.Builder _requestBuilder = new Request.Builder()
.url(httpUrl.build())
.method("GET", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Content-Type", "application/json")
.build();
.addHeader("Content-Type", "application/json");
Request okhttpRequest = _requestBuilder.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.courier.api.resources.bulk.requests;

import com.courier.api.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonDeserialize(builder = BulkGetUsersParams.Builder.class)
public final class BulkGetUsersParams {
private final Optional<String> cursor;

private final Map<String, Object> additionalProperties;

private BulkGetUsersParams(Optional<String> cursor, Map<String, Object> additionalProperties) {
this.cursor = cursor;
this.additionalProperties = additionalProperties;
}

/**
* @return A unique identifier that allows for fetching the next set of users added to the bulk job
*/
@JsonProperty("cursor")
public Optional<String> getCursor() {
return cursor;
}

@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof BulkGetUsersParams && equalTo((BulkGetUsersParams) other);
}

@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}

private boolean equalTo(BulkGetUsersParams other) {
return cursor.equals(other.cursor);
}

@java.lang.Override
public int hashCode() {
return Objects.hash(this.cursor);
}

@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}

public static Builder builder() {
return new Builder();
}

@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<String> cursor = Optional.empty();

@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();

private Builder() {}

public Builder from(BulkGetUsersParams other) {
cursor(other.getCursor());
return this;
}

@JsonSetter(value = "cursor", nulls = Nulls.SKIP)
public Builder cursor(Optional<String> cursor) {
this.cursor = cursor;
return this;
}

public Builder cursor(String cursor) {
this.cursor = Optional.of(cursor);
return this;
}

public BulkGetUsersParams build() {
return new BulkGetUsersParams(cursor, additionalProperties);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.courier.api.resources.send.types.IBaseMessage;
import com.courier.api.resources.send.types.MessageContext;
import com.courier.api.resources.send.types.MessageMetadata;
import com.courier.api.resources.send.types.MessagePreferences;
import com.courier.api.resources.send.types.MessageProvidersType;
import com.courier.api.resources.send.types.Routing;
import com.courier.api.resources.send.types.Timeout;
Expand Down Expand Up @@ -40,6 +41,8 @@ public final class InboundBulkContentMessage implements IBaseMessage {

private final Optional<MessageMetadata> metadata;

private final Optional<MessagePreferences> preferences;

private final Optional<Map<String, MessageProvidersType>> providers;

private final Optional<Routing> routing;
Expand All @@ -60,6 +63,7 @@ private InboundBulkContentMessage(
Optional<Map<String, Channel>> channels,
Optional<MessageContext> context,
Optional<MessageMetadata> metadata,
Optional<MessagePreferences> preferences,
Optional<Map<String, MessageProvidersType>> providers,
Optional<Routing> routing,
Optional<Timeout> timeout,
Expand All @@ -72,6 +76,7 @@ private InboundBulkContentMessage(
this.channels = channels;
this.context = context;
this.metadata = metadata;
this.preferences = preferences;
this.providers = providers;
this.routing = routing;
this.timeout = timeout;
Expand Down Expand Up @@ -124,6 +129,12 @@ public Optional<MessageMetadata> getMetadata() {
return metadata;
}

@JsonProperty("preferences")
@java.lang.Override
public Optional<MessagePreferences> getPreferences() {
return preferences;
}

/**
* @return An object whose keys are valid provider identifiers which map to an object.
*/
Expand All @@ -149,7 +160,7 @@ public Optional<Timeout> getTimeout() {
}

/**
* @return Defines the time to wait before delivering the message.
* @return Defines the time to wait before delivering the message. You can specify one of the following options. Duration with the number of milliseconds to delay. Until with an ISO 8601 timestamp that specifies when it should be delivered. Until with an OpenStreetMap opening_hours-like format that specifies the <a href="https://www.courier.com/docs/platform/sending/failover/#delivery-window">Delivery Window</a> (e.g., 'Mo-Fr 08:00-18:00pm')
*/
@JsonProperty("delay")
@java.lang.Override
Expand Down Expand Up @@ -193,6 +204,7 @@ private boolean equalTo(InboundBulkContentMessage other) {
&& channels.equals(other.channels)
&& context.equals(other.context)
&& metadata.equals(other.metadata)
&& preferences.equals(other.preferences)
&& providers.equals(other.providers)
&& routing.equals(other.routing)
&& timeout.equals(other.timeout)
Expand All @@ -209,6 +221,7 @@ public int hashCode() {
this.channels,
this.context,
this.metadata,
this.preferences,
this.providers,
this.routing,
this.timeout,
Expand Down Expand Up @@ -255,6 +268,10 @@ public interface _FinalStage {

_FinalStage metadata(MessageMetadata metadata);

_FinalStage preferences(Optional<MessagePreferences> preferences);

_FinalStage preferences(MessagePreferences preferences);

_FinalStage providers(Optional<Map<String, MessageProvidersType>> providers);

_FinalStage providers(Map<String, MessageProvidersType> providers);
Expand Down Expand Up @@ -290,6 +307,8 @@ public static final class Builder implements ContentStage, _FinalStage {

private Optional<Map<String, MessageProvidersType>> providers = Optional.empty();

private Optional<MessagePreferences> preferences = Optional.empty();

private Optional<MessageMetadata> metadata = Optional.empty();

private Optional<MessageContext> context = Optional.empty();
Expand All @@ -312,6 +331,7 @@ public Builder from(InboundBulkContentMessage other) {
channels(other.getChannels());
context(other.getContext());
metadata(other.getMetadata());
preferences(other.getPreferences());
providers(other.getProviders());
routing(other.getRouting());
timeout(other.getTimeout());
Expand Down Expand Up @@ -352,7 +372,7 @@ public _FinalStage expiry(Optional<Expiry> expiry) {
}

/**
* <p>Defines the time to wait before delivering the message.</p>
* <p>Defines the time to wait before delivering the message. You can specify one of the following options. Duration with the number of milliseconds to delay. Until with an ISO 8601 timestamp that specifies when it should be delivered. Until with an OpenStreetMap opening_hours-like format that specifies the <a href="https://www.courier.com/docs/platform/sending/failover/#delivery-window">Delivery Window</a> (e.g., 'Mo-Fr 08:00-18:00pm')</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
Expand Down Expand Up @@ -415,6 +435,19 @@ public _FinalStage providers(Optional<Map<String, MessageProvidersType>> provide
return this;
}

@java.lang.Override
public _FinalStage preferences(MessagePreferences preferences) {
this.preferences = Optional.of(preferences);
return this;
}

@java.lang.Override
@JsonSetter(value = "preferences", nulls = Nulls.SKIP)
public _FinalStage preferences(Optional<MessagePreferences> preferences) {
this.preferences = preferences;
return this;
}

/**
* <p>Metadata such as utm tracking attached with the notification through this channel.</p>
* @return Reference to {@code this} so that method calls can be chained together.
Expand Down Expand Up @@ -505,6 +538,7 @@ public InboundBulkContentMessage build() {
channels,
context,
metadata,
preferences,
providers,
routing,
timeout,
Expand Down
Loading

0 comments on commit 43810a2

Please sign in to comment.