Class ResponseApplyPatchToolCall.Operation
-
- All Implemented Interfaces:
public final class ResponseApplyPatchToolCall.OperationOne of the create_file, delete_file, or update_file operations applied via apply_patch.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceResponseApplyPatchToolCall.Operation.VisitorAn interface that defines how to map each variant of Operation to a value of type T.
public final classResponseApplyPatchToolCall.Operation.CreateFileInstruction describing how to create a file via the apply_patch tool.
public final classResponseApplyPatchToolCall.Operation.DeleteFileInstruction describing how to delete a file via the apply_patch tool.
public final classResponseApplyPatchToolCall.Operation.UpdateFileInstruction describing how to update a file via the apply_patch tool.
-
Method Summary
Modifier and Type Method Description final Optional<ResponseApplyPatchToolCall.Operation.CreateFile>createFile()Instruction describing how to create a file via the apply_patch tool. final Optional<ResponseApplyPatchToolCall.Operation.DeleteFile>deleteFile()Instruction describing how to delete a file via the apply_patch tool. final Optional<ResponseApplyPatchToolCall.Operation.UpdateFile>updateFile()Instruction describing how to update a file via the apply_patch tool. final BooleanisCreateFile()final BooleanisDeleteFile()final BooleanisUpdateFile()final ResponseApplyPatchToolCall.Operation.CreateFileasCreateFile()Instruction describing how to create a file via the apply_patch tool. final ResponseApplyPatchToolCall.Operation.DeleteFileasDeleteFile()Instruction describing how to delete a file via the apply_patch tool. final ResponseApplyPatchToolCall.Operation.UpdateFileasUpdateFile()Instruction describing how to update a file via the apply_patch tool. final Optional<JsonValue>_json()final <T extends Any> Taccept(ResponseApplyPatchToolCall.Operation.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final ResponseApplyPatchToolCall.Operationvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static ResponseApplyPatchToolCall.OperationofCreateFile(ResponseApplyPatchToolCall.Operation.CreateFile createFile)Instruction describing how to create a file via the apply_patch tool. final static ResponseApplyPatchToolCall.OperationofDeleteFile(ResponseApplyPatchToolCall.Operation.DeleteFile deleteFile)Instruction describing how to delete a file via the apply_patch tool. final static ResponseApplyPatchToolCall.OperationofUpdateFile(ResponseApplyPatchToolCall.Operation.UpdateFile updateFile)Instruction describing how to update a file via the apply_patch tool. -
-
Method Detail
-
createFile
final Optional<ResponseApplyPatchToolCall.Operation.CreateFile> createFile()
Instruction describing how to create a file via the apply_patch tool.
-
deleteFile
final Optional<ResponseApplyPatchToolCall.Operation.DeleteFile> deleteFile()
Instruction describing how to delete a file via the apply_patch tool.
-
updateFile
final Optional<ResponseApplyPatchToolCall.Operation.UpdateFile> updateFile()
Instruction describing how to update a file via the apply_patch tool.
-
isCreateFile
final Boolean isCreateFile()
-
isDeleteFile
final Boolean isDeleteFile()
-
isUpdateFile
final Boolean isUpdateFile()
-
asCreateFile
final ResponseApplyPatchToolCall.Operation.CreateFile asCreateFile()
Instruction describing how to create a file via the apply_patch tool.
-
asDeleteFile
final ResponseApplyPatchToolCall.Operation.DeleteFile asDeleteFile()
Instruction describing how to delete a file via the apply_patch tool.
-
asUpdateFile
final ResponseApplyPatchToolCall.Operation.UpdateFile asUpdateFile()
Instruction describing how to update a file via the apply_patch tool.
-
accept
final <T extends Any> T accept(ResponseApplyPatchToolCall.Operation.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.openai.core.JsonValue; import java.util.Optional; Optional<String> result = operation.accept(new Operation.Visitor<Optional<String>>() { @Override public Optional<String> visitCreateFile(CreateFile createFile) { return Optional.of(createFile.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ResponseApplyPatchToolCall.Operation validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofCreateFile
final static ResponseApplyPatchToolCall.Operation ofCreateFile(ResponseApplyPatchToolCall.Operation.CreateFile createFile)
Instruction describing how to create a file via the apply_patch tool.
-
ofDeleteFile
final static ResponseApplyPatchToolCall.Operation ofDeleteFile(ResponseApplyPatchToolCall.Operation.DeleteFile deleteFile)
Instruction describing how to delete a file via the apply_patch tool.
-
ofUpdateFile
final static ResponseApplyPatchToolCall.Operation ofUpdateFile(ResponseApplyPatchToolCall.Operation.UpdateFile updateFile)
Instruction describing how to update a file via the apply_patch tool.
-
-
-
-