Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using this wrapper without logging in #72

Open
JamesGold23 opened this issue Jun 10, 2014 · 1 comment
Open

Using this wrapper without logging in #72

JamesGold23 opened this issue Jun 10, 2014 · 1 comment

Comments

@JamesGold23
Copy link
Contributor

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:

  1. 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().
  2. 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.

@snkas
Copy link
Contributor

snkas commented Jun 17, 2014

  1. 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.
  2. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants