most of the important G2 functionality / API is listed in
modules/core/classes/GalleryCoreApi.class
you can call any of these functions with GalleryCoreApi::functionName(arguments);
above each function, there are some comments which explain which parameters are expected (@param) and what it returns (@ret).
in this class, there are also the factory registration functions.
what i do when coding for G2:
first see if any other module / file does almost the same or a part of what i need to do. then copy the fragment of code. e.g. you can copy the factory registration code from pretty much every modules/modulename/module.inc file see function performFactoryRegistration.
e.g. module/comments/module.inc registers it's implementation of the comment entity or modules/register/module.inc registers the PendingUser entity which also extends the GalleryUser.