diff --git a/chat/client-libraries/cloud/src/main/java/com/google/workspace/api/chat/samples/UpdateMessageAppCred.java b/chat/client-libraries/cloud/src/main/java/com/google/workspace/api/chat/samples/UpdateMessageAppCred.java index 8eaf3dd7..559ad13f 100644 --- a/chat/client-libraries/cloud/src/main/java/com/google/workspace/api/chat/samples/UpdateMessageAppCred.java +++ b/chat/client-libraries/cloud/src/main/java/com/google/workspace/api/chat/samples/UpdateMessageAppCred.java @@ -17,7 +17,13 @@ package com.google.workspace.api.chat.samples; import com.google.protobuf.util.JsonFormat; + +import java.util.List; + // [START chat_update_message_app_cred] +import com.google.apps.card.v1.Card; +import com.google.apps.card.v1.Card.CardHeader; +import com.google.chat.v1.CardWithId; import com.google.chat.v1.ChatServiceClient; import com.google.chat.v1.UpdateMessageRequest; import com.google.chat.v1.Message; @@ -33,10 +39,14 @@ public static void main(String[] args) throws Exception { .setMessage(Message.newBuilder() // replace SPACE_NAME and MESSAGE_NAME here .setName("spaces/SPACE_NAME/messages/MESSAGE_NAME") - .setText("Updated with app credential!")) + .setText("Text updated with app credential!") + .addCardsV2(CardWithId.newBuilder().setCard(Card.newBuilder() + .setHeader(CardHeader.newBuilder() + .setTitle("Card updated with app credential!") + .setImageUrl("https://fonts.gstatic.com/s/i/short-term/release/googlesymbols/info/default/24px.svg"))))) .setUpdateMask(FieldMask.newBuilder() // The field paths to update. - .addPaths("text")); + .addAllPaths(List.of("text", "cards_v2"))); Message response = chatServiceClient.updateMessage(request.build()); System.out.println(JsonFormat.printer().print(response));