def with_api(func):
    """Decorate a method to use the client() context manager."""

    def wrapper(*args):
        with args[0].client() as api:
            return func(args[0], api, *args[1:])

    return wrapper