@redseat/api 0.3.6 → 0.3.11

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/CLAUDE.md CHANGED
@@ -1,2 +1,2 @@
1
- @AGENTS.md
1
+ @AGENTS.md
2
2
  if you need to modify this file apply the instruction into agents.md instead
package/README.md CHANGED
@@ -1,132 +1,137 @@
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
+ - **Watch History API** (global history with external IDs)
65
+
66
+ - **[libraries.md](libraries.md)** - LibraryApi documentation
67
+ - Media operations (upload, download, update)
68
+ - Tags, people, series, movies management
69
+ - Face recognition operations
70
+ - Encryption support for encrypted libraries
71
+
72
+ - **[encryption.md](encryption.md)** - Encryption module documentation
73
+ - Key derivation (PBKDF2)
74
+ - Text and binary encryption/decryption
75
+ - File encryption with thumbnails
76
+ - Cross-platform compatibility
77
+
78
+ - **[test.md](test.md)** - Testing guide
79
+ - How to run tests
80
+ - Test file descriptions
81
+ - Test coverage information
82
+
83
+ - **[agents.md](agents.md)** - AI agent instructions
84
+ - Documentation maintenance guidelines
85
+ - Code change workflow
86
+ - Best practices for keeping docs updated
87
+
88
+ ## Package Exports
89
+
90
+ ### Classes
91
+ - `RedseatClient` - HTTP client with authentication
92
+ - `ServerApi` - Server-level API operations
93
+ - `LibraryApi` - Library-level API operations
94
+
95
+ ### Interfaces
96
+ - `IFile` - Media file interface
97
+ - `ILibrary` - Library interface
98
+ - `ITag` - Tag interface
99
+ - `IPerson` - Person interface
100
+ - `ISerie` - Series interface
101
+ - `IMovie` - Movie interface
102
+ - `IServer` - Server interface
103
+ - `MediaRequest` - Media query filter
104
+ - `IWatched` - Watch history entry (uses external IDs)
105
+ - `IWatchedForAdd` - Request body for adding to watch history
106
+ - `IViewProgress` - View progress entry
107
+ - `HistoryQuery` - Query parameters for history endpoint
108
+ - And more (see `src/interfaces.ts`)
109
+
110
+ ### Encryption Functions
111
+ - `deriveKey()` - Derive encryption key from passphrase
112
+ - `encryptText()` / `decryptText()` - Text encryption
113
+ - `encryptBuffer()` / `decryptBuffer()` - Binary encryption
114
+ - `encryptFile()` / `decryptFile()` - File encryption with metadata
115
+ - `getRandomIV()` - Generate random IV
116
+
117
+ ### Utilities
118
+ - `fetchServerToken()` - Fetch server authentication token
119
+ - Base64 encoding/decoding utilities
120
+ - Crypto utilities for cross-platform support
121
+
122
+ ## Installation
123
+
124
+ ```bash
125
+ npm install @redseat/api
126
+ ```
127
+
128
+ ## Requirements
129
+
130
+ - Node.js 15+ (for Web Crypto API support)
131
+ - TypeScript 5.0+
132
+ - Axios 1.11.0+
133
+
134
+ ## License
135
+
136
+ See the main project LICENSE file.
137
+