# Path: pydomo/DomoAPIClient.py
# class DomoAPIClient(object):
#     """DomoAPIClient
#     Each API client class inherits from this superclass
#     """
# 
#     def __init__(self, transport, logger):
#         self.transport = transport
#         self.logger = logger
# 
#     def _create(self, url, request, params, obj_desc):
#         response = self.transport.post(url=url, params=params, body=request)
#         if response.status_code in (requests.codes.CREATED, requests.codes.OK):
#             obj = response.json()
#             self.print_json("Created", obj)
#             return obj
#         else:
#             self.logger.debug("Error creating " + obj_desc + ": "
#                               + self.transport.dump_response(response))
#             raise Exception("Error creating " + obj_desc + ": " + response.text)
# 
#     def _get(self, url, obj_desc):
#         response = self.transport.get(url=url, params={})
#         if response.status_code == requests.codes.OK:
#             return response.json()
#         else:
#             self.logger.debug("Error retrieving " + obj_desc + ": "
#                               + self.transport.dump_response(response))
#             raise Exception("Error retrieving " + obj_desc + ": "
#                             + response.text)
# 
#     def _update(self, url, method, success_code, obj_update, obj_desc):
#         if method == HTTPMethod.PUT:
#             response = self.transport.put(url, obj_update)
#         elif method == HTTPMethod.PATCH:
#             response = self.transport.patch(url, obj_update)
#         if response.status_code == success_code:
#             if str(response.text) == '':
#                 return
#             else:
#                 obj = response.json()
#                 self.print_json("Updated", obj)
#                 return obj
#         else:
#             self.logger.debug("Error updating " + obj_desc + ": "
#                               + self.transport.dump_response(response))
#             raise Exception("Error updating " + obj_desc + ": "
#                             + response.text)
# 
#     def _list(self, url, params, obj_desc):
#         response = self.transport.get(url=url, params=params)
#         if response.status_code == requests.codes.OK:
#             return response.json()
#         else:
#             self.logger.debug(obj_desc + " Error: "
#                               + self.transport.dump_response(response))
#             raise Exception(obj_desc + " Error: " + response.text)
# 
#     def _delete(self, url, obj_desc):
#         response = self.transport.delete(url=url)
#         if response.status_code == requests.codes.NO_CONTENT:
#             return
#         else:
#             self.logger.debug("Error deleting " + obj_desc + ": "
#                               + self.transport.dump_response(response))
#             raise Exception("Error deleting " + obj_desc + ": "
#                             + response.text)
# 
#     def _upload_csv(self, url, success_code, csv, obj_desc):
#         response = self.transport.put_csv(url=url, body=csv)
#         if response.status_code == success_code:
#             if str(response.text) == '':
#                 return
#             else:
#                 return response.json()
#         else:
#             self.logger.debug("Error uploading " + obj_desc + ": " + self.transport.dump_response(response))
#             raise Exception("Error uploading " + obj_desc + ": "
#                             + response.text)
# 
#     def _upload_gzip(self, url, success_code, csv, obj_desc):
#         response = self.transport.put_gzip(url=url, body=csv)
#         if response.status_code == success_code:
#             if str(response.text) == '':
#                 return
#             else:
#                 return response.json()
#         else:
#             self.logger.debug("Error uploading " + obj_desc + ": " + self.transport.dump_response(response))
#             raise Exception("Error uploading " + obj_desc + ": "
#                             + response.text)
# 
#     def _download_csv(self, url, include_csv_header):
#         params = {
#             'includeHeader': str(include_csv_header)
#         }
#         return self.transport.get_csv(url=url, params=params)
# 
#     def _validate_params(self, params, accepted_keys):
#         bad_keys = list(set(params.keys()).difference(accepted_keys))
#         if bad_keys:
#            raise TypeError('Unexpected keyword arguments: {}'.format(bad_keys))
# 
#     def _base(self, obj_id):
#         return self.urlBase + str(obj_id)
# 
#     def print_json(self, message, json_obj):
#         self.logger.info(message + ": " + json.dumps(json_obj, indent=4))
# 
# Path: pydomo/Transport.py
# class HTTPMethod:
#     GET = 'GET'
#     POST = 'POST'
#     PUT = 'PUT'
#     PATCH = 'PATCH'
#     DELETE = 'DELETE'


import requests
from pydomo.DomoAPIClient import DomoAPIClient
from pydomo.Transport import HTTPMethod
        >>> domo.pages.update_collection(page_id, **collections[0])

        :Parameters:
          - `page_id`: ID of the page the collection is on
          - `collection_id`: ID of the collection. Can also be provided
            by supplying `id` to **kwargs. This allows for calling
            get_collections, updating one of the returned collections,
            then passing it to update_collection.
          - `title`: (optional) update the title
          - `description`: (optional) update the description
          - `cardIds`: (optional) update cards in the collection

        :Returns:
          - A dict representing the collection
        """

        self._validate_params(kwargs, COLLECTION_UPDATE_KWARGS)
        if collection_id is None and 'id' not in kwargs:
            raise TypeError("update() missing required argument: "
                            "'collection_id'")
        elif 'id' in kwargs:
            if collection_id is not None and collection_id != kwargs['id']:
                raise ValueError('ambiguous collection ID - collection_id and'
                                 ' id both supplied but do not match')
            collection_id = kwargs['id']
            del kwargs['id']

        url = '{base}/{page_id}/collections/{collection_id}'.format(
                base=URL_BASE, page_id=page_id, collection_id=collection_id)
        return self._update(url,

# Path: pydomo/DomoAPIClient.py
# class DomoAPIClient(object):
#     """DomoAPIClient
#     Each API client class inherits from this superclass
#     """
# 
#     def __init__(self, transport, logger):
#         self.transport = transport
#         self.logger = logger
# 
#     def _create(self, url, request, params, obj_desc):
#         response = self.transport.post(url=url, params=params, body=request)
#         if response.status_code in (requests.codes.CREATED, requests.codes.OK):
#             obj = response.json()
#             self.print_json("Created", obj)
#             return obj
#         else:
#             self.logger.debug("Error creating " + obj_desc + ": "
#                               + self.transport.dump_response(response))
#             raise Exception("Error creating " + obj_desc + ": " + response.text)
# 
#     def _get(self, url, obj_desc):
#         response = self.transport.get(url=url, params={})
#         if response.status_code == requests.codes.OK:
#             return response.json()
#         else:
#             self.logger.debug("Error retrieving " + obj_desc + ": "
#                               + self.transport.dump_response(response))
#             raise Exception("Error retrieving " + obj_desc + ": "
#                             + response.text)
# 
#     def _update(self, url, method, success_code, obj_update, obj_desc):
#         if method == HTTPMethod.PUT:
#             response = self.transport.put(url, obj_update)
#         elif method == HTTPMethod.PATCH:
#             response = self.transport.patch(url, obj_update)
#         if response.status_code == success_code:
#             if str(response.text) == '':
#                 return
#             else:
#                 obj = response.json()
#                 self.print_json("Updated", obj)
#                 return obj
#         else:
#             self.logger.debug("Error updating " + obj_desc + ": "
#                               + self.transport.dump_response(response))
#             raise Exception("Error updating " + obj_desc + ": "
#                             + response.text)
# 
#     def _list(self, url, params, obj_desc):
#         response = self.transport.get(url=url, params=params)
#         if response.status_code == requests.codes.OK:
#             return response.json()
#         else:
#             self.logger.debug(obj_desc + " Error: "
#                               + self.transport.dump_response(response))
#             raise Exception(obj_desc + " Error: " + response.text)
# 
#     def _delete(self, url, obj_desc):
#         response = self.transport.delete(url=url)
#         if response.status_code == requests.codes.NO_CONTENT:
#             return
#         else:
#             self.logger.debug("Error deleting " + obj_desc + ": "
#                               + self.transport.dump_response(response))
#             raise Exception("Error deleting " + obj_desc + ": "
#                             + response.text)
# 
#     def _upload_csv(self, url, success_code, csv, obj_desc):
#         response = self.transport.put_csv(url=url, body=csv)
#         if response.status_code == success_code:
#             if str(response.text) == '':
#                 return
#             else:
#                 return response.json()
#         else:
#             self.logger.debug("Error uploading " + obj_desc + ": " + self.transport.dump_response(response))
#             raise Exception("Error uploading " + obj_desc + ": "
#                             + response.text)
# 
#     def _upload_gzip(self, url, success_code, csv, obj_desc):
#         response = self.transport.put_gzip(url=url, body=csv)
#         if response.status_code == success_code:
#             if str(response.text) == '':
#                 return
#             else:
#                 return response.json()
#         else:
#             self.logger.debug("Error uploading " + obj_desc + ": " + self.transport.dump_response(response))
#             raise Exception("Error uploading " + obj_desc + ": "
#                             + response.text)
# 
#     def _download_csv(self, url, include_csv_header):
#         params = {
#             'includeHeader': str(include_csv_header)
#         }
#         return self.transport.get_csv(url=url, params=params)
# 
#     def _validate_params(self, params, accepted_keys):
#         bad_keys = list(set(params.keys()).difference(accepted_keys))
#         if bad_keys:
#            raise TypeError('Unexpected keyword arguments: {}'.format(bad_keys))
# 
#     def _base(self, obj_id):
#         return self.urlBase + str(obj_id)
# 
#     def print_json(self, message, json_obj):
#         self.logger.info(message + ": " + json.dumps(json_obj, indent=4))
# 
# Path: pydomo/Transport.py
# class HTTPMethod:
#     GET = 'GET'
#     POST = 'POST'
#     PUT = 'PUT'
#     PATCH = 'PATCH'
#     DELETE = 'DELETE'


# Path: pydomo/pages/PageClient.py
import requests
from pydomo.DomoAPIClient import DomoAPIClient
from pydomo.Transport import HTTPMethod

        >>> domo.pages.update_collection(page_id, **collections[0])

        :Parameters:
          - `page_id`: ID of the page the collection is on
          - `collection_id`: ID of the collection. Can also be provided
            by supplying `id` to **kwargs. This allows for calling
            get_collections, updating one of the returned collections,
            then passing it to update_collection.
          - `title`: (optional) update the title
          - `description`: (optional) update the description
          - `cardIds`: (optional) update cards in the collection

        :Returns:
          - A dict representing the collection
        """

        self._validate_params(kwargs, COLLECTION_UPDATE_KWARGS)
        if collection_id is None and 'id' not in kwargs:
            raise TypeError("update() missing required argument: "
                            "'collection_id'")
        elif 'id' in kwargs:
            if collection_id is not None and collection_id != kwargs['id']:
                raise ValueError('ambiguous collection ID - collection_id and'
                                 ' id both supplied but do not match')
            collection_id = kwargs['id']
            del kwargs['id']

        url = '{base}/{page_id}/collections/{collection_id}'.format(
                base=URL_BASE, page_id=page_id, collection_id=collection_id)
        return self._update(url,

                            HTTPMethod.PUT,