Closed godd9170 closed 7 years ago
As per #32, I think it's appropriate to have Response/Request classes for each endpoint instead of a shared one up in tools.py
. I've been racking my brain as to how we can have a mutual Request class that's abstract enough for all... but I think that's probably too meta.
File structure is currently:
├── account
│ └── handler.py
├── contact
│ └── handler.py
├── encryption
│ └── handler.py
├── event
│ └── handler.py
├── serverless.yml
└── tools.py <-- Request/Response are in here
and what's going to make more sense is:
├── account
│ ├── handler.py
│ ├── Response.py
│ └── Request.py
├── contact
│ ├── handler.py
│ ├── Response.py
│ └── Request.py
├── encryption
│ └── handler.py
│ ├── Response.py
│ └── Request.py
├── event
│ ├── handler.py
│ ├── Response.py
│ └── Request.py
├── serverless.yml
└── tools.py
This will also help facilitate #33
I've changed my mind again... Response.py
in theory is going to be very similar if we want to unify what our responses look like across the API. Furthermore, the base of Request
is going to have some similarities so I'm proposing extending it for each endpoint. I'm envisioning this now:
├── account
│ ├── handler.py
│ └── AccountRequest.py
├── contact
│ ├── handler.py
│ └── ContactRequest.py
├── encryption
│ └── handler.py
│ └── EncryptionRequest.py
├── event
│ ├── handler.py
│ └── EventRequest.py
├── serverless.yml
├── Request.py
├── Response.py
└── tools.py
I can comfortably say that the new Request
class in tools.py
and it's endpoint specific extensions are more than solving this.
The responses to our endpoints leave a lot to be desired. Currently it's basically 'Success' or 'Failure'. I believe we need the following:
event
that enters the lambda function, and then spits back it's validity. Either that all fields required are there and of the correct type, or what is wrong with the payload and why.