@redseat/api 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +132 -132
- package/agents.md +275 -275
- package/client.md +318 -288
- package/dist/client.d.ts +1 -0
- package/dist/client.js +3 -0
- package/dist/library.d.ts +3 -0
- package/dist/library.js +8 -1
- package/encryption.md +533 -533
- package/firebase.md +602 -602
- package/libraries.md +1652 -1652
- package/package.json +49 -49
- package/server.md +196 -196
- package/test.md +291 -291
package/README.md
CHANGED
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
# @redseat/api
|
|
2
|
-
|
|
3
|
-
TypeScript API client library for interacting with Redseat servers. This package provides a comprehensive set of APIs for managing libraries, media, tags, people, series, movies, and more.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
The `@redseat/api` package is organized into three main API classes:
|
|
8
|
-
|
|
9
|
-
- **RedseatClient**: Low-level HTTP client with automatic token management and local server detection
|
|
10
|
-
- **ServerApi**: Server-level operations (libraries, settings, plugins, credentials)
|
|
11
|
-
- **LibraryApi**: Library-specific operations (media, tags, people, series, movies, encryption)
|
|
12
|
-
|
|
13
|
-
## Quick Start
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
16
|
-
import { RedseatClient, ServerApi, LibraryApi } from '@redseat/api';
|
|
17
|
-
import { IServer, ILibrary } from '@redseat/api';
|
|
18
|
-
|
|
19
|
-
// Initialize the client
|
|
20
|
-
const client = new RedseatClient({
|
|
21
|
-
server: {
|
|
22
|
-
id: 'server-id',
|
|
23
|
-
url: 'example.com',
|
|
24
|
-
port: 443
|
|
25
|
-
},
|
|
26
|
-
getIdToken: async () => {
|
|
27
|
-
// Return your ID token from your auth provider
|
|
28
|
-
return 'your-id-token';
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
// Get server API
|
|
33
|
-
const serverApi = new ServerApi(client);
|
|
34
|
-
|
|
35
|
-
// Get libraries
|
|
36
|
-
const libraries = await serverApi.getLibraries();
|
|
37
|
-
|
|
38
|
-
// Get library API for a specific library
|
|
39
|
-
const library = libraries[0];
|
|
40
|
-
const libraryApi = new LibraryApi(client, library.id!, library);
|
|
41
|
-
|
|
42
|
-
// For encrypted libraries, set the encryption key
|
|
43
|
-
if (library.crypt) {
|
|
44
|
-
await libraryApi.setKey('your-passphrase');
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Get media
|
|
48
|
-
const medias = await libraryApi.getMedias();
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Documentation
|
|
52
|
-
|
|
53
|
-
- **[client.md](client.md)** - RedseatClient documentation
|
|
54
|
-
- HTTP client configuration
|
|
55
|
-
- Automatic token refresh
|
|
56
|
-
- Local server detection
|
|
57
|
-
- Request/response interceptors
|
|
58
|
-
|
|
59
|
-
- **[server.md](server.md)** - ServerApi documentation
|
|
60
|
-
- Server-level operations
|
|
61
|
-
- Library management
|
|
62
|
-
- Settings and plugins
|
|
63
|
-
- Credentials management
|
|
64
|
-
|
|
65
|
-
- **[libraries.md](libraries.md)** - LibraryApi documentation
|
|
66
|
-
- Media operations (upload, download, update)
|
|
67
|
-
- Tags, people, series, movies management
|
|
68
|
-
- Face recognition operations
|
|
69
|
-
- Encryption support for encrypted libraries
|
|
70
|
-
|
|
71
|
-
- **[encryption.md](encryption.md)** - Encryption module documentation
|
|
72
|
-
- Key derivation (PBKDF2)
|
|
73
|
-
- Text and binary encryption/decryption
|
|
74
|
-
- File encryption with thumbnails
|
|
75
|
-
- Cross-platform compatibility
|
|
76
|
-
|
|
77
|
-
- **[test.md](test.md)** - Testing guide
|
|
78
|
-
- How to run tests
|
|
79
|
-
- Test file descriptions
|
|
80
|
-
- Test coverage information
|
|
81
|
-
|
|
82
|
-
- **[agents.md](agents.md)** - AI agent instructions
|
|
83
|
-
- Documentation maintenance guidelines
|
|
84
|
-
- Code change workflow
|
|
85
|
-
- Best practices for keeping docs updated
|
|
86
|
-
|
|
87
|
-
## Package Exports
|
|
88
|
-
|
|
89
|
-
### Classes
|
|
90
|
-
- `RedseatClient` - HTTP client with authentication
|
|
91
|
-
- `ServerApi` - Server-level API operations
|
|
92
|
-
- `LibraryApi` - Library-level API operations
|
|
93
|
-
|
|
94
|
-
### Interfaces
|
|
95
|
-
- `IFile` - Media file interface
|
|
96
|
-
- `ILibrary` - Library interface
|
|
97
|
-
- `ITag` - Tag interface
|
|
98
|
-
- `IPerson` - Person interface
|
|
99
|
-
- `ISerie` - Series interface
|
|
100
|
-
- `IMovie` - Movie interface
|
|
101
|
-
- `IServer` - Server interface
|
|
102
|
-
- `MediaRequest` - Media query filter
|
|
103
|
-
- And more (see `src/interfaces.ts`)
|
|
104
|
-
|
|
105
|
-
### Encryption Functions
|
|
106
|
-
- `deriveKey()` - Derive encryption key from passphrase
|
|
107
|
-
- `encryptText()` / `decryptText()` - Text encryption
|
|
108
|
-
- `encryptBuffer()` / `decryptBuffer()` - Binary encryption
|
|
109
|
-
- `encryptFile()` / `decryptFile()` - File encryption with metadata
|
|
110
|
-
- `getRandomIV()` - Generate random IV
|
|
111
|
-
|
|
112
|
-
### Utilities
|
|
113
|
-
- `fetchServerToken()` - Fetch server authentication token
|
|
114
|
-
- Base64 encoding/decoding utilities
|
|
115
|
-
- Crypto utilities for cross-platform support
|
|
116
|
-
|
|
117
|
-
## Installation
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
npm install @redseat/api
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
## Requirements
|
|
124
|
-
|
|
125
|
-
- Node.js 15+ (for Web Crypto API support)
|
|
126
|
-
- TypeScript 5.0+
|
|
127
|
-
- Axios 1.11.0+
|
|
128
|
-
|
|
129
|
-
## License
|
|
130
|
-
|
|
131
|
-
See the main project LICENSE file.
|
|
132
|
-
|
|
1
|
+
# @redseat/api
|
|
2
|
+
|
|
3
|
+
TypeScript API client library for interacting with Redseat servers. This package provides a comprehensive set of APIs for managing libraries, media, tags, people, series, movies, and more.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The `@redseat/api` package is organized into three main API classes:
|
|
8
|
+
|
|
9
|
+
- **RedseatClient**: Low-level HTTP client with automatic token management and local server detection
|
|
10
|
+
- **ServerApi**: Server-level operations (libraries, settings, plugins, credentials)
|
|
11
|
+
- **LibraryApi**: Library-specific operations (media, tags, people, series, movies, encryption)
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { RedseatClient, ServerApi, LibraryApi } from '@redseat/api';
|
|
17
|
+
import { IServer, ILibrary } from '@redseat/api';
|
|
18
|
+
|
|
19
|
+
// Initialize the client
|
|
20
|
+
const client = new RedseatClient({
|
|
21
|
+
server: {
|
|
22
|
+
id: 'server-id',
|
|
23
|
+
url: 'example.com',
|
|
24
|
+
port: 443
|
|
25
|
+
},
|
|
26
|
+
getIdToken: async () => {
|
|
27
|
+
// Return your ID token from your auth provider
|
|
28
|
+
return 'your-id-token';
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Get server API
|
|
33
|
+
const serverApi = new ServerApi(client);
|
|
34
|
+
|
|
35
|
+
// Get libraries
|
|
36
|
+
const libraries = await serverApi.getLibraries();
|
|
37
|
+
|
|
38
|
+
// Get library API for a specific library
|
|
39
|
+
const library = libraries[0];
|
|
40
|
+
const libraryApi = new LibraryApi(client, library.id!, library);
|
|
41
|
+
|
|
42
|
+
// For encrypted libraries, set the encryption key
|
|
43
|
+
if (library.crypt) {
|
|
44
|
+
await libraryApi.setKey('your-passphrase');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Get media
|
|
48
|
+
const medias = await libraryApi.getMedias();
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Documentation
|
|
52
|
+
|
|
53
|
+
- **[client.md](client.md)** - RedseatClient documentation
|
|
54
|
+
- HTTP client configuration
|
|
55
|
+
- Automatic token refresh
|
|
56
|
+
- Local server detection
|
|
57
|
+
- Request/response interceptors
|
|
58
|
+
|
|
59
|
+
- **[server.md](server.md)** - ServerApi documentation
|
|
60
|
+
- Server-level operations
|
|
61
|
+
- Library management
|
|
62
|
+
- Settings and plugins
|
|
63
|
+
- Credentials management
|
|
64
|
+
|
|
65
|
+
- **[libraries.md](libraries.md)** - LibraryApi documentation
|
|
66
|
+
- Media operations (upload, download, update)
|
|
67
|
+
- Tags, people, series, movies management
|
|
68
|
+
- Face recognition operations
|
|
69
|
+
- Encryption support for encrypted libraries
|
|
70
|
+
|
|
71
|
+
- **[encryption.md](encryption.md)** - Encryption module documentation
|
|
72
|
+
- Key derivation (PBKDF2)
|
|
73
|
+
- Text and binary encryption/decryption
|
|
74
|
+
- File encryption with thumbnails
|
|
75
|
+
- Cross-platform compatibility
|
|
76
|
+
|
|
77
|
+
- **[test.md](test.md)** - Testing guide
|
|
78
|
+
- How to run tests
|
|
79
|
+
- Test file descriptions
|
|
80
|
+
- Test coverage information
|
|
81
|
+
|
|
82
|
+
- **[agents.md](agents.md)** - AI agent instructions
|
|
83
|
+
- Documentation maintenance guidelines
|
|
84
|
+
- Code change workflow
|
|
85
|
+
- Best practices for keeping docs updated
|
|
86
|
+
|
|
87
|
+
## Package Exports
|
|
88
|
+
|
|
89
|
+
### Classes
|
|
90
|
+
- `RedseatClient` - HTTP client with authentication
|
|
91
|
+
- `ServerApi` - Server-level API operations
|
|
92
|
+
- `LibraryApi` - Library-level API operations
|
|
93
|
+
|
|
94
|
+
### Interfaces
|
|
95
|
+
- `IFile` - Media file interface
|
|
96
|
+
- `ILibrary` - Library interface
|
|
97
|
+
- `ITag` - Tag interface
|
|
98
|
+
- `IPerson` - Person interface
|
|
99
|
+
- `ISerie` - Series interface
|
|
100
|
+
- `IMovie` - Movie interface
|
|
101
|
+
- `IServer` - Server interface
|
|
102
|
+
- `MediaRequest` - Media query filter
|
|
103
|
+
- And more (see `src/interfaces.ts`)
|
|
104
|
+
|
|
105
|
+
### Encryption Functions
|
|
106
|
+
- `deriveKey()` - Derive encryption key from passphrase
|
|
107
|
+
- `encryptText()` / `decryptText()` - Text encryption
|
|
108
|
+
- `encryptBuffer()` / `decryptBuffer()` - Binary encryption
|
|
109
|
+
- `encryptFile()` / `decryptFile()` - File encryption with metadata
|
|
110
|
+
- `getRandomIV()` - Generate random IV
|
|
111
|
+
|
|
112
|
+
### Utilities
|
|
113
|
+
- `fetchServerToken()` - Fetch server authentication token
|
|
114
|
+
- Base64 encoding/decoding utilities
|
|
115
|
+
- Crypto utilities for cross-platform support
|
|
116
|
+
|
|
117
|
+
## Installation
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npm install @redseat/api
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Requirements
|
|
124
|
+
|
|
125
|
+
- Node.js 15+ (for Web Crypto API support)
|
|
126
|
+
- TypeScript 5.0+
|
|
127
|
+
- Axios 1.11.0+
|
|
128
|
+
|
|
129
|
+
## License
|
|
130
|
+
|
|
131
|
+
See the main project LICENSE file.
|
|
132
|
+
|