diff --git a/apps-script/3p-resources/3p-resources.gs b/apps-script/3p-resources/3p-resources.gs index 1ecebb1..9b25f25 100644 --- a/apps-script/3p-resources/3p-resources.gs +++ b/apps-script/3p-resources/3p-resources.gs @@ -72,40 +72,6 @@ function parseQuery(url) { } // [END add_ons_case_preview_link] -// [START add_ons_people_preview_link] - -/** -* Entry point for an employee profile link preview -* -* @param {!Object} event The event object. -* @return {!Card} The resulting preview link card. -*/ -function peopleLinkPreview(event) { - - // If the event object URL matches a specified pattern for employee profile links. - if (event.docs.matchedUrl.url) { - - // Builds a preview card with an employee's name, title, email, and profile photo. - const userHeader = CardService.newCardHeader().setTitle("Rosario Cruz"); - const userImage = CardService.newImage() - .setImageUrl("https://developers.google.com/workspace/add-ons/images/employee-profile.png"); - const userInfo = CardService.newDecoratedText() - .setText("rosario@example.com") - .setBottomLabel("Case Manager") - .setIcon(CardService.Icon.EMAIL); - const userSection = CardService.newCardSection() - .addWidget(userImage) - .addWidget(userInfo); - - // Returns the card. Uses the text from the card's header for the title of the smart chip. - return CardService.newCardBuilder() - .setHeader(userHeader) - .addSection(userSection) - .build(); - } -} - -// [END add_ons_people_preview_link] // [END add_ons_preview_link] // [START add_ons_3p_resources] diff --git a/apps-script/3p-resources/appsscript.json b/apps-script/3p-resources/appsscript.json index 6e1f897..c1752c0 100644 --- a/apps-script/3p-resources/appsscript.json +++ b/apps-script/3p-resources/appsscript.json @@ -36,20 +36,6 @@ "es": "Caso de soporte" }, "logoUrl": "https://developers.google.com/workspace/add-ons/images/support-icon.png" - }, - { - "runFunction": "peopleLinkPreview", - "patterns": [ - { - "hostPattern": "example.com", - "pathPrefix": "people" - } - ], - "labelText": "People", - "localizedLabelText": { - "es": "Personas" - }, - "logoUrl": "https://developers.google.com/workspace/add-ons/images/person-icon.png" } ], "createActionTriggers": [ diff --git a/java/3p-resources/README.md b/java/3p-resources/README.md index 47b94e7..1a2d8d3 100644 --- a/java/3p-resources/README.md +++ b/java/3p-resources/README.md @@ -1,6 +1,6 @@ # Third-Party Resources -The solution is made of two Cloud Functions, one for the two link preview triggers and +The solution is made of two Cloud Functions, one for the link preview trigger and one for the third-party resource create action trigger. To learn about writing Cloud Functions, see the documentation: https://cloud.google.com/functions/docs/writing. diff --git a/java/3p-resources/deployment.json b/java/3p-resources/deployment.json index a4757a4..7a7cc83 100644 --- a/java/3p-resources/deployment.json +++ b/java/3p-resources/deployment.json @@ -33,20 +33,6 @@ "es": "Caso de soporte" }, "logoUrl": "https://developers.google.com/workspace/add-ons/images/support-icon.png" - }, - { - "runFunction": "$URL1", - "patterns": [ - { - "hostPattern": "example.com", - "pathPrefix": "people" - } - ], - "labelText": "People", - "localizedLabelText": { - "es": "Personas" - }, - "logoUrl": "https://developers.google.com/workspace/add-ons/images/person-icon.png" } ], "createActionTriggers": [ diff --git a/java/3p-resources/src/main/java/CreateLinkPreview.java b/java/3p-resources/src/main/java/CreateLinkPreview.java index d1e7c11..d981e08 100644 --- a/java/3p-resources/src/main/java/CreateLinkPreview.java +++ b/java/3p-resources/src/main/java/CreateLinkPreview.java @@ -52,11 +52,6 @@ public void service(HttpRequest request, HttpResponse response) throws Exception response.getWriter().write(gson.toJson(caseLinkPreview(parsedURL))); return; } - - if (parsedURL.getPath().startsWith("/people/")) { - response.getWriter().write(gson.toJson(peopleLinkPreview())); - return; - } } response.getWriter().write("{}"); @@ -116,64 +111,6 @@ JsonObject caseLinkPreview(URL url) throws UnsupportedEncodingException { } // [END add_ons_case_preview_link] - // [START add_ons_people_preview_link] - - /** - * An employee profile link preview. - * - * @return The resulting preview link card. - */ - JsonObject peopleLinkPreview() { - // Builds a preview card with an employee's name, title, email, and profile photo. - // Uses the text from the card's header for the title of the smart chip. - JsonObject cardHeader = new JsonObject(); - cardHeader.add("title", new JsonPrimitive("Rosario Cruz")); - - JsonObject image = new JsonObject(); - image.add("imageUrl", new JsonPrimitive("https://developers.google.com/workspace/add-ons/images/employee-profile.png")); - - JsonObject imageWidget = new JsonObject(); - imageWidget.add("image", image); - - JsonObject startIcon = new JsonObject(); - startIcon.add("knownIcon", new JsonPrimitive("EMAIL")); - - JsonObject decoratedText = new JsonObject(); - decoratedText.add("startIcon", startIcon); - decoratedText.add("text", new JsonPrimitive("rosario@example.com")); - decoratedText.add("bottomLabel", new JsonPrimitive("Case Manager")); - - JsonObject decoratedTextWidget = new JsonObject(); - decoratedTextWidget.add("decoratedText", decoratedText); - - JsonArray widgets = new JsonArray(); - widgets.add(imageWidget); - widgets.add(decoratedTextWidget); - - JsonObject section = new JsonObject(); - section.add("widgets", widgets); - - JsonArray sections = new JsonArray(); - sections.add(section); - - JsonObject previewCard = new JsonObject(); - previewCard.add("header", cardHeader); - previewCard.add("sections", sections); - - JsonObject linkPreview = new JsonObject(); - linkPreview.add("title", new JsonPrimitive("Rosario Cruz")); - linkPreview.add("previewCard", previewCard); - - JsonObject action = new JsonObject(); - action.add("linkPreview", linkPreview); - - JsonObject renderActions = new JsonObject(); - renderActions.add("action", action); - - return renderActions; - } - - // [END add_ons_people_preview_link] } // [END add_ons_preview_link] diff --git a/node/3p-resources/README.md b/node/3p-resources/README.md index 78a78af..13870c9 100644 --- a/node/3p-resources/README.md +++ b/node/3p-resources/README.md @@ -1,6 +1,6 @@ # Third-Party Resources -The solution is made of two Cloud Functions, one for the two link preview triggers and +The solution is made of two Cloud Functions, one for the link preview trigger and one for the third-party resource create action trigger. To learn about writing Cloud Functions, see the documentation: https://cloud.google.com/functions/docs/writing. diff --git a/node/3p-resources/deployment.json b/node/3p-resources/deployment.json index a4757a4..7a7cc83 100644 --- a/node/3p-resources/deployment.json +++ b/node/3p-resources/deployment.json @@ -33,20 +33,6 @@ "es": "Caso de soporte" }, "logoUrl": "https://developers.google.com/workspace/add-ons/images/support-icon.png" - }, - { - "runFunction": "$URL1", - "patterns": [ - { - "hostPattern": "example.com", - "pathPrefix": "people" - } - ], - "labelText": "People", - "localizedLabelText": { - "es": "Personas" - }, - "logoUrl": "https://developers.google.com/workspace/add-ons/images/person-icon.png" } ], "createActionTriggers": [ diff --git a/node/3p-resources/index.js b/node/3p-resources/index.js index 6b6b9c3..000c2ba 100644 --- a/node/3p-resources/index.js +++ b/node/3p-resources/index.js @@ -31,10 +31,6 @@ exports.createLinkPreview = (req, res) => { if (parsedUrl.pathname.startsWith('/support/cases/')) { return res.json(caseLinkPreview(parsedUrl)); } - - if (parsedUrl.pathname.startsWith('/people/')) { - return res.json(peopleLinkPreview()); - } } } }; @@ -75,49 +71,6 @@ function caseLinkPreview(url) { } // [END add_ons_case_preview_link] -// [START add_ons_people_preview_link] - -/** - * An employee profile link preview. - * - * @param {!URL} url The event object. - * @return {!Card} The resulting preview link card. - */ -function peopleLinkPreview() { - // Builds a preview card with an employee's name, title, email, and profile photo. - // Uses the text from the card's header for the title of the smart chip. - return { - action: { - linkPreview: { - title: "Rosario Cruz", - previewCard: { - header: { - title: "Rosario Cruz" - }, - sections: [{ - widgets: [ - { - image: { - imageUrl: 'https://developers.google.com/workspace/add-ons/images/employee-profile.png' - } - }, { - decoratedText: { - startIcon: { - knownIcon: "EMAIL" - }, - text: "rosario@example.com", - bottomLabel: "Case Manager" - } - } - ] - }] - } - } - } - }; -} - -// [END add_ons_people_preview_link] // [END add_ons_preview_link] // [START add_ons_3p_resources] diff --git a/python/3p-resources/README.md b/python/3p-resources/README.md index 052a0b4..734342f 100644 --- a/python/3p-resources/README.md +++ b/python/3p-resources/README.md @@ -1,6 +1,6 @@ # Third-Party Resources -The solution is made of two Cloud Functions, one for the two link preview triggers and +The solution is made of two Cloud Functions, one for the link preview trigger and one for the third-party resource create action trigger. To learn about writing Cloud Functions, see the documentation: https://cloud.google.com/functions/docs/writing. diff --git a/python/3p-resources/create_link_preview/main.py b/python/3p-resources/create_link_preview/main.py index 32bb107..2b970de 100644 --- a/python/3p-resources/create_link_preview/main.py +++ b/python/3p-resources/create_link_preview/main.py @@ -37,9 +37,6 @@ def create_link_preview(req: flask.Request): if parsed_url.path.startswith("/support/cases/"): return case_link_preview(parsed_url) - if parsed_url.path.startswith("/people/"): - return people_link_preview() - return {} @@ -80,48 +77,4 @@ def case_link_preview(url): # [END add_ons_case_preview_link] -# [START add_ons_people_preview_link] - - -def people_link_preview(): - """An employee profile link preview. - Returns: - A people link preview card. - """ - - # Builds a preview card with an employee's name, title, email, and profile photo. - # Uses the text from the card's header for the title of the smart chip. - return { - "action": { - "linkPreview": { - "title": "Rosario Cruz", - "previewCard": { - "header": { - "title": "Rosario Cruz" - }, - "sections": [{ - "widgets": [ - { - "image": { - "imageUrl": "https://developers.google.com/workspace/add-ons/images/employee-profile.png" - } - }, - { - "decoratedText": { - "startIcon": { - "knownIcon": "EMAIL" - }, - "text": "rosario@example.com", - "bottomLabel": "Case Manager", - } - }, - ] - }], - } - } - } - } - - -# [END add_ons_people_preview_link] # [END add_ons_preview_link] diff --git a/python/3p-resources/deployment.json b/python/3p-resources/deployment.json index a4757a4..7a7cc83 100644 --- a/python/3p-resources/deployment.json +++ b/python/3p-resources/deployment.json @@ -33,20 +33,6 @@ "es": "Caso de soporte" }, "logoUrl": "https://developers.google.com/workspace/add-ons/images/support-icon.png" - }, - { - "runFunction": "$URL1", - "patterns": [ - { - "hostPattern": "example.com", - "pathPrefix": "people" - } - ], - "labelText": "People", - "localizedLabelText": { - "es": "Personas" - }, - "logoUrl": "https://developers.google.com/workspace/add-ons/images/person-icon.png" } ], "createActionTriggers": [