Skip to content

Commit 09e8605

Browse files
committed
SDK regeneration
1 parent 7fc98e8 commit 09e8605

File tree

125 files changed

+7892
-1627
lines changed

Some content is hidden

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

125 files changed

+7892
-1627
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repositories {
1212
}
1313

1414
dependencies {
15-
api 'com.squareup.okhttp3:okhttp:4.9.3'
15+
api 'com.squareup.okhttp3:okhttp:4.12.0'
1616
api 'com.fasterxml.jackson.core:jackson-databind:2.13.0'
1717
api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.3'
1818
api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.3'
@@ -46,7 +46,7 @@ publishing {
4646
maven(MavenPublication) {
4747
groupId = 'com.cohere'
4848
artifactId = 'cohere-java'
49-
version = '1.0.3'
49+
version = '1.0.6'
5050
from components.java
5151
}
5252
}

src/main/java/com/cohere/api/Cohere.java

Lines changed: 76 additions & 58 deletions
Large diffs are not rendered by default.

src/main/java/com/cohere/api/CohereBuilder.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,25 @@
99
public final class CohereBuilder {
1010
private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder();
1111

12+
private String token = null;
13+
14+
private String clientName = null;
15+
1216
private Environment environment = Environment.PRODUCTION;
1317

18+
/**
19+
* Sets token
20+
*/
1421
public CohereBuilder token(String token) {
15-
this.clientOptionsBuilder.addHeader("Authorization", "Bearer " + token);
22+
this.token = token;
23+
return this;
24+
}
25+
26+
/**
27+
* Sets clientName
28+
*/
29+
public CohereBuilder clientName(String clientName) {
30+
this.clientName = clientName;
1631
return this;
1732
}
1833

@@ -27,6 +42,14 @@ public CohereBuilder url(String url) {
2742
}
2843

2944
public Cohere build() {
45+
if (token == null) {
46+
throw new RuntimeException("Please provide token");
47+
}
48+
this.clientOptionsBuilder.addHeader("Authorization", "Bearer " + this.token);
49+
if (clientName == null) {
50+
throw new RuntimeException("Please provide clientName");
51+
}
52+
this.clientOptionsBuilder.addHeader("X-Client-Name", this.clientName);
3053
clientOptionsBuilder.environment(this.environment);
3154
return new Cohere(clientOptionsBuilder.build());
3255
}

src/main/java/com/cohere/api/core/ApiError.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public Object body() {
2121
return this.body;
2222
}
2323

24-
@Override
24+
@java.lang.Override
2525
public String toString() {
2626
return "ApiError{" + "statusCode: " + statusCode + ", body: " + body + "}";
2727
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ private ClientOptions(
2929
"X-Fern-SDK-Name",
3030
"com.cohere.fern:api-sdk",
3131
"X-Fern-SDK-Version",
32-
"1.0.3",
32+
"1.0.6",
3333
"X-Fern-Language",
3434
"JAVA"));
3535
this.headerSuppliers = headerSuppliers;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
package com.cohere.api.core;
5+
6+
import okhttp3.MediaType;
7+
8+
public final class MediaTypes {
9+
10+
public static final MediaType APPLICATION_JSON = MediaType.parse("application/json");
11+
12+
private MediaTypes() {}
13+
}

src/main/java/com/cohere/api/core/RequestOptions.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,21 @@
99
public final class RequestOptions {
1010
private final String token;
1111

12-
private RequestOptions(String token) {
12+
private final String clientName;
13+
14+
private RequestOptions(String token, String clientName) {
1315
this.token = token;
16+
this.clientName = clientName;
1417
}
1518

1619
public Map<String, String> getHeaders() {
1720
Map<String, String> headers = new HashMap<>();
1821
if (this.token != null) {
1922
headers.put("Authorization", "Bearer " + this.token);
2023
}
24+
if (this.clientName != null) {
25+
headers.put("X-Client-Name", this.clientName);
26+
}
2127
return headers;
2228
}
2329

@@ -28,13 +34,20 @@ public static Builder builder() {
2834
public static final class Builder {
2935
private String token = null;
3036

37+
private String clientName = null;
38+
3139
public Builder token(String token) {
3240
this.token = token;
3341
return this;
3442
}
3543

44+
public Builder clientName(String clientName) {
45+
this.clientName = clientName;
46+
return this;
47+
}
48+
3649
public RequestOptions build() {
37-
return new RequestOptions(token);
50+
return new RequestOptions(token, clientName);
3851
}
3952
}
4053
}

0 commit comments

Comments
 (0)