masecla22 / Reddit4J

A library which aims to attain full coverage of the Reddit API
MIT License
48 stars 21 forks source link

Global refactoring. Improved maintainability. #11

Open yvasyliev opened 2 years ago

yvasyliev commented 2 years ago

In this PR I completely rewrote the codebase, renamed packages and classes.

I created few entities and API methods. Since there is no complete official Reddit API documentation, I don't think I can finish the work by myself. But I think it's a good start to finally write a stable version.

Here is a quickstart example:

public class Example {
    public static void main(String[] args) throws IOException {
        PersonalUseScript personalUseScript = new PersonalUseScript(
                "app_id",
                "secret"
        );

        UserAgent userAgent = new UserAgent(
                "app_name",
                "version",
                "author"
        );

        Credentials credentials = new Credentials(
                "login",
                "password"
        );

        RedditClient redditClient = new RedditClient(new ScriptClientConfig(
                personalUseScript,
                userAgent,
                credentials
        ));

        User me = redditClient.getMe().execute();
        System.out.println(me);

        PreferenceSettings myPreferences = redditClient.getMyPreferences().execute();
        System.out.println(myPreferences);

        myPreferences.setLang("es");
        myPreferences = redditClient.setMyPreferences().setPreferences(myPreferences).execute();
        System.out.println(myPreferences);
    }
}
masecla22 commented 2 years ago

Do you mind having a look over why there's some conflicts?

I've had a look over your architecture, and I feel like it is really good, and we could really implement it.

With the library being pretty much experimental, there's no worry for backwards compatibility!

yvasyliev commented 2 years ago

Fixed the confilcts. Probably it's a good option to create a separate branch to merge all these changes.

martinformi commented 1 year ago

Any progress on this? :)