Repository: line/line-bot-sdk-go (go)

Issue:
@All in the mention property of the webhooks
News URL
[Messaging API now includes @All in the mention property of the webhooks](https://developers.line.biz/en/news/2023/03/08/messaging-api-updated/)

see the [Text](https://developers.line.biz/en/reference/messaging-api/#wh-text) section of [Message event](https://developers.line.biz/en/reference/messaging-api/#message-event)

Pull request description:
Includes @All in the mention property of the webhooks
- add MentionedTargetType
- fixes #341

Patch:
diff --git a/linebot/mention.go b/linebot/mention.go
index 78bfac9..9155a63 100644
--- a/linebot/mention.go
+++ b/linebot/mention.go
@@ -1,5 +1,14 @@
 package linebot
 
+// MentionedTargetType type
+type MentionedTargetType string
+
+// MentionedTargetType constants
+const (
+	MentionedTargetTypeUser MentionedTargetType = "user"
+	MentionedTargetTypeAll  MentionedTargetType = "all"
+)
+
 // Mention type
 type Mention struct {
 	Mentionees []*Mentionee `json:"mentionees"`
@@ -7,7 +16,8 @@ type Mention struct {
 
 // Mentionee type
 type Mentionee struct {
-	Index  int    `json:"index"`
-	Length int    `json:"length"`
-	UserID string `json:"userId,omitempty"`
+	Index  int                 `json:"index"`
+	Length int                 `json:"length"`
+	Type   MentionedTargetType `json:"type"`
+	UserID string              `json:"userId,omitempty"`
 }


Test patch:
diff --git a/linebot/webhook_test.go b/linebot/webhook_test.go
index ed55c1e..1a1a7d1 100644
--- a/linebot/webhook_test.go
+++ b/linebot/webhook_test.go
@@ -95,11 +95,13 @@ var webhookTestRequestBody = `{
                         {
                             "index": 0,
                             "length": 16,
-                            "userId": "U0047556f2e40dba2456887320ba7c76d"
+                            "userId": "U0047556f2e40dba2456887320ba7c76d",
+                            "type": "user"
                         },
                         {
                             "index": 24,
-                            "length": 16
+                            "length": 16,
+                            "type": "user"
                         }
                     ]
                 }
@@ -751,7 +753,50 @@ var webhookTestRequestBody = `{
             "videoPlayComplete": {
                 "trackingId": "track_id"
             }
-        }
+        },
+		{
+			"replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
+			"type": "message",
+			"mode": "active",
+			"timestamp": 1462629479859,
+			"source": {
+				"type": "group",
+				"groupId": "Ca56f94637c...",
+				"userId": "U4af4980629..."
+			},
+			"webhookEventId": "01FZ74A0TDDPYRVKNK77XKC3ZR",
+			"deliveryContext": {
+				"isRedelivery": false
+			},
+			"message": {
+				"id": "444573844083572737",
+				"type": "text",
+				"text": "@All @example Good Morning!! (love)",
+				"emojis": [
+					{
+						"index": 29,
+						"length": 6,
+						"productId": "5ac1bfd5040ab15980c9b435",
+						"emojiId": "001"
+					}
+				],
+				"mention": {
+					"mentionees": [
+						{
+							"index": 0,
+							"length": 4,
+							"type": "all"
+						},
+						{
+							"index": 5,
+							"length": 8,
+							"userId": "U49585cd0d5...",
+							"type": "user"
+						}
+					]
+				}
+			}
+		}
     ]
 }
 `
@@ -816,11 +861,13 @@ var webhookTestWantEvents = []*Event{
 					{
 						Index:  0,
 						Length: 16,
+						Type:   MentionedTargetTypeUser,
 						UserID: "U0047556f2e40dba2456887320ba7c76d",
 					},
 					{
 						Index:  24,
 						Length: 16,
+						Type:   MentionedTargetTypeUser,
 					},
 				},
 			},
@@ -1453,6 +1500,43 @@ var webhookTestWantEvents = []*Event{
 			TrackingID: "track_id",
 		},
 	},
+	{
+		ReplyToken: "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
+		Type:       EventTypeMessage,
+		Mode:       EventModeActive,
+		Timestamp:  time.Date(2016, time.May, 7, 13, 57, 59, int(859*time.Millisecond), time.UTC),
+		Source: &EventSource{
+			Type:    EventSourceTypeGroup,
+			GroupID: "Ca56f94637c...",
+			UserID:  "U4af4980629...",
+		},
+		WebhookEventID: "01FZ74A0TDDPYRVKNK77XKC3ZR",
+		DeliveryContext: DeliveryContext{
+			IsRedelivery: false,
+		},
+		Message: &TextMessage{
+			ID:   "444573844083572737",
+			Text: "@All @example Good Morning!! (love)",
+			Emojis: []*Emoji{
+				{Index: 29, Length: 6, ProductID: "5ac1bfd5040ab15980c9b435", EmojiID: "001"},
+			},
+			Mention: &Mention{
+				Mentionees: []*Mentionee{
+					{
+						Index:  0,
+						Length: 4,
+						Type:   MentionedTargetTypeAll,
+					},
+					{
+						Index:  5,
+						Length: 8,
+						Type:   MentionedTargetTypeUser,
+						UserID: "U49585cd0d5...",
+					},
+				},
+			},
+		},
+	},
 }
 
 func TestParseRequest(t *testing.T) {