1414# See the License for the specific language governing permissions and
1515# limitations under the License.
1616
17- # IBM OpenAPI SDK Code Generator Version: 3.85 .0-75c38f8f-20240206-210220
17+ # IBM OpenAPI SDK Code Generator Version: 3.97 .0-0e90eab1-20241120-170029
1818"""
1919IBM Watson® Discovery is a cognitive search and content analytics engine that you can
2020add to applications to identify patterns, trends and actionable insights to drive better
@@ -4112,6 +4112,9 @@ class AnalyzedResult:
41124112 Result of the document analysis.
41134113
41144114 :param dict metadata: (optional) Metadata that was specified with the request.
4115+
4116+ This type supports additional properties of type object. The remaining key-value
4117+ pairs.
41154118 """
41164119
41174120 # The set of defined properties for the class
@@ -4121,27 +4124,41 @@ def __init__(
41214124 self,
41224125 *,
41234126 metadata: Optional[dict] = None,
4124- **kwargs,
4127+ **kwargs: Optional[object] ,
41254128 ) -> None:
41264129 """
41274130 Initialize a AnalyzedResult object.
41284131
41294132 :param dict metadata: (optional) Metadata that was specified with the
41304133 request.
4131- :param **kwargs: (optional) Any additional properties .
4134+ :param object **kwargs: (optional) The remaining key-value pairs .
41324135 """
41334136 self.metadata = metadata
4134- for _key, _value in kwargs.items():
4135- setattr(self, _key, _value)
4137+ for k, v in kwargs.items():
4138+ if k not in AnalyzedResult._properties:
4139+ if not isinstance(v, object):
4140+ raise ValueError(
4141+ 'Value for additional property {} must be of type object'
4142+ .format(k))
4143+ setattr(self, k, v)
4144+ else:
4145+ raise ValueError(
4146+ 'Property {} cannot be specified as an additional property'.
4147+ format(k))
41364148
41374149 @classmethod
41384150 def from_dict(cls, _dict: Dict) -> 'AnalyzedResult':
41394151 """Initialize a AnalyzedResult object from a json dictionary."""
41404152 args = {}
41414153 if (metadata := _dict.get('metadata')) is not None:
41424154 args['metadata'] = metadata
4143- args.update(
4144- {k: v for (k, v) in _dict.items() if k not in cls._properties})
4155+ for k, v in _dict.items():
4156+ if k not in cls._properties:
4157+ if not isinstance(v, object):
4158+ raise ValueError(
4159+ 'Value for additional property {} must be of type object'
4160+ .format(k))
4161+ args[k] = v
41454162 return cls(**args)
41464163
41474164 @classmethod
@@ -4154,39 +4171,45 @@ def to_dict(self) -> Dict:
41544171 _dict = {}
41554172 if hasattr(self, 'metadata') and self.metadata is not None:
41564173 _dict['metadata'] = self.metadata
4157- for _key in [
4158- k for k in vars(self).keys()
4159- if k not in AnalyzedResult._properties
4174+ for k in [
4175+ _k for _k in vars(self).keys()
4176+ if _k not in AnalyzedResult._properties
41604177 ]:
4161- _dict[_key ] = getattr(self, _key )
4178+ _dict[k ] = getattr(self, k )
41624179 return _dict
41634180
41644181 def _to_dict(self):
41654182 """Return a json dictionary representing this model."""
41664183 return self.to_dict()
41674184
41684185 def get_properties(self) -> Dict:
4169- """Return a dictionary of arbitrary properties from this instance of AnalyzedResult"""
4186+ """Return the additional properties from this instance of AnalyzedResult in the form of a dict. """
41704187 _dict = {}
4171-
4172- for _key in [
4173- k for k in vars(self).keys()
4174- if k not in AnalyzedResult._properties
4188+ for k in [
4189+ _k for _k in vars(self).keys()
4190+ if _k not in AnalyzedResult._properties
41754191 ]:
4176- _dict[_key ] = getattr(self, _key )
4192+ _dict[k ] = getattr(self, k )
41774193 return _dict
41784194
41794195 def set_properties(self, _dict: dict):
4180- """Set a dictionary of arbitrary properties to this instance of AnalyzedResult"""
4181- for _key in [
4182- k for k in vars(self).keys()
4183- if k not in AnalyzedResult._properties
4196+ """Set a dictionary of additional properties in this instance of AnalyzedResult"""
4197+ for k in [
4198+ _k for _k in vars(self).keys()
4199+ if _k not in AnalyzedResult._properties
41844200 ]:
4185- delattr(self, _key)
4186-
4187- for _key, _value in _dict.items():
4188- if _key not in AnalyzedResult._properties:
4189- setattr(self, _key, _value)
4201+ delattr(self, k)
4202+ for k, v in _dict.items():
4203+ if k not in AnalyzedResult._properties:
4204+ if not isinstance(v, object):
4205+ raise ValueError(
4206+ 'Value for additional property {} must be of type object'
4207+ .format(k))
4208+ setattr(self, k, v)
4209+ else:
4210+ raise ValueError(
4211+ 'Property {} cannot be specified as an additional property'.
4212+ format(k))
41904213
41914214 def __str__(self) -> str:
41924215 """Return a `str` version of this AnalyzedResult object."""
@@ -10266,6 +10289,9 @@ class QueryResult:
1026610289 :param List[QueryResultPassage] document_passages: (optional) Passages from the
1026710290 document that best matches the query. Returned if **passages.per_document** is
1026810291 `true`.
10292+
10293+ This type supports additional properties of type object. The remaining key-value
10294+ pairs.
1026910295 """
1027010296
1027110297 # The set of defined properties for the class
@@ -10279,7 +10305,7 @@ def __init__(
1027910305 *,
1028010306 metadata: Optional[dict] = None,
1028110307 document_passages: Optional[List['QueryResultPassage']] = None,
10282- **kwargs,
10308+ **kwargs: Optional[object] ,
1028310309 ) -> None:
1028410310 """
1028510311 Initialize a QueryResult object.
@@ -10290,14 +10316,23 @@ def __init__(
1029010316 :param List[QueryResultPassage] document_passages: (optional) Passages from
1029110317 the document that best matches the query. Returned if
1029210318 **passages.per_document** is `true`.
10293- :param **kwargs: (optional) Any additional properties .
10319+ :param object **kwargs: (optional) The remaining key-value pairs .
1029410320 """
1029510321 self.document_id = document_id
1029610322 self.metadata = metadata
1029710323 self.result_metadata = result_metadata
1029810324 self.document_passages = document_passages
10299- for _key, _value in kwargs.items():
10300- setattr(self, _key, _value)
10325+ for k, v in kwargs.items():
10326+ if k not in QueryResult._properties:
10327+ if not isinstance(v, object):
10328+ raise ValueError(
10329+ 'Value for additional property {} must be of type object'
10330+ .format(k))
10331+ setattr(self, k, v)
10332+ else:
10333+ raise ValueError(
10334+ 'Property {} cannot be specified as an additional property'.
10335+ format(k))
1030110336
1030210337 @classmethod
1030310338 def from_dict(cls, _dict: Dict) -> 'QueryResult':
@@ -10322,8 +10357,13 @@ def from_dict(cls, _dict: Dict) -> 'QueryResult':
1032210357 args['document_passages'] = [
1032310358 QueryResultPassage.from_dict(v) for v in document_passages
1032410359 ]
10325- args.update(
10326- {k: v for (k, v) in _dict.items() if k not in cls._properties})
10360+ for k, v in _dict.items():
10361+ if k not in cls._properties:
10362+ if not isinstance(v, object):
10363+ raise ValueError(
10364+ 'Value for additional property {} must be of type object'
10365+ .format(k))
10366+ args[k] = v
1032710367 return cls(**args)
1032810368
1032910369 @classmethod
@@ -10353,36 +10393,45 @@ def to_dict(self) -> Dict:
1035310393 else:
1035410394 document_passages_list.append(v.to_dict())
1035510395 _dict['document_passages'] = document_passages_list
10356- for _key in [
10357- k for k in vars(self).keys() if k not in QueryResult._properties
10396+ for k in [
10397+ _k for _k in vars(self).keys()
10398+ if _k not in QueryResult._properties
1035810399 ]:
10359- _dict[_key ] = getattr(self, _key )
10400+ _dict[k ] = getattr(self, k )
1036010401 return _dict
1036110402
1036210403 def _to_dict(self):
1036310404 """Return a json dictionary representing this model."""
1036410405 return self.to_dict()
1036510406
1036610407 def get_properties(self) -> Dict:
10367- """Return a dictionary of arbitrary properties from this instance of QueryResult"""
10408+ """Return the additional properties from this instance of QueryResult in the form of a dict. """
1036810409 _dict = {}
10369-
10370- for _key in [
10371- k for k in vars(self).keys() if k not in QueryResult._properties
10410+ for k in [
10411+ _k for _k in vars(self).keys()
10412+ if _k not in QueryResult._properties
1037210413 ]:
10373- _dict[_key ] = getattr(self, _key )
10414+ _dict[k ] = getattr(self, k )
1037410415 return _dict
1037510416
1037610417 def set_properties(self, _dict: dict):
10377- """Set a dictionary of arbitrary properties to this instance of QueryResult"""
10378- for _key in [
10379- k for k in vars(self).keys() if k not in QueryResult._properties
10418+ """Set a dictionary of additional properties in this instance of QueryResult"""
10419+ for k in [
10420+ _k for _k in vars(self).keys()
10421+ if _k not in QueryResult._properties
1038010422 ]:
10381- delattr(self, _key)
10382-
10383- for _key, _value in _dict.items():
10384- if _key not in QueryResult._properties:
10385- setattr(self, _key, _value)
10423+ delattr(self, k)
10424+ for k, v in _dict.items():
10425+ if k not in QueryResult._properties:
10426+ if not isinstance(v, object):
10427+ raise ValueError(
10428+ 'Value for additional property {} must be of type object'
10429+ .format(k))
10430+ setattr(self, k, v)
10431+ else:
10432+ raise ValueError(
10433+ 'Property {} cannot be specified as an additional property'.
10434+ format(k))
1038610435
1038710436 def __str__(self) -> str:
1038810437 """Return a `str` version of this QueryResult object."""
0 commit comments