Skip to content

Commit 1bfd8fb

Browse files
committed
feat: rename and refactor to APIExecutor for consistency
1 parent f169187 commit 1bfd8fb

19 files changed

Lines changed: 215 additions & 176 deletions

File tree

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,32 @@
22

33
## [Unreleased](https://github.com/openfga/java-sdk/compare/v0.9.4...HEAD)
44

5+
### Changed
6+
- **BREAKING**: Renamed "Raw API" to "API Executor" throughout the SDK for consistency with Go SDK naming conventions
7+
- `RawApi` class renamed to `ApiExecutor`
8+
- `RawRequestBuilder` class renamed to `ApiExecutorRequestBuilder`
9+
- `OpenFgaClient.raw()` method renamed to `OpenFgaClient.apiExecutor()`
10+
- All documentation updated to refer to "API Executor" instead of "Raw API"
11+
- Example directory `examples/raw-api` renamed to `examples/api-executor`
12+
- Documentation file `docs/RawApi.md` renamed to `docs/ApiExecutor.md`
13+
14+
**Migration Guide**: Update your code as follows:
15+
```java
16+
// Before
17+
RawRequestBuilder request = RawRequestBuilder.builder("POST", "/stores/{store_id}/endpoint")
18+
.pathParam("store_id", storeId)
19+
.body(requestData)
20+
.build();
21+
ApiResponse<ResponseType> response = client.raw().send(request, ResponseType.class).get();
22+
23+
// After
24+
ApiExecutorRequestBuilder request = ApiExecutorRequestBuilder.builder("POST", "/stores/{store_id}/endpoint")
25+
.pathParam("store_id", storeId)
26+
.body(requestData)
27+
.build();
28+
ApiResponse<ResponseType> response = client.apiExecutor().send(request, ResponseType.class).get();
29+
```
30+
531
## v0.9.4
632

733
### [0.9.4](https://github.com/openfga/java-sdk/compare/v0.9.3...v0.9.4) (2025-12-05)

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,14 +1170,14 @@ try {
11701170

11711171
### Calling Other Endpoints
11721172

1173-
The Raw API provides direct HTTP access to OpenFGA endpoints not yet wrapped by the SDK. It maintains the SDK's client configuration including authentication, telemetry, retries, and error handling.
1173+
The API Executor provides direct HTTP access to OpenFGA endpoints not yet wrapped by the SDK. It maintains the SDK's client configuration including authentication, telemetry, retries, and error handling.
11741174

11751175
Use cases:
11761176
- Calling endpoints not yet supported by the SDK
11771177
- Using an SDK version that lacks support for a particular endpoint
11781178
- Accessing custom endpoints that extend the OpenFGA API
11791179

1180-
Initialize the SDK normally and access the Raw API via the `fgaClient` instance:
1180+
Initialize the SDK normally and access the API Executor via the `fgaClient` instance:
11811181

11821182
```java
11831183
// Initialize the client, same as above
@@ -1194,7 +1194,7 @@ Map<String, Object> requestBody = Map.of(
11941194
);
11951195

11961196
// Build the request
1197-
RawRequestBuilder request = RawRequestBuilder.builder("POST", "/stores/{store_id}/custom-endpoint")
1197+
ApiExecutorRequestBuilder request = ApiExecutorRequestBuilder.builder("POST", "/stores/{store_id}/custom-endpoint")
11981198
.pathParam("store_id", storeId)
11991199
.queryParam("page_size", "20")
12001200
.queryParam("continuation_token", "eyJwayI6...")
@@ -1207,7 +1207,7 @@ RawRequestBuilder request = RawRequestBuilder.builder("POST", "/stores/{store_id
12071207

12081208
```java
12091209
// Get raw response without automatic decoding
1210-
ApiResponse<String> rawResponse = fgaClient.raw().send(request).get();
1210+
ApiResponse<String> rawResponse = fgaClient.apiExecutor().send(request).get();
12111211

12121212
String rawJson = rawResponse.getData();
12131213
System.out.println("Response: " + rawJson);
@@ -1232,7 +1232,7 @@ class CustomEndpointResponse {
12321232
}
12331233

12341234
// Get response decoded into CustomEndpointResponse class
1235-
ApiResponse<CustomEndpointResponse> response = fgaClient.raw()
1235+
ApiResponse<CustomEndpointResponse> response = fgaClient.apiExecutor()
12361236
.send(request, CustomEndpointResponse.class)
12371237
.get();
12381238

@@ -1245,11 +1245,11 @@ System.out.println("Status Code: " + response.getStatusCode());
12451245
System.out.println("Headers: " + response.getHeaders());
12461246
```
12471247

1248-
For a complete working example, see [examples/raw-api](examples/raw-api).
1248+
For a complete working example, see [examples/api-executor](examples/api-executor).
12491249

12501250
#### Documentation
12511251

1252-
See [docs/RawApi.md](docs/RawApi.md) for complete API reference and examples.
1252+
See [docs/ApiExecutor.md](docs/ApiExecutor.md) for complete API reference and examples.
12531253

12541254
### API Endpoints
12551255

docs/RawApi.md renamed to docs/ApiExecutor.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Raw API
1+
# API Executor
22

33
Direct HTTP access to OpenFGA endpoints.
44

@@ -8,25 +8,25 @@ Direct HTTP access to OpenFGA endpoints.
88
OpenFgaClient client = new OpenFgaClient(config);
99

1010
// Build request
11-
RawRequestBuilder request = RawRequestBuilder.builder("POST", "/stores/{store_id}/check")
11+
ApiExecutorRequestBuilder request = ApiExecutorRequestBuilder.builder("POST", "/stores/{store_id}/check")
1212
.pathParam("store_id", storeId)
1313
.body(Map.of("tuple_key", Map.of("user", "user:jon", "relation", "reader", "object", "doc:1")))
1414
.build();
1515

1616
// Execute - typed response
17-
ApiResponse<CheckResponse> response = client.raw().send(request, CheckResponse.class).get();
17+
ApiResponse<CheckResponse> response = client.apiExecutor().send(request, CheckResponse.class).get();
1818

1919
// Execute - raw JSON
20-
ApiResponse<String> rawResponse = client.raw().send(request).get();
20+
ApiResponse<String> rawResponse = client.apiExecutor().send(request).get();
2121
```
2222

2323
## API Reference
2424

25-
### RawRequestBuilder
25+
### ApiExecutorRequestBuilder
2626

2727
**Factory:**
2828
```java
29-
RawRequestBuilder.builder(String method, String path)
29+
ApiExecutorRequestBuilder.builder(String method, String path)
3030
```
3131

3232
**Methods:**
@@ -40,25 +40,25 @@ RawRequestBuilder.builder(String method, String path)
4040

4141
**Example:**
4242
```java
43-
RawRequestBuilder request = RawRequestBuilder.builder("POST", "/stores/{store_id}/write")
43+
ApiExecutorRequestBuilder request = ApiExecutorRequestBuilder.builder("POST", "/stores/{store_id}/write")
4444
.pathParam("store_id", "01ABC")
4545
.queryParam("dry_run", "true")
4646
.header("X-Request-ID", "uuid")
4747
.body(requestObject)
4848
.build();
4949
```
5050

51-
### RawApi
51+
### ApiExecutor
5252

5353
**Access:**
5454
```java
55-
RawApi rawApi = client.raw();
55+
RawApi rawApi = client.apiExecutor();
5656
```
5757

5858
**Methods:**
5959
```java
60-
CompletableFuture<ApiResponse<String>> send(RawRequestBuilder request)
61-
CompletableFuture<ApiResponse<T>> send(RawRequestBuilder request, Class<T> responseType)
60+
CompletableFuture<ApiResponse<String>> send(ApiExecutorRequestBuilder request)
61+
CompletableFuture<ApiResponse<T>> send(ApiExecutorRequestBuilder request, Class<T> responseType)
6262
```
6363

6464
### ApiResponse<T>
@@ -74,34 +74,34 @@ T getData() // Deserialized data
7474

7575
### GET Request
7676
```java
77-
RawRequestBuilder request = RawRequestBuilder.builder("GET", "/stores/{store_id}/feature")
77+
ApiExecutorRequestBuilder request = ApiExecutorRequestBuilder.builder("GET", "/stores/{store_id}/feature")
7878
.pathParam("store_id", storeId)
7979
.build();
8080

81-
client.raw().send(request, FeatureResponse.class)
81+
client.apiExecutor().send(request, FeatureResponse.class)
8282
.thenAccept(r -> System.out.println("Status: " + r.getStatusCode()));
8383
```
8484

8585
### POST with Body
8686
```java
87-
RawRequestBuilder request = RawRequestBuilder.builder("POST", "/stores/{store_id}/bulk-delete")
87+
ApiExecutorRequestBuilder request = ApiExecutorRequestBuilder.builder("POST", "/stores/{store_id}/bulk-delete")
8888
.pathParam("store_id", storeId)
8989
.queryParam("force", "true")
9090
.body(new BulkDeleteRequest("2023-01-01", "user", 1000))
9191
.build();
9292

93-
client.raw().send(request, BulkDeleteResponse.class).get();
93+
client.apiExecutor().send(request, BulkDeleteResponse.class).get();
9494
```
9595

9696
### Raw JSON Response
9797
```java
98-
ApiResponse<String> response = client.raw().send(request).get();
98+
ApiResponse<String> response = client.apiExecutor().send(request).get();
9999
String json = response.getRawResponse(); // Raw JSON
100100
```
101101

102102
### Query Parameters
103103
```java
104-
RawRequestBuilder.builder("GET", "/stores/{store_id}/items")
104+
ApiExecutorRequestBuilder.builder("GET", "/stores/{store_id}/items")
105105
.pathParam("store_id", storeId)
106106
.queryParam("page", "1")
107107
.queryParam("limit", "50")
@@ -111,7 +111,7 @@ RawRequestBuilder.builder("GET", "/stores/{store_id}/items")
111111

112112
### Custom Headers
113113
```java
114-
RawRequestBuilder.builder("POST", "/stores/{store_id}/action")
114+
ApiExecutorRequestBuilder.builder("POST", "/stores/{store_id}/action")
115115
.header("X-Request-ID", UUID.randomUUID().toString())
116116
.header("X-Idempotency-Key", "key-123")
117117
.body(data)
@@ -120,7 +120,7 @@ RawRequestBuilder.builder("POST", "/stores/{store_id}/action")
120120

121121
### Error Handling
122122
```java
123-
client.raw().send(request, ResponseType.class)
123+
client.apiExecutor().send(request, ResponseType.class)
124124
.exceptionally(e -> {
125125
if (e.getCause() instanceof FgaError) {
126126
FgaError error = (FgaError) e.getCause();
@@ -132,7 +132,7 @@ client.raw().send(request, ResponseType.class)
132132

133133
### Map as Request Body
134134
```java
135-
RawRequestBuilder.builder("POST", "/stores/{store_id}/settings")
135+
ApiExecutorRequestBuilder.builder("POST", "/stores/{store_id}/settings")
136136
.pathParam("store_id", storeId)
137137
.body(Map.of(
138138
"setting", "value",
@@ -151,15 +151,15 @@ RawRequestBuilder.builder("POST", "/stores/{store_id}/settings")
151151

152152
## Migration to Typed Methods
153153

154-
When SDK adds typed methods for an endpoint, you can migrate from Raw API:
154+
When SDK adds typed methods for an endpoint, you can migrate from API Executor:
155155

156156
```java
157-
// Raw API
158-
RawRequestBuilder request = RawRequestBuilder.builder("POST", "/stores/{store_id}/check")
157+
// API Executor
158+
ApiExecutorRequestBuilder request = ApiExecutorRequestBuilder.builder("POST", "/stores/{store_id}/check")
159159
.body(req)
160160
.build();
161161

162-
client.raw().send(request, CheckResponse.class).get();
162+
client.apiExecutor().send(request, CheckResponse.class).get();
163163

164164
// Typed SDK (when available)
165165
client.check(req).get();

examples/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ A simple example that creates a store, runs a set of calls against it including
1313
#### Streaming Examples
1414
- `streamed-list-objects/` - Demonstrates using the StreamedListObjects API to retrieve large result sets without pagination limits
1515

16-
#### Raw API Examples
17-
- `raw-api/` - Demonstrates direct HTTP access to OpenFGA endpoints not yet wrapped by the SDK, maintaining SDK configuration (authentication, retries, error handling)
16+
#### API Executor Examples
17+
- `api-executor/` - Demonstrates direct HTTP access to OpenFGA endpoints not yet wrapped by the SDK, maintaining SDK configuration (authentication, retries, error handling)
1818

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Raw API Example
1+
# API Executor Example
22

3-
Demonstrates using the Raw API to call OpenFGA endpoints that are not yet wrapped by the SDK.
3+
Demonstrates using the API Executor to call OpenFGA endpoints that are not yet wrapped by the SDK.
44

5-
## What is the Raw API?
5+
## What is the API Executor?
66

7-
The Raw API provides direct HTTP access to OpenFGA endpoints while maintaining the SDK's configuration (authentication, telemetry, retries, and error handling).
7+
The API Executor provides direct HTTP access to OpenFGA endpoints while maintaining the SDK's configuration (authentication, telemetry, retries, and error handling).
88

99
Use cases:
1010
- Calling endpoints not yet wrapped by the SDK
@@ -26,7 +26,7 @@ docker run -p 8080:8080 openfga/openfga run
2626
./gradlew build
2727

2828
# Then run the example
29-
cd examples/raw-api
29+
cd examples/api-executor
3030
./gradlew run
3131
```
3232

@@ -39,7 +39,7 @@ make run
3939

4040
## What it does
4141

42-
The example demonstrates Raw API capabilities using real OpenFGA endpoints:
42+
The example demonstrates API Executor capabilities using real OpenFGA endpoints:
4343

4444
1. **List Stores (GET with typed response)**: Lists all stores and deserializes into `ListStoresResponse`
4545
2. **Get Store (GET with raw JSON)**: Retrieves a single store and returns the raw JSON string
@@ -56,7 +56,7 @@ All requests will succeed (except #5 which intentionally triggers an error for d
5656
Build requests using the builder pattern:
5757

5858
```java
59-
RawRequestBuilder request = RawRequestBuilder.builder("POST", "/stores/{store_id}/custom-endpoint")
59+
ApiExecutorRequestBuilder request = ApiExecutorRequestBuilder.builder("POST", "/stores/{store_id}/custom-endpoint")
6060
.pathParam("store_id", storeId)
6161
.queryParam("page_size", "20")
6262
.queryParam("continuation_token", "eyJwayI6...")
@@ -70,7 +70,7 @@ RawRequestBuilder request = RawRequestBuilder.builder("POST", "/stores/{store_id
7070

7171
**Typed Response (automatic deserialization):**
7272
```java
73-
client.raw().send(request, CustomResponse.class)
73+
client.apiExecutor().send(request, CustomResponse.class)
7474
.thenAccept(response -> {
7575
System.out.println("Data: " + response.getData());
7676
System.out.println("Status: " + response.getStatusCode());
@@ -79,7 +79,7 @@ client.raw().send(request, CustomResponse.class)
7979

8080
**Raw JSON Response:**
8181
```java
82-
client.raw().send(request)
82+
client.apiExecutor().send(request)
8383
.thenAccept(response -> {
8484
System.out.println("Raw JSON: " + response.getRawResponse());
8585
});
@@ -96,14 +96,14 @@ Requests automatically include:
9696

9797
## Code Structure
9898

99-
- `RawApiExample.java`: Example demonstrating Raw API usage with real OpenFGA endpoints
99+
- `ApiExecutorExample.java`: Example demonstrating API Executor usage with real OpenFGA endpoints
100100

101101
## Notes
102102

103-
This example uses real OpenFGA endpoints (`/stores`, `/stores/{store_id}`) to demonstrate actual functionality. The Raw API can be used with any OpenFGA endpoint, including custom endpoints if you have extended the API.
103+
This example uses real OpenFGA endpoints (`/stores`, `/stores/{store_id}`) to demonstrate actual functionality. The API Executor can be used with any OpenFGA endpoint, including custom endpoints if you have extended the API.
104104

105105
## See Also
106106

107-
- [Raw API Documentation](../../docs/RawApi.md)
107+
- [API Executor Documentation](../../docs/RawApi.md)
108108
- [OpenFGA API Reference](https://openfga.dev/api)
109109

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
application {
7-
mainClass = 'dev.openfga.sdk.example.RawApiExample'
7+
mainClass = 'dev.openfga.sdk.example.ApiExecutorExample'
88
}
99

1010
repositories {

examples/raw-api/gradle/wrapper/gradle-wrapper.properties renamed to examples/api-executor/gradle/wrapper/gradle-wrapper.properties

File renamed without changes.

0 commit comments

Comments
 (0)