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

README: use different code block for different read API configuration #26

Closed
Tracked by #126
adriantam opened this issue Jun 9, 2023 · 1 comment · Fixed by #31
Closed
Tracked by #126

README: use different code block for different read API configuration #26

adriantam opened this issue Jun 9, 2023 · 1 comment · Fixed by #31
Assignees
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@adriantam
Copy link
Member

The READMEs' read relationship tuples example uses the same code block for different read API configuration (i.e., find if a relationship tuple stating that a certain user is a viewer of certain document, find all relationship tuples where a certain user has a relationship as any relation to a certain document, etc.)

Ideally, each type of API will have its own code block to improve reading experience.

For example,

# Find if a relationship tuple stating that a certain user is a viewer of certain document
body = TupleKey(
    user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
    relation="viewer",
    object="document:roadmap",
)

response = await fga_client.read(body)
# response = ReadResponse({"tuples": [Tuple({"key": TupleKey({"user":"...","relation":"...","object":"..."}), "timestamp": datetime.fromisoformat("...") })]})
# Find all relationship tuples where a certain user has a relationship as any relation to a certain document
body = TupleKey(
    user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
    object="document:roadmap",
)

response = await fga_client.read(body)
# response = ReadResponse({"tuples": [Tuple({"key": TupleKey({"user":"...","relation":"...","object":"..."}), "timestamp": datetime.fromisoformat("...") })]})

The code in question is in

# Find if a relationship tuple stating that a certain user is a viewer of certain document
.

Ideally, we will also fix the SDK generator so that newly generated python SDKs will have the corresponding changes. This is tracked as openfga/sdk-generator#126. However, if that is difficult to do, simply focusing on the Python SDK side https://github.com/openfga/python-sdk/blob/main/README.md will help us as well.

@akj2018
Copy link
Contributor

akj2018 commented Jun 10, 2023

Hi, @adriantam I would like work on this issue. Please assign it to me.
Thank you!

akj2018 added a commit to akj2018/python-sdk that referenced this issue Jun 12, 2023
Edited README.md to create separate code blocks for Read Relationship Tuples example.
@rhamzeh rhamzeh closed this as completed Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants