@@ -41,7 +41,7 @@ def __init__(self, id=None, **kwargs):
41
41
class TextMessage (Message ):
42
42
"""TextMessage.
43
43
44
- https://devdocs .line.me /en/#text-message
44
+ https://developers .line.biz /en/reference/messaging-api/#wh-text
45
45
46
46
Message object which contains the text sent from the source.
47
47
"""
@@ -62,67 +62,89 @@ def __init__(self, id=None, text=None, **kwargs):
62
62
class ImageMessage (Message ):
63
63
"""ImageMessage.
64
64
65
- https://devdocs .line.me /en/#image-message
65
+ https://developers .line.biz /en/reference/messaging-api/#wh-image
66
66
67
67
Message object which contains the image content sent from the source.
68
68
The binary image data can be retrieved with the Content API.
69
69
"""
70
70
71
- def __init__ (self , id = None , ** kwargs ):
71
+ def __init__ (self , id = None , content_provider = None , ** kwargs ):
72
72
"""__init__ method.
73
73
74
74
:param str id: Message ID
75
+ :param content_provider: ContentProvider object
76
+ :type content_provider:
77
+ :py:class:`linebot.models.messages.ContentProvider` | dict[str, str]
75
78
:param kwargs:
76
79
"""
77
80
super (ImageMessage , self ).__init__ (id = id , ** kwargs )
78
81
79
82
self .type = 'image'
83
+ self .content_provider = self .get_or_new_from_json_dict (
84
+ content_provider , ContentProvider
85
+ )
80
86
81
87
82
88
class VideoMessage (Message ):
83
89
"""VideoMessage.
84
90
85
- https://devdocs .line.me /en/#video-message
91
+ https://developers .line.biz /en/reference/messaging-api/#wh-video
86
92
87
93
Message object which contains the video content sent from the source.
88
94
The binary video data can be retrieved with the Content API.
89
95
"""
90
96
91
- def __init__ (self , id = None , ** kwargs ):
97
+ def __init__ (self , id = None , duration = None , content_provider = None , ** kwargs ):
92
98
"""__init__ method.
93
99
94
100
:param str id: Message ID
101
+ :param long duration: Length of video file (milliseconds)
102
+ :param content_provider: ContentProvider object
103
+ :type content_provider:
104
+ :py:class:`linebot.models.messages.ContentProvider` | dict[str, str]
95
105
:param kwargs:
96
106
"""
97
107
super (VideoMessage , self ).__init__ (id = id , ** kwargs )
98
108
99
109
self .type = 'video'
110
+ self .duration = duration
111
+ self .content_provider = self .get_or_new_from_json_dict (
112
+ content_provider , ContentProvider
113
+ )
100
114
101
115
102
116
class AudioMessage (Message ):
103
117
"""AudioMessage.
104
118
105
- https://devdocs .line.me /en/#audio-message
119
+ https://developers .line.biz /en/reference/messaging-api/#wh-audio
106
120
107
121
Message object which contains the audio content sent from the source.
108
122
The binary audio data can be retrieved with the Content API.
109
123
"""
110
124
111
- def __init__ (self , id = None , ** kwargs ):
125
+ def __init__ (self , id = None , duration = None , content_provider = None , ** kwargs ):
112
126
"""__init__ method.
113
127
114
128
:param str id: Message ID
129
+ :param long duration: Length of audio file (milliseconds)
130
+ :param content_provider: ContentProvider object
131
+ :type content_provider:
132
+ :py:class:`linebot.models.messages.ContentProvider` | dict[str, str]
115
133
:param kwargs:
116
134
"""
117
135
super (AudioMessage , self ).__init__ (id = id , ** kwargs )
118
136
119
137
self .type = 'audio'
138
+ self .duration = duration
139
+ self .content_provider = self .get_or_new_from_json_dict (
140
+ content_provider , ContentProvider
141
+ )
120
142
121
143
122
144
class LocationMessage (Message ):
123
145
"""LocationMessage.
124
146
125
- https://devdocs .line.me /en/#location-message
147
+ https://developers .line.biz /en/reference/messaging-api/#wh-location
126
148
"""
127
149
128
150
def __init__ (self , id = None , title = None , address = None , latitude = None , longitude = None ,
@@ -148,7 +170,7 @@ def __init__(self, id=None, title=None, address=None, latitude=None, longitude=N
148
170
class StickerMessage (Message ):
149
171
"""StickerMessage.
150
172
151
- https://devdocs .line.me /en/#sticker-message
173
+ https://developers .line.biz /en/reference/messaging-api/#wh-sticker
152
174
153
175
Message object which contains the sticker data sent from the source.
154
176
For a list of basic LINE stickers and sticker IDs, see sticker list.
@@ -172,7 +194,7 @@ def __init__(self, id=None, package_id=None, sticker_id=None, **kwargs):
172
194
class FileMessage (Message ):
173
195
"""FileMessage.
174
196
175
- https://devdocs .line.me /en/#file-message
197
+ https://developers .line.biz /en/reference/messaging-api/#wh-file
176
198
177
199
Message object which contains the file content sent from the source.
178
200
The binary file data can be retrieved with the Content API.
@@ -191,3 +213,21 @@ def __init__(self, id=None, file_name=None, file_size=None, **kwargs):
191
213
self .type = 'file'
192
214
self .file_size = file_size
193
215
self .file_name = file_name
216
+
217
+
218
+ class ContentProvider (Base ):
219
+ """Content provider."""
220
+
221
+ def __init__ (self , type = None , original_content_url = None , preview_image_url = None , ** kwargs ):
222
+ """__init__ method.
223
+
224
+ :param str type: Provider of the content. `line` or `external`.
225
+ :param str original_content_url: URL of the content.
226
+ :param str preview_image_url: URL of the preview image.
227
+ :param kwargs:
228
+ """
229
+ super (ContentProvider , self ).__init__ (** kwargs )
230
+
231
+ self .type = type
232
+ self .original_content_url = original_content_url
233
+ self .preview_image_url = preview_image_url
0 commit comments