14
14
# See the License for the specific language governing permissions and
15
15
# limitations under the License.
16
16
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
18
18
"""
19
19
IBM Watson® Discovery is a cognitive search and content analytics engine that you can
20
20
add to applications to identify patterns, trends and actionable insights to drive better
@@ -4112,6 +4112,9 @@ class AnalyzedResult:
4112
4112
Result of the document analysis.
4113
4113
4114
4114
: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.
4115
4118
"""
4116
4119
4117
4120
# The set of defined properties for the class
@@ -4121,27 +4124,41 @@ def __init__(
4121
4124
self,
4122
4125
*,
4123
4126
metadata: Optional[dict] = None,
4124
- **kwargs,
4127
+ **kwargs: Optional[object] ,
4125
4128
) -> None:
4126
4129
"""
4127
4130
Initialize a AnalyzedResult object.
4128
4131
4129
4132
:param dict metadata: (optional) Metadata that was specified with the
4130
4133
request.
4131
- :param **kwargs: (optional) Any additional properties .
4134
+ :param object **kwargs: (optional) The remaining key-value pairs .
4132
4135
"""
4133
4136
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))
4136
4148
4137
4149
@classmethod
4138
4150
def from_dict(cls, _dict: Dict) -> 'AnalyzedResult':
4139
4151
"""Initialize a AnalyzedResult object from a json dictionary."""
4140
4152
args = {}
4141
4153
if (metadata := _dict.get('metadata')) is not None:
4142
4154
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
4145
4162
return cls(**args)
4146
4163
4147
4164
@classmethod
@@ -4154,39 +4171,45 @@ def to_dict(self) -> Dict:
4154
4171
_dict = {}
4155
4172
if hasattr(self, 'metadata') and self.metadata is not None:
4156
4173
_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
4160
4177
]:
4161
- _dict[_key ] = getattr(self, _key )
4178
+ _dict[k ] = getattr(self, k )
4162
4179
return _dict
4163
4180
4164
4181
def _to_dict(self):
4165
4182
"""Return a json dictionary representing this model."""
4166
4183
return self.to_dict()
4167
4184
4168
4185
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. """
4170
4187
_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
4175
4191
]:
4176
- _dict[_key ] = getattr(self, _key )
4192
+ _dict[k ] = getattr(self, k )
4177
4193
return _dict
4178
4194
4179
4195
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
4184
4200
]:
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))
4190
4213
4191
4214
def __str__(self) -> str:
4192
4215
"""Return a `str` version of this AnalyzedResult object."""
@@ -10266,6 +10289,9 @@ class QueryResult:
10266
10289
:param List[QueryResultPassage] document_passages: (optional) Passages from the
10267
10290
document that best matches the query. Returned if **passages.per_document** is
10268
10291
`true`.
10292
+
10293
+ This type supports additional properties of type object. The remaining key-value
10294
+ pairs.
10269
10295
"""
10270
10296
10271
10297
# The set of defined properties for the class
@@ -10279,7 +10305,7 @@ def __init__(
10279
10305
*,
10280
10306
metadata: Optional[dict] = None,
10281
10307
document_passages: Optional[List['QueryResultPassage']] = None,
10282
- **kwargs,
10308
+ **kwargs: Optional[object] ,
10283
10309
) -> None:
10284
10310
"""
10285
10311
Initialize a QueryResult object.
@@ -10290,14 +10316,23 @@ def __init__(
10290
10316
:param List[QueryResultPassage] document_passages: (optional) Passages from
10291
10317
the document that best matches the query. Returned if
10292
10318
**passages.per_document** is `true`.
10293
- :param **kwargs: (optional) Any additional properties .
10319
+ :param object **kwargs: (optional) The remaining key-value pairs .
10294
10320
"""
10295
10321
self.document_id = document_id
10296
10322
self.metadata = metadata
10297
10323
self.result_metadata = result_metadata
10298
10324
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))
10301
10336
10302
10337
@classmethod
10303
10338
def from_dict(cls, _dict: Dict) -> 'QueryResult':
@@ -10322,8 +10357,13 @@ def from_dict(cls, _dict: Dict) -> 'QueryResult':
10322
10357
args['document_passages'] = [
10323
10358
QueryResultPassage.from_dict(v) for v in document_passages
10324
10359
]
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
10327
10367
return cls(**args)
10328
10368
10329
10369
@classmethod
@@ -10353,36 +10393,45 @@ def to_dict(self) -> Dict:
10353
10393
else:
10354
10394
document_passages_list.append(v.to_dict())
10355
10395
_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
10358
10399
]:
10359
- _dict[_key ] = getattr(self, _key )
10400
+ _dict[k ] = getattr(self, k )
10360
10401
return _dict
10361
10402
10362
10403
def _to_dict(self):
10363
10404
"""Return a json dictionary representing this model."""
10364
10405
return self.to_dict()
10365
10406
10366
10407
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. """
10368
10409
_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
10372
10413
]:
10373
- _dict[_key ] = getattr(self, _key )
10414
+ _dict[k ] = getattr(self, k )
10374
10415
return _dict
10375
10416
10376
10417
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
10380
10422
]:
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))
10386
10435
10387
10436
def __str__(self) -> str:
10388
10437
"""Return a `str` version of this QueryResult object."""
0 commit comments