Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ java {

group = 'com.schematichq'

version = '1.1.2'
version = '1.1.3'

jar {
dependsOn(":generatePomFileForMavenPublication")
Expand Down Expand Up @@ -79,7 +79,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.schematichq'
artifactId = 'schematic-java'
version = '1.1.2'
version = '1.1.3'
from components.java
pom {
name = 'schematic'
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/com/schematic/api/BaseSchematicBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.schematic.api.core.ClientOptions;
import com.schematic.api.core.Environment;
import okhttp3.OkHttpClient;

public final class BaseSchematicBuilder {
private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder();
Expand Down Expand Up @@ -39,6 +40,14 @@ public BaseSchematicBuilder timeout(int timeout) {
return this;
}

/**
* Sets the underlying OkHttp client
*/
public BaseSchematicBuilder httpClient(OkHttpClient httpClient) {
this.clientOptionsBuilder.httpClient(httpClient);
return this;
}

public BaseSchematic build() {
if (apiKey == null) {
throw new RuntimeException("Please provide apiKey");
Expand Down
19 changes: 13 additions & 6 deletions src/main/java/com/schematic/api/core/ClientOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ private ClientOptions(
this.headers.putAll(headers);
this.headers.putAll(new HashMap<String, String>() {
{
put("User-Agent", "com.schematichq:schematic-java/1.1.3");
put("X-Fern-Language", "JAVA");
put("X-Fern-SDK-Name", "com.schematic.fern:api-sdk");
put("X-Fern-SDK-Version", "1.1.2");
put("X-Fern-SDK-Version", "1.1.3");
}
});
this.headerSuppliers = headerSuppliers;
Expand Down Expand Up @@ -86,6 +87,11 @@ public static final class Builder {

private int timeout = 60;

private OkHttpClient httpClient = new OkHttpClient.Builder()
.addInterceptor(new RetryInterceptor(3))
.callTimeout(this.timeout, TimeUnit.SECONDS)
.build();

public Builder environment(Environment environment) {
this.environment = environment;
return this;
Expand All @@ -109,12 +115,13 @@ public Builder timeout(int timeout) {
return this;
}

public Builder httpClient(OkHttpClient httpClient) {
this.httpClient = httpClient;
return this;
}

public ClientOptions build() {
OkHttpClient okhttpClient = new OkHttpClient.Builder()
.addInterceptor(new RetryInterceptor(3))
.callTimeout(this.timeout, TimeUnit.SECONDS)
.build();
return new ClientOptions(environment, headers, headerSuppliers, okhttpClient, this.timeout);
return new ClientOptions(environment, headers, headerSuppliers, httpClient, this.timeout);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,9 @@ public SearchBillingPricesResponse searchBillingPrices(
if (request.getIds().isPresent()) {
httpUrl.addQueryParameter("ids", request.getIds().get());
}
if (request.getQ().isPresent()) {
httpUrl.addQueryParameter("q", request.getQ().get());
}
if (request.getInterval().isPresent()) {
httpUrl.addQueryParameter("interval", request.getInterval().get());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
public final class SearchBillingPricesRequest {
private final Optional<String> ids;

private final Optional<String> q;

private final Optional<String> interval;

private final Optional<String> usageType;
Expand All @@ -36,13 +38,15 @@ public final class SearchBillingPricesRequest {

private SearchBillingPricesRequest(
Optional<String> ids,
Optional<String> q,
Optional<String> interval,
Optional<String> usageType,
Optional<Integer> price,
Optional<Integer> limit,
Optional<Integer> offset,
Map<String, Object> additionalProperties) {
this.ids = ids;
this.q = q;
this.interval = interval;
this.usageType = usageType;
this.price = price;
Expand All @@ -56,6 +60,11 @@ public Optional<String> getIds() {
return ids;
}

@JsonProperty("q")
public Optional<String> getQ() {
return q;
}

@JsonProperty("interval")
public Optional<String> getInterval() {
return interval;
Expand Down Expand Up @@ -100,6 +109,7 @@ public Map<String, Object> getAdditionalProperties() {

private boolean equalTo(SearchBillingPricesRequest other) {
return ids.equals(other.ids)
&& q.equals(other.q)
&& interval.equals(other.interval)
&& usageType.equals(other.usageType)
&& price.equals(other.price)
Expand All @@ -109,7 +119,7 @@ private boolean equalTo(SearchBillingPricesRequest other) {

@java.lang.Override
public int hashCode() {
return Objects.hash(this.ids, this.interval, this.usageType, this.price, this.limit, this.offset);
return Objects.hash(this.ids, this.q, this.interval, this.usageType, this.price, this.limit, this.offset);
}

@java.lang.Override
Expand All @@ -125,6 +135,8 @@ public static Builder builder() {
public static final class Builder {
private Optional<String> ids = Optional.empty();

private Optional<String> q = Optional.empty();

private Optional<String> interval = Optional.empty();

private Optional<String> usageType = Optional.empty();
Expand All @@ -142,6 +154,7 @@ private Builder() {}

public Builder from(SearchBillingPricesRequest other) {
ids(other.getIds());
q(other.getQ());
interval(other.getInterval());
usageType(other.getUsageType());
price(other.getPrice());
Expand All @@ -161,6 +174,17 @@ public Builder ids(String ids) {
return this;
}

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

public Builder q(String q) {
this.q = Optional.ofNullable(q);
return this;
}

@JsonSetter(value = "interval", nulls = Nulls.SKIP)
public Builder interval(Optional<String> interval) {
this.interval = interval;
Expand Down Expand Up @@ -217,7 +241,8 @@ public Builder offset(Integer offset) {
}

public SearchBillingPricesRequest build() {
return new SearchBillingPricesRequest(ids, interval, usageType, price, limit, offset, additionalProperties);
return new SearchBillingPricesRequest(
ids, q, interval, usageType, price, limit, offset, additionalProperties);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public final class SearchBillingPricesParams {

private final Optional<Integer> price;

private final Optional<String> q;

private final Optional<String> usageType;

private final Map<String, Object> additionalProperties;
Expand All @@ -41,13 +43,15 @@ private SearchBillingPricesParams(
Optional<Integer> limit,
Optional<Integer> offset,
Optional<Integer> price,
Optional<String> q,
Optional<String> usageType,
Map<String, Object> additionalProperties) {
this.ids = ids;
this.interval = interval;
this.limit = limit;
this.offset = offset;
this.price = price;
this.q = q;
this.usageType = usageType;
this.additionalProperties = additionalProperties;
}
Expand Down Expand Up @@ -83,6 +87,11 @@ public Optional<Integer> getPrice() {
return price;
}

@JsonProperty("q")
public Optional<String> getQ() {
return q;
}

@JsonProperty("usage_type")
public Optional<String> getUsageType() {
return usageType;
Expand All @@ -105,12 +114,13 @@ private boolean equalTo(SearchBillingPricesParams other) {
&& limit.equals(other.limit)
&& offset.equals(other.offset)
&& price.equals(other.price)
&& q.equals(other.q)
&& usageType.equals(other.usageType);
}

@java.lang.Override
public int hashCode() {
return Objects.hash(this.ids, this.interval, this.limit, this.offset, this.price, this.usageType);
return Objects.hash(this.ids, this.interval, this.limit, this.offset, this.price, this.q, this.usageType);
}

@java.lang.Override
Expand All @@ -134,6 +144,8 @@ public static final class Builder {

private Optional<Integer> price = Optional.empty();

private Optional<String> q = Optional.empty();

private Optional<String> usageType = Optional.empty();

@JsonAnySetter
Expand All @@ -147,6 +159,7 @@ public Builder from(SearchBillingPricesParams other) {
limit(other.getLimit());
offset(other.getOffset());
price(other.getPrice());
q(other.getQ());
usageType(other.getUsageType());
return this;
}
Expand Down Expand Up @@ -206,6 +219,17 @@ public Builder price(Integer price) {
return this;
}

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

public Builder q(String q) {
this.q = Optional.ofNullable(q);
return this;
}

@JsonSetter(value = "usage_type", nulls = Nulls.SKIP)
public Builder usageType(Optional<String> usageType) {
this.usageType = usageType;
Expand All @@ -218,7 +242,8 @@ public Builder usageType(String usageType) {
}

public SearchBillingPricesParams build() {
return new SearchBillingPricesParams(ids, interval, limit, offset, price, usageType, additionalProperties);
return new SearchBillingPricesParams(
ids, interval, limit, offset, price, q, usageType, additionalProperties);
}
}
}
Loading