3232 AudienceGroup , ClickAudienceGroup , ImpAudienceGroup , GetAuthorityLevel , Audience ,
3333 CreateAudienceGroup
3434)
35- from .models .responses import Group , UserIds
35+ from .models .responses import Group , UserIds , RichMenuAliasResponse , RichMenuAliasListResponse
3636
3737
3838class LineBotApi (object ):
@@ -657,7 +657,7 @@ def leave_room(self, room_id, timeout=None):
657657 def get_rich_menu (self , rich_menu_id , timeout = None ):
658658 """Call get rich menu API.
659659
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
661661
662662 :param str rich_menu_id: ID of the rich menu
663663 :param timeout: (optional) How long to wait for the server
@@ -675,10 +675,49 @@ def get_rich_menu(self, rich_menu_id, timeout=None):
675675
676676 return RichMenuResponse .new_from_json_dict (response .json )
677677
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+
678717 def create_rich_menu (self , rich_menu , timeout = None ):
679718 """Call create rich menu API.
680719
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
682721
683722 :param rich_menu: Inquired to create a rich menu object.
684723 :type rich_menu: T <= :py:class:`linebot.models.rich_menu.RichMenu`
@@ -696,10 +735,51 @@ def create_rich_menu(self, rich_menu, timeout=None):
696735
697736 return response .json .get ('richMenuId' )
698737
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+
699779 def delete_rich_menu (self , rich_menu_id , timeout = None ):
700780 """Call delete rich menu API.
701781
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
703783
704784 :param str rich_menu_id: ID of an uploaded rich menu
705785 :param timeout: (optional) How long to wait for the server
@@ -713,10 +793,28 @@ def delete_rich_menu(self, rich_menu_id, timeout=None):
713793 timeout = timeout
714794 )
715795
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+
716814 def get_rich_menu_id_of_user (self , user_id , timeout = None ):
717815 """Call get rich menu ID of user API.
718816
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
720818
721819 :param str user_id: IDs of the user
722820 :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):
737835 def link_rich_menu_to_user (self , user_id , rich_menu_id , timeout = None ):
738836 """Call link rich menu to user API.
739837
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
741839
742840 :param str user_id: ID of the user
743841 :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):
782880 def unlink_rich_menu_from_user (self , user_id , timeout = None ):
783881 """Call unlink rich menu from user API.
784882
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
786884
787885 :param str user_id: ID of the user
788886 :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):
821919 def get_rich_menu_image (self , rich_menu_id , timeout = None ):
822920 """Call download rich menu image API.
823921
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
825923
826924 :param str rich_menu_id: ID of the rich menu with the image to be downloaded
827925 :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,
13001398 if audiences :
13011399 audiences = [Audience .new_from_json_dict (audience ) for audience in audiences ]
13021400 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+ )
13111409
13121410 return response .json
13131411
0 commit comments