Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.github.jreddit.retrieval;
  
  import java.util.List;
  
 
 public class ExtendedSubmissions {
 	
 
 	public ExtendedSubmissions(Submissions submissions) {
 		this. = submissions;
 	}


    
Get submissions from the specified subreddit after a specific submission, as the given user, attempting to retrieve the desired amount.

Parameters:
redditName Subreddit name (e.g. 'fun', 'wtf', 'programming')
amount Desired amount which will be attempted. No guarantee! See request limits.
after Submission after which the submissions need to be fetched.
Returns:
List of the submissions
 
     public List<SubmissionofSubreddit(String redditNameSubmissionSort sortint amountSubmission after) {
     	
     	if (amount < 0) {
     		..println("You cannot retrieve a negative amount of submissions.");
     		return null;
     	}
 
     	// List of submissions
         List<Submissionresult = new LinkedList<Submission>();
 
         // Do all iterations
         int counter = 0;
 		while (amount >= 0) {
 			
 			// Determine how much still to retrieve in this iteration
 			int limit = (amount < .) ? amount : .;
 			amount -= limit;
 			
 			// Retrieve submissions
 			List<Submissionsubresult = .ofSubreddit(redditNamesortcounterlimitafternulltrue);
 			if (subresult == null) {
 				return new ArrayList<Submission>();
 			}
 			result.addAll(subresult);
 			
 			// Increment counter
 			counter += limit;
 			
 			// If the end of the submission stream has been reached
 			if (subresult.size() < limit) {
 				// System.out.println("API Stream finished prematurely: received " + subresult.size() + " but wanted " + limit + ".");
 				break;
 			}
 			
 			// If nothing is left desired, exit.
 			if (amount <= 0) {
 				break;
 			}
 			
 			// Previous last submission
 			after = subresult.get(subresult.size() - 1);
 			
 		}
 		
 		return result;
     	
     }
    
    
Get submissions from the specified subreddit, as the given user, attempting to retrieve the desired amount after the given submission.

Parameters:
redditName Subreddit name (e.g. 'fun', 'wtf', 'programming')
sort Subreddit sorting method
amount Desired amount which will be attempted. No guarantee! See request limits.
after Submission after which to get
Returns:
List of the submissions
 
     public List<Submissionget(String redditNameSubmissionSort sortint amountSubmission after) {
     	return ofSubreddit(redditNamesortamountafter);
     }
    
    
Get submissions from the specified subreddit, as the specified user, using the given sorting method.

Parameters:
user User
redditName The subreddit at which submissions you want to retrieve submissions.
sort Subreddit sorting method
Returns:
List of submissions on the subreddit.
    public List<SubmissionofSubreddit(String redditNameSubmissionSort sort) {
    	return ofSubreddit(redditNamesort.null);
    }
    
    
Get submissions from the specified subreddit attempting to retrieve the desired amount.

Parameters:
redditName Subreddit name (e.g. 'fun', 'wtf', 'programming')
sort Subreddit sorting method
amount Desired amount which will be attempted. No guarantee! See request limits.
Returns:
List of the submissions
    public List<SubmissionofSubreddit(String redditNameSubmissionSort sortint amount) {
    	return ofSubreddit(redditNamesortamountnull);
    }
    
    
Get submissions from the specified subreddit after a specific submission, as the given user, attempting to retrieve the desired amount.

Parameters:
query Search query
sort Search sorting method (e.g. new or top)
time Search time (e.g. day or all)
amount Desired amount which will be attempted. No guarantee! See request limits.
after Submission after which the submissions need to be fetched.
Returns:
List of the submissions
    public List<Submissionsearch(String querySearchSort sortTimeSpan timeint amountSubmission after) {
    	
    	if (amount < 0) {
    		..println("You cannot retrieve a negative amount of submissions.");
    		return null;
    	}
    	// List of submissions
        List<Submissionresult = new LinkedList<Submission>();
        // Do all iterations
        int counter = 0;
		while (amount >= 0) {
			// Determine how much still to retrieve in this iteration
			int limit = (amount < .) ? amount : .;
			amount -= limit;
			// Retrieve submissions
			List<Submissionsubresult = .search(query.sorttimecounterlimitafternulltrue);
			if (subresult == null) {
				return new ArrayList<Submission>();
			}
			result.addAll(subresult);
			// Increment counter
			counter += limit;
			// If the end of the submission stream has been reached
			if (subresult.size() != limit) {
				..println("API Stream finished prematurely: received " + subresult.size() + " but wanted " + limit + ".");
				break;
			}
			// If nothing is left desired, exit.
			if (amount <= 0) {
				break;
			}
			// Previous last submission
			after = subresult.get(subresult.size() - 1);
		}
		return result;
    	
    }
    
    
Search for submissions using the query with the given sorting method and within the given time as the given user and with maximum amount returned.

Parameters:
query Search query
sort Search sorting method
time Search time
amount How many to retrieve (if possible, result <= amount guaranteed)
Returns:
List of submissions that match the query.
    public List<Submissionsearch(String querySearchSort sortTimeSpan timeint amount) {
    	return search(querysorttimeamountnull);
    }
    
    
Search for submissions using the query with the given sorting method and within the given time as the given user.

Parameters:
query Search query
sort Search sorting method
time Search time
Returns:
List of submissions that match the query.
    public List<Submissionsearch(String querySearchSort sortTimeSpan time) {
    	return search(querysorttime.);
    }

    
    
Get submissions from the specified user.

Parameters:
query Search query
category Category
sort Search sorting method (e.g. new or top)
time Search time (e.g. day or all)
amount Desired amount which will be attempted. No guarantee! See request limits.
after Submission after which the submissions need to be fetched.
Returns:
List of the submissions
    public List<SubmissionofUser(String usernameUserSubmissionsCategory categoryUserOverviewSort sortint amountSubmission after) {
    	
    	if (amount < 0) {
    		..println("You cannot retrieve a negative amount of submissions.");
    		return null;
    	}
    	// List of submissions
        List<Submissionresult = new LinkedList<Submission>();
        // Do all iterations
        int counter = 0;
		while (amount >= 0) {
			// Determine how much still to retrieve in this iteration
			int limit = (amount < .) ? amount : .;
			amount -= limit;
			// Retrieve submissions
			List<Submissionsubresult = .ofUser(usernamecategorysortcounterlimitafternulltrue);
			if (subresult == null) {
				return new ArrayList<Submission>();
			}
			result.addAll(subresult);
			// Increment counter
			counter += limit;
			// If the end of the submission stream has been reached
			if (subresult.size() != limit) {
				// System.out.println("API Stream finished prematurely: received " + subresult.size() + " but wanted " + limit + ".");
				break;
			}
			// If nothing is left desired, exit.
			if (amount <= 0) {
				break;
			}
			// Previous last submission
			after = subresult.get(subresult.size() - 1);
		}
		return result;
    	
    }
    
    
Get submissions from the specified user.

Parameters:
query Search query
category Category
sort Search sorting method (e.g. new or top)
time Search time (e.g. day or all)
amount Desired amount which will be attempted. No guarantee! See request limits.
after Submission after which the submissions need to be fetched.
Returns:
List of the submissions
    public List<SubmissionofUser(String usernameUserSubmissionsCategory categoryUserOverviewSort sortint amount) {
    	return ofUser(usernamecategorysortamountnull);
    }
New to GrepCode? Check out our FAQ X