You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can call many of the Reddit API methods without ever needing to log in, so it seems a little silly to require a username and password when constructing a User. I have a couple proposals in mind:
Create a no-parameter User constructor. Then, if the user ever wants to call an API method that requires being logged in, allow them to call connect(username, password) OR setUsername(name), setPassword(pw), connect().
Instead of the User being the main interface through which a user interacts, create a Reddit class that does that job. This is because it's weird to interact with the Reddit API through a User class if you are in fact not logged in. A user simply creates a Reddit object and then if he ever wants to call a login-required API method, he can do Reddit.login(name, pw). Possible downside: how to handle multiple users connected at the same time?
Also, it doesn't look like there are currently measures put in place to handle cases where not-logged-in users call methods that require the user to be logged in. One exception being getUserInformation(). Perhaps I am wrong in this but this is how it appears.
The text was updated successfully, but these errors were encountered:
The current approach (it seems) to pass a null pointer instead of User instance when a User might have influence on the outcome of the function call (e.g. retrieving from the /r/all subreddit, also known as the frontpage). Not the best way to tackle this, maybe an AnonymousUser singleton can be a proper solution.
All functions in the User class are related to the user itself (e.g. submission of a post, viewing its submission history etc.). General subreddit retrieval and get is done by the Submissions class, which accepts a User as parameter (see (1) on how), but does not need a User instance to function properly.
You can call many of the Reddit API methods without ever needing to log in, so it seems a little silly to require a username and password when constructing a User. I have a couple proposals in mind:
Also, it doesn't look like there are currently measures put in place to handle cases where not-logged-in users call methods that require the user to be logged in. One exception being getUserInformation(). Perhaps I am wrong in this but this is how it appears.
The text was updated successfully, but these errors were encountered: