> For the complete documentation index, see [llms.txt](https://b2-scripts.gitbook.io/help/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://b2-scripts.gitbook.io/help/b2-sleek-ui-collection/b2-sleeknotify/api-reference.md).

# API Reference

## Client API Reference

### Exports

#### CreateNotification

The main function for creating notifications.

**Parameters**

```lua
{
    type = string,      -- 'success', 'error', 'info', 'warning'
    message = string,   -- The notification message
    title = string,     -- (Optional) Title for advanced style
    position = string,  -- (Optional) Screen position
    duration = number   -- (Optional) Duration in milliseconds
}
```

**Examples**

```lua
-- Basic usage
exports['b2-sleeknotify']:CreateNotification({
    type = 'success',
    message = 'Basic notification'
})

-- Full options
exports['b2-sleeknotify']:CreateNotification({
    type = 'success',
    title = 'Operation Complete',
    message = 'Action was successful',
    position = 'TOP_RIGHT',
    duration = 5000
})
```

### Events

#### notifications:create

Event that can be triggered to create a notification.

**Usage**

```lua
TriggerEvent('notifications:create', {
    type = 'success',
    message = 'Event triggered notification'
})
```

## Server API Reference

### Exports

#### SendNotificationToPlayer

Send a notification to a specific player.

```lua
exports['b2-sleeknotify']:SendNotificationToPlayer(source, {
    type = 'success',
    message = 'Server notification'
})
```

#### SendNotificationToAll

Send a notification to all players.

```lua
exports['b2-sleeknotify']:SendNotificationToAll({
    type = 'info',
    title = 'Server Announcement',
    message = 'Server restart in 5 minutes'
})
```

### Events

#### notifications:server:create

Server event to create notifications.

```lua
-- Send to specific player
TriggerClientEvent('notifications:create', playerId, {
    type = 'success',
    message = 'Server message'
})

-- Send to all players
TriggerClientEvent('notifications:create', -1, {
    type = 'info',
    message = 'Broadcast message'
})
```

### Common Use Cases

#### Server Announcements

```lua
-- Restart warning
exports['b2-sleeknotify']:SendNotificationToAll({
    type = 'warning',
    title = 'Server Restart',
    message = 'Server will restart in 5 minutes',
    position = 'TOP_CENTER',
    duration = 10000
})
```

#### Player-Specific Notifications

```lua
-- Admin action result
exports['b2-sleeknotify']:SendNotificationToPlayer(adminId, {
    type = 'success',
    title = 'Admin Action',
    message = 'Command executed successfully'
})
```
