-
Notifications
You must be signed in to change notification settings - Fork 4
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
Implement send input action #12
base: refactoring
Are you sure you want to change the base?
Implement send input action #12
Conversation
Fix types
Extend types.py
Add tests Add cassette Add method description
data: Union[PhotoInputData, SelfiePhotoInputData, SelfieVideoInputData], | ||
group: int = None | ||
): | ||
if group is not None: |
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.
Not sure about this, does there any other way to not pass group if is None?
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.
this looks ok. you can also add group
key after initializing the required keys to avoid code duplication I guess
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.
But I will have to add group property for every instance?
mati/api_service.py
Outdated
@@ -75,6 +77,31 @@ def create_identity(self, metadata: IdentityMetadata) -> IdentityResource: | |||
) | |||
) | |||
|
|||
def send_input(self, identity_id: str, inputs_data: InputsData) -> List[Dict[str, bool]]: |
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.
can we have class name and its structure like we have in js lib (SendInputRequest)?
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
Rename InputsData class to SendInputRequest
group: int = None | ||
): | ||
if group is not None: | ||
dict.__init__( |
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.
any reason not to use super() here and in the else branch?
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 need to serialize this structure with json.dumps
in the future so I inherited from dict
. There are two different structures with the group and without and if group equals None
it converts to null
and it's not correct for our case, so I used super constructor to handle such case
mati/api_service.py
Outdated
encoder = MultipartEncoder(files) | ||
endpoint = 'v2/identities/{identity_id}/send-input' | ||
return self._call_http( | ||
path=endpoint.format(identity_id=identity_id), |
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.
f-string would look nicer here :) like this:
...
path=f'v2/identities/{identity_id}/send-input',
...
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.
Cool! Thanks, done
data: Union[PhotoInputData, SelfiePhotoInputData, SelfieVideoInputData], | ||
group: int = None | ||
): | ||
if group is not None: |
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.
this looks ok. you can also add group
key after initializing the required keys to avoid code duplication I guess
Use f-string
No description provided.