Skip to content
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

[Bug]: Cannot update the session_time due to type error #31

Open
1 task done
vintersnow opened this issue Feb 5, 2024 · 0 comments
Open
1 task done

[Bug]: Cannot update the session_time due to type error #31

vintersnow opened this issue Feb 5, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@vintersnow
Copy link

vintersnow commented Feb 5, 2024

What happened?

When I try to call update_user endpoint and update the session_time, an type mismatch error happens.

Current SDK (2.0.2) expect float

    deltas=PropertiesDeltas(
           ^^^^^^^^^^^^^^^^^
  File "/Users/vinter/Projects/tmp/onesignal_be/venv/lib/python3.11/site-packages/onesignal/model_utils.py", line 49, in wrapped_init
    return fn(_self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/vinter/Projects/tmp/onesignal_be/venv/lib/python3.11/site-packages/onesignal/model/properties_deltas.py", line 275, in __init__
    setattr(self, var_name, var_value)
  File "/Users/vinter/Projects/tmp/onesignal_be/venv/lib/python3.11/site-packages/onesignal/model_utils.py", line 190, in __setattr__
    self[attr] = value
    ~~~~^^^^^^
  File "/Users/vinter/Projects/tmp/onesignal_be/venv/lib/python3.11/site-packages/onesignal/model_utils.py", line 511, in __setitem__
    self.set_attribute(name, value)
  File "/Users/vinter/Projects/tmp/onesignal_be/venv/lib/python3.11/site-packages/onesignal/model_utils.py", line 162, in set_attribute
    value = validate_and_convert_types(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/vinter/Projects/tmp/onesignal_be/venv/lib/python3.11/site-packages/onesignal/model_utils.py", line 1595, in validate_and_convert_types
    raise get_type_error(input_value, path_to_item, valid_classes,

The actual endpoint except int64

{"errors":[{"title":"Field deltas.session_time was expecting value of type 'int64', received value of type 'number 3.14' instead"}]}

Steps to reproduce?

update_user_request = UpdateUserRequest(
        deltas=PropertiesDeltas(
            session_time=3,
            # session_time=3.14,
            session_count=3,
        ),
) 

try:
        api_response = api_instance.update_user(app_id, alias_label, alias_id, update_user_request)
        pprint(api_response)
except onesignal.ApiException as e:
        print("Exception when calling DefaultApi->update_user: %s\n" % e)

What did you expect to happen?

Can update the property.

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@vintersnow vintersnow added the bug Something isn't working label Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant