Skip to content

Commit 28dc6ab

Browse files
committed
feature/template-buttons
1 parent c309508 commit 28dc6ab

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,15 @@ if ($response->isSuccess()) {
849849
*/
850850
echo "\n tag -> name: ", $tag->name;
851851
}
852+
foreach ($messageTemplate->buttons as $button) {
853+
/**
854+
* @var $tag \Sendbee\Api\Models\MessageTemplateButton
855+
*/
856+
echo "\n button -> index: ", $tag->index;
857+
echo "\n button -> type: ", $tag->type;
858+
echo "\n button -> title: ", $tag->title;
859+
echo "\n button -> value: ", $tag->value;
860+
}
852861
}
853862
} else {
854863
/**

src/Sendbee/Api/Models/MessageTemplate.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* @property string $reject_reason Reject Reason
1616
* @property string $keyword Keyword
1717
* @property string $tags Tags
18+
* @property string $buttons Buttons
1819
* @property string $text Text
1920
* @property string $language Language
2021
* @property string $attachment Attachment
@@ -28,9 +29,10 @@ protected function getFieldSpecification(){
2829
'reject_reason' => self::fieldText(),
2930
'keyword' => self::fieldText(),
3031
'tags' => self::fieldModelCollection(MessageTemplateTag::class),
32+
'buttons' => self::fieldModelCollection(MessageTemplateButton::class),
3133
'text' => self::fieldText(),
3234
'language' => self::fieldText(),
3335
'attachment' => self::fieldText(),
3436
];
3537
}
36-
}
38+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
4+
namespace Sendbee\Api\Models;
5+
6+
7+
use Sendbee\Api\Support\Model;
8+
9+
/**
10+
* Class MessageTemplateButton
11+
* @package Sendbee\Api\Models
12+
*
13+
* @property integer $index index
14+
* @property string $type type
15+
* @property string $title title
16+
* @property string $value value
17+
*/
18+
class MessageTemplateButton extends Model
19+
{
20+
protected function getFieldSpecification(){
21+
return [
22+
'index' => self::fieldInteger(),
23+
'type' => self::fieldText(),
24+
'title' => self::fieldText(),
25+
'value' => self::fieldText(),
26+
];
27+
}
28+
}

0 commit comments

Comments
 (0)