To assign a template to a post, I need to add (edit if they already exist) two entries to the postmeata table, meta_key = _edit_last, meta_value = user id and meta_key = _wp_page_template and meta_value = the filename of the template.
As for getting a list of the templates, I think I am stuck with poking through the php files in the template directory looking for template files.
Any other ideas?