Class ParseRun.Builder
- java.lang.Object
-
- ai.extend.types.ParseRun.Builder
-
- All Implemented Interfaces:
ParseRun._FinalStage,ParseRun.ConfigStage,ParseRun.FileStage,ParseRun.IdStage,ParseRun.StatusStage
- Enclosing class:
- ParseRun
public static final class ParseRun.Builder extends java.lang.Object implements ParseRun.IdStage, ParseRun.FileStage, ParseRun.StatusStage, ParseRun.ConfigStage, ParseRun._FinalStage
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ParseRun._FinalStagebatchId(Nullable<java.lang.String> batchId)The ID of the batch this run belongs to, if created viaPOST /parse_runs/batch.ParseRun._FinalStagebatchId(java.lang.String batchId)The ID of the batch this run belongs to, if created viaPOST /parse_runs/batch.ParseRun._FinalStagebatchId(java.util.Optional<java.lang.String> batchId)The ID of the batch this run belongs to, if created viaPOST /parse_runs/batch.ParseRunbuild()ParseRun._FinalStageconfig(ParseConfig config)The configuration used for the parsing process, including any default values that were applied.ParseRun._FinalStagefailureMessage(Nullable<java.lang.String> failureMessage)A human-readable description of the failure.ParseRun._FinalStagefailureMessage(java.lang.String failureMessage)A human-readable description of the failure.ParseRun._FinalStagefailureMessage(java.util.Optional<java.lang.String> failureMessage)A human-readable description of the failure.ParseRun._FinalStagefailureReason(Nullable<java.lang.String> failureReason)The reason for failure.ParseRun._FinalStagefailureReason(java.lang.String failureReason)The reason for failure.ParseRun._FinalStagefailureReason(java.util.Optional<java.lang.String> failureReason)The reason for failure.ParseRun.StatusStagefile(FileSummary file)The file that was parsed.ParseRun.Builderfrom(ParseRun other)ParseRun.FileStageid(java.lang.String id)A unique identifier for the parse run.ParseRun._FinalStagemetadata(Nullable<java.util.Map<java.lang.String,java.lang.Object>> metadata)Any metadata that was provided when creating the parse run.ParseRun._FinalStagemetadata(java.util.Map<java.lang.String,java.lang.Object> metadata)Any metadata that was provided when creating the parse run.ParseRun._FinalStagemetadata(java.util.Optional<java.util.Map<java.lang.String,java.lang.Object>> metadata)Any metadata that was provided when creating the parse run.ParseRun._FinalStagemetrics(Nullable<ParseRunMetrics> metrics)Metrics about the parsing process.ParseRun._FinalStagemetrics(ParseRunMetrics metrics)Metrics about the parsing process.ParseRun._FinalStagemetrics(java.util.Optional<ParseRunMetrics> metrics)Metrics about the parsing process.ParseRun._FinalStageoutput(Nullable<ParseRunOutput> output)The parse run output.ParseRun._FinalStageoutput(ParseRunOutput output)The parse run output.ParseRun._FinalStageoutput(java.util.Optional<ParseRunOutput> output)The parse run output.ParseRun._FinalStageoutputUrl(Nullable<java.lang.String> outputUrl)A presigned URL to download the parse run output as a JSON file.ParseRun._FinalStageoutputUrl(java.lang.String outputUrl)A presigned URL to download the parse run output as a JSON file.ParseRun._FinalStageoutputUrl(java.util.Optional<java.lang.String> outputUrl)A presigned URL to download the parse run output as a JSON file.ParseRun.ConfigStagestatus(ParseRunStatusEnum status)The status of the parse run:ParseRun._FinalStageusage(Nullable<RunUsage> usage)Usage credits consumed by this parse run.ParseRun._FinalStageusage(RunUsage usage)Usage credits consumed by this parse run.ParseRun._FinalStageusage(java.util.Optional<RunUsage> usage)Usage credits consumed by this parse run.
-
-
-
Method Detail
-
from
public ParseRun.Builder from(ParseRun other)
- Specified by:
fromin interfaceParseRun.IdStage
-
id
public ParseRun.FileStage id(@NotNull java.lang.String id)
A unique identifier for the parse run.
Example:
"pr_xK9mLPqRtN3vS8wF5hB2cQ"A unique identifier for the parse run.
Example:
"pr_xK9mLPqRtN3vS8wF5hB2cQ"- Specified by:
idin interfaceParseRun.IdStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
file
public ParseRun.StatusStage file(@NotNull FileSummary file)
The file that was parsed. This file can be used as a parameter for other Extend endpoints, such as
POST /workflow_runs. May benullfor batch parse runs where file ingestion failed.The file that was parsed. This file can be used as a parameter for other Extend endpoints, such as
POST /workflow_runs. May benullfor batch parse runs where file ingestion failed.- Specified by:
filein interfaceParseRun.FileStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
status
public ParseRun.ConfigStage status(@NotNull ParseRunStatusEnum status)
The status of the parse run:
"PENDING"- The run has been created and is waiting to be processed. Only applies to runs created viaPOST /parse_runs/batch."PROCESSING"- The file is still being processed"PROCESSED"- The file was successfully processed"FAILED"- The processing failed (seefailureReasonfor details)
The status of the parse run:
"PENDING"- The run has been created and is waiting to be processed. Only applies to runs created viaPOST /parse_runs/batch."PROCESSING"- The file is still being processed"PROCESSED"- The file was successfully processed"FAILED"- The processing failed (seefailureReasonfor details)
- Specified by:
statusin interfaceParseRun.StatusStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
config
public ParseRun._FinalStage config(@NotNull ParseConfig config)
The configuration used for the parsing process, including any default values that were applied.
The configuration used for the parsing process, including any default values that were applied.
- Specified by:
configin interfaceParseRun.ConfigStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
usage
public ParseRun._FinalStage usage(Nullable<RunUsage> usage)
Usage credits consumed by this parse run.
Availability: Present when
statusis"PROCESSED", the run was created after October 7, 2025, and the customer is on the current billing system.- Specified by:
usagein interfaceParseRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
usage
public ParseRun._FinalStage usage(RunUsage usage)
Usage credits consumed by this parse run.
Availability: Present when
statusis"PROCESSED", the run was created after October 7, 2025, and the customer is on the current billing system.- Specified by:
usagein interfaceParseRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
usage
public ParseRun._FinalStage usage(java.util.Optional<RunUsage> usage)
Usage credits consumed by this parse run.
Availability: Present when
statusis"PROCESSED", the run was created after October 7, 2025, and the customer is on the current billing system.- Specified by:
usagein interfaceParseRun._FinalStage
-
metrics
public ParseRun._FinalStage metrics(Nullable<ParseRunMetrics> metrics)
Metrics about the parsing process.
Availability: Present when
statusis"PROCESSED".- Specified by:
metricsin interfaceParseRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
metrics
public ParseRun._FinalStage metrics(ParseRunMetrics metrics)
Metrics about the parsing process.
Availability: Present when
statusis"PROCESSED".- Specified by:
metricsin interfaceParseRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
metrics
public ParseRun._FinalStage metrics(java.util.Optional<ParseRunMetrics> metrics)
Metrics about the parsing process.
Availability: Present when
statusis"PROCESSED".- Specified by:
metricsin interfaceParseRun._FinalStage
-
outputUrl
public ParseRun._FinalStage outputUrl(Nullable<java.lang.String> outputUrl)
A presigned URL to download the parse run output as a JSON file. The object shape is the same as the
outputfield. Expires after 15 minutes.Availability: Present when
statusis"PROCESSED"and the request was made withresponseType=urlquery parameter.- Specified by:
outputUrlin interfaceParseRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
outputUrl
public ParseRun._FinalStage outputUrl(java.lang.String outputUrl)
A presigned URL to download the parse run output as a JSON file. The object shape is the same as the
outputfield. Expires after 15 minutes.Availability: Present when
statusis"PROCESSED"and the request was made withresponseType=urlquery parameter.- Specified by:
outputUrlin interfaceParseRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
outputUrl
public ParseRun._FinalStage outputUrl(java.util.Optional<java.lang.String> outputUrl)
A presigned URL to download the parse run output as a JSON file. The object shape is the same as the
outputfield. Expires after 15 minutes.Availability: Present when
statusis"PROCESSED"and the request was made withresponseType=urlquery parameter.- Specified by:
outputUrlin interfaceParseRun._FinalStage
-
output
public ParseRun._FinalStage output(Nullable<ParseRunOutput> output)
The parse run output.
Availability: Present when
statusis"PROCESSED"and the request was made without theresponseType=urlquery parameter. Contains the parsed chunks.- Specified by:
outputin interfaceParseRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
output
public ParseRun._FinalStage output(ParseRunOutput output)
The parse run output.
Availability: Present when
statusis"PROCESSED"and the request was made without theresponseType=urlquery parameter. Contains the parsed chunks.- Specified by:
outputin interfaceParseRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
output
public ParseRun._FinalStage output(java.util.Optional<ParseRunOutput> output)
The parse run output.
Availability: Present when
statusis"PROCESSED"and the request was made without theresponseType=urlquery parameter. Contains the parsed chunks.- Specified by:
outputin interfaceParseRun._FinalStage
-
metadata
public ParseRun._FinalStage metadata(Nullable<java.util.Map<java.lang.String,java.lang.Object>> metadata)
Any metadata that was provided when creating the parse run.
Availability: Present when metadata was provided during creation.
- Specified by:
metadatain interfaceParseRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
metadata
public ParseRun._FinalStage metadata(java.util.Map<java.lang.String,java.lang.Object> metadata)
Any metadata that was provided when creating the parse run.
Availability: Present when metadata was provided during creation.
- Specified by:
metadatain interfaceParseRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
metadata
public ParseRun._FinalStage metadata(java.util.Optional<java.util.Map<java.lang.String,java.lang.Object>> metadata)
Any metadata that was provided when creating the parse run.
Availability: Present when metadata was provided during creation.
- Specified by:
metadatain interfaceParseRun._FinalStage
-
failureMessage
public ParseRun._FinalStage failureMessage(Nullable<java.lang.String> failureMessage)
A human-readable description of the failure.
Availability: Present when
statusis"FAILED".- Specified by:
failureMessagein interfaceParseRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
failureMessage
public ParseRun._FinalStage failureMessage(java.lang.String failureMessage)
A human-readable description of the failure.
Availability: Present when
statusis"FAILED".- Specified by:
failureMessagein interfaceParseRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
failureMessage
public ParseRun._FinalStage failureMessage(java.util.Optional<java.lang.String> failureMessage)
A human-readable description of the failure.
Availability: Present when
statusis"FAILED".- Specified by:
failureMessagein interfaceParseRun._FinalStage
-
failureReason
public ParseRun._FinalStage failureReason(Nullable<java.lang.String> failureReason)
The reason for failure.
Availability: Present when
statusis"FAILED".Possible values include:
UNABLE_TO_DOWNLOAD_FILE- The file could not be downloaded from the provided URLFILE_TYPE_NOT_SUPPORTED- The file type is not supported for parsingFILE_SIZE_TOO_LARGE- The file exceeds the maximum allowed sizeCORRUPT_FILE- The file appears to be corrupted or malformedOCR_ERROR- An error occurred during optical character recognitionPASSWORD_PROTECTED_FILE- The file is password protected and cannot be processedFAILED_TO_CONVERT_TO_PDF- The file could not be converted to PDF for processingFAILED_TO_CONVERT_TO_JPEG- The file could not be converted to JPEG for processingFAILED_TO_GENERATE_TARGET_FORMAT- The output could not be generated in the requested formatCHUNKING_ERROR- An error occurred while chunking the documentINTERNAL_ERROR- An unexpected internal error occurredINVALID_CONFIG_OPTIONS- The provided configuration options are invalidOUT_OF_CREDITS- Insufficient credits to process the file
Note: Additional failure reasons may be added in the future. Your integration should handle unknown values gracefully.
- Specified by:
failureReasonin interfaceParseRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
failureReason
public ParseRun._FinalStage failureReason(java.lang.String failureReason)
The reason for failure.
Availability: Present when
statusis"FAILED".Possible values include:
UNABLE_TO_DOWNLOAD_FILE- The file could not be downloaded from the provided URLFILE_TYPE_NOT_SUPPORTED- The file type is not supported for parsingFILE_SIZE_TOO_LARGE- The file exceeds the maximum allowed sizeCORRUPT_FILE- The file appears to be corrupted or malformedOCR_ERROR- An error occurred during optical character recognitionPASSWORD_PROTECTED_FILE- The file is password protected and cannot be processedFAILED_TO_CONVERT_TO_PDF- The file could not be converted to PDF for processingFAILED_TO_CONVERT_TO_JPEG- The file could not be converted to JPEG for processingFAILED_TO_GENERATE_TARGET_FORMAT- The output could not be generated in the requested formatCHUNKING_ERROR- An error occurred while chunking the documentINTERNAL_ERROR- An unexpected internal error occurredINVALID_CONFIG_OPTIONS- The provided configuration options are invalidOUT_OF_CREDITS- Insufficient credits to process the file
Note: Additional failure reasons may be added in the future. Your integration should handle unknown values gracefully.
- Specified by:
failureReasonin interfaceParseRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
failureReason
public ParseRun._FinalStage failureReason(java.util.Optional<java.lang.String> failureReason)
The reason for failure.
Availability: Present when
statusis"FAILED".Possible values include:
UNABLE_TO_DOWNLOAD_FILE- The file could not be downloaded from the provided URLFILE_TYPE_NOT_SUPPORTED- The file type is not supported for parsingFILE_SIZE_TOO_LARGE- The file exceeds the maximum allowed sizeCORRUPT_FILE- The file appears to be corrupted or malformedOCR_ERROR- An error occurred during optical character recognitionPASSWORD_PROTECTED_FILE- The file is password protected and cannot be processedFAILED_TO_CONVERT_TO_PDF- The file could not be converted to PDF for processingFAILED_TO_CONVERT_TO_JPEG- The file could not be converted to JPEG for processingFAILED_TO_GENERATE_TARGET_FORMAT- The output could not be generated in the requested formatCHUNKING_ERROR- An error occurred while chunking the documentINTERNAL_ERROR- An unexpected internal error occurredINVALID_CONFIG_OPTIONS- The provided configuration options are invalidOUT_OF_CREDITS- Insufficient credits to process the file
Note: Additional failure reasons may be added in the future. Your integration should handle unknown values gracefully.
- Specified by:
failureReasonin interfaceParseRun._FinalStage
-
batchId
public ParseRun._FinalStage batchId(Nullable<java.lang.String> batchId)
The ID of the batch this run belongs to, if created via
POST /parse_runs/batch.Availability: Present when the run was submitted as part of a batch.
Example:
"bpar_Xj8mK2pL9nR4vT7qY5wZ"- Specified by:
batchIdin interfaceParseRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
batchId
public ParseRun._FinalStage batchId(java.lang.String batchId)
The ID of the batch this run belongs to, if created via
POST /parse_runs/batch.Availability: Present when the run was submitted as part of a batch.
Example:
"bpar_Xj8mK2pL9nR4vT7qY5wZ"- Specified by:
batchIdin interfaceParseRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
batchId
public ParseRun._FinalStage batchId(java.util.Optional<java.lang.String> batchId)
The ID of the batch this run belongs to, if created via
POST /parse_runs/batch.Availability: Present when the run was submitted as part of a batch.
Example:
"bpar_Xj8mK2pL9nR4vT7qY5wZ"- Specified by:
batchIdin interfaceParseRun._FinalStage
-
build
public ParseRun build()
- Specified by:
buildin interfaceParseRun._FinalStage
-
-