Class File
-
- All Implemented Interfaces:
public abstract class File extends JsonSerializable
A file uploaded to the API.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public abstract classFile.BuilderBuilder for File.
-
Field Summary
Fields Modifier and Type Field Description public final static StringMAX_READ_LENGTH_PROPERTY
-
Constructor Summary
Constructors Constructor Description File()
-
Method Summary
Modifier and Type Method Description abstract Optional<String>name()The `File` resource name. abstract Optional<String>displayName()Optional. abstract Optional<String>mimeType()Output only. abstract Optional<Long>sizeBytes()Output only. abstract Optional<Instant>createTime()Output only. abstract Optional<Instant>expirationTime()Output only. abstract Optional<Instant>updateTime()Output only. abstract Optional<String>sha256Hash()Output only. abstract Optional<String>uri()Output only. abstract Optional<String>downloadUri()Output only. abstract Optional<FileState>state()Output only. abstract Optional<FileSource>source()Output only. abstract Optional<Map<String, Object>>videoMetadata()Output only. abstract Optional<FileStatus>error()Output only. static File.Builderbuilder()Instantiates a builder for File. abstract File.BuildertoBuilder()Creates a builder with the same values as this instance. static FilefromJson(String jsonString)Deserializes a JSON string to a File object. -
Methods inherited from class com.google.genai.JsonSerializable
fromJsonNode, fromJsonString, objectMapper, setMaxReadLength, stringToJsonNode, toJson, toJsonNode, toJsonString -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
name
abstract Optional<String> name()
The `File` resource name. The ID (name excluding the "files/" prefix) can contain up to 40 characters that are lowercase alphanumeric or dashes (-). The ID cannot start or end with a dash. If the name is empty on create, a unique name will be generated. Example: `files/123-456`
-
displayName
abstract Optional<String> displayName()
Optional. The human-readable display name for the `File`. The display name must be no more than 512 characters in length, including spaces. Example: 'Welcome Image'
-
createTime
abstract Optional<Instant> createTime()
Output only. The timestamp of when the `File` was created.
-
expirationTime
abstract Optional<Instant> expirationTime()
Output only. The timestamp of when the `File` will be deleted. Only set if the `File` is scheduled to expire.
-
updateTime
abstract Optional<Instant> updateTime()
Output only. The timestamp of when the `File` was last updated.
-
sha256Hash
abstract Optional<String> sha256Hash()
Output only. SHA-256 hash of the uploaded bytes. The hash value is encoded in base64 format.
-
downloadUri
abstract Optional<String> downloadUri()
Output only. The URI of the `File`, only set for downloadable (generated) files.
-
source
abstract Optional<FileSource> source()
Output only. The source of the `File`.
-
videoMetadata
abstract Optional<Map<String, Object>> videoMetadata()
Output only. Metadata for a video.
-
error
abstract Optional<FileStatus> error()
Output only. Error status if File processing failed.
-
builder
static File.Builder builder()
Instantiates a builder for File.
-
toBuilder
abstract File.Builder toBuilder()
Creates a builder with the same values as this instance.
-
-
-
-