def create_user(self,
                    auth,
                    login_name,
                    username,
                    email,
                    password,
                    send_notify=False):
        """
        Creates a new user, and returns the created user.

        :param auth.Authentication auth: authentication object, must be admin-level
        :param str login_name: login name for created user
        :param str username: username for created user
        :param str email: email address for created user
        :param str password: password for created user
        :param bool send_notify: whether a notification email should be sent upon creation
        :return: a representation of the created user
        :rtype: GogsUser
        :raises NetworkFailure: if there is an error communicating with the server
        :raises ApiFailure: if the request cannot be serviced
        """
        # Since the source_id parameter was not well-documented at the time this method was
        # written, force the default value
        data = {
            "login_name": login_name,
            "username": username,
            "email": email,
            "password": password,
            "send_notify": send_notify
        }
        response = self.post("/admin/users", auth=auth, data=data)
        return GogsUser.from_json(response.json())
    def authenticated_user(self, auth):
        """
        Returns the user authenticated by ``auth``

        :param auth.Authentication auth: authentication for user to retrieve

        :return: user authenticated by the provided authentication
        :rtype: GogsUser
        :raises NetworkFailure: if there is an error communicating with the server
        :raises ApiFailure: if the request cannot be serviced
        """
        response = self.get("/user", auth=auth)
        return GogsUser.from_json(response.json())
    def get_user(self, auth, username):
        """
        Returns a representing the user with username ``username``.

        :param auth.Authentication auth: authentication object, can be ``None``
        :param str username: username of user to get
        :return: the retrieved user
        :rtype: GogsUser
        :raises NetworkFailure: if there is an error communicating with the server
        :raises ApiFailure: if the request cannot be serviced
        """
        path = "/users/{}".format(username)
        response = self.get(path, auth=auth)
        return GogsUser.from_json(response.json())
    def update_user(self, auth, username, update):
        """
        Updates the user with username ``username`` according to ``update``.

        :param auth.Authentication auth: authentication object, must be admin-level
        :param str username: username of user to update
        :param GogsUserUpdate update: a ``GogsUserUpdate`` object describing the requested update
        :return: the updated user
        :rtype: GogsUser
        :raises NetworkFailure: if there is an error communicating with the server
        :raises ApiFailure: if the request cannot be serviced
        """
        path = "/admin/users/{}".format(username)
        response = self.patch(path, auth=auth, data=update.as_dict())
        return GogsUser.from_json(response.json())
    def search_users(self, username_keyword, limit=10):
        """
        Searches for users whose username matches ``username_keyword``, and returns
        a list of matched users.

        :param str username_keyword: keyword to search with
        :param int limit: maximum number of returned users
        :return: a list of matched users
        :rtype: List[GogsUser]
        :raises NetworkFailure: if there is an error communicating with the server
        :raises ApiFailure: if the request cannot be serviced
        """
        params = {"q": username_keyword, "limit": limit}
        response = self.get("/users/search", params=params)
        return [
            GogsUser.from_json(user_json)
            for user_json in response.json()["data"]
        ]