Skip to content

Commit 7ececca

Browse files
committed
Add changeAppearance
1 parent c08b8cd commit 7ececca

File tree

1 file changed

+29
-7
lines changed

1 file changed

+29
-7
lines changed

api.php

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,16 +1055,16 @@ public static function Sticker($packageId, $stickerId)
10551055
* https://developers.line.biz/en/reference/messaging-api/#image-message
10561056
*
10571057
* @param string $url
1058-
* @param string $preview_url (optional)
1058+
* @param string $previewUrl (optional)
10591059
*
10601060
* @return array
10611061
*/
1062-
public static function Image($url, $preview_url = null)
1062+
public static function Image($url, $previewUrl = null)
10631063
{
1064-
if ($preview_url == null) {
1064+
if ($previewUrl == null) {
10651065
$preview = $url;
10661066
} else {
1067-
$preview = $preview_url;
1067+
$preview = $previewUrl;
10681068
}
10691069

10701070
return array(
@@ -1079,16 +1079,16 @@ public static function Image($url, $preview_url = null)
10791079
* https://developers.line.biz/en/reference/messaging-api/#video-message
10801080
*
10811081
* @param string $url
1082-
* @param string $preview_url
1082+
* @param string $previewUrl
10831083
*
10841084
* @return array
10851085
*/
1086-
public static function Video($url, $preview_url)
1086+
public static function Video($url, $previewUrl)
10871087
{
10881088
return array(
10891089
"type" => "video",
10901090
"originalContentUrl" => $url,
1091-
"previewImageUrl" => $preview_url,
1091+
"previewImageUrl" => $previewUrl,
10921092
);
10931093
}
10941094

@@ -1218,6 +1218,28 @@ public static function Flex($altText, $contents)
12181218
"contents" => $contents,
12191219
);
12201220
}
1221+
1222+
/**
1223+
* Change icon and display name
1224+
* https://developers.line.biz/en/docs/messaging-api/icon-nickname-switch/
1225+
*
1226+
* The function will help you assign the message object with icon and display name changing.
1227+
*
1228+
* @param array $originalMessage
1229+
* @param string $name
1230+
* @param string $iconUrl
1231+
*
1232+
* @return array
1233+
*/
1234+
public static function changeAppearance($originalMessage, $name, $iconUrl)
1235+
{
1236+
return array_merge($originalMessage, array(
1237+
"sender" => array(
1238+
"name" => $name,
1239+
"iconUrl" => $iconUrl,
1240+
),
1241+
));
1242+
}
12211243
}
12221244

12231245
// The classes below is used for creating the object of events with the class `LINEMSG`.

0 commit comments

Comments
 (0)