Skip to content

Commit eaa826d

Browse files
committed
fix client_batch_check reference
1 parent a734f47 commit eaa826d

File tree

1 file changed

+1
-73
lines changed

1 file changed

+1
-73
lines changed

README.md

Lines changed: 1 addition & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -825,82 +825,10 @@ response = await fga_client.batch_check(ClientBatchCheckRequest(checks=checks),
825825
# ]
826826
```
827827

828-
If you are using an OpenFGA version less than 1.8.0, you can use the `clientBatchCheck` function,
828+
If you are using an OpenFGA version less than 1.8.0, you can use `client_batch_check`,
829829
which calls `check` in parallel. It will return `allowed: false` if it encounters an error, and will return the error in the body.
830830
If 429s or 5xxs are encountered, the underlying check will retry up to 3 times before giving up.
831831

832-
```python
833-
# from openfga_sdk import OpenFgaClient
834-
# from openfga_sdk.client import ClientCheckRequest
835-
# from openfga_sdk.client.models import ClientTuple
836-
# Initialize the fga_client
837-
# fga_client = OpenFgaClient(configuration)
838-
839-
options = {
840-
# You can rely on the model id set in the configuration or override it for this specific request
841-
"authorization_model_id": "01GXSA8YR785C4FYS3C0RTG7B1"
842-
}
843-
body = [ClientCheckRequest(
844-
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
845-
relation="viewer",
846-
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
847-
@@ -748,7 +750,7 @@
848-
context=dict(
849-
ViewCount=100
850-
)
851-
), ClientCheckRequest(
852-
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
853-
relation="admin",
854-
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
855-
@@ -759,20 +761,21 @@
856-
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
857-
),
858-
]
859-
), ClientCheckRequest(
860-
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
861-
relation="creator",
862-
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
863-
), ClientCheckRequest(
864-
user="user:81684243-9356-4421-8fbf-a4f8d36aa31b",
865-
relation="deleter",
866-
object="document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
867-
)]
868-
869-
response = await fga_client.batch_check(body, options)
870-
# response.responses = [{
871-
# allowed: false,
872-
# request: {
873-
# user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
874-
# relation: "viewer",
875-
# object: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
876-
@@ -787,7 +790,8 @@
877-
# }
878-
# }, {
879-
# allowed: false,
880-
# request: {
881-
# user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
882-
# relation: "admin",
883-
# object: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
884-
@@ -799,35 +803,40 @@
885-
# }
886-
# }, {
887-
# allowed: false,
888-
# request: {
889-
# user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
890-
# relation: "creator",
891-
# object: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
892-
# },
893-
# error: <FgaError ...>
894-
# }, {
895-
# allowed: true,
896-
# request: {
897-
# user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
898-
# relation: "deleter",
899-
# object: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
900-
# }},
901-
# ]
902-
```
903-
904832
#### Expand
905833

906834
Expands the relationships in userset tree format.

0 commit comments

Comments
 (0)