in guide/blueprints/java/gist_generator/GistGeneratorImpl.java [21:36]
public String createGist(String gistName, String fileName, String gistContents, String oathToken) throws IOException {
if (Strings.isBlank(oathToken)) oathToken = config().get(OAUTH_KEY);
GistFile file = new GistFile();
file.setContent(gistContents);
Gist gist = new Gist();
gist.setDescription(gistName);
gist.setFiles(Collections.singletonMap(fileName, file));
gist.setPublic(true);
GistService service = new GistService();
service.getClient().setOAuth2Token(oathToken);
LOG.info("Creating Gist: " + gistName);
Gist result = service.createGist(gist);
return result.getId();
}