File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed 
aws_lambda_powertools/event_handler Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -21,19 +21,21 @@ class AppSyncResolver:
2121        app = AppSyncResolver() 
2222
2323        @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"}]  
2727
2828        @app.resolver(type_name="Merchant", field_name="extraInfo") 
29-         def get_extra_info(): 
29+         def get_extra_info() -> dict : 
3030            # 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} 
3234
3335        @app.resolver(field_name="commonField") 
34-         def common_field(): 
36+         def common_field() -> str : 
3537            # Would match all fieldNames matching 'commonField' 
36-             ...  
38+             return str(uuid.uuid4())  
3739    """ 
3840
3941    current_event : AppSyncResolverEvent 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments