You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In certain cases you may want to call other APIs not yet wrapped by the SDK. You can do so by using the `raw_request` method available on the `OpenFgaClient`. The `raw_request` method allows you to make raw HTTP calls to any OpenFGA endpoint by specifying the operation name, HTTP method, path, parameters, body, and headers, while still honoring the client configuration (authentication, telemetry, retries, and error handling).
1266
+
In certain cases you may want to call other APIs not yet wrapped by the SDK. You can do so by using the `execute_api_request` method available on the `OpenFgaClient`. The `execute_api_request` method allows you to make raw HTTP calls to any OpenFGA endpoint by specifying the HTTP method, path, body, query parameters, and path parameters, while still honoring the client configuration (authentication, telemetry, retries, and error handling).
1267
+
1268
+
For streaming endpoints, use `execute_streamed_api_request` instead.
1267
1269
1268
1270
This is useful when:
1269
1271
- You want to call a new endpoint that is not yet supported by the SDK
1270
1272
- You are using an earlier version of the SDK that doesn't yet support a particular endpoint
1271
1273
- You have a custom endpoint deployed that extends the OpenFGA API
1272
1274
1273
-
In all cases, you initialize the SDK the same way as usual, and then call `raw_request` on the `fga_client` instance.
1275
+
In all cases, you initialize the SDK the same way as usual, and then call `execute_api_request` on the `fga_client` instance.
1274
1276
1275
1277
```python
1276
1278
from openfga_sdk import ClientConfiguration, OpenFgaClient
@@ -1287,82 +1289,57 @@ async with OpenFgaClient(configuration) as fga_client:
1287
1289
"resource": "resource:123",
1288
1290
}
1289
1291
1290
-
response =await fga_client.raw_request(
1291
-
operation_name="CustomEndpoint",
1292
-
method="POST",
1293
-
path="/stores/{store_id}/custom-endpoint",
1294
-
path_params={"store_id": FGA_STORE_ID},
1295
-
query_params={"page_size": "20"},
1296
-
body=request_body,
1297
-
headers={"X-Experimental-Feature": "enabled"},
1298
-
)
1292
+
response =await fga_client.execute_api_request({
1293
+
"operation_name": "CustomEndpoint",
1294
+
"method": "POST",
1295
+
"path": "/stores/{store_id}/custom-endpoint",
1296
+
"path_params": {"store_id": FGA_STORE_ID},
1297
+
"query_params": {"page_size": "20"},
1298
+
"body": request_body,
1299
+
"headers": {"X-Experimental-Feature": "enabled"},
1300
+
})
1299
1301
```
1300
1302
1301
-
#### Example: Calling a new "Custom Endpoint" endpoint and handling raw response
0 commit comments