() {
+ /**
+ * Returns {@code true} if there are more elements in the stream.
+ *
+ * Will block and wait for input if the stream has not ended and the next object is not yet available.
+ *
+ * @return {@code true} if there are more elements, {@code false} otherwise.
+ */
+ @Override
+ public boolean hasNext() {
+ return scanner.hasNext();
+ }
+
+ /**
+ * Returns the next element in the stream.
+ *
+ * Will block and wait for input if the stream has not ended and the next object is not yet available.
+ *
+ * @return The next element in the stream.
+ * @throws NoSuchElementException If there are no more elements in the stream.
+ */
+ @Override
+ public T next() {
+ if (!scanner.hasNext()) {
+ throw new NoSuchElementException();
+ } else {
+ try {
+ T parsedResponse = ObjectMappers.JSON_MAPPER.readValue(
+ scanner.next().trim(), valueType);
+ return parsedResponse;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ /**
+ * Removing elements from {@code Stream} is not supported.
+ *
+ * @throws UnsupportedOperationException Always, as removal is not supported.
+ */
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+}
diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/core/Suppliers.java b/common/src/main/java/com/skyflow/generated/auth/rest/core/Suppliers.java
new file mode 100644
index 00000000..d3ab5e53
--- /dev/null
+++ b/common/src/main/java/com/skyflow/generated/auth/rest/core/Suppliers.java
@@ -0,0 +1,23 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.skyflow.generated.auth.rest.core;
+
+import java.util.Objects;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.function.Supplier;
+
+public final class Suppliers {
+ private Suppliers() {}
+
+ public static Supplier memoize(Supplier delegate) {
+ AtomicReference value = new AtomicReference<>();
+ return () -> {
+ T val = value.get();
+ if (val == null) {
+ val = value.updateAndGet(cur -> cur == null ? Objects.requireNonNull(delegate.get()) : cur);
+ }
+ return val;
+ };
+ }
+}
diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/errors/BadRequestError.java b/common/src/main/java/com/skyflow/generated/auth/rest/errors/BadRequestError.java
new file mode 100644
index 00000000..4517200d
--- /dev/null
+++ b/common/src/main/java/com/skyflow/generated/auth/rest/errors/BadRequestError.java
@@ -0,0 +1,34 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.skyflow.generated.auth.rest.errors;
+
+import com.skyflow.generated.auth.rest.core.ApiClientApiException;
+import okhttp3.Response;
+
+import java.util.Map;
+
+public final class BadRequestError extends ApiClientApiException {
+ /**
+ * The body of the response that triggered the exception.
+ */
+ private final Map body;
+
+ public BadRequestError(Map body) {
+ super("BadRequestError", 400, body);
+ this.body = body;
+ }
+
+ public BadRequestError(Map body, Response rawResponse) {
+ super("BadRequestError", 400, body, rawResponse);
+ this.body = body;
+ }
+
+ /**
+ * @return the body
+ */
+ @Override
+ public Map body() {
+ return this.body;
+ }
+}
diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/errors/HttpStatus.java b/common/src/main/java/com/skyflow/generated/auth/rest/errors/HttpStatus.java
new file mode 100644
index 00000000..2e1c45d2
--- /dev/null
+++ b/common/src/main/java/com/skyflow/generated/auth/rest/errors/HttpStatus.java
@@ -0,0 +1,15 @@
+package com.skyflow.generated.auth.rest.errors;
+
+public enum HttpStatus {
+ BAD_REQUEST("Bad Request");
+
+ private final String httpStatus;
+
+ HttpStatus(String httpStatus) {
+ this.httpStatus = httpStatus;
+ }
+
+ public String getHttpStatus() {
+ return httpStatus;
+ }
+}
diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/errors/NotFoundError.java b/common/src/main/java/com/skyflow/generated/auth/rest/errors/NotFoundError.java
new file mode 100644
index 00000000..60a1771c
--- /dev/null
+++ b/common/src/main/java/com/skyflow/generated/auth/rest/errors/NotFoundError.java
@@ -0,0 +1,34 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.skyflow.generated.auth.rest.errors;
+
+import com.skyflow.generated.auth.rest.core.ApiClientApiException;
+import okhttp3.Response;
+
+import java.util.Map;
+
+public final class NotFoundError extends ApiClientApiException {
+ /**
+ * The body of the response that triggered the exception.
+ */
+ private final Map body;
+
+ public NotFoundError(Map body) {
+ super("NotFoundError", 404, body);
+ this.body = body;
+ }
+
+ public NotFoundError(Map body, Response rawResponse) {
+ super("NotFoundError", 404, body, rawResponse);
+ this.body = body;
+ }
+
+ /**
+ * @return the body
+ */
+ @Override
+ public Map body() {
+ return this.body;
+ }
+}
diff --git a/common/src/main/java/com/skyflow/generated/auth/rest/errors/UnauthorizedError.java b/common/src/main/java/com/skyflow/generated/auth/rest/errors/UnauthorizedError.java
new file mode 100644
index 00000000..42f1c624
--- /dev/null
+++ b/common/src/main/java/com/skyflow/generated/auth/rest/errors/UnauthorizedError.java
@@ -0,0 +1,34 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.skyflow.generated.auth.rest.errors;
+
+import com.skyflow.generated.auth.rest.core.ApiClientApiException;
+import okhttp3.Response;
+
+import java.util.Map;
+
+public final class UnauthorizedError extends ApiClientApiException {
+ /**
+ * The body of the response that triggered the exception.
+ */
+ private final Map body;
+
+ public UnauthorizedError(Map body) {
+ super("UnauthorizedError", 401, body);
+ this.body = body;
+ }
+
+ public UnauthorizedError(Map body, Response rawResponse) {
+ super("UnauthorizedError", 401, body, rawResponse);
+ this.body = body;
+ }
+
+ /**
+ * @return the body
+ */
+ @Override
+ public Map body() {
+ return this.body;
+ }
+}
diff --git a/src/main/java/com/skyflow/generated/rest/resources/authentication/AsyncAuthenticationClient.java b/common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/AsyncAuthenticationClient.java
similarity index 84%
rename from src/main/java/com/skyflow/generated/rest/resources/authentication/AsyncAuthenticationClient.java
rename to common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/AsyncAuthenticationClient.java
index 43ffab73..c742b239 100644
--- a/src/main/java/com/skyflow/generated/rest/resources/authentication/AsyncAuthenticationClient.java
+++ b/common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/AsyncAuthenticationClient.java
@@ -1,12 +1,13 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
-package com.skyflow.generated.rest.resources.authentication;
+package com.skyflow.generated.auth.rest.resources.authentication;
+
+import com.skyflow.generated.auth.rest.core.ClientOptions;
+import com.skyflow.generated.auth.rest.core.RequestOptions;
+import com.skyflow.generated.auth.rest.resources.authentication.requests.V1GetAuthTokenRequest;
+import com.skyflow.generated.auth.rest.types.V1GetAuthTokenResponse;
-import com.skyflow.generated.rest.core.ClientOptions;
-import com.skyflow.generated.rest.core.RequestOptions;
-import com.skyflow.generated.rest.resources.authentication.requests.V1GetAuthTokenRequest;
-import com.skyflow.generated.rest.types.V1GetAuthTokenResponse;
import java.util.concurrent.CompletableFuture;
public class AsyncAuthenticationClient {
diff --git a/src/main/java/com/skyflow/generated/rest/resources/authentication/AsyncRawAuthenticationClient.java b/common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/AsyncRawAuthenticationClient.java
similarity index 82%
rename from src/main/java/com/skyflow/generated/rest/resources/authentication/AsyncRawAuthenticationClient.java
rename to common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/AsyncRawAuthenticationClient.java
index eca4ab90..56a47dc0 100644
--- a/src/main/java/com/skyflow/generated/rest/resources/authentication/AsyncRawAuthenticationClient.java
+++ b/common/src/main/java/com/skyflow/generated/auth/rest/resources/authentication/AsyncRawAuthenticationClient.java
@@ -1,33 +1,22 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
-package com.skyflow.generated.rest.resources.authentication;
+package com.skyflow.generated.auth.rest.resources.authentication;
import com.fasterxml.jackson.core.JsonProcessingException;
-import com.skyflow.generated.rest.core.ApiClientApiException;
-import com.skyflow.generated.rest.core.ApiClientException;
-import com.skyflow.generated.rest.core.ApiClientHttpResponse;
-import com.skyflow.generated.rest.core.ClientOptions;
-import com.skyflow.generated.rest.core.MediaTypes;
-import com.skyflow.generated.rest.core.ObjectMappers;
-import com.skyflow.generated.rest.core.RequestOptions;
-import com.skyflow.generated.rest.errors.BadRequestError;
-import com.skyflow.generated.rest.errors.NotFoundError;
-import com.skyflow.generated.rest.errors.UnauthorizedError;
-import com.skyflow.generated.rest.resources.authentication.requests.V1GetAuthTokenRequest;
-import com.skyflow.generated.rest.types.V1GetAuthTokenResponse;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.skyflow.generated.auth.rest.core.*;
+import com.skyflow.generated.auth.rest.errors.BadRequestError;
+import com.skyflow.generated.auth.rest.errors.NotFoundError;
+import com.skyflow.generated.auth.rest.errors.UnauthorizedError;
+import com.skyflow.generated.auth.rest.resources.authentication.requests.V1GetAuthTokenRequest;
+import com.skyflow.generated.auth.rest.types.V1GetAuthTokenResponse;
+import okhttp3.*;
+import org.jetbrains.annotations.NotNull;
+
import java.io.IOException;
+import java.util.Map;
import java.util.concurrent.CompletableFuture;
-import okhttp3.Call;
-import okhttp3.Callback;
-import okhttp3.Headers;
-import okhttp3.HttpUrl;
-import okhttp3.OkHttpClient;
-import okhttp3.Request;
-import okhttp3.RequestBody;
-import okhttp3.Response;
-import okhttp3.ResponseBody;
-import org.jetbrains.annotations.NotNull;
public class AsyncRawAuthenticationClient {
protected final ClientOptions clientOptions;
@@ -88,17 +77,20 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
switch (response.code()) {
case 400:
future.completeExceptionally(new BadRequestError(
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBodyString, new TypeReference