Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@


public class AgentListResponse {

/**
* The list of agents.
*/
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("agents")
private List<Agent> agents;


/**
* A token to retrieve the next page of results.
*/
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("next_page_token")
private String nextPageToken;
Expand All @@ -54,10 +58,16 @@ public AgentListResponse() {
this(null, null);
}

/**
* The list of agents.
*/
public Optional<List<Agent>> agents() {
return Optional.ofNullable(this.agents);
}

/**
* A token to retrieve the next page of results.
*/
public Optional<String> nextPageToken() {
return Optional.ofNullable(this.nextPageToken);
}
Expand All @@ -67,12 +77,18 @@ public static Builder builder() {
}


/**
* The list of agents.
*/
public AgentListResponse withAgents(@Nullable List<Agent> agents) {
this.agents = agents;
return this;
}


/**
* A token to retrieve the next page of results.
*/
public AgentListResponse withNextPageToken(@Nullable String nextPageToken) {
this.nextPageToken = nextPageToken;
return this;
Expand Down Expand Up @@ -117,11 +133,17 @@ private Builder() {
// force use of static builder() method
}

/**
* The list of agents.
*/
public Builder agents(@Nullable List<Agent> agents) {
this.agents = agents;
return this;
}

/**
* A token to retrieve the next page of results.
*/
public Builder nextPageToken(@Nullable String nextPageToken) {
this.nextPageToken = nextPageToken;
return this;
Expand Down
34 changes: 17 additions & 17 deletions src/main/java/com/google/genai/gaos/models/interactions/Env.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,39 +49,39 @@ private Env(TypedObject value) {
this.value = value;
}

public static Env of(Map<String, EnvVar> value) {
public static Env of(EnvVar value) {
Utils.checkNotNull(value, "value");
return new Env(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference<Map<String, EnvVar>>(){}));
return new Env(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference<EnvVar>(){}));
}

public static Env of(String value) {
public static Env of(Map<String, EnvVar> value) {
Utils.checkNotNull(value, "value");
return new Env(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference<String>(){}));
return new Env(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference<Map<String, EnvVar>>(){}));
}

/**
* Returns an {@link Optional} containing the value if it is of type {@code Map<String, EnvVar>},
* Returns an {@link Optional} containing the value if it is of type {@code EnvVar},
* otherwise returns an empty {@link Optional}.
*
* @return an {@link Optional} containing the {@code Map<String, EnvVar>} value, or empty if not of this type
* @return an {@link Optional} containing the {@code EnvVar} value, or empty if not of this type
*/
@SuppressWarnings("unchecked")
public Optional<Map<String, EnvVar>> mapOfEnvVar() {
if (value.value() instanceof Map) {
return Optional.of((Map<String, EnvVar>) value.value());
public Optional<EnvVar> envVar() {
if (value.value() instanceof EnvVar) {
return Optional.of((EnvVar) value.value());
}
return Optional.empty();
}

/**
* Returns an {@link Optional} containing the value if it is of type {@code String},
* Returns an {@link Optional} containing the value if it is of type {@code Map<String, EnvVar>},
* otherwise returns an empty {@link Optional}.
*
* @return an {@link Optional} containing the {@code String} value, or empty if not of this type
* @return an {@link Optional} containing the {@code Map<String, EnvVar>} value, or empty if not of this type
*/
public Optional<String> string() {
if (value.value() instanceof String) {
return Optional.of((String) value.value());
@SuppressWarnings("unchecked")
public Optional<Map<String, EnvVar>> mapOfEnvVar() {
if (value.value() instanceof Map) {
return Optional.of((Map<String, EnvVar>) value.value());
}
return Optional.empty();
}
Expand Down Expand Up @@ -120,8 +120,8 @@ public static final class _Deserializer extends OneOfDeserializer<Env> {

public _Deserializer() {
super(Env.class, false,
TypeReferenceWithShape.of(new TypeReference<Map<String, EnvVar>>() {}, JsonShape.DEFAULT),
TypeReferenceWithShape.of(new TypeReference<String>() {}, JsonShape.DEFAULT));
TypeReferenceWithShape.of(new TypeReference<EnvVar>() {}, JsonShape.DEFAULT),
TypeReferenceWithShape.of(new TypeReference<Map<String, EnvVar>>() {}, JsonShape.DEFAULT));
}
}

Expand Down
Loading