-
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 6 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,133 @@ | ||
| # -*- 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): | ||
| """Demographic. | ||
|
|
||
| https://developers.line.biz/en/reference/messaging-api/#narrowcast-demographic-filter | ||
|
|
||
| A demogrphic filter is the top-level structure of a demographic element. | ||
| """ | ||
|
|
||
| def __init__(self, condition=None, **kwargs): | ||
| """__init__ method. | ||
|
|
||
| :param kwargs: | ||
| """ | ||
| super(DemographicFilter, self).__init__(**kwargs) | ||
|
|
||
| self.demographic = condition | ||
|
|
||
|
|
||
| class GenderFilter(Filter): | ||
| """GenderFilter | ||
| """ | ||
|
|
||
| def __init__(self, one_of=[], **kwargs): | ||
| """__init__ method. | ||
|
|
||
| :param header: Style of the header block | ||
| :type header: :py:class:`linebot.models.flex_message.BlockStyle` | ||
| """ | ||
| 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. | ||
|
|
||
| """ | ||
| 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. | ||
|
|
||
| """ | ||
| super(AreaFilter, self).__init__(**kwargs) | ||
|
|
||
| self.type = "area" | ||
| self.one_of = one_of | ||
|
|
||
|
|
||
| class AgeFilter(Filter): | ||
| """AgeFilter | ||
| """ | ||
|
|
||
| def __init__(self, gte=None, lt=None, **kwargs): | ||
| """__init__ method. | ||
|
|
||
| """ | ||
| super(AgeFilter, self).__init__(**kwargs) | ||
|
|
||
| self.type = "age" | ||
| self.gte = gte | ||
| self.lt = lt | ||
|
|
||
|
|
||
| class SubscriptionPeriodFilter(Filter): | ||
| """SubscriptionPeriodFilter | ||
| """ | ||
|
|
||
| def __init__(self, gte=None, lt=None, **kwargs): | ||
| """__init__ method. | ||
|
|
||
| """ | ||
| 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 |
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,86 @@ | ||
| # -*- 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 Operator(with_metaclass(ABCMeta, Base)): | ||
| """Operator. | ||
|
|
||
| https://developers.line.biz/en/reference/messaging-api/#narrowcast-demographic-filter | ||
|
|
||
| A operator is the top-level structure of a demographic element. | ||
| """ | ||
|
|
||
| def __init__(self, **kwargs): | ||
| """__init__ method. | ||
|
|
||
| :param kwargs: | ||
| """ | ||
| super(Operator, self).__init__(**kwargs) | ||
|
|
||
| self.type = "operator" | ||
|
|
||
|
|
||
| class OpAND(Operator): | ||
clsung marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| """OpAND | ||
| """ | ||
|
|
||
| def __init__(self, *args, **kwargs): | ||
| """__init__ method. | ||
|
|
||
| :param args: | ||
| :param kwargs: | ||
| """ | ||
| super(OpAND, self).__init__(**kwargs) | ||
|
|
||
| setattr(self, 'and', args) | ||
|
|
||
|
|
||
| class OpOR(Operator): | ||
| """OpOR | ||
| """ | ||
|
|
||
| def __init__(self, *args, **kwargs): | ||
| """__init__ method. | ||
|
|
||
| :param args: | ||
| :param kwargs: | ||
| """ | ||
| super(OpOR, self).__init__(**kwargs) | ||
|
|
||
| setattr(self, 'or', args) | ||
|
|
||
|
|
||
| class OpNOT(Operator): | ||
| """OpNOT | ||
| """ | ||
|
|
||
| def __init__(self, arg, **kwargs): | ||
| """__init__ method. | ||
|
|
||
| :param arg: | ||
| :param kwargs: | ||
| """ | ||
| super(OpNOT, self).__init__(**kwargs) | ||
|
|
||
| setattr(self, 'not', arg) | ||
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.