ServiceAPI upload file and associate with an existing record

I know it is possible to create a record and upload a file in a single ServiceAPI call PostFileWithRequest(), however, I would like to know if it’s possible to first upload a file using ServiceAPI and then associate it with an existing record? I found the blog with the section “Upload a file and create a new revision” where this exact requirement is covered, but there is a line of code I just can’t figure out:

var fileResponse = client.UploadFile(fi, System.Web.MimeMapping.GetMimeMapping(fi.Name));

The class TrimClient doesn’t have the method called “UploadFile” so I’m wondering how this “client” object gets instantiated? I have a feeling I am missing something obvious, so I apologize in advance.

Thanks in advance.