Skip to content

Instantly share code, notes, and snippets.

@mnjstwins
Forked from kevinsawicki/GistCreator.java
Created July 29, 2016 14:39
Show Gist options
  • Save mnjstwins/5ebb01dbf9ac0ce3a10b19d460f19f8f to your computer and use it in GitHub Desktop.
Save mnjstwins/5ebb01dbf9ac0ce3a10b19d460f19f8f to your computer and use it in GitHub Desktop.
Create Gists using the GitHub v3 Java API
GitHubClient client = new GitHubClient().setCredentials("user", "p4ssw0rd");
Gist gist = new Gist().setDescription("Prints a string to standard out");
GistFile file = new GistFile().setContent("System.out.println(\"Hello World\");");
gist.setFiles(Collections.singletonMap("Hello.java", file));
gist = new GistService(client).createGist(gist);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment