@@ -5,6 +5,25 @@ def run_command(command):
5
5
output = subprocess .check_output (command , shell = True )
6
6
return output .decode ('utf-8' ).strip ()
7
7
8
+
9
+ def rewrite_liff_function_name_backward_compats ():
10
+ for fname in ['liff.py' , 'async_liff.py' ]:
11
+ with open (f'linebot/v3/liff/api/{ fname } ' , 'a' ) as fp :
12
+ fp .write ("\n \n " )
13
+ for (orig , cur ) in [('liff_v1_apps_get' , 'get_all_liff_apps' ),
14
+ ('liff_v1_apps_get_with_http_info' , 'get_all_liff_apps_with_http_info' ),
15
+ ('liff_v1_apps_post' , 'add_liff_app' ),
16
+ ('liff_v1_apps_post_with_http_info' , 'add_liff_app_with_http_info' ),
17
+ ('liff_v1_apps_liff_id_put' , 'update_liff_app' ),
18
+ ('liff_v1_apps_liff_id_put_with_http_info' , 'update_liff_app_with_http_info' ),
19
+ ('liff_v1_apps_liff_id_delete' , 'delete_liff_app' ),
20
+ ('liff_v1_apps_liff_id_delete_with_http_info' , 'delete_liff_app_with_http_info' )]:
21
+ fp .write (f"\n " )
22
+ fp .write (f" def { orig } (self, *args, **kwargs):\n " )
23
+ fp .write (f" import warnings\n " )
24
+ fp .write (f" warnings.warn('{ orig } was deprecated. use { cur } instead.', DeprecationWarning)\n " )
25
+ fp .write (f" return self.{ cur } (*args, **kwargs)\n " )
26
+
8
27
def main ():
9
28
10
29
os .chdir ("generator" )
@@ -68,5 +87,10 @@ def main():
68
87
'''
69
88
run_command (command )
70
89
90
+
91
+ ## TODO(v4): Delete this workaround in v4. This workaround keeps backward compatibility.
92
+ rewrite_liff_function_name_backward_compats ()
93
+
94
+
71
95
if __name__ == "__main__" :
72
96
main ()
0 commit comments