File tree 1 file changed +9
-7
lines changed
aws_lambda_powertools/event_handler
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -21,19 +21,21 @@ class AppSyncResolver:
21
21
app = AppSyncResolver()
22
22
23
23
@app.resolver(type_name="Query", field_name="listLocations")
24
- def list_locations(page: int = 0, size: int = 10):
25
- # Your logic to fetch locations
26
- ...
24
+ def list_locations(page: int = 0, size: int = 10) -> list :
25
+ # Your logic to fetch locations with arguments passed in
26
+ return [{"id": 100, "name": "Smooth Grooves"}]
27
27
28
28
@app.resolver(type_name="Merchant", field_name="extraInfo")
29
- def get_extra_info():
29
+ def get_extra_info() -> dict :
30
30
# Can use "app.current_event.source" to filter within the parent context
31
- ...
31
+ account_type = app.current_event.source["accountType"]
32
+ method = "BTC" if account_type == "NEW" else "USD"
33
+ return {"preferredPaymentMethod": method}
32
34
33
35
@app.resolver(field_name="commonField")
34
- def common_field():
36
+ def common_field() -> str :
35
37
# Would match all fieldNames matching 'commonField'
36
- ...
38
+ return str(uuid.uuid4())
37
39
"""
38
40
39
41
current_event : AppSyncResolverEvent
You can’t perform that action at this time.
0 commit comments