Skip to content

feat(generated): update API definition to 1.0.0-dev0.1.18 #698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 0 additions & 92 deletions ibmcloudant/cloudant_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -12238,28 +12238,22 @@ class DesignDocumentViewsMapReduce:
Schema for view functions definition.

:param str map: JavaScript map function as a string.
:param DesignDocumentViewsMapReduceOptions options: (optional) Options of view
build resuls.
:param str reduce: (optional) JavaScript reduce function as a string.
"""

def __init__(
self,
map: str,
*,
options: Optional['DesignDocumentViewsMapReduceOptions'] = None,
reduce: Optional[str] = None,
) -> None:
"""
Initialize a DesignDocumentViewsMapReduce object.

:param str map: JavaScript map function as a string.
:param DesignDocumentViewsMapReduceOptions options: (optional) Options of
view build resuls.
:param str reduce: (optional) JavaScript reduce function as a string.
"""
self.map = map
self.options = options
self.reduce = reduce

@classmethod
Expand All @@ -12270,8 +12264,6 @@ def from_dict(cls, _dict: Dict) -> 'DesignDocumentViewsMapReduce':
args['map'] = map
else:
raise ValueError('Required property \'map\' not present in DesignDocumentViewsMapReduce JSON')
if (options := _dict.get('options')) is not None:
args['options'] = DesignDocumentViewsMapReduceOptions.from_dict(options)
if (reduce := _dict.get('reduce')) is not None:
args['reduce'] = reduce
return cls(**args)
Expand All @@ -12286,11 +12278,6 @@ def to_dict(self) -> Dict:
_dict = {}
if hasattr(self, 'map') and self.map is not None:
_dict['map'] = self.map
if hasattr(self, 'options') and self.options is not None:
if isinstance(self.options, dict):
_dict['options'] = self.options
else:
_dict['options'] = self.options.to_dict()
if hasattr(self, 'reduce') and self.reduce is not None:
_dict['reduce'] = self.reduce
return _dict
Expand All @@ -12314,85 +12301,6 @@ def __ne__(self, other: 'DesignDocumentViewsMapReduce') -> bool:
return not self == other


class DesignDocumentViewsMapReduceOptions:
"""
Options of view build resuls.


This type supports additional properties of type object.
"""

def __init__(
self,
**kwargs: Optional[object],
) -> None:
"""
Initialize a DesignDocumentViewsMapReduceOptions object.

:param object **kwargs: (optional) Additional properties of type object
"""
for k, v in kwargs.items():
if not isinstance(v, object):
raise ValueError('Value for additional property {} must be of type object'.format(k))
setattr(self, k, v)

@classmethod
def from_dict(cls, _dict: Dict) -> 'DesignDocumentViewsMapReduceOptions':
"""Initialize a DesignDocumentViewsMapReduceOptions object from a json dictionary."""
args = {}
for k, v in _dict.items():
if not isinstance(v, object):
raise ValueError('Value for additional property {} must be of type object'.format(k))
args[k] = v
return cls(**args)

@classmethod
def _from_dict(cls, _dict):
"""Initialize a DesignDocumentViewsMapReduceOptions object from a json dictionary."""
return cls.from_dict(_dict)

def to_dict(self) -> Dict:
"""Return a json dictionary representing this model."""
_dict = {}
for k in [_k for _k in vars(self).keys()]:
_dict[k] = getattr(self, k)
return _dict

def _to_dict(self):
"""Return a json dictionary representing this model."""
return self.to_dict()

def get_properties(self) -> Dict:
"""Return the additional properties from this instance of DesignDocumentViewsMapReduceOptions in the form of a dict."""
_dict = {}
for k in [_k for _k in vars(self).keys()]:
_dict[k] = getattr(self, k)
return _dict

def set_properties(self, _dict: dict):
"""Set a dictionary of additional properties in this instance of DesignDocumentViewsMapReduceOptions"""
for k in [_k for _k in vars(self).keys()]:
delattr(self, k)
for k, v in _dict.items():
if not isinstance(v, object):
raise ValueError('Value for additional property {} must be of type object'.format(k))
setattr(self, k, v)

def __str__(self) -> str:
"""Return a `str` version of this DesignDocumentViewsMapReduceOptions object."""
return json.dumps(self.to_dict(), indent=2)

def __eq__(self, other: 'DesignDocumentViewsMapReduceOptions') -> bool:
"""Return `true` when self and other are equal, false otherwise."""
if not isinstance(other, self.__class__):
return False
return self.__dict__ == other.__dict__

def __ne__(self, other: 'DesignDocumentViewsMapReduceOptions') -> bool:
"""Return `true` when self and other are not equal, false otherwise."""
return not self == other


class DocsResultRow:
"""
Schema for a row of document information in a DocsResult.
Expand Down
5 changes: 0 additions & 5 deletions test/integration/test_cloudant_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,14 +755,9 @@ def test_put_design_document(self):
design_document_options_model = {
'partitioned': True,
}
# Construct a dict representation of a DesignDocumentViewsMapReduceOptions model
design_document_views_map_reduce_options_model = {
'foo': 'testString',
}
# Construct a dict representation of a DesignDocumentViewsMapReduce model
design_document_views_map_reduce_model = {
'map': 'function(doc) { \n emit(doc.productid, [doc.brand, doc.name, doc.description]) \n}',
'options': design_document_views_map_reduce_options_model,
'reduce': 'testString',
}
# Construct a dict representation of a DesignDocument model
Expand Down
71 changes: 3 additions & 68 deletions test/unit/test_cloudant_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -4709,7 +4709,7 @@ def test_get_design_document_all_params(self):
"""
# Set up mock
url = preprocess_url('/testString/_design/testString')
mock_response = '{"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}], "autoupdate": true, "filters": {"mapKey": "inner"}, "indexes": {"mapKey": {"analyzer": {"name": "classic", "stopwords": ["stopwords"], "fields": {"mapKey": {"name": "classic", "stopwords": ["stopwords"]}}}, "index": "index"}}, "language": "javascript", "options": {"partitioned": false}, "validate_doc_update": "validate_doc_update", "views": {"mapKey": {"map": "map", "options": {}, "reduce": "reduce"}}}'
mock_response = '{"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}], "autoupdate": true, "filters": {"mapKey": "inner"}, "indexes": {"mapKey": {"analyzer": {"name": "classic", "stopwords": ["stopwords"], "fields": {"mapKey": {"name": "classic", "stopwords": ["stopwords"]}}}, "index": "index"}}, "language": "javascript", "options": {"partitioned": false}, "validate_doc_update": "validate_doc_update", "views": {"mapKey": {"map": "map", "reduce": "reduce"}}}'
responses.add(
responses.GET,
url,
Expand Down Expand Up @@ -4784,7 +4784,7 @@ def test_get_design_document_required_params(self):
"""
# Set up mock
url = preprocess_url('/testString/_design/testString')
mock_response = '{"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}], "autoupdate": true, "filters": {"mapKey": "inner"}, "indexes": {"mapKey": {"analyzer": {"name": "classic", "stopwords": ["stopwords"], "fields": {"mapKey": {"name": "classic", "stopwords": ["stopwords"]}}}, "index": "index"}}, "language": "javascript", "options": {"partitioned": false}, "validate_doc_update": "validate_doc_update", "views": {"mapKey": {"map": "map", "options": {}, "reduce": "reduce"}}}'
mock_response = '{"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}], "autoupdate": true, "filters": {"mapKey": "inner"}, "indexes": {"mapKey": {"analyzer": {"name": "classic", "stopwords": ["stopwords"], "fields": {"mapKey": {"name": "classic", "stopwords": ["stopwords"]}}}, "index": "index"}}, "language": "javascript", "options": {"partitioned": false}, "validate_doc_update": "validate_doc_update", "views": {"mapKey": {"map": "map", "reduce": "reduce"}}}'
responses.add(
responses.GET,
url,
Expand Down Expand Up @@ -4824,7 +4824,7 @@ def test_get_design_document_value_error(self):
"""
# Set up mock
url = preprocess_url('/testString/_design/testString')
mock_response = '{"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}], "autoupdate": true, "filters": {"mapKey": "inner"}, "indexes": {"mapKey": {"analyzer": {"name": "classic", "stopwords": ["stopwords"], "fields": {"mapKey": {"name": "classic", "stopwords": ["stopwords"]}}}, "index": "index"}}, "language": "javascript", "options": {"partitioned": false}, "validate_doc_update": "validate_doc_update", "views": {"mapKey": {"map": "map", "options": {}, "reduce": "reduce"}}}'
mock_response = '{"_attachments": {"mapKey": {"content_type": "content_type", "data": "VGhpcyBpcyBhIG1vY2sgYnl0ZSBhcnJheSB2YWx1ZS4=", "digest": "digest", "encoded_length": 0, "encoding": "encoding", "follows": false, "length": 0, "revpos": 1, "stub": true}}, "_conflicts": ["conflicts"], "_deleted": true, "_deleted_conflicts": ["deleted_conflicts"], "_id": "_id", "_local_seq": "_local_seq", "_rev": "_rev", "_revisions": {"ids": ["ids"], "start": 1}, "_revs_info": [{"rev": "rev", "status": "available"}], "autoupdate": true, "filters": {"mapKey": "inner"}, "indexes": {"mapKey": {"analyzer": {"name": "classic", "stopwords": ["stopwords"], "fields": {"mapKey": {"name": "classic", "stopwords": ["stopwords"]}}}, "index": "index"}}, "language": "javascript", "options": {"partitioned": false}, "validate_doc_update": "validate_doc_update", "views": {"mapKey": {"map": "map", "reduce": "reduce"}}}'
responses.add(
responses.GET,
url,
Expand Down Expand Up @@ -4920,14 +4920,9 @@ def test_put_design_document_all_params(self):
design_document_options_model = {}
design_document_options_model['partitioned'] = True

# Construct a dict representation of a DesignDocumentViewsMapReduceOptions model
design_document_views_map_reduce_options_model = {}
design_document_views_map_reduce_options_model['foo'] = 'testString'

# Construct a dict representation of a DesignDocumentViewsMapReduce model
design_document_views_map_reduce_model = {}
design_document_views_map_reduce_model['map'] = 'function(doc) { \n emit(doc.productid, [doc.brand, doc.name, doc.description]) \n}'
design_document_views_map_reduce_model['options'] = design_document_views_map_reduce_options_model
design_document_views_map_reduce_model['reduce'] = 'testString'

# Construct a dict representation of a DesignDocument model
Expand Down Expand Up @@ -5055,14 +5050,9 @@ def test_put_design_document_required_params(self):
design_document_options_model = {}
design_document_options_model['partitioned'] = True

# Construct a dict representation of a DesignDocumentViewsMapReduceOptions model
design_document_views_map_reduce_options_model = {}
design_document_views_map_reduce_options_model['foo'] = 'testString'

# Construct a dict representation of a DesignDocumentViewsMapReduce model
design_document_views_map_reduce_model = {}
design_document_views_map_reduce_model['map'] = 'function(doc) { \n emit(doc.productid, [doc.brand, doc.name, doc.description]) \n}'
design_document_views_map_reduce_model['options'] = design_document_views_map_reduce_options_model
design_document_views_map_reduce_model['reduce'] = 'testString'

# Construct a dict representation of a DesignDocument model
Expand Down Expand Up @@ -5176,14 +5166,9 @@ def test_put_design_document_value_error(self):
design_document_options_model = {}
design_document_options_model['partitioned'] = True

# Construct a dict representation of a DesignDocumentViewsMapReduceOptions model
design_document_views_map_reduce_options_model = {}
design_document_views_map_reduce_options_model['foo'] = 'testString'

# Construct a dict representation of a DesignDocumentViewsMapReduce model
design_document_views_map_reduce_model = {}
design_document_views_map_reduce_model['map'] = 'function(doc) { \n emit(doc.productid, [doc.brand, doc.name, doc.description]) \n}'
design_document_views_map_reduce_model['options'] = design_document_views_map_reduce_options_model
design_document_views_map_reduce_model['reduce'] = 'testString'

# Construct a dict representation of a DesignDocument model
Expand Down Expand Up @@ -14653,12 +14638,8 @@ def test_design_document_serialization(self):
design_document_options_model = {} # DesignDocumentOptions
design_document_options_model['partitioned'] = True

design_document_views_map_reduce_options_model = {} # DesignDocumentViewsMapReduceOptions
design_document_views_map_reduce_options_model['foo'] = 'testString'

design_document_views_map_reduce_model = {} # DesignDocumentViewsMapReduce
design_document_views_map_reduce_model['map'] = 'testString'
design_document_views_map_reduce_model['options'] = design_document_views_map_reduce_options_model
design_document_views_map_reduce_model['reduce'] = 'testString'

# Construct a json representation of a DesignDocument model
Expand Down Expand Up @@ -14851,15 +14832,9 @@ def test_design_document_views_map_reduce_serialization(self):
Test serialization/deserialization for DesignDocumentViewsMapReduce
"""

# Construct dict forms of any model objects needed in order to build this model.

design_document_views_map_reduce_options_model = {} # DesignDocumentViewsMapReduceOptions
design_document_views_map_reduce_options_model['foo'] = 'testString'

# Construct a json representation of a DesignDocumentViewsMapReduce model
design_document_views_map_reduce_model_json = {}
design_document_views_map_reduce_model_json['map'] = 'testString'
design_document_views_map_reduce_model_json['options'] = design_document_views_map_reduce_options_model
design_document_views_map_reduce_model_json['reduce'] = 'testString'

# Construct a model instance of DesignDocumentViewsMapReduce by calling from_dict on the json representation
Expand All @@ -14878,46 +14853,6 @@ def test_design_document_views_map_reduce_serialization(self):
assert design_document_views_map_reduce_model_json2 == design_document_views_map_reduce_model_json


class TestModel_DesignDocumentViewsMapReduceOptions:
"""
Test Class for DesignDocumentViewsMapReduceOptions
"""

def test_design_document_views_map_reduce_options_serialization(self):
"""
Test serialization/deserialization for DesignDocumentViewsMapReduceOptions
"""

# Construct a json representation of a DesignDocumentViewsMapReduceOptions model
design_document_views_map_reduce_options_model_json = {}
design_document_views_map_reduce_options_model_json['foo'] = 'testString'

# Construct a model instance of DesignDocumentViewsMapReduceOptions by calling from_dict on the json representation
design_document_views_map_reduce_options_model = DesignDocumentViewsMapReduceOptions.from_dict(design_document_views_map_reduce_options_model_json)
assert design_document_views_map_reduce_options_model != False

# Construct a model instance of DesignDocumentViewsMapReduceOptions by calling from_dict on the json representation
design_document_views_map_reduce_options_model_dict = DesignDocumentViewsMapReduceOptions.from_dict(design_document_views_map_reduce_options_model_json).__dict__
design_document_views_map_reduce_options_model2 = DesignDocumentViewsMapReduceOptions(**design_document_views_map_reduce_options_model_dict)

# Verify the model instances are equivalent
assert design_document_views_map_reduce_options_model == design_document_views_map_reduce_options_model2

# Convert model instance back to dict and verify no loss of data
design_document_views_map_reduce_options_model_json2 = design_document_views_map_reduce_options_model.to_dict()
assert design_document_views_map_reduce_options_model_json2 == design_document_views_map_reduce_options_model_json

# Test get_properties and set_properties methods.
design_document_views_map_reduce_options_model.set_properties({})
actual_dict = design_document_views_map_reduce_options_model.get_properties()
assert actual_dict == {}

expected_dict = {'foo': 'testString'}
design_document_views_map_reduce_options_model.set_properties(expected_dict)
actual_dict = design_document_views_map_reduce_options_model.get_properties()
assert actual_dict.keys() == expected_dict.keys()


class TestModel_DocsResultRow:
"""
Test Class for DocsResultRow
Expand Down