示例#1
0
 def retrieve(cls, id):
     path = 'commands/' + id
     response = get(path)
     if WiaResource.is_success(response):
         return cls(**response.json())
     else:
         return WiaResource.error_response(response)
示例#2
0
 def retrieve(cls, id):
     path = 'devices/' + id
     response = get(path)
     if WiaResource.is_success(response):
         return cls(**WiaResource.json_converter(response))
     else:
         return WiaResource.error_response(response)
示例#3
0
 def list(cls, **kwargs):
     response = get('spaces', **kwargs)
     if WiaResource.is_success(response):
         responseJson = response.json()
         spaces = []
         for space in responseJson['spaces']:
             spaces.append(cls(**space))
         return {'spaces': spaces, 'count': responseJson['count']}
     else:
         return WiaResource.error_response(response)
示例#4
0
 def list(cls, **kwargs):
     response = get('commands', **kwargs)
     if WiaResource.is_success(response):
         responseJson = response.json()
         commands = []
         for command in responseJson['commands']:
             commands.append(cls(**command))
         return {'commands': commands, 'count': responseJson['count']}
     else:
         return WiaResource.error_response(response)
示例#5
0
 def list(cls, **kwargs):
     response = get('locations', **kwargs)
     if WiaResource.is_success(response):
         responseJson = response.json()
         locations = []
         for location in responseJson['locations']:
             locations.append(cls(**location))
         return {'locations': locations, 'count': responseJson['count']}
     else:
         return WiaResource.error_response(response)
示例#6
0
 def list(cls, **kwargs):
     response = get('events', **kwargs)
     if WiaResource.is_success(response):
         responseJson = response.json()
         events = []
         for event in responseJson['events']:
             events.append(cls(**event))
         return {'events': events, 'count': responseJson['count']}
     else:
         return WiaResource.error_response(response)
示例#7
0
 def retrieve(cls, id):
     """
     Retrieves a Space by ID
     :param id: ID of the space
     :return: Instance of the Space object
     """
     path = 'spaces/' + id
     response = get(path)
     if WiaResource.is_success(response):
         return cls(**response.json())
     else:
         return WiaResource.error_response(response)
示例#8
0
 def retrieve(cls):
     response = get('whoami')
     if WiaResource.is_success(response):
         return cls(**response.json())
     else:
         return WiaResource.error_response(response)