@mongoui/skills 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mongoui/skills",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "CLI for installing product skills into AI tools",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  name: glink-hotel-api
3
- description: Integrate with the Glink hotel OpenAPI exposed through the Open Platform runtime gateway. Use when an AI coding assistant needs to read, verify, explain, test, or implement against `docs/swagger/glink-api.json` or Glink route code; choose Glink hotel endpoints; generate or debug `X-OP-*` signatures; explain sandbox or production credential issuance/reset; or handle Chinese/English requests about Glink 酒店 static data, hotel search, hotel info, product detail, booking, payment, order, cancel, order status push/callback, checkout, invoice, and balance workflows.
3
+ description: Integrate with the Glink hotel OpenAPI exposed through the Open Platform runtime gateway. Use when Codex needs to read, verify, explain, test, or implement against `docs/swagger/glink-api.json` or Glink route code; choose Glink hotel endpoints; generate or debug `X-OP-*` signatures; explain sandbox or production credential issuance/reset; or drive Chinese/English requests about Glink hotel static data, hotel search, hotel info, product detail, booking, payment, order, cancel, order status push/callback, checkout, invoice, and balance workflows.
4
4
  ---
5
5
 
6
- # Glink Hotel API Skill
6
+ # Glink OpenAPI Integration
7
7
 
8
8
  ## Quick Start
9
9
 
@@ -12,6 +12,8 @@ Use this skill when the task is "call Glink through the open platform".
12
12
  Start with the smallest current source that answers the request:
13
13
 
14
14
  - Prefer the repository source of truth when it exists: `docs/swagger/glink-api.json`, route handlers, DTOs, and tests.
15
+ - Treat the current DHub shared document and `docs/swagger/glink-api.json` as the route source of truth; older bundled notes can be stale.
16
+ - Customer-facing explanations should use only our short interface paths such as `/search/destination`, `/booking/createOrder`, and `/order/orderDetail`.
15
17
  - Read `references/auth-and-credentials.md` for signing, headers, key acquisition, reset, and auth troubleshooting.
16
18
  - Read `references/api-workflows.md` for hotel search, booking, cancel, checkout, invoice, and balance workflows.
17
19
  - Read `references/endpoint-index.md` for a compact endpoint map and platform-managed field caveats, then verify fragile fields against the current swagger or code.
@@ -23,53 +25,128 @@ Follow this workflow:
23
25
 
24
26
  1. Confirm the environment: `sandbox` and `production` credentials are separate.
25
27
  2. Confirm whether the user is asking for documentation, code changes, local smoke testing, or live API calls.
26
- 3. Confirm the public path under `/openapi/v1/glink/*`.
27
- 4. Build the minimum valid request body from swagger/code first, using `references/endpoint-index.md` as navigation.
28
- 5. Sign the exact public path, sorted query string, and raw body bytes with the platform secret.
29
- 6. Evaluate both HTTP status and response envelope `code`, not HTTP status alone.
30
-
31
- When the user asks for the Open Platform Glink hotel onboarding or booking flow, apply this required sequence:
32
-
33
- 1. Static bootstrap: `queryCityList` -> `queryHotelIdList` by city -> `queryHotelInfo` for hotel/room static data, then persist mapping locally.
34
- 2. Static maintenance: run `queryHotelIncrement`, then call `queryHotelInfo` for changed hotel IDs and update or disconnect local mappings when needed.
35
- 3. List pricing: run `queryHotelLowestPrice` for mapped hotels, normally as a daily job after the Glink price refresh window, and use it as list-page display/reference data.
36
- 4. Detail pricing: before `queryProductDetail`, check the local saleable hotel ID cache; skip hotels not in the saleable list. Use `bookType=1` products as bookable candidates.
37
- 5. Booking: call `checkBooking` with the actual room count before entering or submitting the order flow; call it again before `createOrder` when the local order is ready.
38
- 6. Payment and confirmation: after `createOrder`, call `payOrder` only after local customer payment succeeds or the platform has decided the Glink order should be confirmed.
39
- 7. Confirmation result: treat Glink order operation push/callback as primary and idempotent; use `queryOrderDetail` only as low-frequency compensation before final confirmation or cancellation.
40
- 8. Cancellation: call `cancelOrder` for unpaid timeout such as 30 minutes or customer cancellation. If the cancellation API returns success, update the local order and do not keep polling for another status push.
41
-
42
- Do not violate these rules:
28
+ 3. Confirm the interface path, for example `/search/destination` or `/booking/productDetails`.
29
+ 4. Choose the integration mode before recommending a flow:
30
+ - Standard API Integration: for partners who build and maintain a local saleable hotel catalog and room mapping.
31
+ - Lightweight Integration Flow: for faster launch with destination-driven hotel discovery and less pre-synced catalog data.
32
+ 5. Keep customer-facing docs and answers aligned to our short interface paths only, such as `/search/destination`, `/booking/productDetails`, and `/order/orderDetail`.
33
+ 6. For actual gateway signing/calls, the runtime public path is the short path prefixed with `/openapi/v1/glink`. Keep that detail in tooling/auth guidance, not in customer workflow names.
34
+ 7. Build the minimum valid request body from swagger/code first, using `references/endpoint-index.md` as navigation.
35
+ 8. Sign the exact runtime public path, sorted query string, and raw body bytes with the platform secret.
36
+ 9. Evaluate both HTTP status and response envelope `code`, not HTTP status alone.
37
+
38
+ When the user asks for the Open Platform Glink hotel onboarding or booking flow, choose one of these two approved integration modes and use the mandatory interface sets below.
39
+
40
+ ## Standard API Integration
41
+
42
+ Mandatory interfaces:
43
+
44
+ | No. | Interface | Method | Path |
45
+ | --- | --- | --- | --- |
46
+ | 1 | Available Hotel ID List | POST | `/search/hotelIdList` |
47
+ | 2 | Query Hotel Basic Information | POST | `/hotel/detail` |
48
+ | 3 | Hotel Real-Time Product Query | POST | `/booking/productDetails` |
49
+ | 4 | Trial Booking / Availability Check | POST | `/booking/availabilityCheck` |
50
+ | 5 | Create Order | POST | `/booking/createOrder` |
51
+ | 6 | Order Payment | POST | `/booking/payOrder` |
52
+ | 7 | Cancel Order | POST | `/order/cancelOrder` |
53
+ | 8 | Order Detail Query | POST | `/order/orderDetail` |
54
+
55
+ Use this sequence by default:
56
+
57
+ 1. Static bootstrap: `/search/hotelIdList` -> `/hotel/detail` for hotel/room static data, then persist local hotel and room mappings.
58
+ 2. Optional foundational data: `/region/countries` and `/region/cities` can be used to build country/city mappings against the FCG hotel system.
59
+ 3. Static maintenance: run `/hotel/increment`, then call `/hotel/detail` for changed hotel IDs and update or disconnect local mappings when needed.
60
+ 4. List pricing: run `/hotel/lowestPrice` for mapped hotels as list-page display/reference data. The next 30 days of daily lowest prices are updated every day; recommend updating daily after 5:00 AM.
61
+ 5. Detail pricing: call `/booking/productDetails` in real time when the customer enters the hotel detail or booking path. Before querying, check the local saleable hotel ID cache and skip hotels not in the saleable list. Prefer `bookType=1` products as bookable candidates.
62
+ 6. Booking pre-check: when the user clicks Book, call `/booking/availabilityCheck` with the actual room count to confirm the product is bookable before entering the order form.
63
+ 7. Submit order: call `/booking/availabilityCheck` again immediately before `/booking/createOrder`; if still bookable, call `/booking/createOrder`.
64
+ 8. Payment and confirmation: after `/booking/createOrder`, call `/booking/payOrder` only after local customer payment succeeds or when the platform has decided the Glink order should be confirmed.
65
+ 9. Confirmation result: treat `/notify/orderStatus` as the primary confirmation channel and make the callback idempotent. Use `/order/orderDetail` only as low-frequency compensation if no confirmation result is received.
66
+ 10. Cancellation: call `/order/cancelOrder` for unpaid timeout such as 30 minutes or active customer cancellation. If the cancellation API returns success, update the local order and stop polling.
67
+
68
+ ## Lightweight Integration Flow
69
+
70
+ Mandatory interfaces:
71
+
72
+ | No. | Interface | Method | Path |
73
+ | --- | --- | --- | --- |
74
+ | 1 | Destination Query | POST | `/search/destination` |
75
+ | 2 | Get Hotel Filter Conditions | POST | `/search/hotelFilters` |
76
+ | 3 | Query Hotel List by Destination | POST | `/search/hotelList` |
77
+ | 4 | Query Hotel Basic Information | POST | `/hotel/detail` |
78
+ | 5 | Query Hotel Basic Information Increment | POST | `/hotel/increment` |
79
+ | 6 | Query Hotel Images | POST | `/hotel/images` |
80
+ | 7 | Hotel Real-Time Product Query | POST | `/booking/productDetails` |
81
+ | 8 | Trial Booking / Availability Check | POST | `/booking/availabilityCheck` |
82
+ | 9 | Create Order | POST | `/booking/createOrder` |
83
+ | 10 | Order Payment | POST | `/booking/payOrder` |
84
+ | 11 | Cancel Order | POST | `/order/cancelOrder` |
85
+ | 12 | Order Detail Query | POST | `/order/orderDetail` |
86
+ | 13 | Order Status Push | POST | `/notify/orderStatus` |
87
+
88
+ Use this sequence by default:
89
+
90
+ 1. Destination bootstrap: call `/search/destination` to obtain the destination ID.
91
+ 2. Discovery: optionally call `/search/hotelFilters` for filter conditions, then call `/search/hotelList` with the destination ID to obtain matching hotels.
92
+ 3. Display hydration: call `/hotel/detail` for hotel static information and `/hotel/images` for images used by the client.
93
+ 4. Static maintenance: use `/hotel/increment` to discover changed hotel static information when local caching is used.
94
+ 5. List pricing: optionally call `/hotel/lowestPrice` as list-page price reference when the product experience needs a stable starting price.
95
+ 6. Detail pricing: call `/booking/productDetails` in real time when the customer enters the hotel detail or booking path. Prefer `bookType=1` products.
96
+ 7. Booking pre-check: when the user clicks Book, call `/booking/availabilityCheck` with the actual room count before entering the order form.
97
+ 8. Submit order: call `/booking/availabilityCheck` again immediately before `/booking/createOrder`; if still bookable, call `/booking/createOrder`.
98
+ 9. Payment and confirmation: after `/booking/createOrder`, call `/booking/payOrder` only after local customer payment succeeds or when the platform has decided the Glink order should be confirmed.
99
+ 10. Confirmation result: treat `/notify/orderStatus` as the primary confirmation channel and make the callback idempotent. Use `/order/orderDetail` only as low-frequency compensation if no confirmation result is received.
100
+ 11. Cancellation: call `/order/cancelOrder` for unpaid timeout such as 30 minutes or active customer cancellation. If the cancellation API returns success, update the local order and stop polling.
101
+
102
+ ## Mandatory Order Placement Flow
103
+
104
+ Use these calls for order placement in both integration modes:
105
+
106
+ 1. `/hotel/lowestPrice`: Query the lowest price of mapped hotels as a reference for whether to display the hotel in the local hotel list.
107
+ 2. `/booking/productDetails`: Called in real time when a customer enters the hotel details or booking path.
108
+ 3. `/booking/availabilityCheck`: Validate whether a bookable product can be reserved, passing in the actual number of rooms to book.
109
+ 4. `/booking/createOrder`: Called after trial booking passes and the local order is successfully created. It is recommended to perform another trial booking validation before calling.
110
+ 5. `/booking/payOrder`: Called after the local customer pays successfully, or when the order needs confirmation, to notify FCG to process the order.
111
+ 6. `/order/cancelOrder`: Called when the order is unpaid for 30 minutes or the customer actively cancels. If the interface returns success, update the local order and stop polling.
112
+ 7. `/notify/orderStatus`: After payment notification, FCG processes the order and pushes the status. This callback must support idempotency.
113
+ 8. `/order/orderDetail`: If no confirmation result is received after payment, periodic queries can be used as compensation. Frequent polling is unnecessary; stop querying once the order is confirmed or canceled.
114
+
115
+ ## Do Not Violate
43
116
 
44
117
  - Always send `X-OP-App-Key`, `X-OP-Timestamp`, `X-OP-Nonce`, and `X-OP-Sign`.
45
- - Never send Glink-side `partnerCode`, `signature`, `requestType`, or Glink-side `timestamp`.
46
- - Never wrap the payload in Glink-style `header` or `businessRequest`; send only business fields.
118
+ - Send only the business fields defined by our Open Platform swagger.
119
+ - For adapter code, keep internal route configuration and customer-facing interface paths clearly separated.
47
120
  - Never invent credentials or secrets. Use explicit user-provided values or environment variables.
48
121
  - Treat `code=SUCCESS` as success. Treat `code=SUPPLIER_BIZ_ERROR` as a business failure even if HTTP status is `200`.
49
122
  - Keep timestamp skew within `+-5` minutes.
50
123
  - Reuse of the same nonce under the same app key can trigger `NONCE_REPLAY`.
51
- - If a swagger schema still shows Glink-managed fields as required, follow the route description first and omit those platform-managed downstream fields from the client payload.
124
+ - If a swagger schema still shows Glink-managed fields as required, follow the route description first and omit those platform-managed internal fields from the client payload.
125
+ - If external reference material and the current swagger/code use different names, use our current short interface path as the source of truth.
52
126
  - Do not frequently poll order status. Stop polling once the order is confirmed or canceled; rely on idempotent push/callback handling as the source of truth for confirmation progress.
53
127
  - Do not query real-time products for hotels outside the cached saleable hotel list; it wastes integration quota and usually returns no useful sellable data.
128
+ - For Standard API Integration, recommend local saleable hotel cache maintenance. For Lightweight Integration Flow, recommend the smaller destination-driven flow unless the user explicitly needs full static catalog sync.
54
129
 
55
130
  ## Typical Requests
56
131
 
57
132
  Use these patterns by default:
58
133
 
59
- - Static data: city, country, district, business area, and brand lookup calls
60
- - Catalog sync: `queryCityList` -> `queryHotelIdList` -> `queryHotelInfo`; maintain with `queryHotelIncrement` -> `queryHotelInfo`
61
- - Search and booking: mapped saleable hotel IDs -> `queryHotelLowestPrice` for list display -> `queryProductDetail` for hotel detail -> `checkBooking` -> optional second `checkBooking` -> `createOrder` -> `payOrder` -> order push/callback primary, `queryOrderDetail` as compensation
62
- - Order aftercare: `cancelOrder`, Glink order push/callback, `queryOrderDetail`, `queryOrderCheckDetailInfo`, `checkoutApply`, `queryCheckoutDetail`
63
- - Finance: `createInvoice`, `queryCreditBalance`
134
+ - Static data and filters: `/region/countries`, `/region/cities`, `/region/popularCities`, `/region/businesses`, `/region/districts`, `/region/pois`, and `/hotel/groupBrand`.
135
+ - Standard catalog sync: `/search/hotelIdList` -> `/hotel/detail`; maintain with `/hotel/increment` -> `/hotel/detail`.
136
+ - Lightweight discovery: `/search/destination` -> `/search/hotelFilters` -> `/search/hotelList` -> `/hotel/detail`/`/hotel/images` -> `/booking/productDetails`.
137
+ - Search and booking: `/hotel/lowestPrice` for list display/reference -> `/booking/productDetails` for hotel detail -> `/booking/availabilityCheck` -> optional second `/booking/availabilityCheck` -> `/booking/createOrder` -> `/booking/payOrder` -> order push/callback primary, `/order/orderDetail` as compensation.
138
+ - Order aftercare: `/order/cancelOrder`, order push/callback, `/order/orderDetail`, `/order/checkInDetail`, `/order/checkoutRequest`, `/order/checkoutDetail`.
139
+ - Finance: `/order/invoiceRequest`, `/order/invoiceInfo`, `/search/creditBalance`.
64
140
 
65
141
  ## Output Expectations
66
142
 
67
143
  When answering or coding with this skill:
68
144
 
69
145
  - Prefer concrete request examples over abstract summaries.
70
- - Name the source used when the current swagger/code and bundled references disagree.
146
+ - Name the source used when the current swagger/code and bundled references disagree, but keep customer-facing answers on our short interface paths.
147
+ - State whether the recommendation follows Standard API Integration or Lightweight Integration Flow when giving onboarding advice.
71
148
  - State which environment the credential belongs to.
72
149
  - State whether the payload should contain only business fields.
73
150
  - Call out Glink-managed field residue in the swagger when relevant.
74
151
  - Call out auth failures with the likely root cause and the exact header or field to inspect.
75
- - For code changes, keep Glink downstream auth and platform gateway auth clearly separated.
152
+ - For code changes, keep internal Glink integration auth and platform gateway auth clearly separated.
@@ -1,77 +1,124 @@
1
1
  # Glink API Workflows
2
2
 
3
- ## Static Data
3
+ Source of truth:
4
4
 
5
- Use these calls to build hotel search prerequisites:
5
+ - Current Open Platform route and payload source: `docs/swagger/glink-api.json`.
6
+ - Customer-facing explanations should use only our short interface paths, such as `/search/destination`, `/booking/createOrder`, and `/order/orderDetail`.
6
7
 
7
- - `glink.queryCountryList`
8
- - `glink.queryCityList`
9
- - `glink.queryHotCityList`
10
- - `glink.queryDistrictList`
11
- - `glink.queryDistrictAndBusiness`
12
- - `glink.queryBusinessList`
13
- - `glink.queryHotelPlateList`
14
- - `glink.queryCityAndHotelByKeyword`
8
+ ## Standard API Integration
15
9
 
16
- These APIs usually feed city selection, district filters, brand filters, and keyword suggestions.
10
+ Use this mode when the integrator will maintain a local saleable hotel catalog, hotel-room mapping, and daily price refresh jobs.
17
11
 
18
- For the required Open Platform Glink onboarding flow, build local hotel and room mapping in this order:
12
+ Mandatory interfaces:
19
13
 
20
- 1. `glink.queryCityList`
21
- - Get Glink city codes used by the platform hotel flow.
22
- 2. `glink.queryHotelIdList`
23
- - Use the city code to fetch the account's saleable hotel ID list and cache it locally.
24
- 3. `glink.queryHotelInfo`
25
- - Fetch hotel and room static data for the cached hotel IDs. Persist only the fields needed for local hotel and room mapping.
26
- 4. `glink.queryHotelIncrement`
27
- - Periodically fetch changed hotel IDs, including added, updated, or deleted hotels.
28
- 5. `glink.queryHotelInfo`
29
- - Rehydrate changed hotel IDs and decide whether local mappings should be updated or disconnected.
14
+ | No. | Interface | Method | Path |
15
+ | --- | --- | --- | --- |
16
+ | 1 | Available Hotel ID List | POST | `/search/hotelIdList` |
17
+ | 2 | Query Hotel Basic Information | POST | `/hotel/detail` |
18
+ | 3 | Hotel Real-Time Product Query | POST | `/booking/productDetails` |
19
+ | 4 | Trial Booking / Availability Check | POST | `/booking/availabilityCheck` |
20
+ | 5 | Create Order | POST | `/booking/createOrder` |
21
+ | 6 | Order Payment | POST | `/booking/payOrder` |
22
+ | 7 | Cancel Order | POST | `/order/cancelOrder` |
23
+ | 8 | Order Detail Query | POST | `/order/orderDetail` |
30
24
 
31
- ## Hotel Search And Product Selection
25
+ ## Static Data
32
26
 
33
- Use this sequence for discovery and pricing:
27
+ Use these calls to build hotel search prerequisites:
34
28
 
35
- 1. `glink.getDestination` or `glink.queryCityAndHotelByKeyword`
36
- - Resolve the destination or keyword to a city or hotel scope.
37
- 2. `glink.getHotelSearch` or `glink.findHotelList`
38
- - Search hotels using city, dates, room count, and optional filters.
39
- 3. `glink.queryHotelLowestPrice`
40
- - Pull summary pricing for selected hotel IDs.
41
- 4. `glink.queryProductDetail`
42
- - Read real-time sellable products for a selected hotel and stay range.
43
- 5. `glink.queryHotelInfo`, `glink.queryHotelImage`, or `glink.queryHotelMainInfoByHotelIds`
44
- - Hydrate hotel details for display or validation.
29
+ - `/region/countries`
30
+ - `/region/cities`
31
+ - `/region/popularCities`
32
+ - `/region/districts`
33
+ - `/region/pois`
34
+ - `/region/businesses`
35
+ - `/hotel/groupBrand`
45
36
 
46
- Use `queryHotelAllList`, `queryHotelIdList`, and `queryHotelIncrement` when synchronizing hotel catalogs rather than serving live booking UX.
37
+ These APIs usually feed country/city selection, district filters, POI filters, business area filters, and brand filters.
47
38
 
48
- For the Open Platform Glink flow, prefer the local mapped catalog over broad live search during booking:
39
+ For Standard API Integration, build local hotel and room mapping in this order:
49
40
 
50
- - Use `glink.queryHotelLowestPrice` for mapped hotels to refresh daily starting prices. It is list-page reference/display data and should normally be refreshed once daily after the Glink price refresh window, for example after 05:00.
51
- - Before calling `glink.queryProductDetail`, verify that the hotel is still in the cached saleable hotel ID list. Do not query products for hotels outside the saleable list.
52
- - Use `glink.queryProductDetail` when the customer enters a hotel detail or booking path. Treat products with `bookType=1` as bookable candidates, then confirm with `checkBooking`.
41
+ 1. `/search/hotelIdList`
42
+ - Fetch the account's saleable hotel ID list and cache it locally.
43
+ 2. `/hotel/detail`
44
+ - Fetch hotel and room static data for the cached hotel IDs. Persist only the fields needed for local hotel and room mapping.
45
+ 3. `/hotel/increment`
46
+ - Periodically fetch changed hotel IDs, including added, updated, or deleted hotels.
47
+ 4. `/hotel/detail`
48
+ - Rehydrate changed hotel IDs and decide whether local mappings should be updated or disconnected.
49
+ 5. `/hotel/lowestPrice`
50
+ - Refresh mapped-hotel starting prices daily, normally after 05:00.
51
+
52
+ ## Lightweight Integration Flow
53
+
54
+ Use this mode when the user wants a faster launch with less up-front static sync and a destination-driven hotel discovery path.
55
+
56
+ Mandatory interfaces:
57
+
58
+ | No. | Interface | Method | Path |
59
+ | --- | --- | --- | --- |
60
+ | 1 | Destination Query | POST | `/search/destination` |
61
+ | 2 | Get Hotel Filter Conditions | POST | `/search/hotelFilters` |
62
+ | 3 | Query Hotel List by Destination | POST | `/search/hotelList` |
63
+ | 4 | Query Hotel Basic Information | POST | `/hotel/detail` |
64
+ | 5 | Query Hotel Basic Information Increment | POST | `/hotel/increment` |
65
+ | 6 | Query Hotel Images | POST | `/hotel/images` |
66
+ | 7 | Hotel Real-Time Product Query | POST | `/booking/productDetails` |
67
+ | 8 | Trial Booking / Availability Check | POST | `/booking/availabilityCheck` |
68
+ | 9 | Create Order | POST | `/booking/createOrder` |
69
+ | 10 | Order Payment | POST | `/booking/payOrder` |
70
+ | 11 | Cancel Order | POST | `/order/cancelOrder` |
71
+ | 12 | Order Detail Query | POST | `/order/orderDetail` |
72
+ | 13 | Order Status Push | POST | `/notify/orderStatus` |
73
+
74
+ Recommended sequence:
75
+
76
+ 1. `/search/destination`
77
+ - Resolve the destination keyword into an Open Platform destination ID.
78
+ 2. `/search/hotelFilters`
79
+ - Fetch filter conditions when the UI needs hotel filters.
80
+ 3. `/search/hotelList`
81
+ - Search destination-based hotel results using the destination ID, stay dates, and optional filters.
82
+ 4. `/hotel/detail` and optionally `/hotel/images`
83
+ - Read richer hotel details and media for client display after the hotel list returns candidates.
84
+ 5. `/hotel/lowestPrice`
85
+ - Optional but useful for list-page price reference when the experience needs a stable starting-price display.
86
+ 6. `/booking/productDetails`
87
+ - Query real-time sellable products for a selected hotel on the hotel detail or booking path.
88
+ 7. `/booking/availabilityCheck`
89
+ - Run trial booking with the actual room count before final booking.
90
+ 8. `/booking/createOrder`
91
+ - Create the order after trial booking succeeds. If the booking step is delayed, run `/booking/availabilityCheck` again first.
92
+ 9. `/booking/payOrder`
93
+ - Notify payment status after local payment succeeds or when the platform decides the order should be confirmed.
94
+
95
+ Lightweight mode still benefits from small local caches:
96
+
97
+ - Cache destination lookup results from `/search/destination` when the same searches are repeated often.
98
+ - Keep the current hotel IDs from `/search/hotelList` or prior detail-page flows long enough to avoid wasteful duplicate quote traffic.
99
+ - Treat order push/callback as primary even in lightweight mode.
53
100
 
54
101
  ## Booking Flow
55
102
 
56
- Use this sequence for a normal hotel booking flow:
103
+ Use this sequence for both Standard API Integration and Lightweight Integration Flow:
57
104
 
58
- 1. `glink.queryProductDetail`
105
+ 1. `/booking/productDetails`
59
106
  - Identify the exact sellable room and rate.
60
- 2. `glink.checkBooking`
107
+ 2. `/booking/availabilityCheck`
61
108
  - Perform pre-booking validation with the actual room count. Use this before showing or entering the final order submission path.
62
- 3. `glink.createOrder`
63
- - Submit the order with guest, contact, amount, and price item details. When the local order has been created and is ready to submit, call `checkBooking` again first if there is any delay or state change risk.
64
- 4. `glink.payOrder`
65
- - Notify Glink after local customer payment succeeds, or after the platform has decided the Glink order should be confirmed.
66
- 5. Glink order operation push/callback
109
+ 3. `/booking/createOrder`
110
+ - Submit the order with guest, contact, amount, and price item details. When the local order has been created and is ready to submit, call `/booking/availabilityCheck` again first if there is any delay or state change risk.
111
+ 4. `/booking/payOrder`
112
+ - Notify payment after local customer payment succeeds, or after the platform has decided the order should be confirmed.
113
+ 5. `/notify/orderStatus`
67
114
  - Treat the push/callback as the primary confirmation result channel. The receiver must be idempotent.
68
- 6. `glink.queryOrderDetail`
115
+ 6. `/order/orderDetail`
69
116
  - Use as low-frequency compensation only before final confirmation or cancellation. Do not keep polling confirmed or canceled orders.
70
117
 
71
118
  Key order identifiers:
72
119
 
73
- - `coOrderCode`: your platform-side order number
74
- - `fcOrderCode`: Glink-side order number when available
120
+ - `coOrderCode`: customer platform order number.
121
+ - `fcOrderCode`: FCG order number when available.
75
122
 
76
123
  Prefer carrying both once they appear, because several aftercare APIs accept one or both.
77
124
 
@@ -79,32 +126,33 @@ Prefer carrying both once they appear, because several aftercare APIs accept one
79
126
 
80
127
  Use these calls after booking:
81
128
 
82
- - `glink.cancelOrder`
129
+ - `/order/cancelOrder`
83
130
  - Cancel an order when policy permits, when the customer asks to cancel, or when the local unpaid timeout is reached, such as 30 minutes. If cancellation returns success, update the local order and do not continue polling for another push.
84
- - Glink order operation push/callback
85
- - This is required for order confirmation progress after `payOrder`. It may not appear as a public `/openapi/v1/glink/*` request route in swagger because it is an inbound callback capability; inspect platform callback route code before implementing.
86
- - `glink.queryOrderCheckDetailInfo`
131
+ - `/notify/orderStatus`
132
+ - Required for order confirmation progress after `/booking/payOrder`; implement idempotency.
133
+ - `/order/checkInDetail`
87
134
  - Read extended order or check-in related detail.
88
- - `glink.checkoutApply`
135
+ - `/order/checkoutRequest`
89
136
  - Submit a checkout or refund-like aftercare request for an order.
90
- - `glink.queryCheckoutDetail`
137
+ - `/order/checkoutDetail`
91
138
  - Query the checkout task by `taskOrderCode`.
92
139
 
93
140
  ## Finance
94
141
 
95
142
  Use these calls for financial follow-up:
96
143
 
97
- - `glink.createInvoice`
144
+ - `/order/invoiceRequest`
98
145
  - Submit invoice information using business fields only.
99
- - Ignore Glink-managed `partnerCode` and `sign` even if they appear in the swagger schema.
100
- - `glink.queryCreditBalance`
146
+ - `/order/invoiceInfo`
147
+ - Query invoice status and invoice metadata after an invoice request.
148
+ - `/search/creditBalance`
101
149
  - Read remaining credit balance.
102
150
 
103
151
  ## Business Handling Rules
104
152
 
105
153
  - Do not treat HTTP `200` as enough; inspect `code`.
106
- - Do not rebuild Glink headers or wrapper payloads; the runtime gateway handles downstream authentication and wrapping.
107
- - Preserve Glink order identifiers from earlier responses instead of recomputing them.
154
+ - Use only our short interface paths in customer-facing docs and workflows.
155
+ - Preserve FCG order identifiers from earlier responses instead of recomputing them.
108
156
  - Keep local saleable hotel ID cache and hotel/room mappings current before pricing and booking.
109
- - Avoid integration quota waste: skip `queryProductDetail` for hotels not in the saleable hotel cache.
110
- - Push/callback is primary for order confirmation; `queryOrderDetail` is only a compensation path and should not be frequent.
157
+ - Avoid integration quota waste: skip `/booking/productDetails` for hotels not in the saleable hotel cache.
158
+ - Push/callback is primary for order confirmation; `/order/orderDetail` is only a compensation path and should not be frequent.
@@ -34,7 +34,7 @@ APP_KEY
34
34
  Rules:
35
35
 
36
36
  - Uppercase `METHOD`.
37
- - Use the exact public request path, for example `/openapi/v1/glink/queryBusinessList`.
37
+ - Use the exact runtime public request path. Customer-facing docs use short paths like `/region/businesses`; for actual signing, prefix with `/openapi/v1/glink`, for example `/openapi/v1/glink/region/businesses`.
38
38
  - Sort query parameters by key and then value before joining them as `k=v&k2=v2`.
39
39
  - Hash the raw request body bytes with SHA256 and use the lowercase hex digest.
40
40
  - Use the request timestamp exactly as sent in `X-OP-Timestamp`.
@@ -49,28 +49,15 @@ Notes:
49
49
  - Nonce must be unique for the same app key in a short time window.
50
50
  - For empty bodies, hash the empty byte string.
51
51
 
52
- ## Platform Wrapping Rules
53
-
54
- Glink downstream authentication is handled by the runtime gateway.
52
+ ## Request Body Rules
55
53
 
56
54
  Client responsibilities:
57
55
 
58
- - Send only business fields.
59
- - Sign the public open-platform request.
60
-
61
- Do not send:
62
-
63
- - `partnerCode`
64
- - `signature` or `sign` used by Glink downstream auth
65
- - `requestType`
66
- - Glink-side `timestamp`
67
- - wrapper objects like `header` or `businessRequest`
68
-
69
- Important exception handling:
56
+ - Send only the business fields shown by our Open Platform swagger.
57
+ - Sign the runtime public request path, not only the short interface path.
58
+ - Do not add wrapper objects or hidden integration fields that are not part of our public schema.
70
59
 
71
- - `createInvoice` currently still exposes `partnerCode` and `sign` in schema examples and required lists.
72
- - The route description still says the platform fills those fields automatically.
73
- - Prefer the route description and treat those fields as platform-managed downstream fields.
60
+ If a legacy schema still exposes an internal managed field, prefer the route description and current swagger examples. Do not ask the customer to send fields that are not part of the Open Platform public contract.
74
61
 
75
62
  ## Credential Acquisition
76
63
 
@@ -94,7 +81,7 @@ Important constraints:
94
81
 
95
82
  - Sandbox and production credentials are separate and not interchangeable.
96
83
  - Developers can see platform credentials only.
97
- - Developers cannot see Glink downstream secrets.
84
+ - Developers cannot see internal integration secrets.
98
85
 
99
86
  ## How To View Or Reset Keys
100
87
 
@@ -110,10 +97,10 @@ Developer portal APIs:
110
97
 
111
98
  Response fields that matter:
112
99
 
113
- - `open_app_id`: the App Key to place into `X-OP-App-Key`
114
- - `open_secret_masked`: masked secret for display only
115
- - `open_secret_version`: useful for rotation tracking
116
- - `plain_open_secret`: returned only on first issuance or reset
100
+ - `open_app_id`: the App Key to place into `X-OP-App-Key`.
101
+ - `open_secret_masked`: masked secret for display only.
102
+ - `open_secret_version`: useful for rotation tracking.
103
+ - `plain_open_secret`: returned only on first issuance or reset.
117
104
 
118
105
  Practical guidance:
119
106
 
@@ -142,7 +129,7 @@ The platform wraps business responses in a common envelope:
142
129
  {
143
130
  "request_id": "req_xxx",
144
131
  "trace_id": "trc_xxx",
145
- "downstream_request_id": "optional",
132
+ "downstream_request_id": "dreq_xxx",
146
133
  "code": "SUCCESS",
147
134
  "message": "ok",
148
135
  "data": {}
@@ -152,6 +139,6 @@ The platform wraps business responses in a common envelope:
152
139
  Interpretation:
153
140
 
154
141
  - `request_id` and `trace_id` are platform-side tracing keys.
155
- - `downstream_request_id` is the Glink request identifier when available.
142
+ - `downstream_request_id` is a platform response field used for cross-system tracing when available.
156
143
  - `code=SUCCESS` means the business call succeeded.
157
- - `code=SUPPLIER_BIZ_ERROR` means Glink returned a business error and can still arrive with HTTP `200`.
144
+ - `code=SUPPLIER_BIZ_ERROR` means the business call failed after reaching the hotel integration and can still arrive with HTTP `200`.
@@ -1,129 +1,128 @@
1
1
  # Glink Endpoint Index
2
2
 
3
- All routes are public gateway routes. Sign the public path, not the downstream Glink path.
4
-
5
- ## Static Data
6
-
7
- - `glink.queryBusinessList`
8
- - `POST /openapi/v1/glink/queryBusinessList`
9
- - Required body fields: `cityCode`
10
- - `glink.queryCountryList`
11
- - `POST /openapi/v1/glink/queryCountryList`
12
- - Required body fields: none
13
- - `glink.queryHotelPlateList`
14
- - `POST /openapi/v1/glink/queryHotelPlateList`
15
- - Required body fields: none
16
- - `glink.queryHotCityList`
17
- - `POST /openapi/v1/glink/queryHotCityList`
18
- - Required body fields: none
19
- - `glink.queryDistrictList`
20
- - `POST /openapi/v1/glink/queryDistrictList`
21
- - Required body fields: `cityCode`
22
- - `glink.queryDistrictAndBusiness`
23
- - `POST /openapi/v1/glink/queryDistrictAndBusiness`
24
- - Required body fields: `cityCode`
25
- - `glink.queryCityList`
26
- - `POST /openapi/v1/glink/queryCityList`
27
- - Required body fields: `countryCode`
28
-
29
- ## Hotel Query
30
-
31
- - `glink.queryCityAndHotelByKeyword`
32
- - `POST /openapi/v1/glink/queryCityAndHotelByKeyword`
33
- - Required body fields: `keyWord`
34
- - `glink.getDestination`
35
- - `POST /openapi/v1/glink/getDestination`
36
- - Required body fields: `keyWord`
37
- - Swagger example uses `keyword`; double-check the field naming against current backend behavior before coding around it.
38
- - `glink.getHotelSearch`
39
- - `POST /openapi/v1/glink/getHotelSearch`
40
- - Required body fields: none
41
- - Common fields: `cityCode`, `checkInDate`, `checkOutDate`, `roomNum`, `language`
42
- - `glink.findHotelList`
43
- - `POST /openapi/v1/glink/findHotelList`
44
- - Required body fields from schema: `roomFacilityCodes`, `hotelFacilityCodes`, `checkInDate`, `checkOutDate`, `distance`
45
- - Treat this as a high-friction route and inspect the real example payload before implementing.
46
- - `glink.queryHotelAllList`
47
- - `POST /openapi/v1/glink/queryHotelAllList`
48
- - Required body fields: none
3
+ Source of truth: current DHub / `docs/swagger/glink-api.json`.
4
+
5
+ All routes below are customer-facing short interface paths. For actual gateway calls and signing, prefix them with `/openapi/v1/glink`.
6
+
7
+ Customer-facing explanations should use only short interface paths such as `/search/destination`.
8
+
9
+ Integration mode shortcuts:
10
+
11
+ - Standard API Integration: prefer `/search/hotelIdList` -> `/hotel/detail` -> `/hotel/increment` and maintain local saleable hotel mappings.
12
+ - Lightweight Integration Flow: prefer `/search/destination` -> `/search/hotelFilters` -> `/search/hotelList` -> `/hotel/detail`/`/hotel/images` -> `/booking/productDetails` for faster launch.
13
+
14
+ ## Region Static Data
15
+
16
+ - `/region/countries`
17
+ - Method: `POST`
18
+ - Required body fields: none.
19
+ - `/region/cities`
20
+ - Method: `POST`
21
+ - Common body fields: `countryCode`, `language`, `dataType`.
22
+ - `/region/popularCities`
23
+ - Method: `POST`
24
+ - Required body fields: none.
25
+ - `/region/businesses`
26
+ - Method: `POST`
27
+ - Common body fields: `cityCode`, `language`.
28
+ - `/region/districts`
29
+ - Method: `POST`
30
+ - Common body fields: `cityCode`, `language`.
31
+ - `/region/pois`
32
+ - Method: `POST`
33
+ - Common body fields: `cityCode`, `keyword`, `language`.
49
34
 
50
35
  ## Hotel Info
51
36
 
52
- - `glink.queryHotelIdList`
53
- - `POST /openapi/v1/glink/queryHotelIdList`
54
- - Required body fields: none
55
- - The Open Platform Glink onboarding flow commonly uses `cityCode` to fetch the account's saleable hotel IDs for that city; verify the current swagger/code example before generating strict DTOs.
56
- - `glink.queryHotelInfo`
57
- - `POST /openapi/v1/glink/queryHotelInfo`
58
- - Required body fields: `hotelIds`
59
- - `glink.queryHotelIncrement`
60
- - `POST /openapi/v1/glink/queryHotelIncrement`
61
- - Required body fields: `startTime`, `endTime`
62
- - Swagger example uses `lastUpdateTime`; inspect schema versus example before generating code.
63
- - `glink.queryHotelImage`
64
- - `POST /openapi/v1/glink/queryHotelImage`
65
- - Required body fields: `hotelIds`
66
- - Swagger example uses `hotelId`; inspect schema versus example before generating code.
67
- - `glink.queryHotelMainInfoByHotelIds`
68
- - `POST /openapi/v1/glink/queryHotelMainInfoByHotelIds`
69
- - Required body fields: `language`
70
-
71
- ## Product Info
72
-
73
- - `glink.queryHotelLowestPrice`
74
- - `POST /openapi/v1/glink/queryHotelLowestPrice`
75
- - Required body fields: `hotelIds`
76
- - `glink.queryProductDetail`
77
- - `POST /openapi/v1/glink/queryProductDetail`
78
- - Required body fields: `hotelId`, `checkInDate`, `checkOutDate`, `roomNum`
37
+ - `/search/hotelIdList`
38
+ - Method: `POST`
39
+ - Common body fields: `cityCode`.
40
+ - Use for saleable hotel ID bootstrap and cache refresh.
41
+ - `/hotel/detail`
42
+ - Method: `POST`
43
+ - Required body fields: `hotelIds`.
44
+ - `/hotel/increment`
45
+ - Method: `POST`
46
+ - Common body fields: `startTime`, `endTime`, `maxId`, `pageSize`.
47
+ - `/hotel/lowestPrice`
48
+ - Method: `POST`
49
+ - Common body fields: `hotelIds`, `checkInDate`, `checkOutDate`, `checkInType`.
50
+ - `/hotel/images`
51
+ - Method: `POST`
52
+ - Common body fields: `hotelIds` or `hotelId`; verify the current swagger example before strict DTO generation.
53
+ - `/hotel/groupBrand`
54
+ - Method: `POST`
55
+ - Required body fields: none.
56
+
57
+ ## Search And Booking
58
+
59
+ - `/search/destination`
60
+ - Method: `POST`
61
+ - Common body fields: `keyWord`, `cityCode`, `destinationType`, `source`.
62
+ - `/search/hotelFilters`
63
+ - Method: `POST`
64
+ - Common body fields: `destinationId`, `destinationType`, `language`, `lngGoogle`, `latGoogle`, `lngBaidu`, `latBaidu`, `dataType`, `distance`.
65
+ - `/search/hotelList`
66
+ - Method: `POST`
67
+ - Common body fields: `destinationId`, `destinationType`, `lngGoogle`, `latGoogle`, `lngBaidu`, `latBaidu`, `checkInDate`, `checkOutDate`, filters.
68
+ - `/booking/productDetails`
69
+ - Method: `POST`
70
+ - Required body fields: `hotelId`, `checkInDate`, `checkOutDate`, `roomNum`, `numberOfAdults`.
71
+ - `/booking/availabilityCheck`
72
+ - Method: `POST`
73
+ - Required body fields: `hotelId`, `roomId`, `ratePlanId`, `checkInDate`, `checkOutDate`, `roomNum`, `supplyCode`.
74
+ - `/booking/createOrder`
75
+ - Method: `POST`
76
+ - Required body fields: `hotelId`, `roomId`, `ratePlanId`, `checkInDate`, `checkOutDate`, `roomNum`, `supplyCode`, `totalAmount`, `coOrderCode`, `priceItems`, `guestInfos`, `linkMan`, `linkPhone`, `arriveTime`, `latestArriveTime`.
77
+ - `/booking/payOrder`
78
+ - Method: `POST`
79
+ - Common body fields: `coOrderCode`, `fcOrderCode`.
80
+ - `/search/creditBalance`
81
+ - Method: `POST`
82
+ - Required body fields: none; send `{}` or omit body according to the SDK/runtime caller.
79
83
 
80
84
  ## Order Info
81
85
 
82
- - `glink.checkBooking`
83
- - `POST /openapi/v1/glink/checkBooking`
84
- - Required body fields: `hotelId`, `checkInDate`, `checkOutDate`, `roomId`, `ratePlanId`, `roomNum`, `supplyCode`
85
- - `glink.createOrder`
86
- - `POST /openapi/v1/glink/createOrder`
87
- - Required body fields: `hotelId`, `checkInDate`, `checkOutDate`, `roomId`, `ratePlanId`, `roomNum`, `supplyCode`, `totalAmount`, `coOrderCode`, `priceItems`, `guestInfos`, `linkMan`, `linkPhone`, `arriveTime`, `latestArriveTime`
88
- - `glink.payOrder`
89
- - `POST /openapi/v1/glink/payOrder`
90
- - Required body fields: none
91
- - Common fields: `coOrderCode`, `fcOrderCode`
92
- - `glink.cancelOrder`
93
- - `POST /openapi/v1/glink/cancelOrder`
94
- - Required body fields: none
95
- - Common fields: `coOrderCode`, `fcOrderCode`, `cancelReson`
96
- - `glink.queryOrderDetail`
97
- - `POST /openapi/v1/glink/queryOrderDetail`
98
- - Required body fields: none
99
- - Common fields: `coOrderCode`, `fcOrderCode`
100
- - Glink order operation push/callback
101
- - Required by the Open Platform Glink booking flow after `payOrder`.
102
- - This is an inbound callback capability rather than a normal public `/openapi/v1/glink/*` request route in the current endpoint list. Before implementing, inspect route code or product requirements for the platform callback URL, signature/auth expectations, idempotency key, and retry handling.
103
- - `glink.queryOrderCheckDetailInfo`
104
- - `POST /openapi/v1/glink/queryOrderCheckDetailInfo`
105
- - Required body fields: none
106
- - Common fields: `coOrderCode`, `fcOrderCode`
107
- - `glink.checkoutApply`
108
- - `POST /openapi/v1/glink/checkoutApply`
109
- - Required body fields: `fcOrderCode`, `checkoutReason`, `checkoutRoomInfoList`
110
- - `glink.queryCheckoutDetail`
111
- - `POST /openapi/v1/glink/queryCheckoutDetail`
112
- - Required body fields: `taskOrderCode`
113
- - Swagger example uses order codes instead of `taskOrderCode`; inspect the live contract before coding.
114
-
115
- ## Finance
116
-
117
- - `glink.createInvoice`
118
- - `POST /openapi/v1/glink/createInvoice`
119
- - Business-required fields to focus on: `orderCode`, `invoiceTypeInteger`, `invoiceHeader`, `amount`, `applyId`, `invoiceTitleType`, `getMethod`
120
- - Schema still marks `partnerCode` and `sign` as required, but route docs say the platform injects Glink auth fields. Do not send Glink-managed fields from the client.
121
- - `glink.queryCreditBalance`
122
- - `POST /openapi/v1/glink/queryCreditBalance`
123
- - Required body fields: none
86
+ - `/order/orderDetail`
87
+ - Method: `POST`
88
+ - Common body fields: `coOrderCode`, `fcOrderCode`.
89
+ - `/order/cancelOrder`
90
+ - Method: `POST`
91
+ - Common body fields: `coOrderCode`, `fcOrderCode`, `cancelReson`.
92
+ - `/order/checkInDetail`
93
+ - Method: `POST`
94
+ - Common body fields: `coOrderCode`, `fcOrderCode`.
95
+ - `/order/invoiceRequest`
96
+ - Method: `POST`
97
+ - Business fields to focus on: `orderCode`, `invoiceTypeInteger`, `invoiceHeader`, `amount`, `applyId`, `invoiceTitleType`, `getMethod`.
98
+ - `/order/invoiceInfo`
99
+ - Method: `POST`
100
+ - Common body fields: `coOrderCode` or `fcOrderCode`.
101
+ - `/order/checkoutRequest`
102
+ - Method: `POST`
103
+ - Required body fields: `fcOrderCode`, `supplierRefundNumber`, `checkoutReason`, `refundType`, `checkoutRooms`.
104
+ - `/order/checkoutDetail`
105
+ - Method: `POST`
106
+ - Common body fields: `taskOrderCode`, `coOrderCode`, `fcOrderCode`; verify current swagger example before strict DTO generation.
107
+
108
+ ## Callback Capabilities
109
+
110
+ - `/notify/orderStatus`
111
+ - Method: `POST`
112
+ - Order status push/callback. The receiver must be idempotent.
113
+ - `/notify/orderOperate`
114
+ - Method: `POST`
115
+ - Order operation push/callback. The receiver must be idempotent.
116
+ - `/notify/orderCheckout`
117
+ - Method: `POST`
118
+ - Checkout status push/callback. The receiver must be idempotent.
119
+ - `/notify/orderInvoice`
120
+ - Method: `POST`
121
+ - Invoice status push/callback. The receiver must be idempotent.
124
122
 
125
123
  ## Global Notes
126
124
 
125
+ - Current Glink swagger route count may include outbound request APIs and callback APIs; verify against `docs/swagger/glink-api.json`.
127
126
  - Most Glink routes accept plain business JSON bodies with no wrapper objects.
128
127
  - Platform error responses can return `401`, `403`, `404`, `500`, `502`, or `504`.
129
128
  - Common auth-related `401` codes are `APP_KEY_INVALID`, `SIGN_ERROR`, `TIMESTAMP_EXPIRED`, and `NONCE_REPLAY`.
@@ -4,14 +4,14 @@
4
4
  Examples:
5
5
  python scripts/glink_signed_request.py ^
6
6
  --method POST ^
7
- --path /openapi/v1/glink/queryBusinessList ^
7
+ --path /region/businesses ^
8
8
  --body-json "{\"language\":\"zh-CN\",\"cityCode\":\"1\"}" ^
9
9
  --app-key open_app_xxx ^
10
10
  --app-secret sk_xxx
11
11
 
12
12
  python scripts/glink_signed_request.py ^
13
13
  --method POST ^
14
- --path /openapi/v1/glink/queryCreditBalance ^
14
+ --path /search/creditBalance ^
15
15
  --body-json "{}" ^
16
16
  --app-key open_app_xxx ^
17
17
  --app-secret sk_xxx ^
@@ -32,11 +32,21 @@ import urllib.request
32
32
  import uuid
33
33
  from pathlib import Path
34
34
 
35
+ GATEWAY_PREFIX = "/openapi/v1/glink"
36
+
35
37
 
36
38
  def sha256_hex(data: bytes) -> str:
37
39
  return hashlib.sha256(data).hexdigest()
38
40
 
39
41
 
42
+ def normalize_path(path: str) -> str:
43
+ if not path.startswith("/"):
44
+ path = f"/{path}"
45
+ if path == GATEWAY_PREFIX or path.startswith(f"{GATEWAY_PREFIX}/"):
46
+ return path
47
+ return f"{GATEWAY_PREFIX}{path}"
48
+
49
+
40
50
  def parse_query_items(items: list[str]) -> list[tuple[str, str]]:
41
51
  pairs: list[tuple[str, str]] = []
42
52
  for item in items:
@@ -124,7 +134,7 @@ def main() -> int:
124
134
  parser = argparse.ArgumentParser(description="Generate or send a signed Glink open-platform request.")
125
135
  parser.add_argument("--base-url", default=os.getenv("OPEN_PLATFORM_BASE_URL", "http://127.0.0.1:8671"))
126
136
  parser.add_argument("--method", required=True)
127
- parser.add_argument("--path", required=True)
137
+ parser.add_argument("--path", required=True, help="Short interface path, such as /search/destination; full gateway paths are also accepted")
128
138
  parser.add_argument("--query", action="append", default=[], help="Repeatable key=value query parameter")
129
139
  parser.add_argument("--body-json", help="JSON string request body")
130
140
  parser.add_argument("--body-file", help="Path to a raw request body file")
@@ -143,6 +153,7 @@ def main() -> int:
143
153
  try:
144
154
  query_pairs = parse_query_items(args.query)
145
155
  body_bytes = load_body(args)
156
+ runtime_path = normalize_path(args.path)
146
157
  except Exception as exc:
147
158
  print(str(exc), file=sys.stderr)
148
159
  return 2
@@ -150,7 +161,7 @@ def main() -> int:
150
161
  query_string = canonical_query(query_pairs)
151
162
  payload = build_sign_payload(
152
163
  method=args.method,
153
- path=args.path,
164
+ path=runtime_path,
154
165
  query_string=query_string,
155
166
  body_bytes=body_bytes,
156
167
  timestamp=args.timestamp,
@@ -159,7 +170,7 @@ def main() -> int:
159
170
  )
160
171
  signature = sign(args.app_secret, payload)
161
172
  headers = build_headers(args.app_key, args.timestamp, args.nonce, signature, bool(body_bytes))
162
- url = build_url(args.base_url, args.path, query_string)
173
+ url = build_url(args.base_url, runtime_path, query_string)
163
174
 
164
175
  print("URL:")
165
176
  print(url)