sriramsv / custom_component_splitwise

Custom component for HomeAssistant for Splitwise API
MIT License
11 stars 4 forks source link

Additional event emitter for Notifications? #4

Open CloCkWeRX opened 2 years ago

CloCkWeRX commented 2 years ago

https://secure.splitwise.com/api/v3.0/get_notifications lets you get:

{
  "notifications": [
    {
      "id": 32514315,
      "type": 0,
      "created_at": "2019-08-24T14:15:22Z",
      "created_by": 2,
      "source": {
        "type": "Expense",
        "id": 865077,
        "url": "string"
      },
      "image_url": "https://s3.amazonaws.com/splitwise/uploads/notifications/v2/0-venmo.png",
      "image_shape": "square",
      "content": "<strong>You</strong> paid <strong>Jon H.</strong>.<br><font color=\\\"#5bc5a7\\\">You paid $23.45</font>"
    }
  ]
}

These seem a good fit for events: https://developers.home-assistant.io/docs/dev_101_events/

Unclear if its a safe assumption that the content returned is trustable/won't lead to weird XSS bugs; and they are shaped around what the user themselves would see on the mobile app.

Not sure if you'd want to call the relevant get method based on the type - get_expense/id for type:0 - added for example.

Useful scenarios:

CloCkWeRX commented 2 years ago

Well; I have a fork of the splitwise package which adds in those methods; so let's hope that gets merged - https://github.com/namaggarwal/splitwise/pull/68

CloCkWeRX commented 1 year ago

It got merged!