Skip to content

Commit

Permalink
close #2 add a function to get columns to query
Browse files Browse the repository at this point in the history
  • Loading branch information
ntuaha committed May 17, 2023
1 parent 413488e commit 13500f2
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ai-plugin.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"schema_version": "v1",
"schema_version": "v1.0.1",
"name_for_human": "OpenTaiwan",
"name_for_model": "OpenTaiwan",
"description_for_human": "A plugin to provide government information in Taiwan",
Expand Down
30 changes: 29 additions & 1 deletion api.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,34 @@ def getList():



@app.route('/customer_support/creditcard/columns', methods=['POST'])
def cs_cc_cols():
d = [
'No',
'Card Issuing Organization Name',
'Accounts receivable included in the revolving credit principal, interest commencement date for each account',
'Reprinting statement fee',
'Check payment dishonored fee',
'Clearance (agency) repayment certificate fee',
'Foreign transaction settlement fee',
'Lost report fee',
'Cash advance fee',
'Review of signed transaction slip fee',
'Penalty (late processing fee)',
'Overpayment refund fee',
'Customer service phone',
'Complaint phone',
'24-hour lost report phone',
'Head office address',
'Website',
'Data update year',
'Data update month',
'Data update day'
]
return jsonify(d)



@app.route('/customer_support/creditcard', methods=['POST'])
def cs():
if request.is_json:
Expand Down Expand Up @@ -103,7 +131,7 @@ def cs():
'Data update month',
'Data update day'
]
d = data_frame[data_frame['Card Issuing Organization Name'].isin(request.get_json()['names'])].to_dict('records')
d = data_frame[data_frame['Card Issuing Organization Name'].isin(request.get_json()['names'])][request.get_json()['columns']].to_dict('records')
return jsonify(d)


Expand Down
30 changes: 27 additions & 3 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ paths:
/customer_support/creditcard:
post:
operationId: cs_cc
summary: "Get Credit card fees and customer service phone numbers and other information in Taiwan By institutions. Before ask the function, you should ask function:lists to get official full names"
summary: "Get Credit card fees and customer service phone numbers and other information in Taiwan By institutions. Before call the function, you should call function:lists to get official full names and call function:cs_cc_cols to get columns"
responses:
"200":
description: OK
Expand All @@ -30,7 +30,7 @@ paths:
schema:
$ref: '#/components/schemas/cs_cc'
requestBody:
description: names of the institutions
description: names of the institutions and the column names of /customer_support/creditcard
content:
application/json:
schema:
Expand All @@ -42,6 +42,24 @@ paths:
type: string
description: the official full name
description: the official full names of institutions
columns:
type: array
items:
type: string
description: the column name of /customer_support/creditcard
description: the list of the column names of /customer_support/creditcard

/customer_support/creditcard/columns:
post:
operationId: cs_cc_cols
summary: "Get column names in /customer_support/creditcard"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/cs_cc_cols'

/lists:
post:
Expand Down Expand Up @@ -143,4 +161,10 @@ components:
type: array
items:
type: string
description: The list of official full names with the specific type
description: The list of official full names with the specific type
names:
cs_cc_cols:
type: array
items:
type: string
description: The list of the column names of /customer_support/creditcard

0 comments on commit 13500f2

Please sign in to comment.