How to add / embed an author into REST data from a custom post type?

I found out how to grab each result and add a link. For the ananda_video_audio post type:

add_filter( 'rest_prepare_ananda_video_audio', function( $results ) {

    // These two lines are unique to our code of course
    $video = new Ananda_Video_Audio( $results->data['id'] ); 
    $authors = $video->get_author_IDs();

    foreach( $authors as $author_id ) {
        $results->add_link( 'author', rest_url( '/wp/v2/users/' . $author_id ), array( 'embeddable' => true ) );
    }

    return $results;

});

Because embeddable is set to true, the author data all gets added to _embedded as well, in the response. Works great.

Links I found helpful, in case you’re doing something similar: