-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VerificationAPI #13
VerificationAPI #13
Conversation
sinch/domains/verification/enums.py
Outdated
|
||
class VerificationMethod(Enum): | ||
SMS = "sms" | ||
FLASHCALL = "flashCall" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It must be flashcall
lowercase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs and OAS file specify this method as flashCall
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the end I'm transforming this property into more Python friendly snake_case anyway:
@dataclass
class StartFlashCallInitiateVerificationResponse(StartVerificationResponse):
flash_call: dict
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The enum value (https://github.com/sinch/sinch-sdk-python/blob/DEVEXP-205-186-verification-API/sinch/domains/verification/enums.py#L6) is still defined as flashCall
but, e.g.: https://github.com/sinch/sinch-sdk-python/blob/DEVEXP-205-186-verification-API/sinch/domains/verification/endpoints/get_verification_by_id.py#L26C13-L26C48
Will set the value to flashcall
so if end user is using enum value for a test it will failed (and same for other classes)
reference="random" | ||
) | ||
|
||
assert isinstance(verification_response, StartVerificationResponse) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to have a dedicated model for sms
(same for the 3 other type) as described in the OAS document? So that when getting a response from this request, the end user has access only to the properties returned by the server.
For reference, it has been done here in java: https://github.com/sinch/sinch-sdk-java/blob/main/client/src/main/com/sinch/sdk/domains/verification/adapters/converters/VerificationsDtoConverter.java#L90
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was planning to ask for same.
Better added value for end user to have dedicated models defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 👌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, now is it also possible to update the test in order to verify the response is an instance of a subclass (is should be StartSMSInitiateVerificationResponse
if I understand well the inheritance in Python?) instead of the parent StartVerificationResponse
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
No description provided.