3434public class PreviewLink implements HttpFunction {
3535 private static final Gson gson = new Gson ();
3636
37+ /**
38+ * Responds to any HTTP request.
39+ *
40+ * @param request An HTTP request context.
41+ * @param response An HTTP response context.
42+ */
3743 @ Override
3844 public void service (HttpRequest request , HttpResponse response ) throws Exception {
3945 JsonObject body = gson .fromJson (request .getReader (), JsonObject .class );
@@ -45,6 +51,12 @@ public void service(HttpRequest request, HttpResponse response) throws Exception
4551 response .getWriter ().write (gson .toJson (createCard (url )));
4652 }
4753
54+ /**
55+ * Creates a preview link card for either a case link or people link.
56+ *
57+ * @param url A URL.
58+ * @return A case link preview card or a people link preview card.
59+ */
4860 Card createCard (String url ) throws MalformedURLException {
4961 URL parsedURL = new URL (url );
5062
@@ -65,6 +77,12 @@ Card createCard(String url) throws MalformedURLException {
6577
6678 // [START add_ons_case_preview_link]
6779
80+ /**
81+ * Creates a case link preview card.
82+ *
83+ * @param url A URL.
84+ * @return A case link preview card.
85+ */
6886 Card caseLinkPreview (String url ) {
6987 String [] segments = url .split ("/" );
7088 String caseId = segments [segments .length - 1 ];
@@ -90,6 +108,11 @@ Card caseLinkPreview(String url) {
90108 // [END add_ons_case_preview_link]
91109 // [START add_ons_people_preview_link]
92110
111+ /**
112+ * Creates a people link preview card.
113+ *
114+ * @return A people link preview card.
115+ */
93116 Card peopleLinkPreview () {
94117 CardHeader cardHeader = new CardHeader ();
95118 cardHeader .setTitle ("Rosario Cruz" );
0 commit comments