Skip to content

Commit

Permalink
AI generated API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zefhemel committed Jan 16, 2025
1 parent 8b2e76e commit 38983b4
Show file tree
Hide file tree
Showing 14 changed files with 953 additions and 0 deletions.
28 changes: 28 additions & 0 deletions website/API/clientStore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
The Client Store API provides a simple key-value store for client-specific states and preferences.

# Client Store API

## clientStore.set(key, value)
Sets a value in the client store.

Example:
```lua
clientStore.set("theme", "dark")
```

## clientStore.get(key)
Gets a value from the client store.

Example:
```lua
local theme = clientStore.get("theme")
print("Current theme: " .. theme)
```

## clientStore.del(key)
Deletes a value from the client store.

Example:
```lua
clientStore.del("theme")
```
66 changes: 66 additions & 0 deletions website/API/datastore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Datastore API

The Datastore API provides functions for interacting with a key-value store that has query capabilities.

## Key-Value Operations

### datastore.set(key, value)
Sets a value in the key-value store.

Example:
```lua
datastore.set("user:123", {name = "John", age = 30})
```

### datastore.get(key)
Gets a value from the key-value store.

Example:
```lua
local user = datastore.get("user:123")
print(user.name) -- prints "John"
```

### datastore.del(key)
Deletes a value from the key-value store.

Example:
```lua
datastore.del("user:123")
```

## Batch Operations

### datastore.batch_set(kvs)
Sets multiple key-value pairs in a single operation.

Example:
```lua
local kvs = {
{key = "user:1", value = {name = "Alice"}},
{key = "user:2", value = {name = "Bob"}}
}
datastore.batch_set(kvs)
```

### datastore.batch_get(keys)
Gets multiple values in a single operation.

Example:
```lua
local keys = {"user:1", "user:2"}
local values = datastore.batch_get(keys)
for _, value in ipairs(values) do
print(value.name)
end
```

### datastore.batch_del(keys)
Deletes multiple values in a single operation.

Example:
```lua
local keys = {"user:1", "user:2"}
datastore.batch_del(keys)
```

21 changes: 21 additions & 0 deletions website/API/debug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Debug API

The Debug API provides functions for debugging and resetting the application state.

## debug.reset_client()
Completely wipes the client state, including cached files and databases.

Example:
```lua
debug.reset_client()
print("Client state has been reset")
```

## debug.cleanup()
Wipes the entire state KV store and the entire space KV store.

Example:
```lua
debug.cleanup()
print("All KV stores have been wiped")
```
Loading

0 comments on commit 38983b4

Please sign in to comment.