Skip to content

Commit

Permalink
SDK regeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Aug 30, 2024
1 parent fe9906b commit 99fe009
Show file tree
Hide file tree
Showing 28 changed files with 2,196 additions and 430 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.cohere'
artifactId = 'cohere-java'
version = '1.3.0'
version = '1.3.1'
from components.java
pom {
name = 'cohere'
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down
709 changes: 578 additions & 131 deletions src/main/java/com/cohere/api/Cohere.java

Large diffs are not rendered by default.

28 changes: 0 additions & 28 deletions src/main/java/com/cohere/api/core/ApiError.java

This file was deleted.

15 changes: 7 additions & 8 deletions src/main/java/com/cohere/api/core/ClientOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@ private ClientOptions(
this.environment = environment;
this.headers = new HashMap<>();
this.headers.putAll(headers);
this.headers.putAll(Map.of(
"X-Fern-SDK-Name",
"com.cohere.fern:api-sdk",
"X-Fern-SDK-Version",
"1.3.0",
"X-Fern-Language",
"JAVA"));
this.headers.putAll(new HashMap<String, String>() {
{
put("X-Fern-Language", "JAVA");
put("X-Fern-SDK-Name", "com.cohere.fern:api-sdk");
put("X-Fern-SDK-Version", "1.3.1");
}
});
this.headerSuppliers = headerSuppliers;
this.httpClient = httpClient;
;
}

public Environment environment() {
Expand Down
45 changes: 45 additions & 0 deletions src/main/java/com/cohere/api/core/CohereApiApiError.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.cohere.api.core;

/**
* This exception type will be thrown for any non-2XX API responses.
*/
public class CohereApiApiError extends CohereApiError {
/**
* The error code of the response that triggered the exception.
*/
private final int statusCode;

/**
* The body of the response that triggered the exception.
*/
private final Object body;

public CohereApiApiError(String message, int statusCode, Object body) {
super(message);
this.statusCode = statusCode;
this.body = body;
}

/**
* @return the statusCode
*/
public int statusCode() {
return this.statusCode;
}

/**
* @return the body
*/
public Object body() {
return this.body;
}

@java.lang.Override
public String toString() {
return "CohereApiApiError{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " + body
+ "}";
}
}
17 changes: 17 additions & 0 deletions src/main/java/com/cohere/api/core/CohereApiError.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.cohere.api.core;

/**
* This class serves as the base exception for all errors in the SDK.
*/
public class CohereApiError extends RuntimeException {
public CohereApiError(String message) {
super(message);
}

public CohereApiError(String message, Exception e) {
super(message, e);
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/cohere/api/core/RequestOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static final class Builder {

private String clientName = null;

private Optional<Integer> timeout = null;
private Optional<Integer> timeout = Optional.empty();

private TimeUnit timeoutTimeUnit = TimeUnit.SECONDS;

Expand Down
26 changes: 26 additions & 0 deletions src/main/java/com/cohere/api/errors/CohereApiBadRequestError.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.cohere.api.errors;

import com.cohere.api.core.CohereApiApiError;

public final class CohereApiBadRequestError extends CohereApiApiError {
/**
* The body of the response that triggered the exception.
*/
private final Object body;

public CohereApiBadRequestError(Object body) {
super("BadRequestError", 400, body);
this.body = body;
}

/**
* @return the body
*/
@java.lang.Override
public Object body() {
return this.body;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.cohere.api.errors;

import com.cohere.api.core.CohereApiApiError;
import com.cohere.api.types.ClientClosedRequestErrorBody;

public final class CohereApiClientClosedRequestError extends CohereApiApiError {
/**
* The body of the response that triggered the exception.
*/
private final ClientClosedRequestErrorBody body;

public CohereApiClientClosedRequestError(ClientClosedRequestErrorBody body) {
super("ClientClosedRequestError", 499, body);
this.body = body;
}

/**
* @return the body
*/
@java.lang.Override
public ClientClosedRequestErrorBody body() {
return this.body;
}
}
26 changes: 26 additions & 0 deletions src/main/java/com/cohere/api/errors/CohereApiForbiddenError.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.cohere.api.errors;

import com.cohere.api.core.CohereApiApiError;

public final class CohereApiForbiddenError extends CohereApiApiError {
/**
* The body of the response that triggered the exception.
*/
private final Object body;

public CohereApiForbiddenError(Object body) {
super("ForbiddenError", 403, body);
this.body = body;
}

/**
* @return the body
*/
@java.lang.Override
public Object body() {
return this.body;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.cohere.api.errors;

import com.cohere.api.core.CohereApiApiError;
import com.cohere.api.types.GatewayTimeoutErrorBody;

public final class CohereApiGatewayTimeoutError extends CohereApiApiError {
/**
* The body of the response that triggered the exception.
*/
private final GatewayTimeoutErrorBody body;

public CohereApiGatewayTimeoutError(GatewayTimeoutErrorBody body) {
super("GatewayTimeoutError", 504, body);
this.body = body;
}

/**
* @return the body
*/
@java.lang.Override
public GatewayTimeoutErrorBody body() {
return this.body;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.cohere.api.errors;

import com.cohere.api.core.CohereApiApiError;

public final class CohereApiInternalServerError extends CohereApiApiError {
/**
* The body of the response that triggered the exception.
*/
private final Object body;

public CohereApiInternalServerError(Object body) {
super("InternalServerError", 500, body);
this.body = body;
}

/**
* @return the body
*/
@java.lang.Override
public Object body() {
return this.body;
}
}
26 changes: 26 additions & 0 deletions src/main/java/com/cohere/api/errors/CohereApiNotFoundError.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.cohere.api.errors;

import com.cohere.api.core.CohereApiApiError;

public final class CohereApiNotFoundError extends CohereApiApiError {
/**
* The body of the response that triggered the exception.
*/
private final Object body;

public CohereApiNotFoundError(Object body) {
super("NotFoundError", 404, body);
this.body = body;
}

/**
* @return the body
*/
@java.lang.Override
public Object body() {
return this.body;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.cohere.api.errors;

import com.cohere.api.core.CohereApiApiError;
import com.cohere.api.types.NotImplementedErrorBody;

public final class CohereApiNotImplementedError extends CohereApiApiError {
/**
* The body of the response that triggered the exception.
*/
private final NotImplementedErrorBody body;

public CohereApiNotImplementedError(NotImplementedErrorBody body) {
super("NotImplementedError", 501, body);
this.body = body;
}

/**
* @return the body
*/
@java.lang.Override
public NotImplementedErrorBody body() {
return this.body;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.cohere.api.errors;

import com.cohere.api.core.CohereApiApiError;

public final class CohereApiServiceUnavailableError extends CohereApiApiError {
/**
* The body of the response that triggered the exception.
*/
private final Object body;

public CohereApiServiceUnavailableError(Object body) {
super("ServiceUnavailableError", 503, body);
this.body = body;
}

/**
* @return the body
*/
@java.lang.Override
public Object body() {
return this.body;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.cohere.api.errors;

import com.cohere.api.core.CohereApiApiError;
import com.cohere.api.types.TooManyRequestsErrorBody;

public final class CohereApiTooManyRequestsError extends CohereApiApiError {
/**
* The body of the response that triggered the exception.
*/
private final TooManyRequestsErrorBody body;

public CohereApiTooManyRequestsError(TooManyRequestsErrorBody body) {
super("TooManyRequestsError", 429, body);
this.body = body;
}

/**
* @return the body
*/
@java.lang.Override
public TooManyRequestsErrorBody body() {
return this.body;
}
}
Loading

0 comments on commit 99fe009

Please sign in to comment.