-
Notifications
You must be signed in to change notification settings - Fork 1k
support narrowcast api #241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
be2add4
support narrowcast api
clsung 33c671d
fix test
clsung bea6fd4
add test
clsung b6f77c9
add MessageProgressNarrowcastResponse
clsung a8fbacf
update operator
clsung 15d48bc
fix by flake8
clsung d7b8d0a
OpAND, OpNOT, OpOR to AND, NOT, OR
clsung 8fa09f1
add test for get_progress_status_narrowcast
clsung 05399fd
Add English comments
clsung cd93889
AND/OR/NOT to And/Or/Not
clsung a748fa1
fix flake8
clsung 338eab6
make DemographicFilter as base class of demographic filters
clsung eda653c
flake8
clsung 7c17cae
fix typo
clsung File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,165 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| # Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
| # not use this file except in compliance with the License. You may obtain | ||
| # a copy of the License at | ||
| # | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| # License for the specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| """linebot.models.filter module.""" | ||
|
|
||
| from __future__ import unicode_literals | ||
|
|
||
| from abc import ABCMeta | ||
|
|
||
| from future.utils import with_metaclass | ||
|
|
||
| from .base import Base | ||
|
|
||
|
|
||
| class Filter(with_metaclass(ABCMeta, Base)): | ||
| """Filter. | ||
okue marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| https://developers.line.biz/en/reference/messaging-api/#narrowcast-demographic-filter | ||
| A filter is the top-level structure of a demographic element. | ||
| """ | ||
|
|
||
| def __init__(self, **kwargs): | ||
| """__init__ method. | ||
| :param kwargs: | ||
| """ | ||
| super(Filter, self).__init__(**kwargs) | ||
|
|
||
| self.type = None | ||
|
|
||
|
|
||
| class DemographicFilter(Filter): | ||
| """DemographicFilter. | ||
| https://developers.line.biz/en/reference/messaging-api/#narrowcast-demographic-filter | ||
| Demographic filter objects represent criteria (e.g. age, gender, OS, region, | ||
| and friendship duration) on which to filter the list of recipients. | ||
| You can filter recipients based on a combination of different criteria using | ||
| logical operator objects. | ||
| """ | ||
|
|
||
| def __init__(self, criteria=None, **kwargs): | ||
| """__init__ method. | ||
| :param criteria: Combination of different criteria using logical | ||
| operator objects. | ||
| :type criteria: :py:class:`linebot.model.DemographicFilter` | | ||
| :py:class:`linebot.model.Operator` | ||
| :param kwargs: | ||
| """ | ||
| super(DemographicFilter, self).__init__(**kwargs) | ||
|
|
||
| self.demographic = criteria | ||
|
|
||
|
|
||
| class GenderFilter(Filter): | ||
| """GenderFilter.""" | ||
|
|
||
| def __init__(self, one_of=[], **kwargs): | ||
| """__init__ method. | ||
| :param one_of: Send messages to users of a given gender. One of: | ||
| male: Users who identify as male | ||
| female: Users who identify as female | ||
| :type one_of: list[str] | ||
| """ | ||
| super(GenderFilter, self).__init__(**kwargs) | ||
|
|
||
| self.type = "gender" | ||
| self.one_of = one_of | ||
|
|
||
|
|
||
| class AppTypeFilter(Filter): | ||
| """AppTypeFilter.""" | ||
|
|
||
| def __init__(self, one_of=[], **kwargs): | ||
| """__init__ method. | ||
| :param one_of: Send messages to users of the specified OS. One of: | ||
| ios: Users who using iOS. | ||
| android: Users who using Android. | ||
| :type one_of: list[str] | ||
| """ | ||
| super(AppTypeFilter, self).__init__(**kwargs) | ||
|
|
||
| self.type = "appType" | ||
| self.one_of = one_of | ||
|
|
||
|
|
||
| class AreaFilter(Filter): | ||
| """AreaFilter.""" | ||
|
|
||
| def __init__(self, one_of=[], **kwargs): | ||
| """__init__ method. | ||
| :param one_of: Send messages to users in the specified region. | ||
| :type one_of: list[str] | ||
| """ | ||
| super(AreaFilter, self).__init__(**kwargs) | ||
|
|
||
| self.type = "area" | ||
| self.one_of = one_of | ||
|
|
||
|
|
||
| class AgeFilter(Filter): | ||
| """AgeFilter. | ||
| This lets you filter recipients with a given age range. | ||
| """ | ||
|
|
||
| def __init__(self, gte=None, lt=None, **kwargs): | ||
| """__init__ method. | ||
| Be sure to specify either gte, lt, or both. | ||
| :param gte: Send messages to users at least as old as the specified age. | ||
| :type gte: str | ||
| :param lt: Send messages to users younger than the specified age. | ||
| You can specify the same values as for the gte property. | ||
| :type lt: str | ||
| """ | ||
| super(AgeFilter, self).__init__(**kwargs) | ||
|
|
||
| self.type = "age" | ||
| self.gte = gte | ||
| self.lt = lt | ||
|
|
||
|
|
||
| class SubscriptionPeriodFilter(Filter): | ||
| """SubscriptionPeriodFilter. | ||
| This lets you filter recipients with a given range of friendship durations. | ||
| """ | ||
|
|
||
| def __init__(self, gte=None, lt=None, **kwargs): | ||
| """__init__ method. | ||
| Be sure to specify either gte, lt, or both. | ||
| :param gte: Send messages to users who have been friends of yours for | ||
| at least the specified number of days | ||
| :type gte: str | ||
| :param lt: Send messages to users who have been friends of yours for | ||
| less than the specified number of days. | ||
| You can specify the same values as for the gte property. | ||
| :type lt: str | ||
| """ | ||
| super(SubscriptionPeriodFilter, self).__init__(**kwargs) | ||
|
|
||
| self.type = "subscriptionPeriod" | ||
| self.gte = gte | ||
| self.lt = lt | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| # Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
| # not use this file except in compliance with the License. You may obtain | ||
| # a copy of the License at | ||
| # | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| # License for the specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| """linebot.models.recipient module.""" | ||
|
|
||
| from __future__ import unicode_literals | ||
|
|
||
| from abc import ABCMeta | ||
|
|
||
| from future.utils import with_metaclass | ||
|
|
||
| from .base import Base | ||
|
|
||
|
|
||
| class Limit(with_metaclass(ABCMeta, Base)): | ||
| """Limit. | ||
|
|
||
| https://developers.line.biz/en/reference/messaging-api/#send-narrowcast-message | ||
|
|
||
| """ | ||
|
|
||
| def __init__(self, max=None, **kwargs): | ||
| """__init__ method. | ||
|
|
||
| :param kwargs: | ||
| """ | ||
| super(Limit, self).__init__(**kwargs) | ||
|
|
||
| self.max = max |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.