32
32
AudienceGroup , ClickAudienceGroup , ImpAudienceGroup , GetAuthorityLevel , Audience ,
33
33
CreateAudienceGroup
34
34
)
35
- from .models .responses import Group , UserIds
35
+ from .models .responses import Group , UserIds , RichMenuAliasResponse , RichMenuAliasListResponse
36
36
37
37
38
38
class LineBotApi (object ):
@@ -657,7 +657,7 @@ def leave_room(self, room_id, timeout=None):
657
657
def get_rich_menu (self , rich_menu_id , timeout = None ):
658
658
"""Call get rich menu API.
659
659
660
- https://developers.line.me /en/docs /messaging-api/reference /#get-rich-menu
660
+ https://developers.line.biz /en/reference /messaging-api/#get-rich-menu
661
661
662
662
:param str rich_menu_id: ID of the rich menu
663
663
:param timeout: (optional) How long to wait for the server
@@ -675,10 +675,49 @@ def get_rich_menu(self, rich_menu_id, timeout=None):
675
675
676
676
return RichMenuResponse .new_from_json_dict (response .json )
677
677
678
+ def get_rich_menu_alias (self , rich_menu_alias_id = None , timeout = None ):
679
+ """Call get rich menu alias API.
680
+
681
+ https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-alias-by-id
682
+
683
+ :param str rich_menu_alias_id: ID of an uploaded rich menu alias.
684
+ :param timeout: (optional) How long to wait for the server
685
+ to send data before giving up, as a float,
686
+ or a (connect timeout, read timeout) float tuple.
687
+ Default is self.http_client.timeout
688
+ :type timeout: float | tuple(float, float)
689
+ :rtype: :py:class:`linebot.models.responses.RichMenuAliasResponse`
690
+ :return: RichMenuAliasResponse instance
691
+ """
692
+ response = self ._get (
693
+ '/v2/bot/richmenu/alias/{rich_menu_id}' .format (rich_menu_id = rich_menu_alias_id ),
694
+ timeout = timeout
695
+ )
696
+ return RichMenuAliasResponse .new_from_json_dict (response .json )
697
+
698
+ def get_rich_menu_alias_list (self , timeout = None ):
699
+ """Call get rich menu alias list API.
700
+
701
+ https://developers.line.biz/en/reference/messaging-api/#update-rich-menu-alias
702
+
703
+ :param timeout: (optional) How long to wait for the server
704
+ to send data before giving up, as a float,
705
+ or a (connect timeout, read timeout) float tuple.
706
+ Default is self.http_client.timeout
707
+ :type timeout: float | tuple(float, float)
708
+ :rtype: :py:class:`linebot.models.responses.RichMenuAliasListResponse`
709
+ :return: RichMenuAliasListResponse instance
710
+ """
711
+ response = self ._get (
712
+ '/v2/bot/richmenu/alias/list' ,
713
+ timeout = timeout
714
+ )
715
+ return RichMenuAliasListResponse .new_from_json_dict (response .json )
716
+
678
717
def create_rich_menu (self , rich_menu , timeout = None ):
679
718
"""Call create rich menu API.
680
719
681
- https://developers.line.me /en/docs /messaging-api/reference /#create-rich-menu
720
+ https://developers.line.biz /en/reference /messaging-api/#create-rich-menu
682
721
683
722
:param rich_menu: Inquired to create a rich menu object.
684
723
:type rich_menu: T <= :py:class:`linebot.models.rich_menu.RichMenu`
@@ -696,10 +735,51 @@ def create_rich_menu(self, rich_menu, timeout=None):
696
735
697
736
return response .json .get ('richMenuId' )
698
737
738
+ def create_rich_menu_alias (self , rich_menu_alias , timeout = None ):
739
+ """Call create rich menu alias API.
740
+
741
+ https://developers.line.biz/en/reference/messaging-api/#create-rich-menu-alias
742
+
743
+ :param rich_menu_alias: Inquired to create a rich menu alias object.
744
+ :type rich_menu_alias: T <= :py:class:`linebot.models.rich_menu.RichMenuAlias`
745
+ :param timeout: (optional) How long to wait for the server
746
+ to send data before giving up, as a float,
747
+ or a (connect timeout, read timeout) float tuple.
748
+ Default is self.http_client.timeout
749
+ :type timeout: float | tuple(float, float)
750
+ :rtype: str
751
+ :return: rich menu id
752
+ """
753
+ self ._post (
754
+ '/v2/bot/richmenu/alias' , data = rich_menu_alias .as_json_string (), timeout = timeout
755
+ )
756
+
757
+ def update_rich_menu_alias (self , rich_menu_alias_id , rich_menu_alias , timeout = None ):
758
+ """Call update rich menu alias API.
759
+
760
+ https://developers.line.biz/en/reference/messaging-api/#update-rich-menu-alias
761
+
762
+ :param str rich_menu_alias_id: ID of an uploaded rich menu alias.
763
+ :param rich_menu_alias: Inquired to create a rich menu alias object.
764
+ :type rich_menu_alias: T <= :py:class:`linebot.models.rich_menu.RichMenuAlias`
765
+ :param timeout: (optional) How long to wait for the server
766
+ to send data before giving up, as a float,
767
+ or a (connect timeout, read timeout) float tuple.
768
+ Default is self.http_client.timeout
769
+ :type timeout: float | tuple(float, float)
770
+ :rtype: str
771
+ :return: rich menu id
772
+ """
773
+ self ._post (
774
+ '/v2/bot/richmenu/alias/{rich_menu_id}' .format (rich_menu_id = rich_menu_alias_id ),
775
+ data = rich_menu_alias .as_json_string (),
776
+ timeout = timeout
777
+ )
778
+
699
779
def delete_rich_menu (self , rich_menu_id , timeout = None ):
700
780
"""Call delete rich menu API.
701
781
702
- https://developers.line.me /en/docs /messaging-api/reference /#delete-rich-menu
782
+ https://developers.line.biz /en/reference /messaging-api/#delete-rich-menu
703
783
704
784
:param str rich_menu_id: ID of an uploaded rich menu
705
785
:param timeout: (optional) How long to wait for the server
@@ -713,10 +793,28 @@ def delete_rich_menu(self, rich_menu_id, timeout=None):
713
793
timeout = timeout
714
794
)
715
795
796
+ def delete_rich_menu_alias (self , rich_menu_alias_id , timeout = None ):
797
+ """Call delete rich menu alias API.
798
+
799
+ https://developers.line.biz/en/reference/messaging-api/#delete-rich-menu-alias
800
+
801
+ :param str rich_menu_alias_id: ID of an uploaded rich menu alias.
802
+ :param timeout: (optional) How long to wait for the server
803
+ to send data before giving up, as a float,
804
+ or a (connect timeout, read timeout) float tuple.
805
+ Default is self.http_client.timeout
806
+ :type timeout: float | tuple(float, float)
807
+ """
808
+ self ._delete (
809
+ '/v2/bot/richmenu/alias/{rich_menu_alias_id}' .format (
810
+ rich_menu_alias_id = rich_menu_alias_id ),
811
+ timeout = timeout
812
+ )
813
+
716
814
def get_rich_menu_id_of_user (self , user_id , timeout = None ):
717
815
"""Call get rich menu ID of user API.
718
816
719
- https://developers.line.me /en/docs /messaging-api/reference /#get-rich-menu-id-of-user
817
+ https://developers.line.biz /en/reference /messaging-api/#get-rich-menu-id-of-user
720
818
721
819
:param str user_id: IDs of the user
722
820
:param timeout: (optional) How long to wait for the server
@@ -737,7 +835,7 @@ def get_rich_menu_id_of_user(self, user_id, timeout=None):
737
835
def link_rich_menu_to_user (self , user_id , rich_menu_id , timeout = None ):
738
836
"""Call link rich menu to user API.
739
837
740
- https://developers.line.me /en/docs /messaging-api/reference /#link-rich-menu-to-user
838
+ https://developers.line.biz /en/reference /messaging-api/#link-rich-menu-to-user
741
839
742
840
:param str user_id: ID of the user
743
841
:param str rich_menu_id: ID of an uploaded rich menu
@@ -782,7 +880,7 @@ def link_rich_menu_to_users(self, user_ids, rich_menu_id, timeout=None):
782
880
def unlink_rich_menu_from_user (self , user_id , timeout = None ):
783
881
"""Call unlink rich menu from user API.
784
882
785
- https://developers.line.me /en/docs /messaging-api/reference/ #unlink-rich-menu-from-user
883
+ https://developers.line.biz /en/reference /messaging-api#unlink-rich-menu-from-user
786
884
787
885
:param str user_id: ID of the user
788
886
:param timeout: (optional) How long to wait for the server
@@ -821,7 +919,7 @@ def unlink_rich_menu_from_users(self, user_ids, timeout=None):
821
919
def get_rich_menu_image (self , rich_menu_id , timeout = None ):
822
920
"""Call download rich menu image API.
823
921
824
- https://developers.line.me /en/docs /messaging-api/reference/ #download-rich-menu-image
922
+ https://developers.line.biz /en/reference /messaging-api#download-rich-menu-image
825
923
826
924
:param str rich_menu_id: ID of the rich menu with the image to be downloaded
827
925
:param timeout: (optional) How long to wait for the server
@@ -1300,14 +1398,14 @@ def add_audiences_to_audience_group(self, audience_group_id, audiences,
1300
1398
if audiences :
1301
1399
audiences = [Audience .new_from_json_dict (audience ) for audience in audiences ]
1302
1400
response = self ._put (
1303
- '/v2/bot/audienceGroup/upload' ,
1304
- data = json .dumps ({
1305
- "audienceGroupId" : audience_group_id ,
1306
- "audiences" : [audience .as_json_dict () for audience in audiences ],
1307
- "uploadDescription" : upload_description ,
1308
- }),
1309
- timeout = timeout
1310
- )
1401
+ '/v2/bot/audienceGroup/upload' ,
1402
+ data = json .dumps ({
1403
+ "audienceGroupId" : audience_group_id ,
1404
+ "audiences" : [audience .as_json_dict () for audience in audiences ],
1405
+ "uploadDescription" : upload_description ,
1406
+ }),
1407
+ timeout = timeout
1408
+ )
1311
1409
1312
1410
return response .json
1313
1411
0 commit comments