@redseat/api 0.3.5 → 0.3.7

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/libraries.md CHANGED
@@ -899,12 +899,19 @@ const results = await libraryApi.searchSeries('Breaking');
899
899
 
900
900
  Marks an episode as watched.
901
901
 
902
+ **How it works:** This method uses the local series/episode IDs from the library. The server automatically resolves these to external IDs (IMDb, Trakt, etc.) and stores the watch entry in the **global history** system. This means:
903
+ - Watch status syncs across different servers
904
+ - Watch status is accessible via `ServerApi.getHistory()`
905
+ - External services can sync with your watch history
906
+
907
+ See [server.md - Watch History API](server.md#watch-history-api) for details on the global history system.
908
+
902
909
  **Parameters:**
903
910
 
904
- - `serieId`: The ID of the series
911
+ - `serieId`: The ID of the series (local library ID)
905
912
  - `season`: Season number
906
913
  - `number`: Episode number
907
- - `date`: Timestamp of when it was watched
914
+ - `date`: Timestamp of when it was watched (unix milliseconds)
908
915
 
909
916
  **Example:**
910
917
 
@@ -912,6 +919,73 @@ Marks an episode as watched.
912
919
  await libraryApi.setEpisodeWatched('serie-id', 1, 1, Date.now());
913
920
  ```
914
921
 
922
+ ### `getEpisodeWatched(serieId: string, season: number, episode: number): Promise<IWatched>`
923
+
924
+ Gets the watched status for an episode.
925
+
926
+ **Parameters:**
927
+
928
+ - `serieId`: The ID of the series (local library ID)
929
+ - `season`: Season number
930
+ - `episode`: Episode number
931
+
932
+ **Returns:** Promise resolving to an `IWatched` object containing:
933
+ - `type`: Always `'episode'`
934
+ - `id`: External ID in format `provider:value` (e.g., `imdb:tt0959621`)
935
+ - `date`: Timestamp when watched
936
+ - `modified`: Timestamp when entry was modified
937
+
938
+ **Example:**
939
+
940
+ ```typescript
941
+ const watched = await libraryApi.getEpisodeWatched('serie-id', 1, 1);
942
+ console.log(`Watched on: ${new Date(watched.date).toLocaleDateString()}`);
943
+ console.log(`External ID: ${watched.id}`); // e.g., "imdb:tt0959621"
944
+ ```
945
+
946
+ ### `getEpisodeProgress(serieId: string, season: number, episode: number): Promise<IViewProgress>`
947
+
948
+ Gets the view progress for an episode. Progress is stored in the global history system.
949
+
950
+ **Parameters:**
951
+
952
+ - `serieId`: The ID of the series (local library ID)
953
+ - `season`: Season number
954
+ - `episode`: Episode number
955
+
956
+ **Returns:** Promise resolving to an `IViewProgress` object containing:
957
+ - `type`: Always `'episode'`
958
+ - `id`: External ID in format `provider:value`
959
+ - `progress`: Playback position in milliseconds
960
+ - `parent`: Series external ID (if available)
961
+ - `modified`: Timestamp when progress was last updated
962
+
963
+ **Example:**
964
+
965
+ ```typescript
966
+ const progress = await libraryApi.getEpisodeProgress('serie-id', 1, 1);
967
+ console.log(`Progress: ${progress.progress}ms`);
968
+ console.log(`Episode ID: ${progress.id}`);
969
+ ```
970
+
971
+ ### `setEpisodeProgress(serieId: string, season: number, episode: number, progress: number): Promise<void>`
972
+
973
+ Sets the view progress for an episode. Progress is stored in the global history system using external IDs.
974
+
975
+ **Parameters:**
976
+
977
+ - `serieId`: The ID of the series (local library ID)
978
+ - `season`: Season number
979
+ - `episode`: Episode number
980
+ - `progress`: Progress value in milliseconds (video playback position)
981
+
982
+ **Example:**
983
+
984
+ ```typescript
985
+ // Save progress at 30 minutes
986
+ await libraryApi.setEpisodeProgress('serie-id', 1, 1, 1800000);
987
+ ```
988
+
915
989
  ---
916
990
 
917
991
  ## Movies
@@ -1023,10 +1097,17 @@ const images = await libraryApi.getMovieImages('movie-id');
1023
1097
 
1024
1098
  Marks a movie as watched.
1025
1099
 
1100
+ **How it works:** This method uses the local movie ID from the library. The server automatically resolves this to an external ID (IMDb, Trakt, TMDb, etc.) and stores the watch entry in the **global history** system. This means:
1101
+ - Watch status syncs across different servers
1102
+ - Watch status is accessible via `ServerApi.getHistory()`
1103
+ - External services can sync with your watch history
1104
+
1105
+ See [server.md - Watch History API](server.md#watch-history-api) for details on the global history system.
1106
+
1026
1107
  **Parameters:**
1027
1108
 
1028
- - `movieId`: The ID of the movie
1029
- - `date`: Timestamp of when it was watched
1109
+ - `movieId`: The ID of the movie (local library ID)
1110
+ - `date`: Timestamp of when it was watched (unix milliseconds)
1030
1111
 
1031
1112
  **Example:**
1032
1113
 
@@ -1034,6 +1115,66 @@ Marks a movie as watched.
1034
1115
  await libraryApi.setMovieWatched('movie-id', Date.now());
1035
1116
  ```
1036
1117
 
1118
+ ### `getMovieWatched(movieId: string): Promise<IWatched>`
1119
+
1120
+ Gets the watched status for a movie.
1121
+
1122
+ **Parameters:**
1123
+
1124
+ - `movieId`: The ID of the movie (local library ID)
1125
+
1126
+ **Returns:** Promise resolving to an `IWatched` object containing:
1127
+ - `type`: Always `'movie'`
1128
+ - `id`: External ID in format `provider:value` (e.g., `imdb:tt0111161`)
1129
+ - `date`: Timestamp when watched
1130
+ - `modified`: Timestamp when entry was modified
1131
+
1132
+ **Example:**
1133
+
1134
+ ```typescript
1135
+ const watched = await libraryApi.getMovieWatched('movie-id');
1136
+ console.log(`Watched on: ${new Date(watched.date).toLocaleDateString()}`);
1137
+ console.log(`External ID: ${watched.id}`); // e.g., "imdb:tt0111161"
1138
+ ```
1139
+
1140
+ ### `getMovieProgress(movieId: string): Promise<IViewProgress>`
1141
+
1142
+ Gets the view progress for a movie. Progress is stored in the global history system.
1143
+
1144
+ **Parameters:**
1145
+
1146
+ - `movieId`: The ID of the movie (local library ID)
1147
+
1148
+ **Returns:** Promise resolving to an `IViewProgress` object containing:
1149
+ - `type`: Always `'movie'`
1150
+ - `id`: External ID in format `provider:value`
1151
+ - `progress`: Playback position in milliseconds
1152
+ - `modified`: Timestamp when progress was last updated
1153
+
1154
+ **Example:**
1155
+
1156
+ ```typescript
1157
+ const progress = await libraryApi.getMovieProgress('movie-id');
1158
+ console.log(`Progress: ${progress.progress}ms`);
1159
+ console.log(`External ID: ${progress.id}`);
1160
+ ```
1161
+
1162
+ ### `setMovieProgress(movieId: string, progress: number): Promise<void>`
1163
+
1164
+ Sets the view progress for a movie. Progress is stored in the global history system using external IDs.
1165
+
1166
+ **Parameters:**
1167
+
1168
+ - `movieId`: The ID of the movie (local library ID)
1169
+ - `progress`: Progress value in milliseconds (video playback position)
1170
+
1171
+ **Example:**
1172
+
1173
+ ```typescript
1174
+ // Save progress at 45 minutes
1175
+ await libraryApi.setMovieProgress('movie-id', 2700000);
1176
+ ```
1177
+
1037
1178
  ### `searchMovies(name: string): Promise<IMovie[]>`
1038
1179
 
1039
1180
  Searches for movies by name.
package/package.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "@redseat/api",
3
- "version": "0.3.5",
4
- "description": "TypeScript API client library for interacting with Redseat servers",
5
- "type": "module",
6
- "main": "./dist/index.js",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "import": "./dist/index.js",
12
- "types": "./dist/index.d.ts"
13
- }
14
- },
15
- "files": [
16
- "dist/**/*",
17
- "README.md",
18
- "*.md"
19
- ],
20
- "keywords": [
21
- "redseat",
22
- "api",
23
- "client",
24
- "typescript"
25
- ],
26
- "author": "Arnaud JEZEQUEL <arnaud.jezequel@gmail.com>",
27
- "license": "MIT",
28
- "repository": {
29
- "type": "git",
30
- "url": "https://github.com/yourusername/redseat-svelte.git",
31
- "directory": "packages/api"
32
- },
33
- "scripts": {
34
- "build": "tsc",
35
- "test": "vitest run",
36
- "test:watch": "vitest"
37
- },
38
- "dependencies": {
39
- "axios": "^1.11.0",
40
- "rxjs": "^7.8.2"
41
- },
42
- "devDependencies": {
43
- "typescript": "^5.8.3",
44
- "vite": "^7.3.0",
45
- "vitest": "^4.0.16"
46
- },
47
- "publishConfig": {
48
- "access": "public"
49
- }
1
+ {
2
+ "name": "@redseat/api",
3
+ "version": "0.3.7",
4
+ "description": "TypeScript API client library for interacting with Redseat servers",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist/**/*",
17
+ "README.md",
18
+ "*.md"
19
+ ],
20
+ "keywords": [
21
+ "redseat",
22
+ "api",
23
+ "client",
24
+ "typescript"
25
+ ],
26
+ "author": "Arnaud JEZEQUEL <arnaud.jezequel@gmail.com>",
27
+ "license": "MIT",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/yourusername/redseat-svelte.git",
31
+ "directory": "packages/api"
32
+ },
33
+ "scripts": {
34
+ "build": "tsc",
35
+ "test": "vitest run",
36
+ "test:watch": "vitest"
37
+ },
38
+ "dependencies": {
39
+ "axios": "^1.11.0",
40
+ "rxjs": "^7.8.2"
41
+ },
42
+ "devDependencies": {
43
+ "typescript": "^5.8.3",
44
+ "vite": "^7.3.0",
45
+ "vitest": "^4.0.16"
46
+ },
47
+ "publishConfig": {
48
+ "access": "public"
49
+ }
50
50
  }