Skip to content

Commit 3c3d6ce

Browse files
build(generated): Update spec version to 0.0.51 (#709) (#469)
Generated SDK source code using: - Generator version 3.69.0 - Specification version 1.0.0-dev0.0.51 - Automation (cloudant-sdks) version d87ff5b Signed-off-by: cloudant-sdks-automation <71659186+cloudant-sdks-automation@users.noreply.github.com>
1 parent 63cbef7 commit 3c3d6ce

2 files changed

Lines changed: 145 additions & 2 deletions

File tree

ibmcloudant/cloudant_v1.py

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11720,6 +11720,8 @@ class DesignDocumentViewIndex:
1172011720
:attr str signature: MD5 signature of the views for the design document.
1172111721
:attr ContentInformationSizes sizes: Schema for size information of content.
1172211722
:attr bool updater_running: Indicates if the view is currently being updated.
11723+
:attr UpdatesPending updates_pending: Schema for an ability to tell if view is
11724+
up-to-date without querying it.
1172311725
:attr int waiting_clients: Number of clients waiting on views from this design
1172411726
document.
1172511727
:attr bool waiting_commit: Indicates if there are outstanding commits to the
@@ -11734,6 +11736,7 @@ def __init__(
1173411736
signature: str,
1173511737
sizes: 'ContentInformationSizes',
1173611738
updater_running: bool,
11739+
updates_pending: 'UpdatesPending',
1173711740
waiting_clients: int,
1173811741
waiting_commit: bool,
1173911742
) -> None:
@@ -11751,6 +11754,8 @@ def __init__(
1175111754
content.
1175211755
:param bool updater_running: Indicates if the view is currently being
1175311756
updated.
11757+
:param UpdatesPending updates_pending: Schema for an ability to tell if
11758+
view is up-to-date without querying it.
1175411759
:param int waiting_clients: Number of clients waiting on views from this
1175511760
design document.
1175611761
:param bool waiting_commit: Indicates if there are outstanding commits to
@@ -11762,6 +11767,7 @@ def __init__(
1176211767
self.signature = signature
1176311768
self.sizes = sizes
1176411769
self.updater_running = updater_running
11770+
self.updates_pending = updates_pending
1176511771
self.waiting_clients = waiting_clients
1176611772
self.waiting_commit = waiting_commit
1176711773

@@ -11793,6 +11799,10 @@ def from_dict(cls, _dict: Dict) -> 'DesignDocumentViewIndex':
1179311799
args['updater_running'] = _dict.get('updater_running')
1179411800
else:
1179511801
raise ValueError('Required property \'updater_running\' not present in DesignDocumentViewIndex JSON')
11802+
if 'updates_pending' in _dict:
11803+
args['updates_pending'] = UpdatesPending.from_dict(_dict.get('updates_pending'))
11804+
else:
11805+
raise ValueError('Required property \'updates_pending\' not present in DesignDocumentViewIndex JSON')
1179611806
if 'waiting_clients' in _dict:
1179711807
args['waiting_clients'] = _dict.get('waiting_clients')
1179811808
else:
@@ -11826,6 +11836,11 @@ def to_dict(self) -> Dict:
1182611836
_dict['sizes'] = self.sizes.to_dict()
1182711837
if hasattr(self, 'updater_running') and self.updater_running is not None:
1182811838
_dict['updater_running'] = self.updater_running
11839+
if hasattr(self, 'updates_pending') and self.updates_pending is not None:
11840+
if isinstance(self.updates_pending, dict):
11841+
_dict['updates_pending'] = self.updates_pending
11842+
else:
11843+
_dict['updates_pending'] = self.updates_pending.to_dict()
1182911844
if hasattr(self, 'waiting_clients') and self.waiting_clients is not None:
1183011845
_dict['waiting_clients'] = self.waiting_clients
1183111846
if hasattr(self, 'waiting_commit') and self.waiting_commit is not None:
@@ -17312,6 +17327,90 @@ class StatusEnum(str, Enum):
1731217327

1731317328

1731417329

17330+
class UpdatesPending:
17331+
"""
17332+
Schema for an ability to tell if view is up-to-date without querying it.
17333+
17334+
:attr int minimum: Sum of shard copies with the least amount of work to do.
17335+
:attr int preferred: Sum of unique shards. This value is zero when at least one
17336+
copy of every shard range is up-to-date and the view is able to answer a query
17337+
without index building delays.
17338+
:attr int total: Sum of all shard copies.
17339+
"""
17340+
17341+
def __init__(
17342+
self,
17343+
minimum: int,
17344+
preferred: int,
17345+
total: int,
17346+
) -> None:
17347+
"""
17348+
Initialize a UpdatesPending object.
17349+
17350+
:param int minimum: Sum of shard copies with the least amount of work to
17351+
do.
17352+
:param int preferred: Sum of unique shards. This value is zero when at
17353+
least one copy of every shard range is up-to-date and the view is able to
17354+
answer a query without index building delays.
17355+
:param int total: Sum of all shard copies.
17356+
"""
17357+
self.minimum = minimum
17358+
self.preferred = preferred
17359+
self.total = total
17360+
17361+
@classmethod
17362+
def from_dict(cls, _dict: Dict) -> 'UpdatesPending':
17363+
"""Initialize a UpdatesPending object from a json dictionary."""
17364+
args = {}
17365+
if 'minimum' in _dict:
17366+
args['minimum'] = _dict.get('minimum')
17367+
else:
17368+
raise ValueError('Required property \'minimum\' not present in UpdatesPending JSON')
17369+
if 'preferred' in _dict:
17370+
args['preferred'] = _dict.get('preferred')
17371+
else:
17372+
raise ValueError('Required property \'preferred\' not present in UpdatesPending JSON')
17373+
if 'total' in _dict:
17374+
args['total'] = _dict.get('total')
17375+
else:
17376+
raise ValueError('Required property \'total\' not present in UpdatesPending JSON')
17377+
return cls(**args)
17378+
17379+
@classmethod
17380+
def _from_dict(cls, _dict):
17381+
"""Initialize a UpdatesPending object from a json dictionary."""
17382+
return cls.from_dict(_dict)
17383+
17384+
def to_dict(self) -> Dict:
17385+
"""Return a json dictionary representing this model."""
17386+
_dict = {}
17387+
if hasattr(self, 'minimum') and self.minimum is not None:
17388+
_dict['minimum'] = self.minimum
17389+
if hasattr(self, 'preferred') and self.preferred is not None:
17390+
_dict['preferred'] = self.preferred
17391+
if hasattr(self, 'total') and self.total is not None:
17392+
_dict['total'] = self.total
17393+
return _dict
17394+
17395+
def _to_dict(self):
17396+
"""Return a json dictionary representing this model."""
17397+
return self.to_dict()
17398+
17399+
def __str__(self) -> str:
17400+
"""Return a `str` version of this UpdatesPending object."""
17401+
return json.dumps(self.to_dict(), indent=2)
17402+
17403+
def __eq__(self, other: 'UpdatesPending') -> bool:
17404+
"""Return `true` when self and other are equal, false otherwise."""
17405+
if not isinstance(other, self.__class__):
17406+
return False
17407+
return self.__dict__ == other.__dict__
17408+
17409+
def __ne__(self, other: 'UpdatesPending') -> bool:
17410+
"""Return `true` when self and other are not equal, false otherwise."""
17411+
return not self == other
17412+
17413+
1731517414
class UserContext:
1731617415
"""
1731717416
Schema for the user context of a session.

test/unit/test_cloudant_v1.py

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5182,7 +5182,7 @@ def test_get_design_document_information_all_params(self):
51825182
"""
51835183
# Set up mock
51845184
url = preprocess_url('/testString/_design/testString/_info')
5185-
mock_response = '{"name": "name", "view_index": {"collator_versions": ["collator_versions"], "compact_running": false, "language": "language", "signature": "signature", "sizes": {"active": 6, "external": 8, "file": 4}, "updater_running": false, "waiting_clients": 0, "waiting_commit": true}}'
5185+
mock_response = '{"name": "name", "view_index": {"collator_versions": ["collator_versions"], "compact_running": false, "language": "language", "signature": "signature", "sizes": {"active": 6, "external": 8, "file": 4}, "updater_running": false, "updates_pending": {"minimum": 7, "preferred": 9, "total": 5}, "waiting_clients": 0, "waiting_commit": true}}'
51865186
responses.add(
51875187
responses.GET,
51885188
url,
@@ -5222,7 +5222,7 @@ def test_get_design_document_information_value_error(self):
52225222
"""
52235223
# Set up mock
52245224
url = preprocess_url('/testString/_design/testString/_info')
5225-
mock_response = '{"name": "name", "view_index": {"collator_versions": ["collator_versions"], "compact_running": false, "language": "language", "signature": "signature", "sizes": {"active": 6, "external": 8, "file": 4}, "updater_running": false, "waiting_clients": 0, "waiting_commit": true}}'
5225+
mock_response = '{"name": "name", "view_index": {"collator_versions": ["collator_versions"], "compact_running": false, "language": "language", "signature": "signature", "sizes": {"active": 6, "external": 8, "file": 4}, "updater_running": false, "updates_pending": {"minimum": 7, "preferred": 9, "total": 5}, "waiting_clients": 0, "waiting_commit": true}}'
52265226
responses.add(
52275227
responses.GET,
52285228
url,
@@ -14482,13 +14482,19 @@ def test_design_document_information_serialization(self):
1448214482
content_information_sizes_model['external'] = 26
1448314483
content_information_sizes_model['file'] = 26
1448414484

14485+
updates_pending_model = {} # UpdatesPending
14486+
updates_pending_model['minimum'] = 26
14487+
updates_pending_model['preferred'] = 26
14488+
updates_pending_model['total'] = 26
14489+
1448514490
design_document_view_index_model = {} # DesignDocumentViewIndex
1448614491
design_document_view_index_model['collator_versions'] = ['testString']
1448714492
design_document_view_index_model['compact_running'] = True
1448814493
design_document_view_index_model['language'] = 'testString'
1448914494
design_document_view_index_model['signature'] = 'testString'
1449014495
design_document_view_index_model['sizes'] = content_information_sizes_model
1449114496
design_document_view_index_model['updater_running'] = True
14497+
design_document_view_index_model['updates_pending'] = updates_pending_model
1449214498
design_document_view_index_model['waiting_clients'] = 0
1449314499
design_document_view_index_model['waiting_commit'] = True
1449414500

@@ -14560,6 +14566,11 @@ def test_design_document_view_index_serialization(self):
1456014566
content_information_sizes_model['external'] = 26
1456114567
content_information_sizes_model['file'] = 26
1456214568

14569+
updates_pending_model = {} # UpdatesPending
14570+
updates_pending_model['minimum'] = 26
14571+
updates_pending_model['preferred'] = 26
14572+
updates_pending_model['total'] = 26
14573+
1456314574
# Construct a json representation of a DesignDocumentViewIndex model
1456414575
design_document_view_index_model_json = {}
1456514576
design_document_view_index_model_json['collator_versions'] = ['testString']
@@ -14568,6 +14579,7 @@ def test_design_document_view_index_serialization(self):
1456814579
design_document_view_index_model_json['signature'] = 'testString'
1456914580
design_document_view_index_model_json['sizes'] = content_information_sizes_model
1457014581
design_document_view_index_model_json['updater_running'] = True
14582+
design_document_view_index_model_json['updates_pending'] = updates_pending_model
1457114583
design_document_view_index_model_json['waiting_clients'] = 0
1457214584
design_document_view_index_model_json['waiting_commit'] = True
1457314585

@@ -16934,6 +16946,38 @@ def test_up_information_serialization(self):
1693416946
assert up_information_model_json2 == up_information_model_json
1693516947

1693616948

16949+
class TestModel_UpdatesPending:
16950+
"""
16951+
Test Class for UpdatesPending
16952+
"""
16953+
16954+
def test_updates_pending_serialization(self):
16955+
"""
16956+
Test serialization/deserialization for UpdatesPending
16957+
"""
16958+
16959+
# Construct a json representation of a UpdatesPending model
16960+
updates_pending_model_json = {}
16961+
updates_pending_model_json['minimum'] = 26
16962+
updates_pending_model_json['preferred'] = 26
16963+
updates_pending_model_json['total'] = 26
16964+
16965+
# Construct a model instance of UpdatesPending by calling from_dict on the json representation
16966+
updates_pending_model = UpdatesPending.from_dict(updates_pending_model_json)
16967+
assert updates_pending_model != False
16968+
16969+
# Construct a model instance of UpdatesPending by calling from_dict on the json representation
16970+
updates_pending_model_dict = UpdatesPending.from_dict(updates_pending_model_json).__dict__
16971+
updates_pending_model2 = UpdatesPending(**updates_pending_model_dict)
16972+
16973+
# Verify the model instances are equivalent
16974+
assert updates_pending_model == updates_pending_model2
16975+
16976+
# Convert model instance back to dict and verify no loss of data
16977+
updates_pending_model_json2 = updates_pending_model.to_dict()
16978+
assert updates_pending_model_json2 == updates_pending_model_json
16979+
16980+
1693716981
class TestModel_UserContext:
1693816982
"""
1693916983
Test Class for UserContext

0 commit comments

Comments
 (0)