Reddit4J icon indicating copy to clipboard operation
Reddit4J copied to clipboard

Global refactoring. Improved maintainability.

Open yvasyliev opened this issue 2 years ago • 3 comments

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);
    }
}

yvasyliev avatar Sep 01 '22 13:09 yvasyliev

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!

masecla22 avatar Sep 08 '22 21:09 masecla22

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

yvasyliev avatar Sep 09 '22 06:09 yvasyliev

Any progress on this? :)

martinformi avatar Jan 21 '23 13:01 martinformi