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

Make RelationType.set_relates return the created role #566

Open
james-whiteside opened this issue Jan 10, 2024 · 0 comments
Open

Make RelationType.set_relates return the created role #566

james-whiteside opened this issue Jan 10, 2024 · 0 comments

Comments

@james-whiteside
Copy link
Contributor

Problem to Solve

Currently, RelationType.set_relates returns Promise[None]. This is pretty inconvenient, as a lot of the time we then want to perform further operations on the newly created role. Unlike the put methods for creating thing types, there is no parallel for roles, so they need to be gotten with RelationType.get_relates to continue operating on them like so:

message = transaction.concepts.put_relation_type("message").resolve()
message.set_relates(transaction, "sender").resolve()
message.set_relates(transaction, "recipient").resolve()
message_sender = response.get_relates(transaction, "sender").resolve()
message_recipient = response.get_relates(transaction, "recipient").resolve()

Proposed Solution

Make RelationType.set_relates return Promise[RoleType] instead of Promise[None], like so:

message = transaction.concepts.put_relation_type("message").resolve()
message_sender = message.set_relates(transaction, "sender").resolve()
message_recipient = message.set_relates(transaction, "recipient").resolve()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants