Package com.github.jreddit.retrieval

Examples of com.github.jreddit.retrieval.Submissions


      /***************************************************************************************************
       * First: basic API functionality
      */
     
      // Handle to Submissions, which offers the basic API functionality
      Submissions subms = new Submissions(restClient, user);
     
      // Retrieve submissions of a submission
      System.out.println("\n============== Basic subreddit submissions ==============");
      List<Submission> submissionsSubreddit = subms.ofSubreddit("flowers", SubmissionSort.TOP, -1, 100, null, null, true);
      printSubmissionsList(submissionsSubreddit);
     
      // Search for submissions
      System.out.println("\n============== Basic search submissions ==============");
      List<Submission> submissionsSearch = subms.search("flowers", null, null, TimeSpan.MONTH, -1, 100, null, null, true);
      printSubmissionsList(submissionsSearch);
     
      // Retrieve submissions of a user
      System.out.println("\n============== Basic user submissions ==============");
      List<Submission> submissionsUser = subms.ofUser("Unidan", UserSubmissionsCategory.SUBMITTED, UserOverviewSort.TOP, -1, 100, null, null, true);
      printSubmissionsList(submissionsUser);
     
     
      /***************************************************************************************************
       * Second: extended API functionality
View Full Code Here


        restClient.setUserAgent("Generous-Bot");

    User user = new User(restClient, Authentication.getUsername(), Authentication.getPassword());
    user.connect();
   
    Submissions subms = new Submissions(restClient, user);
    MarkActions submAct = new MarkActions(restClient, user);
   
    try {
     
      // Retrieve the 25 hottest submissions of the subreddit
      List<Submission> submissions = subms.ofSubreddit("programming", SubmissionSort.HOT, 0, 25, null, null, true);

      // Upvote each submission
      for (Submission submission : submissions) {
        if (!submAct.vote(submission.getFullName(), 1)) {
          System.out.println("Could not upvote.");
View Full Code Here

TOP

Related Classes of com.github.jreddit.retrieval.Submissions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.