-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
FeishuBitableAPI.py
206 lines (159 loc) · 10.4 KB
/
FeishuBitableAPI.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
from GET_APP_ACCESS_TOKEN import GET_APP_ACCESS_TOKEN
from GET_FIELD_INFO import GET_FIELD_INFO, GET_FIELD_ID, GET_FIELD_NAME
from GET_INFO_FROM_URL import GET_INFO_FROM_URL, GET_INFO_FROM_URL_JSON, GET_APPTOKEN_FROM_URL, GET_TABLEID_FROM_URL, GET_VIEWID_FROM_URL
from GET_LOGIN_CODE import GET_LOGIN_CODE
from GET_RECORD_ID import GET_RECORD_ID
from GET_RECORD import GET_RECORD
from GET_TABLE_ID import GET_TABLE_ID
from GET_TENANT_ACCESS_TOKEN import GET_TENANT_ACCESS_TOKEN
from GET_USER_ACCESS_TOKEN import GET_USER_ACCESS_TOKEN
from GET_VIEW_ID import GET_VIEW_ID
from LIST_FIELDS import LIST_FIELDS
from LIST_RECORDS import LIST_RECORDS
from LIST_TABLES import LIST_TABLES
from LIST_VIEWS import LIST_VIEWS
from REFRESH_USER_ACCESS_TOKEN import REFRESH_USER_ACCESS_TOKEN
from WRITE_APP_ACCESS_TOKEN import WRITE_APP_ACCESS_TOKEN
from WRITE_FIELD_INFO import WRITE_FIELD_INFO
from WRITE_INFO_FROM_URL import WRITE_INFO_FROM_URL
from WRITE_LOGIN_CODE import WRITE_LOGIN_CODE
from WRITE_RECORD_ID import WRITE_RECORD_ID
from WRITE_TABLE_ID import WRITE_TABLE_ID
from WRITE_TENANT_ACCESS_TOKEN import WRITE_TENANT_ACCESS_TOKEN
from WRITE_VIEW_ID import WRITE_VIEW_ID
from CREATE_FIELD import CREATE_FIELD
from CREATE_TABLE import CREATE_TABLE
from CHECK_FIELD_EXIST import CHECK_FIELD_EXIST
from CHECK_FIELD_EXIST_SQL import CHECK_FIELD_EXIST_SQL
from DELETE_FIELDS import DELETE_FIELD
from DELETE_RECORD import DELETE_RECORD
from BUILD_FIELD import BUILD_FIELD
from UPDATE_FIELD import UPDATE_FIELD
from UPDATE_RECORD import UPDATE_RECORD
from ADD_RECORDS_FROM_CSV import ADD_RECORDS_FROM_CSV
from CONVERSION_FIELDS import CONVERSION_FIELDS_HUMAN_TO_MACHINE, CONVERSION_FIELDS_MACHINE_TO_HUMAN
class FeishuBitableAPI:
def __init__(self):
pass
# 调用 ping 函数进行验证
def ping(self):
print("pong")
return "pong"
#GET_APP_ACCESS_TOKEN
def GET_APP_ACCESS_TOKEN(self, app_id=None, app_secret=None, config_file=None):
return GET_APP_ACCESS_TOKEN(app_id, app_secret, config_file)
#GET_FIELD_INFO
def GET_FIELD_INFO(self, field_name=None, field_id=None, app_token=None, table_id=None, view_id=None, page_token=None, page_size=None, config_file=None):
return GET_FIELD_INFO(field_name, field_id, app_token, table_id, view_id, page_token, page_size, config_file)
def GET_FIELD_ID(self, field_name, app_token=None, table_id=None, view_id=None, page_token=None, page_size=None, config_file=None):
return GET_FIELD_ID(field_name, app_token, table_id, view_id, page_token, page_size, config_file)
def GET_FIELD_NAME(self, field_id, app_token=None, table_id=None, view_id=None, page_token=None, page_size=None, config_file=None):
return GET_FIELD_NAME(field_id, app_token, table_id, view_id, page_token, page_size, config_file)
#GET_INFO_FROM_URL
def GET_INFO_FROM_URL(self, url):
return GET_INFO_FROM_URL(url)
def GGET_INFO_FROM_URL_JSON(self, url):
return GET_INFO_FROM_URL_JSON(url)
def GET_APPTOKEN_FROM_URL(self, url):
return GET_APPTOKEN_FROM_URL(url)
def GET_TABLEID_FROM_URL(self, url):
return GET_TABLEID_FROM_URL(url)
def GET_VIEWID_FROM_URL(self, url):
return GET_VIEWID_FROM_URL(url)
#GET_LOGIN_CODE
def GET_LOGIN_CODE(self, redirect_uri=None, app_id=None, config_file=None):
return GET_LOGIN_CODE(redirect_uri, app_id, config_file)
#GET_RECORD_ID
def GET_RECORD_ID(self, field_value, field_name=None, config_file=None):
return GET_RECORD_ID(field_value, field_name, config_file)
#GET_RECORD
def GET_RECORD(self, app_token=None, table_id=None, record_id=None, config_file=None):
return GET_RECORD(app_token, table_id, record_id, config_file)
#GET_TABLE_ID
def GET_TABLE_ID(self, name="数据表", app_token=None, user_access_token=None, page_size=None, page_token=None, config_file=None):
return GET_TABLE_ID(name, app_token, user_access_token, page_size, page_token, config_file)
#GET_TENANT_ACCESS_TOKEN
def GET_TENANT_ACCESS_TOKEN(self, app_id=None, app_secret=None, config_file=None):
return GET_TENANT_ACCESS_TOKEN(app_id, app_secret, config_file)
#GET_USER_ACCESS_TOKEN
def GET_USER_ACCESS_TOKEN(self, login_code=None, app_access_token=None, config_file=None):
return GET_USER_ACCESS_TOKEN(login_code, app_access_token, config_file)
#GET_VIEW_ID
def GET_VIEW_ID(self, view_name="默认视图", app_token=None, user_access_token=None, page_size=None, page_token=None, config_file=None):
return GET_VIEW_ID(view_name, app_token, user_access_token, page_size, page_token, config_file)
#LIST_FIELDS
def LIST_FIELDS(self, app_token=None, table_id=None, view_id=None, page_token=None, page_size=None, config_file=None):
return LIST_FIELDS(app_token, table_id, view_id, page_token, page_size, config_file)
#LIST_RECORDS
def LIST_RECORDS(self, app_token=None, table_id=None, page_token=None, page_size=None, config_file=None):
return LIST_RECORDS(app_token, table_id, page_token, page_size, config_file)
#LIST_TABLES
def LIST_TABLES(self, app_token=None, user_access_token=None, page_size=None, page_token=None, config_file=None):
return LIST_TABLES(app_token, user_access_token, page_size, page_token, config_file)
#LIST_VIEWS
def LIST_VIEWS(self, app_token=None, user_access_token=None, page_size=None, page_token=None, table_id=None, config_file=None):
return LIST_VIEWS(app_token, user_access_token, page_size, page_token, table_id, config_file)
#REFRESH_USER_ACCESS_TOKEN
def REFRESH_USER_ACCESS_TOKEN(self, app_access_token=None, refresh_token=None, config_file=None):
return REFRESH_USER_ACCESS_TOKEN(app_access_token, refresh_token, config_file)
#WRITE_APP_ACCESS_TOKEN
def WRITE_APP_ACCESS_TOKEN(self, app_id=None, app_secret=None, config_file=None):
return WRITE_APP_ACCESS_TOKEN(app_id, app_secret, config_file)
#WRITE_FIELD_INFO
def WRITE_FIELD_INFO(self, field_name=None, field_id=None, app_token=None, table_id=None, view_id=None, page_token=None, page_size=None, config_file=None):
return WRITE_FIELD_INFO(field_name, field_id, app_token, table_id, view_id, page_token, page_size, config_file)
#WRITE_INFO_FROM_URL
def WRITE_INFO_FROM_URL(self, url, config_file="feishu-config.ini"):
return WRITE_INFO_FROM_URL(url, config_file)
#WRITE_LOGIN_CODE
def WRITE_LOGIN_CODE(self, redirect_uri=None, app_id=None, config_file=None):
return WRITE_LOGIN_CODE(redirect_uri, app_id, config_file)
#WRITE_RECORD_ID
def WRITE_RECORD_ID(self, value, field_name=None, config_file=None):
return WRITE_RECORD_ID(value, field_name, config_file)
#WRITE_TABLE_ID
def WRITE_TABLE_ID(self, name, app_token=None, user_access_token=None, page_size=None, page_token=None, config_file=None):
return WRITE_TABLE_ID(name, app_token, user_access_token, page_size, page_token, config_file)
#WRITE_TENANT_ACCESS_TOKEN
def WRITE_TENANT_ACCESS_TOKEN(self, app_id=None, app_secret=None, config_file=None):
return WRITE_TENANT_ACCESS_TOKEN(app_id, app_secret, config_file)
#WRITE_VIEW_ID
def WRITE_VIEW_ID(self, view_name, app_token=None, user_access_token=None, page_size=None, page_token=None, config_file=None):
return WRITE_VIEW_ID(view_name, app_token, user_access_token, page_size, page_token, config_file)
#CREATE_FIELD
def CREATE_FIELD(self, field_name, field_type=None, app_token=None, table_id=None, config_file=None):
return CREATE_FIELD(field_name, field_type, app_token, table_id, config_file)
#CREATE_TABLE
def CREATE_TABLE(self, app_token=None, table_name=None, default_view_name=None, fields=None, config_file=None, fields_file=None):
return CREATE_TABLE(app_token, table_name, default_view_name, fields, config_file, fields_file)
#CHECK_FIELD_EXIST
def CHECK_FIELD_EXIST(self, app_token=None, table_id=None, view_id=None, page_token=None, page_size=None, csv_file=None, config_file=None):
return CHECK_FIELD_EXIST(app_token, table_id, view_id, page_token, page_size, csv_file, config_file)
def CHECK_FIELD_EXIST_CSV(self, app_token=None, table_id=None, view_id=None, page_token=None, page_size=None, csv_file=None, config_file=None):
return CHECK_FIELD_EXIST(app_token, table_id, view_id, page_token, page_size, csv_file, config_file)
#CHECK_FIELD_EXIST_SQL
def CHECK_FIELD_EXIST_SQL(self, app_token=None, table_id=None, view_id=None, page_token=None, page_size=None, config_file=None):
return CHECK_FIELD_EXIST_SQL(app_token, table_id, view_id, page_token, page_size, config_file)
#DELETE_FIELDS
def DELETE_FIELD(self, app_token=None, table_id=None, field_id=None, config_file=None):
return DELETE_FIELD(app_token, table_id, field_id, config_file)
#DELETE_RECORD
def DELETE_RECORD(self, app_token=None, table_id=None, record_id=None, config_file=None):
return DELETE_RECORD(app_token, table_id, record_id, config_file)
#BUILD_FIELD
def BUILD_FIELD(self, csv_file=None, config_file=None):
return BUILD_FIELD(csv_file, config_file)
#UPDATE_FIELD
def UPDATE_FIELD(self, app_token=None, table_id=None, field_id=None, field_name=None, field_type=None, config_file=None):
return UPDATE_FIELD(app_token, table_id, field_id, field_name, field_type, config_file)
#UPDATE_RECORD
def UPDATE_RECORD(self, app_token=None, table_id=None, record_id=None, fields=None, config_file=None):
return UPDATE_RECORD(app_token, table_id, record_id, fields, config_file)
#ADD_RECORDS_FROM_CSV
def ADD_RECORDS_FROM_CSV(self, app_token=None, table_id=None, view_id=None, page_token=None, page_size=None, csv_file=None, config_file=None, field_file=None):
return ADD_RECORDS_FROM_CSV(app_token, table_id, view_id, page_token, page_size, csv_file, config_file, field_file)
#CONVERSION_FIELDS
def CONVERSION_FIELDS_HUMAN_TO_MACHINE(self, app_token=None, table_id=None, view_id=None, page_token=None, page_size=None, config_file=None):
return CONVERSION_FIELDS_HUMAN_TO_MACHINE(app_token, table_id, view_id, page_token, page_size, config_file)
def CONVERSION_FIELDS_MACHINE_TO_HUMAN(self, app_token=None, table_id=None, view_id=None, page_token=None, page_size=None, config_file=None):
return CONVERSION_FIELDS_MACHINE_TO_HUMAN(app_token, table_id, view_id, page_token, page_size, config_file)