How do I get the annotation “title”?

Q: How do I get the annotation “title”? Our old code called Adobe’s
PDAnnotGetTitle function. You have a knowledge base article that uses
Annot::GetTextContents to get the title but that method no longer
exists. I see there’s a Annot::GetContents method. Is that the one
that gets the “title”?
A: GetTextContents was renamed to Annot.GetContents. This method
returns the contents of the ‘Contents’ in the annotation dictionary.
The description of this entry is as follows:

Text that shall be displayed for the annotation or, if this type of
annotation does not display text, an alternate description of the
annotation’s contents in human-readable form. In either case, this
text is useful when extracting the document’s contents in support of
accessibility to users with disabilities or for other purposes (see
14.9.3, “Alternate Descriptions”). See 12.5.6, “Annotation Types” for
more details on the meaning of this entry for each annotation type.