Search in sources :

Example 6 with Group

use of me.perrycate.groupmeutils.data.Group in project groupme-utils by TheGuyWithTheFace.

the class Stats method main.

public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    // User auth
    System.out.println("Please enter your GroupMe API Token: ");
    GroupMe api = new GroupMe(s.nextLine());
    // Select group
    System.out.println("Fetching groups list...");
    Group[] groups = api.getGroups();
    for (int i = 0; i < groups.length; i++) {
        System.out.format("[%d] %s\n", i, groups[i].getName());
    }
    System.out.print("Please select a group to dump: ");
    Group selectedGroup = groups[Integer.parseInt(s.nextLine())];
    System.out.println("Selected \"" + selectedGroup.getName() + "\".");
    // Create output file
    System.out.println("Please enter a new file to save data to: ");
    File out = new File(s.nextLine());
    // Analyze and dump
    Stats stats = new Stats(api, selectedGroup, out);
    stats.write();
    s.close();
}
Also used : Scanner(java.util.Scanner) Group(me.perrycate.groupmeutils.data.Group) GroupMe(me.perrycate.groupmeutils.api.GroupMe) File(java.io.File)

Example 7 with Group

use of me.perrycate.groupmeutils.data.Group in project groupme-utils by TheGuyWithTheFace.

the class ListGroups method main.

public static void main(String[] args) {
    System.out.println("Please enter your groupme API Token: ");
    Scanner s = new Scanner(System.in);
    String token = s.nextLine();
    System.out.println("Fetching groups...");
    GroupMe groupme = new GroupMe(token);
    Group[] groups = groupme.getGroups();
    for (int i = 0; i < groups.length; i++) {
        System.out.println("Name: " + groups[i].getName());
        System.out.print("Members: ");
        Member[] members = groups[i].getMembers();
        for (int j = 0; j < members.length; j++) {
            System.out.print(members[j].getNickname() + " ");
        }
        System.out.println();
    }
    s.close();
}
Also used : Scanner(java.util.Scanner) Group(me.perrycate.groupmeutils.data.Group) GroupMe(me.perrycate.groupmeutils.api.GroupMe) Member(me.perrycate.groupmeutils.data.Member)

Example 8 with Group

use of me.perrycate.groupmeutils.data.Group in project groupme-utils by TheGuyWithTheFace.

the class TestDump method main.

public static void main(String[] args) {
    // required info
    String token = "YOUR API TOKEN HERE";
    String groupId = "GROUP ID HERE";
    GroupMe groupme = new GroupMe(token);
    Group group = groupme.getGroup(groupId);
    Dumper dumper = new Dumper(groupme, group);
    dumper.dump(new File("testdump.txt"));
    System.out.println("Complete");
}
Also used : Group(me.perrycate.groupmeutils.data.Group) GroupMe(me.perrycate.groupmeutils.api.GroupMe) Dumper(me.perrycate.groupmeutils.Dumper) File(java.io.File)

Aggregations

Group (me.perrycate.groupmeutils.data.Group)8 GroupMe (me.perrycate.groupmeutils.api.GroupMe)5 File (java.io.File)4 Scanner (java.util.Scanner)3 Dumper (me.perrycate.groupmeutils.Dumper)2 JsonArray (com.google.gson.JsonArray)1 JsonElement (com.google.gson.JsonElement)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 Reader (java.io.Reader)1 GroupMessages (me.perrycate.groupmeutils.data.GroupMessages)1 Member (me.perrycate.groupmeutils.data.Member)1 ChunkStorage (me.perrycate.groupmeutils.util.ChunkStorage)1