add user to protected content membership in code

I am using protected content on my site, but am using a web hook to add users to the site via a hubspot account. I have written the code to add the user, but need to add the user to a specific membership.

Can you give me a clue as to what class I might load and what function I might call to add a user to a specific membership?