Skip to content

[Bug]: notification_types type is wrong on UpdateSubscriptionRequestBody #46

@tonypizzicato

Description

@tonypizzicato

What happened?

Setting notification_types as a float number throws an error from CloudFlare:

Field notification_types was expecting value of type 'int32', received value of type 'number 1.0' instead

But setting it to an integer value throws an error from OneSignal api:

onesignal.exceptions.ApiTypeError: Invalid type for variable 'notification_types'. Required value type is float and passed type was int at ['notification_types']

Steps to reproduce?

with onesignal.ApiClient(configuration) as api_client:
    enabled = True
    update_subscription_request_body = UpdateSubscriptionRequestBody(
        subscription=SubscriptionObject(
            id=sub_id,
            enabled=enabled,
            notification_types=1 if enabled else -31,
        ),
    )

    api_instance.update_subscription(app_id, sub_id, update_subscription_request_body)

What did you expect to happen?

API should accept float numbers (as stated in docs)

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions