001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.juneau.bean.mcp.v20260728;
018
019import static org.apache.juneau.commons.utils.CollectionUtils.*;
020import static org.apache.juneau.commons.utils.Shorts.*;
021
022import java.util.*;
023
024import org.apache.juneau.marshall.*;
025
026/**
027 * Parameters for {@value McpMethods#RESOURCES_READ}.
028 */
029@Marshalled
030public class ReadResourceRequest extends RequestParams<ReadResourceRequest> {
031
032   private String uri;
033   private Map<String,Object> inputResponses;
034   private String requestState;
035
036   /**
037    * Resource URI to read.
038    *
039    * @return The URI, or {@code null} if not set.
040    */
041   public String getUri() {
042      return uri;
043   }
044
045   /**
046    * Sets the resource URI.
047    *
048    * @param value The new value.  Can be <jk>null</jk> to unset the property.
049    * @return This object (for method chaining).
050    */
051   public ReadResourceRequest setUri(String value) {
052      uri = value;
053      return this;
054   }
055
056   /**
057    * Server-assigned-id-keyed map of collected answers to a prior {@code input_required} pause, echoed back on a
058    * resume call.
059    *
060    * @return The map, or {@code null} if not set.
061    */
062   public Map<String,Object> getInputResponses() {
063      return u(inputResponses);
064   }
065
066   /**
067    * Sets the collected-answers map.
068    *
069    * @param value The new value.  Can be <jk>null</jk> to unset the property.
070    * @return This object (for method chaining).
071    */
072   public ReadResourceRequest setInputResponses(Map<String,Object> value) {
073      inputResponses = value;
074      return this;
075   }
076
077   /**
078    * Convenience method to add a single collected answer.
079    *
080    * @param id The server-assigned id.  Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
081    * @param value The answer value.  Can be <jk>null</jk> (stored as <jk>null</jk>).
082    * @return This object (for method chaining).
083    */
084   public ReadResourceRequest putInputResponse(String id, Object value) {
085      if (inputResponses == null)
086         inputResponses = map();
087      inputResponses.put(id, value);
088      return this;
089   }
090
091   /**
092    * The opaque continuation token echoed back from a prior {@code input_required} result.
093    *
094    * @return The token, or {@code null} if not set.
095    */
096   public String getRequestState() {
097      return requestState;
098   }
099
100   /**
101    * Sets the echoed continuation token.
102    *
103    * @param value The new value.  Can be <jk>null</jk> to unset the property.
104    * @return This object (for method chaining).
105    */
106   public ReadResourceRequest setRequestState(String value) {
107      requestState = value;
108      return this;
109   }
110}