Skip to content

Commit baa4c4b

Browse files
committed
docs: update documentation
1 parent ae1e9b4 commit baa4c4b

File tree

12 files changed

+479
-161
lines changed

12 files changed

+479
-161
lines changed

.github/labeler.yml

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Documentation
2-
documentation:
2+
"kind/documentation":
33
- changed-files:
44
- any-glob-to-any-file:
55
- "**/*.md"
66
- "docs/**/*"
77

88
# CI/CD
9-
ci:
9+
"area/ci":
1010
- changed-files:
1111
- any-glob-to-any-file:
1212
- ".github/**/*"
1313

1414
# Configuration
15-
config:
15+
"area/config":
1616
- changed-files:
1717
- any-glob-to-any-file:
1818
- "**/*.toml"
@@ -21,72 +21,70 @@ config:
2121
- "!.github/**/*"
2222

2323
# Dependencies
24-
dependencies:
24+
"area/deps":
2525
- changed-files:
2626
- any-glob-to-any-file:
2727
- "**/Cargo.toml"
2828
- "**/Cargo.lock"
2929

3030
# Testing
31-
testing:
31+
"area/testing":
3232
- changed-files:
3333
- any-glob-to-any-file:
3434
- "**/tests/**/*"
3535
- "**/*_test.rs"
3636
- "**/*_tests.rs"
37-
38-
# Source code
39-
source:
40-
- changed-files:
41-
- any-glob-to-any-file:
42-
- "src/**/*"
37+
- "src/testing/**/*"
4338

4439
# Client
45-
client:
40+
"area/client":
4641
- changed-files:
4742
- any-glob-to-any-file:
4843
- "src/client/**/*"
4944
- "src/client.rs"
45+
- "src/vault/**/*"
5046

51-
# Transport
52-
transport:
47+
# Protocol buffers and gRPC
48+
"area/proto":
5349
- changed-files:
5450
- any-glob-to-any-file:
5551
- "src/transport/**/*"
56-
- "src/grpc/**/*"
57-
- "src/rest/**/*"
52+
- "proto/**/*"
53+
- "build.rs"
5854

5955
# Authentication
60-
auth:
56+
"area/auth":
6157
- changed-files:
6258
- any-glob-to-any-file:
6359
- "src/auth/**/*"
6460
- "src/credentials/**/*"
6561

6662
# API
67-
api:
63+
"area/api":
6864
- changed-files:
6965
- any-glob-to-any-file:
7066
- "src/api/**/*"
7167
- "src/check/**/*"
7268
- "src/relationships/**/*"
7369
- "src/expand/**/*"
70+
- "src/control/**/*"
71+
72+
# Data models and types
73+
"area/models":
74+
- changed-files:
75+
- any-glob-to-any-file:
76+
- "src/types/**/*"
77+
- "src/models/**/*"
78+
- "src/error/**/*"
7479

7580
# Derive macros
76-
macros:
81+
"area/derive":
7782
- changed-files:
7883
- any-glob-to-any-file:
7984
- "inferadb-derive/**/*"
8085

8186
# Examples
82-
examples:
87+
"area/examples":
8388
- changed-files:
8489
- any-glob-to-any-file:
8590
- "examples/**/*"
86-
87-
# Proto/gRPC
88-
proto:
89-
- changed-files:
90-
- any-glob-to-any-file:
91-
- "proto/**/*"
92-
- "build.rs"

README.md

Lines changed: 7 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -60,36 +60,11 @@ let vault = org.vault("vlt_...");
6060

6161
### Permission Checks
6262

63-
#### Check a Permission
64-
6563
```rust
6664
let allowed = vault.check("user:alice", "view", "doc:1").await?;
6765
```
6866

69-
#### Check with ABAC Context
70-
71-
```rust
72-
let allowed = vault.check("user:alice", "view", "doc:confidential")
73-
.with_context(Context::new()
74-
.with("ip_address", "10.0.0.50")
75-
.with("mfa_verified", true))
76-
.await?;
77-
```
78-
79-
#### Require Permission (Guard Clause)
80-
81-
```rust
82-
vault.check("user:alice", "edit", "doc:1").require().await?;
83-
```
84-
85-
#### Check Multiple Permissions
86-
87-
```rust
88-
let results = vault.check_batch([
89-
("user:alice", "view", "doc:1"),
90-
("user:alice", "edit", "doc:1"),
91-
]).await?;
92-
```
67+
See the [Authorization API Guide](docs/guides/authorization-api.md) for ABAC context, batch checks, guard clauses, and more.
9368

9469
### Relationships
9570

@@ -205,125 +180,40 @@ while let Some(event) = stream.next().await {
205180

206181
```rust
207182
let org = client.organization("org_...");
208-
let vault = org.vault("vlt_...");
209-
```
210-
211-
### Organizations
212-
213-
#### Get Current Organization
214-
215-
```rust
216-
let info = org.control().get().await?;
217183
```
218184

219185
### Vaults
220186

221-
#### Create a Vault
222-
223187
```rust
224188
let vault = org.vaults().create(CreateVaultRequest::new("production")).await?;
225189
```
226190

227-
#### List Vaults
228-
229-
```rust
230-
let vaults = org.vaults().list().collect().await?;
231-
```
232-
233191
### Schemas
234192

235-
#### Push a Schema
236-
237193
```rust
238-
let result = vault.schemas().push(r#"
194+
vault.schemas().push(r#"
239195
type user {}
240196
type document {
241197
relation viewer: user
242-
relation editor: user
243-
permission view = viewer + editor
244-
permission edit = editor
198+
permission view = viewer
245199
}
246200
"#).await?;
247201
```
248202

249-
#### Validate a Schema
250-
251-
```rust
252-
let validation = vault.schemas().validate(schema_content).await?;
253-
```
254-
255-
#### Activate a Schema Version
256-
257-
```rust
258-
vault.schemas().activate("v2").await?;
259-
```
260-
261-
#### Compare Schema Versions
262-
263-
```rust
264-
let diff = vault.schemas().diff("v1", "v2").await?;
265-
```
266-
267-
### Members
268-
269-
#### Invite a Member
203+
### Members & Teams
270204

271205
```rust
272206
org.members().invite(InviteMemberRequest::new("alice@example.com", OrgRole::Admin)).await?;
273-
```
274-
275-
### Teams
276-
277-
#### Create a Team
278-
279-
```rust
280207
org.teams().create(CreateTeamRequest::new("Engineering")).await?;
281208
```
282209

283-
#### Add Member to Team
284-
285-
```rust
286-
org.teams().add_member("team_...", "user_...", TeamRole::Member).await?;
287-
```
288-
289-
### API Clients
290-
291-
#### Create an API Client
292-
293-
```rust
294-
let api_client = org.clients().create(
295-
CreateApiClientRequest::new("payment-service")
296-
).await?;
297-
```
298-
299-
#### Rotate Client Credentials
300-
301-
```rust
302-
org.clients().certificates("client_...").rotate(
303-
RotateCertificateRequest::new(public_key_pem)
304-
).await?;
305-
```
306-
307210
### Audit Logs
308211

309-
#### Query Audit Events
310-
311212
```rust
312-
let events = org.audit().list()
313-
.action(AuditAction::RelationshipCreated)
314-
.since(one_hour_ago)
315-
.collect()
316-
.await?;
213+
let events = org.audit().list().collect().await?;
317214
```
318215

319-
#### Export Audit Logs
320-
321-
```rust
322-
org.audit().export()
323-
.format(ExportFormat::Json)
324-
.write_to_file("audit.json")
325-
.await?;
326-
```
216+
See the [Management API Guide](docs/guides/management-api.md) for organizations, API clients, schema versioning, and more.
327217

328218
## Local Development
329219

@@ -373,6 +263,7 @@ See the [Testing Guide](docs/guides/testing.md) for `InMemoryClient` (full polic
373263
| ----------------------------------------------------------- | ------------------------------------------------- |
374264
| [Installation](docs/guides/installation.md) | Feature flags, optimized builds, TLS, MSRV |
375265
| [Authentication](docs/guides/authentication.md) | Client credentials, bearer tokens, key management |
266+
| [Authorization API](docs/guides/authorization-api.md) | Permission checks, relationships, lookups, watch |
376267
| [Integration Patterns](docs/guides/integration-patterns.md) | Axum, Actix-web, GraphQL, gRPC middleware |
377268
| [Error Handling](docs/guides/errors.md) | Error types, retries, graceful degradation |
378269
| [Testing](docs/guides/testing.md) | MockClient, InMemoryClient, TestVault |

docs/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Supplementary documentation for the InferaDB Rust SDK. For the main README and q
88
| ------------------------------------------------------ | ------------------------------------------------------ |
99
| [Installation](guides/installation.md) | Feature flags, optimized builds, TLS options, MSRV |
1010
| [Authentication](guides/authentication.md) | Client credentials, bearer tokens, key management |
11+
| [Authorization API](guides/authorization-api.md) | Permission checks, relationships, lookups, watch |
1112
| [Integration Patterns](guides/integration-patterns.md) | Framework integration (Axum, Actix-web, GraphQL, gRPC) |
1213
| [Error Handling](guides/errors.md) | Error types, retries, graceful degradation |
1314
| [Testing](guides/testing.md) | MockClient, InMemoryClient, TestVault |
@@ -31,7 +32,7 @@ Supplementary documentation for the InferaDB Rust SDK. For the main README and q
3132

3233
| Guide | Description |
3334
| --------------------------------------- | -------------------------------------------------- |
34-
| [Control API](guides/control-api.md) | Organizations, vaults, schemas, members, audit |
35+
| [Management API](guides/management-api.md) | Organizations, vaults, schemas, members, audit |
3536
| [Advanced Features](guides/advanced.md) | Simulation, explain, export/import, type-safe APIs |
3637

3738
## Production

docs/guides/authentication.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,4 +255,4 @@ match client.auth_status().await {
255255

256256
- [Production Checklist](production-checklist.md) - Security requirements
257257
- [Error Handling](errors.md) - Auth error types
258-
- [Control API](control-api.md) - Managing API clients and keys
258+
- [Management API](management-api.md) - Managing API clients and keys

0 commit comments

Comments
 (0)