40 lines
1.6 KiB
Java
40 lines
1.6 KiB
Java
/*
|
|
* Copyright 2025 Google. This software is provided as-is, without warranty or representation for any use or purpose.
|
|
* Your use of it is subject to your agreement with Google.
|
|
*/
|
|
|
|
package com.example.dto.dialogflow.base;
|
|
|
|
import com.example.dto.dialogflow.conversation.QueryInputDTO;
|
|
import com.example.dto.dialogflow.conversation.QueryParamsDTO;
|
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
public record DetectIntentRequestDTO(
|
|
@JsonProperty("queryInput") QueryInputDTO queryInput,
|
|
@JsonProperty("queryParams") QueryParamsDTO queryParams
|
|
) {
|
|
|
|
public DetectIntentRequestDTO withParameter(String key, Object value) {
|
|
// Create a new QueryParamsDTO with the updated session parameter
|
|
QueryParamsDTO updatedQueryParams = this.queryParams().withSessionParameter(key, value);
|
|
|
|
// Return a new DetectIntentRequestDTO instance with the updated QueryParamsDTO
|
|
return new DetectIntentRequestDTO(
|
|
this.queryInput(),
|
|
updatedQueryParams
|
|
);
|
|
}
|
|
|
|
public DetectIntentRequestDTO withParameters(java.util.Map<String, Object> parameters) {
|
|
// Create a new QueryParamsDTO with the updated session parameters
|
|
QueryParamsDTO updatedQueryParams = this.queryParams().withSessionParameters(parameters);
|
|
|
|
// Return a new DetectIntentRequestDTO instance with the updated QueryParamsDTO
|
|
return new DetectIntentRequestDTO(
|
|
this.queryInput(),
|
|
updatedQueryParams
|
|
);
|
|
}
|
|
} |