Skip to content

Commit

Permalink
Release 0.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Feb 13, 2024
1 parent 5ed607a commit 7940080
Show file tree
Hide file tree
Showing 369 changed files with 6,378 additions and 3,764 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repositories {
}

dependencies {
api 'com.squareup.okhttp3:okhttp:4.9.3'
api 'com.squareup.okhttp3:okhttp:4.12.0'
api 'com.fasterxml.jackson.core:jackson-databind:2.13.0'
api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.3'
api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.3'
Expand Down Expand Up @@ -46,7 +46,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.flatfile'
artifactId = 'flatfile-java'
version = '0.0.5'
version = '0.0.6'
from components.java
}
}
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/flatfile/api/Flatfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.flatfile.api.resources.commits.CommitsClient;
import com.flatfile.api.resources.dataretentionpolicies.DataRetentionPoliciesClient;
import com.flatfile.api.resources.documents.DocumentsClient;
import com.flatfile.api.resources.entitlements.EntitlementsClient;
import com.flatfile.api.resources.environments.EnvironmentsClient;
import com.flatfile.api.resources.events.EventsClient;
import com.flatfile.api.resources.files.FilesClient;
Expand Down Expand Up @@ -40,6 +41,8 @@ public class Flatfile {

protected final Supplier<DocumentsClient> documentsClient;

protected final Supplier<EntitlementsClient> entitlementsClient;

protected final Supplier<EnvironmentsClient> environmentsClient;

protected final Supplier<EventsClient> eventsClient;
Expand Down Expand Up @@ -77,6 +80,7 @@ public Flatfile(ClientOptions clientOptions) {
this.commitsClient = Suppliers.memoize(() -> new CommitsClient(clientOptions));
this.dataRetentionPoliciesClient = Suppliers.memoize(() -> new DataRetentionPoliciesClient(clientOptions));
this.documentsClient = Suppliers.memoize(() -> new DocumentsClient(clientOptions));
this.entitlementsClient = Suppliers.memoize(() -> new EntitlementsClient(clientOptions));
this.environmentsClient = Suppliers.memoize(() -> new EnvironmentsClient(clientOptions));
this.eventsClient = Suppliers.memoize(() -> new EventsClient(clientOptions));
this.filesClient = Suppliers.memoize(() -> new FilesClient(clientOptions));
Expand Down Expand Up @@ -114,6 +118,10 @@ public DocumentsClient documents() {
return this.documentsClient.get();
}

public EntitlementsClient entitlements() {
return this.entitlementsClient.get();
}

public EnvironmentsClient environments() {
return this.environmentsClient.get();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/flatfile/api/core/ApiError.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public Object body() {
return this.body;
}

@Override
@java.lang.Override
public String toString() {
return "ApiError{" + "statusCode: " + statusCode + ", body: " + body + "}";
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/flatfile/api/core/ClientOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private ClientOptions(
"X-Fern-SDK-Name",
"com.flatfile.fern:api-sdk",
"X-Fern-SDK-Version",
"0.0.5",
"0.0.6",
"X-Fern-Language",
"JAVA"));
this.headerSuppliers = headerSuppliers;
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/com/flatfile/api/core/MediaTypes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.flatfile.api.core;

import okhttp3.MediaType;

public final class MediaTypes {

public static final MediaType APPLICATION_JSON = MediaType.parse("application/json");

private MediaTypes() {}
}
97 changes: 97 additions & 0 deletions src/main/java/com/flatfile/api/core/Stream.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.flatfile.api.core;

import java.io.Reader;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Scanner;

/**
* The {@code Stream} class implmenets {@link Iterable} to provide a simple mechanism for reading and parsing
* objects of a given type from data streamed via a {@link Reader} using a specified delimiter.
* <p>
* {@code Stream} assumes that data is being pushed to the provided {@link Reader} asynchronously and utilizes a
* {@code Scanner} to block during iteration if the next object is not available.
*
* @param <T> The type of objects in the stream.
*/
public final class Stream<T> implements Iterable<T> {
/**
* The {@link Class} of the objects in the stream.
*/
private final Class<T> valueType;
/**
* The {@link Scanner} used for reading from the input stream and blocking when neede during iteration.
*/
private final Scanner scanner;

/**
* Constructs a new {@code Stream} with the specified value type, reader, and delimiter.
*
* @param valueType The class of the objects in the stream.
* @param reader The reader that provides the streamed data.
* @param delimiter The delimiter used to separate elements in the stream.
*/
public Stream(Class<T> valueType, Reader reader, String delimiter) {
this.scanner = new Scanner(reader).useDelimiter(delimiter);
this.valueType = valueType;
}

/**
* Returns an iterator over the elements in this stream that blocks during iteration when the next object is
* not yet available.
*
* @return An iterator that can be used to traverse the elements in the stream.
*/
@Override
public Iterator<T> iterator() {
return new Iterator<T>() {
/**
* Returns {@code true} if there are more elements in the stream.
* <p>
* 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.
* <p>
* 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();
}
};
}
}
Loading

0 comments on commit 7940080

Please sign in to comment.