2
2
3
3
This repository contains a function that demonstrates how to generate pickup point delivery options based on an external
4
4
API accessible via an HTTP request. To simulate an external API, we have hosted a
5
- [ JSON file] ( https://cdn.shopify.com/s/files/1/0628/3830/9033/files/pickup-points-external-api-v1 .json?v=1712853748 ) ,
5
+ [ JSON file] ( https://cdn.shopify.com/s/files/1/0628/3830/9033/files/pickup-points-external-api-v2 .json?v=1714588690 ) ,
6
6
which contains pickup point information in the following format:
7
7
8
8
``` json
@@ -16,7 +16,10 @@ which contains pickup point information in the following format:
16
16
"streetNumber" : " 620" ,
17
17
"route" : " King St W" ,
18
18
"locality" : " Toronto" ,
19
- "administrativeAreaLevel1" : " ON" ,
19
+ "administrativeArea" : {
20
+ "name" : " Ontario" ,
21
+ "code" : " ON"
22
+ },
20
23
"postalCode" : " M5V 1M6" ,
21
24
"country" : " Canada" ,
22
25
"countryCode" : " CA"
@@ -80,7 +83,7 @@ the [schema](./schema.graphql).
80
83
{
81
84
"request" : {
82
85
"method" : " GET" ,
83
- "url" : " https://cdn.shopify.com/s/files/1/0628/3830/9033/files/demo- pickup-points_3dcda620-e196-40cb-ae6b-6dac17dc81c3 .json?v=1706119857 &lat=-79.42&lon=43.7" ,
86
+ "url" : " https://cdn.shopify.com/s/files/1/0628/3830/9033/files/pickup-points-external-api-v2 .json?v=1714588690 &lat=-79.42&lon=43.7" ,
84
87
"headers" : [
85
88
{
86
89
"name" : " Accept" ,
@@ -94,7 +97,6 @@ the [schema](./schema.graphql).
94
97
}
95
98
}
96
99
```
97
-
98
100
### Run target
99
101
100
102
The ** run** target is responsible for generating the pickup point delivery options. Its input API is defined by
@@ -112,7 +114,7 @@ specified by the `FunctionRunResult` type in the [schema](./schema.graphql).
112
114
{
113
115
"fetchResult" : {
114
116
"status" : 200 ,
115
- "body" : " {\" deliveryPoints\" :[{\" pointId\" :\" 001\" ,\" pointName\" :\" Toronto Store\" ,\" location\" :{\" addressComponents\" :{\" streetNumber\" :\" 620\" ,\" route\" :\" King St W\" ,\" locality\" :\" Toronto\" ,\" administrativeAreaLevel1 \" :\" ON\" ,\" postalCode\" :\" M5V 1M6\" ,\" country\" :\" Canada\" ,\" countryCode\" :\" CA\" },\" geometry\" :{\" location\" :{\" lat\" :43.644664618786685,\" lng\" :-79.40066267417106}}},\" openingHours\" :{\" weekdayText\" :[\" Monday: 9:00 AM – 9:00 PM\" ,\" Tuesday: 9:00 AM – 9:00 PM\" ,\" Wednesday: 9:00 AM – 9:00 PM\" ,\" Thursday: 9:00 AM – 9:00 PM\" ,\" Friday: 9:00 AM – 9:00 PM\" ,\" Saturday: 10:00 AM – 6:00 PM\" ,\" Sunday: Closed\" ]}}]}"
117
+ "body" : " {\" deliveryPoints\" :[{\" pointId\" :\" 001\" ,\" pointName\" :\" Toronto Store\" ,\" location\" :{\" addressComponents\" :{\" streetNumber\" :\" 620\" ,\" route\" :\" King St W\" ,\" locality\" :\" Toronto\" ,\" administrativeArea \" :{ \" name \" : \" Ontario \" , \" code \" : \" ON\" } ,\" postalCode\" :\" M5V 1M6\" ,\" country\" :\" Canada\" ,\" countryCode\" :\" CA\" },\" geometry\" :{\" location\" :{\" lat\" :43.644664618786685,\" lng\" :-79.40066267417106}}},\" openingHours\" :{\" weekdayText\" :[\" Monday: 9:00 AM – 9:00 PM\" ,\" Tuesday: 9:00 AM – 9:00 PM\" ,\" Wednesday: 9:00 AM – 9:00 PM\" ,\" Thursday: 9:00 AM – 9:00 PM\" ,\" Friday: 9:00 AM – 9:00 PM\" ,\" Saturday: 10:00 AM – 6:00 PM\" ,\" Sunday: Closed\" ]}}]}"
116
118
}
117
119
}
118
120
```
@@ -141,8 +143,8 @@ specified by the `FunctionRunResult` type in the [schema](./schema.graphql).
141
143
"latitude" : 43.644664618786685 ,
142
144
"longitude" : -79.40066267417106 ,
143
145
"phone" : null ,
144
- "province" : " ON " ,
145
- "province_code" : null ,
146
+ "province" : " Ontario " ,
147
+ "province_code" : " ON " ,
146
148
"zip" : " M5V 1M6"
147
149
},
148
150
"business_hours" : [
0 commit comments