Class ArtifactController
java.lang.Object
com.google.adk.web.controller.ArtifactController
Controller handling artifact-related API endpoints.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<Void> deleteArtifact(String appName, String userId, String sessionId, String artifactName) Deletes an artifact and all its versions.listArtifactNames(String appName, String userId, String sessionId) Lists the names of all artifacts associated with a session.listArtifactVersions(String appName, String userId, String sessionId, String artifactName) Lists the available versions for a specific artifact.com.google.genai.types.PartLoads the latest or a specific version of an artifact associated with a session.com.google.genai.types.PartloadArtifactVersion(String appName, String userId, String sessionId, String artifactName, int versionId) Loads a specific version of an artifact.
-
Constructor Details
-
ArtifactController
-
-
Method Details
-
loadArtifact
@GetMapping("/apps/{appName}/users/{userId}/sessions/{sessionId}/artifacts/{artifactName}") public com.google.genai.types.Part loadArtifact(@PathVariable String appName, @PathVariable String userId, @PathVariable String sessionId, @PathVariable String artifactName, @RequestParam(required=false) Integer version) Loads the latest or a specific version of an artifact associated with a session.- Parameters:
appName- The application name.userId- The user ID.sessionId- The session ID.artifactName- The name of the artifact.version- Optional specific version number. If null, loads the latest.- Returns:
- The artifact content as a Part object.
- Throws:
org.springframework.web.server.ResponseStatusException- if the artifact is not found (NOT_FOUND).
-
loadArtifactVersion
@GetMapping("/apps/{appName}/users/{userId}/sessions/{sessionId}/artifacts/{artifactName}/versions/{versionId}") public com.google.genai.types.Part loadArtifactVersion(@PathVariable String appName, @PathVariable String userId, @PathVariable String sessionId, @PathVariable String artifactName, @PathVariable int versionId) Loads a specific version of an artifact.- Parameters:
appName- The application name.userId- The user ID.sessionId- The session ID.artifactName- The name of the artifact.versionId- The specific version number.- Returns:
- The artifact content as a Part object.
- Throws:
org.springframework.web.server.ResponseStatusException- if the artifact version is not found (NOT_FOUND).
-
listArtifactNames
@GetMapping("/apps/{appName}/users/{userId}/sessions/{sessionId}/artifacts") public List<String> listArtifactNames(@PathVariable String appName, @PathVariable String userId, @PathVariable String sessionId) Lists the names of all artifacts associated with a session.- Parameters:
appName- The application name.userId- The user ID.sessionId- The session ID.- Returns:
- A list of artifact names.
-
listArtifactVersions
@GetMapping("/apps/{appName}/users/{userId}/sessions/{sessionId}/artifacts/{artifactName}/versions") public List<Integer> listArtifactVersions(@PathVariable String appName, @PathVariable String userId, @PathVariable String sessionId, @PathVariable String artifactName) Lists the available versions for a specific artifact.- Parameters:
appName- The application name.userId- The user ID.sessionId- The session ID.artifactName- The name of the artifact.- Returns:
- A list of version numbers (integers).
-
deleteArtifact
@DeleteMapping("/apps/{appName}/users/{userId}/sessions/{sessionId}/artifacts/{artifactName}") public org.springframework.http.ResponseEntity<Void> deleteArtifact(@PathVariable String appName, @PathVariable String userId, @PathVariable String sessionId, @PathVariable String artifactName) Deletes an artifact and all its versions.- Parameters:
appName- The application name.userId- The user ID.sessionId- The session ID.artifactName- The name of the artifact to delete.- Returns:
- A ResponseEntity with status NO_CONTENT on success.
- Throws:
org.springframework.web.server.ResponseStatusException- if deletion fails (INTERNAL_SERVER_ERROR).
-