Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/main/java/com/mindee/parsing/v2/Inference.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ public class Inference {
* Model info.
*/
@JsonProperty("model")
private InferenceResultModel model;
private InferenceModel model;

/**
* File info.
*/
@JsonProperty("file")
private InferenceResultFile file;
private InferenceFile file;

/**
* Model result values.
Expand All @@ -51,9 +51,7 @@ public String toString() {
.add("=====")
.add(":ID: " + (model != null ? model.getId() : ""))
.add("")
.add("File")
.add("====")
.add(file != null ? file.toString() : "")
.add(file.toString())
.add("")
.add(result != null ? result.toString() : "");
return joiner.toString().trim() + "\n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.StringJoiner;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
Expand All @@ -15,7 +16,7 @@
@JsonIgnoreProperties(ignoreUnknown = true)
@AllArgsConstructor
@NoArgsConstructor
public class InferenceResultFile {
public class InferenceFile {
/**
* File name.
*/
Expand All @@ -28,7 +29,29 @@ public class InferenceResultFile {
@JsonProperty("alias")
private String alias;

/**
* Page Count.
*/
@JsonProperty("page_count")
private int pageCount;

/**
* Mime type, as read by the server.
*/
@JsonProperty("mime_type")
private String mimeType;


public String toString() {
return ":Name: " + name + "\n:Alias:" + (alias != null ? " " + alias : "");

StringJoiner joiner = new StringJoiner("\n");
joiner
.add("File")
.add("====")
.add(":Name: " + name)
.add(":Alias:" + (alias != null ? " " + alias : ""))
.add(":Page Count: " + pageCount)
.add(":MIME Type: " + mimeType);
return joiner.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@JsonIgnoreProperties(ignoreUnknown = true)
@AllArgsConstructor
@NoArgsConstructor
public class InferenceResultModel {
public class InferenceModel {

/**
* The ID of the model.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/mindee/parsing/v2/Job.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ public final class Job {
* Polling URL.
*/
@JsonProperty("webhooks")
private List<JobResponseWebhook> webhooks;
private List<JobWebhook> webhooks;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
import lombok.NoArgsConstructor;

/**
* JobResponseWebhook info.
* JobWebhook info.
*/
@Getter
@EqualsAndHashCode
@JsonIgnoreProperties(ignoreUnknown = true)
@AllArgsConstructor
@NoArgsConstructor
public final class JobResponseWebhook {
public final class JobWebhook {

/**
* ID of the webhook.
Expand Down
6 changes: 4 additions & 2 deletions src/test/java/com/mindee/parsing/v2/InferenceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,15 @@ void asyncPredict_whenComplete_mustExposeAllProperties() throws IOException {
assertNotNull(inf, "Inference must not be null");
assertEquals("12345678-1234-1234-1234-123456789abc", inf.getId(), "Inference ID mismatch");

InferenceResultModel model = inf.getModel();
InferenceModel model = inf.getModel();
assertNotNull(model, "Model must not be null");
assertEquals("12345678-1234-1234-1234-123456789abc", model.getId(), "Model ID mismatch");

InferenceResultFile file = inf.getFile();
InferenceFile file = inf.getFile();
assertNotNull(file, "File must not be null");
assertEquals("complete.jpg", file.getName(), "File name mismatch");
assertEquals(1, file.getPageCount(), "Page count mismatch");
assertEquals("image/jpeg", file.getMimeType(), "MIME type mismatch");
assertNull(file.getAlias(), "File alias must be null for this payload");

InferenceFields fields = inf.getResult().getFields();
Expand Down
Loading