@redseat/api 0.3.6 → 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
 
@@ -918,48 +925,59 @@ Gets the watched status for an episode.
918
925
 
919
926
  **Parameters:**
920
927
 
921
- - `serieId`: The ID of the series
928
+ - `serieId`: The ID of the series (local library ID)
922
929
  - `season`: Season number
923
930
  - `episode`: Episode number
924
931
 
925
- **Returns:** Promise resolving to an `IWatched` object containing watched date and metadata
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
926
937
 
927
938
  **Example:**
928
939
 
929
940
  ```typescript
930
941
  const watched = await libraryApi.getEpisodeWatched('serie-id', 1, 1);
931
942
  console.log(`Watched on: ${new Date(watched.date).toLocaleDateString()}`);
943
+ console.log(`External ID: ${watched.id}`); // e.g., "imdb:tt0959621"
932
944
  ```
933
945
 
934
946
  ### `getEpisodeProgress(serieId: string, season: number, episode: number): Promise<IViewProgress>`
935
947
 
936
- Gets the view progress for an episode.
948
+ Gets the view progress for an episode. Progress is stored in the global history system.
937
949
 
938
950
  **Parameters:**
939
951
 
940
- - `serieId`: The ID of the series
952
+ - `serieId`: The ID of the series (local library ID)
941
953
  - `season`: Season number
942
954
  - `episode`: Episode number
943
955
 
944
- **Returns:** Promise resolving to an `IViewProgress` object containing progress value
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
945
962
 
946
963
  **Example:**
947
964
 
948
965
  ```typescript
949
966
  const progress = await libraryApi.getEpisodeProgress('serie-id', 1, 1);
950
967
  console.log(`Progress: ${progress.progress}ms`);
968
+ console.log(`Episode ID: ${progress.id}`);
951
969
  ```
952
970
 
953
971
  ### `setEpisodeProgress(serieId: string, season: number, episode: number, progress: number): Promise<void>`
954
972
 
955
- Sets the view progress for an episode.
973
+ Sets the view progress for an episode. Progress is stored in the global history system using external IDs.
956
974
 
957
975
  **Parameters:**
958
976
 
959
- - `serieId`: The ID of the series
977
+ - `serieId`: The ID of the series (local library ID)
960
978
  - `season`: Season number
961
979
  - `episode`: Episode number
962
- - `progress`: Progress value (typically in milliseconds for video playback position)
980
+ - `progress`: Progress value in milliseconds (video playback position)
963
981
 
964
982
  **Example:**
965
983
 
@@ -1079,10 +1097,17 @@ const images = await libraryApi.getMovieImages('movie-id');
1079
1097
 
1080
1098
  Marks a movie as watched.
1081
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
+
1082
1107
  **Parameters:**
1083
1108
 
1084
- - `movieId`: The ID of the movie
1085
- - `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)
1086
1111
 
1087
1112
  **Example:**
1088
1113
 
@@ -1096,42 +1121,52 @@ Gets the watched status for a movie.
1096
1121
 
1097
1122
  **Parameters:**
1098
1123
 
1099
- - `movieId`: The ID of the movie
1124
+ - `movieId`: The ID of the movie (local library ID)
1100
1125
 
1101
- **Returns:** Promise resolving to an `IWatched` object containing watched date and metadata
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
1102
1131
 
1103
1132
  **Example:**
1104
1133
 
1105
1134
  ```typescript
1106
1135
  const watched = await libraryApi.getMovieWatched('movie-id');
1107
1136
  console.log(`Watched on: ${new Date(watched.date).toLocaleDateString()}`);
1137
+ console.log(`External ID: ${watched.id}`); // e.g., "imdb:tt0111161"
1108
1138
  ```
1109
1139
 
1110
1140
  ### `getMovieProgress(movieId: string): Promise<IViewProgress>`
1111
1141
 
1112
- Gets the view progress for a movie.
1142
+ Gets the view progress for a movie. Progress is stored in the global history system.
1113
1143
 
1114
1144
  **Parameters:**
1115
1145
 
1116
- - `movieId`: The ID of the movie
1146
+ - `movieId`: The ID of the movie (local library ID)
1117
1147
 
1118
- **Returns:** Promise resolving to an `IViewProgress` object containing progress value
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
1119
1153
 
1120
1154
  **Example:**
1121
1155
 
1122
1156
  ```typescript
1123
1157
  const progress = await libraryApi.getMovieProgress('movie-id');
1124
1158
  console.log(`Progress: ${progress.progress}ms`);
1159
+ console.log(`External ID: ${progress.id}`);
1125
1160
  ```
1126
1161
 
1127
1162
  ### `setMovieProgress(movieId: string, progress: number): Promise<void>`
1128
1163
 
1129
- Sets the view progress for a movie.
1164
+ Sets the view progress for a movie. Progress is stored in the global history system using external IDs.
1130
1165
 
1131
1166
  **Parameters:**
1132
1167
 
1133
- - `movieId`: The ID of the movie
1134
- - `progress`: Progress value (typically in milliseconds for video playback position)
1168
+ - `movieId`: The ID of the movie (local library ID)
1169
+ - `progress`: Progress value in milliseconds (video playback position)
1135
1170
 
1136
1171
  **Example:**
1137
1172
 
package/package.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "@redseat/api",
3
- "version": "0.3.6",
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
  }