from .rest import RestClient


class Client(object):

    """Docstring for Client. """

    def __init__(self, domain, jwt_token):
        self.domain = domain
        self.client = RestClient(jwt=jwt_token)

    def _url(self, id=None):
        url = 'https://%s/api/v2/clients' % self.domain
        if id is not None:
            return url + '/' + id
        return url

    def all(self, fields=[], include_fields=True):
        """Retrieves a list of all client applications.

        Important: The client_secret and encryption_key attributes can only be
        retrieved with the read:client_keys scope.

        Args:
           fields (list of str, optional): A list of fields to include or
              exclude from the result (depending on include_fields). Empty to
              retrieve all fields.

           include_fields (bool, optional): True if the fields specified are
              to be include in the result, False otherwise.
        """

        params = {'fields': ','.join(fields) or None,
                  'include_fields': str(include_fields).lower()}

        return self.client.get(self._url(), params=params)

    def create(self, body):
        return self.client.post(self._url(), data=body)

    def get(self, id, fields=[], include_fields=True):
        params = {'fields': ','.join(fields) or None,
                  'include_fields': str(include_fields).lower()}

        return self.client.get(self._url(id), params=params)

    def delete(self, id):
        return self.client.delete(self._url(id))

    def update(self, id, body):
        return self.client.patch(self._url(id), data=body)

@@ -58,29 +58,315 @@
  %22%22%22
-Docstring for Client.
+Auth0 client endpoints%0A%0A    Args:%0A        domain (str): Your Auth0 domain, e.g: 'username.auth0.com'%0A%0A        jwt_token (str): An API token created with your account's global%0A            keys. You can create one by using the token generator in the%0A            API Explorer: https://auth0.com/docs/api/v2%0A   
  %22%22%22

Add class docstring to Client