I try to extend the python Library nextcloud-deck. There is one thing missing in this library I really want to access. And that's the assigned users on the card. I already extended the modle in hope to be able to parse the JSON into the existing Class, but so far I don't get it how to realize it.
@attr.s(auto_attribs=True, frozen=True)class User: primary_key: str uid: str displayname: str type: int@attr.s(auto_attribs=True, frozen=True)class Assignment: card_id: int id: int participant: User type: int@attr.s(auto_attribs=True, frozen=True)class Card: id: int title: str stack_id: int last_modified: int created_at: int owner: str order: int archived: bool assignedUsers: typing.List[str] = attr.Factory(list) notified: bool = False deleted_at: int = 0 duedate: typing.Optional[str] = None description: typing.Optional[str] = None type: str = "plain" labels: typing.Optional[typing.List[Label]] = attr.Factory(list)
I tried several different things to geht the assignedUsers into the class. I've added the class user and Assignment. And the field assignedUsers. Doesn't matter what I tried the field stays empty. Even if there is some information in JSON about the assignedUsers.
The JSON I try to parse is this one
{"id": 37,"title": "Title","description": "","stackId": 8,"type": "plain","lastModified": 1712608194,"lastEditor": null,"createdAt": 1705467293,"labels": [],"assignedUsers": [ {"id": 20,"participant": {"primaryKey": "Name","uid": "Name","displayname": "ShortName","type": 0 },"cardId": 37,"type": 0 } ],"attachments": [],"attachmentCount": 0,"owner": {"primaryKey": "Name2","uid": "Name2","displayname": "ShortName2","type": 0 },"order": 0,"archived": false,"duedate": "2024-01-30T23:00:00+00:00","deletedAt": 0,"commentsUnread": 0,"commentsCount": 0,"ETag": "8432d5e8466347d6d16f5869ad92d20b","overdue": 3}
For me it seams like the assignedUsers is a list of dict. But I have no idea how to put this together.
Would be great if someone could give me a hint. Thanks a lot.
Or even better if there is already a lib that returns the assignedUsers from the Nextcloud card.
PS: That would be the docs of the api https://deck.readthedocs.io/en/latest/API/
I tried to changed to bold code above to make my issue work.