Skip to content

Commit 4d5b46a

Browse files
committed
Release 0.0.26
1 parent e565a5e commit 4d5b46a

File tree

179 files changed

+1190
-224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+1190
-224
lines changed

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ dependencies {
1515
api 'com.squareup.okhttp3:okhttp:4.9.3'
1616
api 'com.fasterxml.jackson.core:jackson-databind:2.13.0'
1717
api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.3'
18+
api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.3'
1819
}
1920

2021
spotless {
@@ -33,7 +34,7 @@ publishing {
3334
maven(MavenPublication) {
3435
groupId = 'io.github.seamapi'
3536
artifactId = 'java'
36-
version = '0.0.25'
37+
version = '0.0.26'
3738
from components.java
3839
}
3940
}

src/main/java/com/seam/api/SeamApiClientBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ public final class SeamApiClientBuilder {
88

99
private Environment environment = Environment.DEFAULT;
1010

11-
public SeamApiClientBuilder token(String token) {
12-
this.clientOptionsBuilder.addHeader("Authorization", "Bearer " + token);
11+
public SeamApiClientBuilder apiKey(String apiKey) {
12+
this.clientOptionsBuilder.addHeader("Authorization", "Bearer " + apiKey);
1313
return this;
1414
}
1515

src/main/java/com/seam/api/core/ClientOptions.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ private ClientOptions(
2020
Map<String, Supplier<String>> headerSuppliers,
2121
OkHttpClient httpClient) {
2222
this.environment = environment;
23-
this.headers = headers;
23+
this.headers = new HashMap<>();
24+
this.headers.putAll(headers);
25+
this.headers.putAll(Map.of(
26+
"X-Fern-SDK-Name", "com.seam.fern:api-sdk", "X-Fern-SDK-Version", "0.0.26", "X-Fern-Language", "JAVA"));
2427
this.headerSuppliers = headerSuppliers;
2528
this.httpClient = httpClient;
2629
;
@@ -30,11 +33,14 @@ public Environment environment() {
3033
return this.environment;
3134
}
3235

33-
public Map<String, String> headers() {
36+
public Map<String, String> headers(RequestOptions requestOptions) {
3437
Map<String, String> values = new HashMap<>(this.headers);
3538
headerSuppliers.forEach((key, supplier) -> {
3639
values.put(key, supplier.get());
3740
});
41+
if (requestOptions != null) {
42+
values.putAll(requestOptions.getHeaders());
43+
}
3844
return values;
3945
}
4046

src/main/java/com/seam/api/core/ObjectMappers.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
import com.fasterxml.jackson.databind.ObjectMapper;
55
import com.fasterxml.jackson.databind.json.JsonMapper;
66
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
7+
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
78

89
public final class ObjectMappers {
910
public static final ObjectMapper JSON_MAPPER = JsonMapper.builder()
1011
.addModule(new Jdk8Module())
12+
.addModule(new JavaTimeModule())
1113
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
1214
.build();
1315

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.seam.api.core;
2+
3+
import java.util.HashMap;
4+
import java.util.Map;
5+
6+
public final class RequestOptions {
7+
private final String apiKey;
8+
9+
private RequestOptions(String apiKey) {
10+
this.apiKey = apiKey;
11+
}
12+
13+
public Map<String, String> getHeaders() {
14+
Map<String, String> headers = new HashMap<>();
15+
if (this.apiKey != null) {
16+
headers.put("Authorization", "Bearer " + this.apiKey);
17+
}
18+
return headers;
19+
}
20+
21+
public static Builder builder() {
22+
return new Builder();
23+
}
24+
25+
public static final class Builder {
26+
private String apiKey = null;
27+
28+
public Builder apiKey(String apiKey) {
29+
this.apiKey = apiKey;
30+
return this;
31+
}
32+
33+
public RequestOptions build() {
34+
return new RequestOptions(apiKey);
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)