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
14 changes: 14 additions & 0 deletions src/main/java/com/mindee/v2/cli/BaseInferenceCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.mindee.v2.MindeeClient;
import com.mindee.v2.parsing.CommonResponse;
import java.io.File;
import java.util.List;
import java.util.concurrent.Callable;
import picocli.CommandLine.Option;
import picocli.CommandLine.Parameters;
Expand All @@ -28,6 +29,12 @@ public abstract class BaseInferenceCommand implements Callable<Integer> {
@Option(names = { "-a", "--alias" }, description = "Alias for the file")
protected String alias;

@Option(
names = { "-w", "--webhook-id" },
description = "Specify a webhook by ID. May be used multiple times."
)
private List<String> webhookIds;

/** Output format for the command. */
public enum OutputType {
summary,
Expand All @@ -45,6 +52,13 @@ public enum OutputType {
)
protected OutputType output;

/**
* @return The properly formatted webhook IDs.
*/
protected String[] getWebhookIds() {
return (webhookIds != null ? webhookIds.toArray(new String[0]) : new String[] {});
}

/**
* Executes the inference request and returns the product response.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/mindee/v2/cli/ClassificationCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected CommonResponse executeRequest(
.enqueueAndGetResult(
ClassificationResponse.class,
inputSource,
ClassificationParameters.builder(modelId).alias(alias).build()
ClassificationParameters.builder(modelId).alias(alias).webhookIds(getWebhookIds()).build()
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/mindee/v2/cli/CropCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected CommonResponse executeRequest(
.enqueueAndGetResult(
CropResponse.class,
inputSource,
CropParameters.builder(modelId).alias(alias).build()
CropParameters.builder(modelId).alias(alias).webhookIds(getWebhookIds()).build()
);
}

Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/mindee/v2/cli/ExtractionCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ protected CommonResponse executeRequest(
ExtractionParameters
.builder(modelId)
.alias(alias)
.webhookIds(getWebhookIds())
.rag(rag)
.rawText(rawText)
.confidence(confidence)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/mindee/v2/cli/OcrCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected CommonResponse executeRequest(
.enqueueAndGetResult(
OcrResponse.class,
inputSource,
OcrParameters.builder(modelId).alias(alias).build()
OcrParameters.builder(modelId).alias(alias).webhookIds(getWebhookIds()).build()
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/mindee/v2/cli/SplitCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected CommonResponse executeRequest(
.enqueueAndGetResult(
SplitResponse.class,
inputSource,
SplitParameters.builder(modelId).alias(alias).build()
SplitParameters.builder(modelId).alias(alias).webhookIds(getWebhookIds()).build()
);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/test_v2_cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ run_test() {
model_type="$2"

echo "--- Test $model_type ID: $model_id"
SUMMARY_OUTPUT=$(./cli.sh "$model_type" -m "$model_id" "$TEST_FILE")
SUMMARY_OUTPUT=$(./cli.sh "$model_type" -m "$model_id" -a "java-sdk-cli-${model_type}" "$TEST_FILE")
echo "$SUMMARY_OUTPUT"
echo ""
echo ""
Expand Down
Loading