Skip to content

Commit 9853618

Browse files
authored
Merge pull request #5 from Shawnshank/master
Community Edition More Thingsboard 3.1 REST API Compatible (limit/page_size/page)
2 parents 64907bd + 29ab141 commit 9853618

12 files changed

+592
-436
lines changed

tb_rest_client/api/api_ce/alarm_controller_api.py

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -499,20 +499,24 @@ def get_alarm_info_by_id_using_get_with_http_info(self, alarm_id, **kwargs): #
499499
_request_timeout=params.get('_request_timeout'),
500500
collection_formats=collection_formats)
501501

502-
def get_alarms_using_get(self, entity_type, entity_id, limit, **kwargs): # noqa: E501
502+
def get_alarms_using_get(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501
503503
"""getAlarms # noqa: E501
504504
505505
This method makes a synchronous HTTP request by default. To make an
506506
asynchronous HTTP request, please pass async_req=True
507-
>>> thread = api_pe.get_alarms_using_get(entity_type, entity_id, limit, async_req=True)
507+
>>> thread = api_pe.get_alarms_using_get(entity_type, entity_id, page_size, page, async_req=True)
508508
>>> result = thread.get()
509509
510510
:param async_req bool
511511
:param str entity_type: entityType (required)
512512
:param str entity_id: entityId (required)
513-
:param int limit: limit (required)
514513
:param str search_status: searchStatus
515514
:param str status: status
515+
:param str page_size: pageSize (required)
516+
:param str page: page (required)
517+
:param str text_search: textSearch
518+
:param str sort_property: sortProperty
519+
:param str sort_order: sortOrder
516520
:param int start_time: startTime
517521
:param int end_time: endTime
518522
:param bool asc_order: ascOrder
@@ -524,25 +528,29 @@ def get_alarms_using_get(self, entity_type, entity_id, limit, **kwargs): # noqa
524528
"""
525529
kwargs['_return_http_data_only'] = True
526530
if kwargs.get('async_req'):
527-
return self.get_alarms_using_get_with_http_info(entity_type, entity_id, limit, **kwargs) # noqa: E501
531+
return self.get_alarms_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501
528532
else:
529-
(data) = self.get_alarms_using_get_with_http_info(entity_type, entity_id, limit, **kwargs) # noqa: E501
533+
(data) = self.get_alarms_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501
530534
return data
531535

532-
def get_alarms_using_get_with_http_info(self, entity_type, entity_id, limit, **kwargs): # noqa: E501
536+
def get_alarms_using_get_with_http_info(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501
533537
"""getAlarms # noqa: E501
534538
535539
This method makes a synchronous HTTP request by default. To make an
536540
asynchronous HTTP request, please pass async_req=True
537-
>>> thread = api_pe.get_alarms_using_get_with_http_info(entity_type, entity_id, limit, async_req=True)
541+
>>> thread = api_pe.get_alarms_using_get_with_http_info(entity_type, entity_id, page_size, page, async_req=True)
538542
>>> result = thread.get()
539543
540544
:param async_req bool
541545
:param str entity_type: entityType (required)
542546
:param str entity_id: entityId (required)
543-
:param int limit: limit (required)
544547
:param str search_status: searchStatus
545548
:param str status: status
549+
:param str page_size: pageSize (required)
550+
:param str page: page (required)
551+
:param str text_search: textSearch
552+
:param str sort_property: sortProperty
553+
:param str sort_order: sortOrder
546554
:param int start_time: startTime
547555
:param int end_time: endTime
548556
:param bool asc_order: ascOrder
@@ -553,7 +561,7 @@ def get_alarms_using_get_with_http_info(self, entity_type, entity_id, limit, **k
553561
returns the request thread.
554562
"""
555563

556-
all_params = ['entity_type', 'entity_id', 'limit', 'search_status', 'status', 'start_time', 'end_time', 'asc_order', 'offset', 'fetch_originator'] # noqa: E501
564+
all_params = ['entity_type', 'entity_id', 'search_status', 'status', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'asc_order', 'offset', 'fetch_originator'] # noqa: E501
557565
all_params.append('async_req')
558566
all_params.append('_return_http_data_only')
559567
all_params.append('_preload_content')
@@ -572,10 +580,14 @@ def get_alarms_using_get_with_http_info(self, entity_type, entity_id, limit, **k
572580
if ('entity_id' not in params or
573581
params['entity_id'] is None):
574582
raise ValueError("Missing the required parameter `entity_id` when calling `get_alarms_using_get`") # noqa: E501
575-
# verify the required parameter 'limit' is set
576-
if ('limit' not in params or
577-
params['limit'] is None):
578-
raise ValueError("Missing the required parameter `limit` when calling `get_alarms_using_get`") # noqa: E501
583+
# verify the required parameter 'page_size' is set
584+
if ('page_size' not in params or
585+
params['page_size'] is None):
586+
raise ValueError("Missing the required parameter `page_size` when calling `get_alarms_using_get`") # noqa: E501
587+
# verify the required parameter 'page' is set
588+
if ('page' not in params or
589+
params['page'] is None):
590+
raise ValueError("Missing the required parameter `page` when calling `get_alarms_using_get`") # noqa: E501
579591

580592
collection_formats = {}
581593

@@ -590,8 +602,16 @@ def get_alarms_using_get_with_http_info(self, entity_type, entity_id, limit, **k
590602
query_params.append(('searchStatus', params['search_status'])) # noqa: E501
591603
if 'status' in params:
592604
query_params.append(('status', params['status'])) # noqa: E501
593-
if 'limit' in params:
594-
query_params.append(('limit', params['limit'])) # noqa: E501
605+
if 'page_size' in params:
606+
query_params.append(('pageSize', params['page_size'])) # noqa: E501
607+
if 'page' in params:
608+
query_params.append(('page', params['page'])) # noqa: E501
609+
if 'text_search' in params:
610+
query_params.append(('textSearch', params['text_search'])) # noqa: E501
611+
if 'sort_property' in params:
612+
query_params.append(('sortProperty', params['sort_property'])) # noqa: E501
613+
if 'sort_order' in params:
614+
query_params.append(('sortOrder', params['sort_order'])) # noqa: E501
595615
if 'start_time' in params:
596616
query_params.append(('startTime', params['start_time'])) # noqa: E501
597617
if 'end_time' in params:
@@ -621,7 +641,7 @@ def get_alarms_using_get_with_http_info(self, entity_type, entity_id, limit, **k
621641
auth_settings = ['X-Authorization'] # noqa: E501
622642

623643
return self.api_client.call_api(
624-
'/api/alarm/{entityType}/{entityId}{?searchStatus,status,limit,startTime,endTime,ascOrder,offset,fetchOriginator}', 'GET',
644+
'/api/alarm/{entityType}/{entityId}{?searchStatus,status,pageSize,page,textSearch,sortProperty,sortOrder,startTime,endTime,offset,fetchOriginator}', 'GET',
625645
path_params,
626646
query_params,
627647
header_params,

tb_rest_client/api/api_ce/asset_controller_api.py

Lines changed: 64 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -685,53 +685,55 @@ def get_assets_by_ids_using_get_with_http_info(self, asset_ids, **kwargs): # no
685685
_request_timeout=params.get('_request_timeout'),
686686
collection_formats=collection_formats)
687687

688-
def get_customer_assets_using_get(self, customer_id, limit, **kwargs): # noqa: E501
688+
def get_customer_assets_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501
689689
"""getCustomerAssets # noqa: E501
690690
691691
This method makes a synchronous HTTP request by default. To make an
692692
asynchronous HTTP request, please pass async_req=True
693-
>>> thread = api_pe.get_customer_assets_using_get(customer_id, limit, async_req=True)
693+
>>> thread = api_pe.get_customer_assets_using_get(customer_id, page_size, page, async_req=True)
694694
>>> result = thread.get()
695695
696696
:param async_req bool
697697
:param str customer_id: customerId (required)
698-
:param str limit: limit (required)
699698
:param str type: type
700699
:param str text_search: textSearch
701-
:param str id_offset: idOffset
702-
:param str text_offset: textOffset
700+
:param str sort_property: sortProperty
701+
:param str sort_order: sortOrder
702+
:param str page_size: pageSize (required)
703+
:param str page: page (required)
703704
:return: TextPageDataAsset
704705
If the method is called asynchronously,
705706
returns the request thread.
706707
"""
707708
kwargs['_return_http_data_only'] = True
708709
if kwargs.get('async_req'):
709-
return self.get_customer_assets_using_get_with_http_info(customer_id, limit, **kwargs) # noqa: E501
710+
return self.get_customer_assets_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501
710711
else:
711-
(data) = self.get_customer_assets_using_get_with_http_info(customer_id, limit, **kwargs) # noqa: E501
712+
(data) = self.get_customer_assets_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501
712713
return data
713714

714-
def get_customer_assets_using_get_with_http_info(self, customer_id, limit, **kwargs): # noqa: E501
715+
def get_customer_assets_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501
715716
"""getCustomerAssets # noqa: E501
716717
717718
This method makes a synchronous HTTP request by default. To make an
718719
asynchronous HTTP request, please pass async_req=True
719-
>>> thread = api_pe.get_customer_assets_using_get_with_http_info(customer_id, limit, async_req=True)
720+
>>> thread = api_pe.get_customer_assets_using_get_with_http_info(customer_id, page_size, page, async_req=True)
720721
>>> result = thread.get()
721722
722723
:param async_req bool
723724
:param str customer_id: customerId (required)
724-
:param str limit: limit (required)
725725
:param str type: type
726726
:param str text_search: textSearch
727-
:param str id_offset: idOffset
728-
:param str text_offset: textOffset
727+
:param str sort_property: sortProperty
728+
:param str sort_order: sortOrder
729+
:param str page_size: pageSize (required)
730+
:param str page: page (required)
729731
:return: TextPageDataAsset
730732
If the method is called asynchronously,
731733
returns the request thread.
732734
"""
733735

734-
all_params = ['customer_id', 'limit', 'type', 'text_search', 'id_offset', 'text_offset'] # noqa: E501
736+
all_params = ['customer_id', 'type', 'text_search', 'sort_property', 'sort_order', 'page_size', 'page'] # noqa: E501
735737
all_params.append('async_req')
736738
all_params.append('_return_http_data_only')
737739
all_params.append('_preload_content')
@@ -746,10 +748,14 @@ def get_customer_assets_using_get_with_http_info(self, customer_id, limit, **kwa
746748
if ('customer_id' not in params or
747749
params['customer_id'] is None):
748750
raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_assets_using_get`") # noqa: E501
749-
# verify the required parameter 'limit' is set
750-
if ('limit' not in params or
751-
params['limit'] is None):
752-
raise ValueError("Missing the required parameter `limit` when calling `get_customer_assets_using_get`") # noqa: E501
751+
# verify the required parameter 'page_size' is set
752+
if ('page_size' not in params or
753+
params['page_size'] is None):
754+
raise ValueError("Missing the required parameter `page_size` when calling `get_customer_assets_using_get`") # noqa: E501
755+
# verify the required parameter 'page' is set
756+
if ('page' not in params or
757+
params['page'] is None):
758+
raise ValueError("Missing the required parameter `page` when calling `get_customer_assets_using_get`") # noqa: E501
753759

754760
collection_formats = {}
755761

@@ -762,12 +768,14 @@ def get_customer_assets_using_get_with_http_info(self, customer_id, limit, **kwa
762768
query_params.append(('type', params['type'])) # noqa: E501
763769
if 'text_search' in params:
764770
query_params.append(('textSearch', params['text_search'])) # noqa: E501
765-
if 'id_offset' in params:
766-
query_params.append(('idOffset', params['id_offset'])) # noqa: E501
767-
if 'text_offset' in params:
768-
query_params.append(('textOffset', params['text_offset'])) # noqa: E501
769-
if 'limit' in params:
770-
query_params.append(('limit', params['limit'])) # noqa: E501
771+
if 'sort_property' in params:
772+
query_params.append(('sortProperty', params['sort_property'])) # noqa: E501
773+
if 'sort_order' in params:
774+
query_params.append(('sortOrder', params['sort_order'])) # noqa: E501
775+
if 'page_size' in params:
776+
query_params.append(('pageSize', params['page_size'])) # noqa: E501
777+
if 'page' in params:
778+
query_params.append(('page', params['page'])) # noqa: E501
771779

772780
header_params = {}
773781

@@ -787,7 +795,7 @@ def get_customer_assets_using_get_with_http_info(self, customer_id, limit, **kwa
787795
auth_settings = ['X-Authorization'] # noqa: E501
788796

789797
return self.api_client.call_api(
790-
'/api/customer/{customerId}/assets{?type,textSearch,idOffset,textOffset,limit}', 'GET',
798+
'/api/customer/{customerId}/assets{?type,textSearch,sortProperty,sortOrder,pageSize,page}', 'GET',
791799
path_params,
792800
query_params,
793801
header_params,
@@ -895,51 +903,53 @@ def get_tenant_asset_using_get_with_http_info(self, asset_name, **kwargs): # no
895903
_request_timeout=params.get('_request_timeout'),
896904
collection_formats=collection_formats)
897905

898-
def get_tenant_assets_using_get(self, limit, **kwargs): # noqa: E501
906+
def get_tenant_assets_using_get(self, page_size, page, **kwargs): # noqa: E501
899907
"""getTenantAssets # noqa: E501
900908
901909
This method makes a synchronous HTTP request by default. To make an
902910
asynchronous HTTP request, please pass async_req=True
903-
>>> thread = api_pe.get_tenant_assets_using_get(limit, async_req=True)
911+
>>> thread = api_pe.get_tenant_assets_using_get(page_size, page, async_req=True)
904912
>>> result = thread.get()
905913
906914
:param async_req bool
907-
:param str limit: limit (required)
908915
:param str type: type
909916
:param str text_search: textSearch
910-
:param str id_offset: idOffset
911-
:param str text_offset: textOffset
917+
:param str sort_property: sortProperty
918+
:param str sort_order: sortOrder
919+
:param str page_size: pageSize (required)
920+
:param str page: page (required)
912921
:return: TextPageDataAsset
913922
If the method is called asynchronously,
914923
returns the request thread.
915924
"""
916925
kwargs['_return_http_data_only'] = True
917926
if kwargs.get('async_req'):
918-
return self.get_tenant_assets_using_get_with_http_info(limit, **kwargs) # noqa: E501
927+
return self.get_tenant_assets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501
919928
else:
920-
(data) = self.get_tenant_assets_using_get_with_http_info(limit, **kwargs) # noqa: E501
929+
(data) = self.get_tenant_assets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501
921930
return data
922931

923-
def get_tenant_assets_using_get_with_http_info(self, limit, **kwargs): # noqa: E501
932+
def get_tenant_assets_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501
924933
"""getTenantAssets # noqa: E501
925934
926935
This method makes a synchronous HTTP request by default. To make an
927936
asynchronous HTTP request, please pass async_req=True
928-
>>> thread = api_pe.get_tenant_assets_using_get_with_http_info(limit, async_req=True)
937+
>>> thread = api_pe.get_tenant_assets_using_get_with_http_info(page_size, page, async_req=True)
929938
>>> result = thread.get()
930939
931940
:param async_req bool
932-
:param str limit: limit (required)
933941
:param str type: type
934942
:param str text_search: textSearch
935-
:param str id_offset: idOffset
936-
:param str text_offset: textOffset
943+
:param str sort_property: sortProperty
944+
:param str sort_order: sortOrder
945+
:param str page_size: pageSize (required)
946+
:param str page: page (required)
937947
:return: TextPageDataAsset
938948
If the method is called asynchronously,
939949
returns the request thread.
940950
"""
941951

942-
all_params = ['limit', 'type', 'text_search', 'id_offset', 'text_offset'] # noqa: E501
952+
all_params = ['type', 'text_search', 'sort_property', 'sort_order', 'page_size', 'page'] # noqa: E501
943953
all_params.append('async_req')
944954
all_params.append('_return_http_data_only')
945955
all_params.append('_preload_content')
@@ -950,10 +960,14 @@ def get_tenant_assets_using_get_with_http_info(self, limit, **kwargs): # noqa:
950960

951961
params[key] = val
952962
del params['kwargs']
953-
# verify the required parameter 'limit' is set
954-
if ('limit' not in params or
955-
params['limit'] is None):
956-
raise ValueError("Missing the required parameter `limit` when calling `get_tenant_assets_using_get`") # noqa: E501
963+
# verify the required parameter 'page_size' is set
964+
if ('page_size' not in params or
965+
params['page_size'] is None):
966+
raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_assets_using_get`") # noqa: E501
967+
# verify the required parameter 'page' is set
968+
if ('page' not in params or
969+
params['page'] is None):
970+
raise ValueError("Missing the required parameter `page` when calling `get_tenant_assets_using_get`") # noqa: E501
957971

958972
collection_formats = {}
959973

@@ -964,12 +978,14 @@ def get_tenant_assets_using_get_with_http_info(self, limit, **kwargs): # noqa:
964978
query_params.append(('type', params['type'])) # noqa: E501
965979
if 'text_search' in params:
966980
query_params.append(('textSearch', params['text_search'])) # noqa: E501
967-
if 'id_offset' in params:
968-
query_params.append(('idOffset', params['id_offset'])) # noqa: E501
969-
if 'text_offset' in params:
970-
query_params.append(('textOffset', params['text_offset'])) # noqa: E501
971-
if 'limit' in params:
972-
query_params.append(('limit', params['limit'])) # noqa: E501
981+
if 'sort_property' in params:
982+
query_params.append(('sortProperty', params['sort_property'])) # noqa: E501
983+
if 'sort_order' in params:
984+
query_params.append(('sortOrder', params['sort_order'])) # noqa: E501
985+
if 'page_size' in params:
986+
query_params.append(('pageSize', params['page_size'])) # noqa: E501
987+
if 'page' in params:
988+
query_params.append(('page', params['page'])) # noqa: E501
973989

974990
header_params = {}
975991

@@ -989,7 +1005,7 @@ def get_tenant_assets_using_get_with_http_info(self, limit, **kwargs): # noqa:
9891005
auth_settings = ['X-Authorization'] # noqa: E501
9901006

9911007
return self.api_client.call_api(
992-
'/api/tenant/assets{?type,textSearch,idOffset,textOffset,limit}', 'GET',
1008+
'/api/tenant/assets{?type,textSearch,sortProperty,sortOrder,pageSize,page}', 'GET',
9931009
path_params,
9941010
query_params,
9951011
header_params,

0 commit comments

Comments
 (0)