Skip to content

Instantly share code, notes, and snippets.

@RickStrahl
Last active February 14, 2022 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RickStrahl/e3df0de7e9603205270c059e5de00dda to your computer and use it in GitHub Desktop.
Save RickStrahl/e3df0de7e9603205270c059e5de00dda to your computer and use it in GitHub Desktop.
CreateGistFile
public static JObject CreateGistPostJson(GistItem gist)
{
dynamic obj = new JObject();
obj.Add("description", new JValue(gist.description));
obj.Add("public", gist.isPublic);
obj.Add("files", new JObject());
obj.files.Add(gist.filename, new JObject());
var fileObj = obj.files[gist.filename];
fileObj.content = gist.code;
// add a comment
return obj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment