Skip to content

Commit 449c8f9

Browse files
Merge pull request #17 from lmsohamdeshmukh/v2_dev
Appended 'errors' in the SDK Response
2 parents e17e3b6 + cdddc5b commit 449c8f9

File tree

3 files changed

+59
-7
lines changed

3 files changed

+59
-7
lines changed

logicmonitor_data_sdk/api_client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,10 @@ def __call_api(
190190
if _return_http_data_only:
191191
return (return_data)
192192
else:
193-
return (return_data, response_data.status,
194-
response_data.getheaders())
193+
return_data.errors = json.loads(response_data.data)['errors']
194+
if len(json.loads(response_data.data)['errors'])>0:
195+
return_data.resource_ids = json.loads(response_data.data)['errors'][0]['resourceIds']
196+
return return_data
195197

196198
def sanitize_for_serialization(self, obj):
197199
if obj is None:

logicmonitor_data_sdk/models/push_metric_api_response.py

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,32 +42,62 @@ class PushMetricAPIResponse(object):
4242
and the value is json key in definition.
4343
"""
4444
swagger_types = {
45+
'code': 'int',
4546
'message': 'str',
4647
'resource_ids': 'MapStringString',
47-
'timestamp': 'int'
48+
'timestamp': 'int',
49+
'errors': 'MapStringString'
4850
}
4951

5052
attribute_map = {
53+
'code': 'code',
5154
'message': 'message',
5255
'resource_ids': 'resourceIds',
53-
'timestamp': 'timestamp'
56+
'timestamp': 'timestamp',
57+
'errors': 'error'
5458
}
5559

56-
def __init__(self, message=None, resource_ids=None,
57-
timestamp=None): # noqa: E501
60+
def __init__(self, code=None, message=None, resource_ids=None,
61+
timestamp=None, errors=None): # noqa: E501
5862
"""PushMetricAPIResponse - a model defined in Swagger""" # noqa: E501
5963

6064
self._message = None
65+
self._code = None
6166
self._resource_ids = None
6267
self._timestamp = None
68+
self._errors = None
6369
self.discriminator = None
6470

71+
if code is not None:
72+
self.code = code
6573
if message is not None:
6674
self.message = message
6775
if resource_ids is not None:
6876
self.resource_ids = resource_ids
6977
if timestamp is not None:
7078
self.timestamp = timestamp
79+
if errors is not None:
80+
self.errors = errors
81+
82+
@property
83+
def code(self):
84+
"""Gets the status code of this PushMetricAPIResponse. # noqa: E501
85+
86+
87+
:return: The status code of this PushMetricAPIResponse. # noqa: E501
88+
:rtype: list
89+
"""
90+
return self._code
91+
92+
@code.setter
93+
def code(self, code):
94+
"""Sets the status code of this PushMetricAPIResponse. # noqa: E501
95+
96+
97+
:return: The status code of this PushMetricAPIResponse. # noqa: E501
98+
:rtype: list
99+
"""
100+
self._code = code
71101

72102
@property
73103
def message(self):
@@ -132,6 +162,26 @@ def timestamp(self, timestamp):
132162

133163
self._timestamp = timestamp
134164

165+
@property
166+
def errors(self):
167+
"""Gets the errors of this PushMetricAPIResponse. # noqa: E501
168+
169+
170+
:return: The errors of this PushMetricAPIResponse. # noqa: E501
171+
:rtype: list
172+
"""
173+
return self._errors
174+
175+
@errors.setter
176+
def errors(self, errors):
177+
"""Sets the errors of this PushMetricAPIResponse. # noqa: E501
178+
179+
180+
:return: The errors of this PushMetricAPIResponse. # noqa: E501
181+
:rtype: list
182+
"""
183+
self._errors = errors
184+
135185
def to_dict(self):
136186
"""Returns the model properties as a dict"""
137187
result = {}

logicmonitor_data_sdk/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
=======
99
"""
1010

11-
__version__ = "0.0.5.beta1"
11+
__version__ = "0.0.7.beta1"

0 commit comments

Comments
 (0)