Repository: line/line-bot-sdk-python

Issue:
Messaging API - September 2020 update
News: https://developers.line.biz/en/news/2020/09/01/messaging-api-update-september-2020/

- [ ] [limit.upToRemainingQuota property has been added to narrowcast messages.](https://developers.line.biz/en/reference/messaging-api/#send-narrowcast-message)

Discussion:

Patch:
diff --git a/linebot/api.py b/linebot/api.py
index bb6075b..85bee50 100644
--- a/linebot/api.py
+++ b/linebot/api.py
@@ -228,7 +228,8 @@ class LineBotApi(object):
 
     def narrowcast(
             self, messages,
-            retry_key=None, recipient=None, filter=None, limit=None, timeout=None):
+            retry_key=None, recipient=None, filter=None, limit=None,
+            notification_disabled=False, timeout=None):
         """Call narrowcast API.
 
         https://developers.line.biz/en/reference/messaging-api/#send-narrowcast-message
@@ -247,6 +248,8 @@ class LineBotApi(object):
         :type filter: T <= :py:class:`linebot.models.filter.DemographicFilter`
         :param limit: limit on this narrowcast
         :type limit: T <= :py:class:`linebot.models.limit.Limit`
+        :param bool notification_disabled: (optional) True to disable push notification
+            when the message is sent. The default value is False.
         :param timeout: (optional) How long to wait for the server
             to send data before giving up, as a float,
             or a (connect timeout, read timeout) float tuple.
@@ -265,6 +268,7 @@ class LineBotApi(object):
             'recipient': recipient.as_json_dict(),
             'filter': filter.as_json_dict(),
             'limit': limit.as_json_dict(),
+            'notificationDisabled': notification_disabled,
         }
 
         response = self._post(
diff --git a/linebot/models/limit.py b/linebot/models/limit.py
index 7f96767..8cae392 100644
--- a/linebot/models/limit.py
+++ b/linebot/models/limit.py
@@ -30,7 +30,7 @@ class Limit(with_metaclass(ABCMeta, Base)):
 
     """
 
-    def __init__(self, max=None, **kwargs):
+    def __init__(self, max=None, up_to_remaining_quota=False, **kwargs):
         """__init__ method.
 
         :param kwargs:
@@ -38,3 +38,4 @@ class Limit(with_metaclass(ABCMeta, Base)):
         super(Limit, self).__init__(**kwargs)
 
         self.max = max
+        self.up_to_remaining_quota = up_to_remaining_quota


Test patch:
diff --git a/tests/api/test_narrowcast_message.py b/tests/api/test_narrowcast_message.py
index 24ff784..3e48c12 100644
--- a/tests/api/test_narrowcast_message.py
+++ b/tests/api/test_narrowcast_message.py
@@ -85,8 +85,10 @@ class TestNarrowcastMessage(unittest.TestCase):
                     }
                 },
                 "limit": {
-                    "max": 10
-                }
+                    "max": 10,
+                    "upToRemainingQuota": False,
+                },
+                "notificationDisabled": False,
             }
         )
 
@@ -120,7 +122,7 @@ class TestNarrowcastMessage(unittest.TestCase):
                     )
                 )
             ),
-            limit=Limit(max=100),
+            limit=Limit(max=100, up_to_remaining_quota=True),
         )
 
         request = responses.calls[0].request
@@ -211,8 +213,10 @@ class TestNarrowcastMessage(unittest.TestCase):
                     }
                 },
                 "limit": {
-                    "max": 100
-                }
+                    "max": 100,
+                    "upToRemainingQuota": True,
+                },
+                "notificationDisabled": False,
             }
         )
         self.assertEqual('request_id_test', response.request_id)
@@ -242,7 +246,7 @@ class TestNarrowcastMessage(unittest.TestCase):
                     )
                 )
             ),
-            limit=Limit(max=100),
+            limit=Limit(max=100, up_to_remaining_quota=True),
             retry_key='123e4567-e89b-12d3-a456-426614174000',
         )
 
@@ -295,8 +299,10 @@ class TestNarrowcastMessage(unittest.TestCase):
                     }
                 },
                 "limit": {
-                    "max": 100
-                }
+                    "max": 100,
+                    "upToRemainingQuota": True,
+                },
+                "notificationDisabled": False,
             }
         )
         self.assertEqual('request_id_test', response.request_id)