Initial Python rewrite
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* 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.QueryResultDTO;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import com.example.dto.quickreplies.QuickReplyDTO;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public record DetectIntentResponseDTO(
|
||||
@JsonProperty("responseId") String responseId,
|
||||
@JsonProperty("queryResult") QueryResultDTO queryResult,
|
||||
@JsonProperty("quick_replies") QuickReplyDTO quickReplies
|
||||
) {
|
||||
public DetectIntentResponseDTO(String responseId, QueryResultDTO queryResult) {
|
||||
this(responseId, queryResult, null);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user