@fett/synology-api 0.0.1-beta.8 → 0.0.1

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.
Files changed (112) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +81 -10
  3. package/lib/cli/apis.js +47 -0
  4. package/lib/{esm/cli → cli}/config.js +38 -41
  5. package/lib/cli/core.js +20 -0
  6. package/lib/{types/cli → cli}/helper.d.ts +1 -0
  7. package/lib/{esm/cli → cli}/helper.js +9 -5
  8. package/lib/cli/index.d.ts +2 -0
  9. package/lib/cli/index.js +5 -0
  10. package/lib/{types/core.d.ts → core.d.ts} +1 -1
  11. package/lib/core.js +99 -0
  12. package/lib/decorators/bindMethods.js +45 -0
  13. package/lib/{types/errorcodes.d.ts → errorcodes.d.ts} +2 -2
  14. package/lib/{esm/errorcodes.js → errorcodes.js} +10 -5
  15. package/lib/helpers.d.ts +19 -0
  16. package/lib/helpers.js +70 -0
  17. package/lib/index.d.ts +4 -0
  18. package/lib/index.js +4 -0
  19. package/lib/modules/Api/Auth.d.ts +4 -0
  20. package/lib/modules/Api/Auth.js +30 -0
  21. package/lib/modules/Api/Info.d.ts +3 -0
  22. package/lib/modules/Api/Info.js +15 -0
  23. package/lib/modules/Api/index.d.ts +2 -0
  24. package/lib/modules/Api/index.js +2 -0
  25. package/lib/modules/AudioStation/Album.d.ts +30 -0
  26. package/lib/modules/AudioStation/Album.js +17 -0
  27. package/lib/modules/AudioStation/Artist.d.ts +25 -0
  28. package/lib/modules/AudioStation/Artist.js +17 -0
  29. package/lib/modules/AudioStation/Cover.js +0 -0
  30. package/lib/modules/AudioStation/Folder.d.ts +24 -0
  31. package/lib/modules/AudioStation/Folder.js +17 -0
  32. package/lib/modules/AudioStation/Info.d.ts +45 -0
  33. package/lib/modules/AudioStation/Info.js +9 -0
  34. package/lib/modules/AudioStation/Lyrics.d.ts +25 -0
  35. package/lib/modules/AudioStation/Lyrics.js +23 -0
  36. package/lib/modules/AudioStation/Playlist.d.ts +34 -0
  37. package/lib/modules/AudioStation/Playlist.js +38 -0
  38. package/lib/modules/AudioStation/Search.d.ts +53 -0
  39. package/lib/modules/AudioStation/Search.js +17 -0
  40. package/lib/modules/AudioStation/Song.d.ts +33 -0
  41. package/lib/modules/AudioStation/Song.js +27 -0
  42. package/lib/modules/AudioStation/index.d.ts +23 -0
  43. package/lib/modules/AudioStation/index.js +23 -0
  44. package/lib/modules/Auth/AuthKey.d.ts +8 -0
  45. package/lib/modules/Auth/AuthKey.js +12 -0
  46. package/lib/modules/Auth/index.d.ts +7 -0
  47. package/lib/modules/Auth/index.js +8 -0
  48. package/lib/modules/FileStation/File.d.ts +0 -0
  49. package/lib/modules/FileStation/File.js +0 -0
  50. package/lib/{types/modules → modules}/FileStation/Info.d.ts +1 -1
  51. package/lib/modules/FileStation/Info.js +9 -0
  52. package/lib/{types/modules → modules}/FileStation/List.d.ts +1 -1
  53. package/lib/modules/FileStation/List.js +30 -0
  54. package/lib/{types/modules → modules}/FileStation/index.d.ts +2 -2
  55. package/lib/{esm/modules → modules}/FileStation/index.js +2 -2
  56. package/lib/modules/VideoStation/File.d.ts +48 -0
  57. package/lib/modules/VideoStation/File.js +20 -0
  58. package/lib/modules/VideoStation/HomeVideo.d.ts +6 -0
  59. package/lib/modules/VideoStation/HomeVideo.js +10 -0
  60. package/lib/modules/VideoStation/Info.d.ts +44 -0
  61. package/lib/modules/VideoStation/Info.js +9 -0
  62. package/lib/modules/VideoStation/Library.d.ts +70 -0
  63. package/lib/modules/VideoStation/Library.js +23 -0
  64. package/lib/modules/VideoStation/Movie.d.ts +27 -0
  65. package/lib/modules/VideoStation/Movie.js +13 -0
  66. package/lib/modules/VideoStation/Streaming.d.ts +11 -0
  67. package/lib/modules/VideoStation/Streaming.js +24 -0
  68. package/lib/modules/VideoStation/index.d.ts +15 -0
  69. package/lib/modules/VideoStation/index.js +16 -0
  70. package/lib/modules/VideoStation/types.d.ts +27 -0
  71. package/lib/modules/VideoStation/types.js +1 -0
  72. package/lib/modules/index.d.ts +26 -0
  73. package/lib/{esm/modules → modules}/index.js +31 -3
  74. package/lib/types/{types/apiInfo.d.ts → apiInfo.d.ts} +15 -2
  75. package/lib/{esm/types → types}/apiInfo.js +15 -1
  76. package/lib/types/index.d.ts +2 -5
  77. package/lib/types/index.js +2 -0
  78. package/lib/{types/utils.d.ts → utils.d.ts} +1 -0
  79. package/lib/{esm/utils.js → utils.js} +3 -0
  80. package/package.json +24 -24
  81. package/bin/syno +0 -6
  82. package/lib/cjs/index.js +0 -733
  83. package/lib/esm/cli/apis.js +0 -53
  84. package/lib/esm/cli/index.js +0 -30
  85. package/lib/esm/core.js +0 -111
  86. package/lib/esm/helpers.js +0 -80
  87. package/lib/esm/index.js +0 -5
  88. package/lib/esm/modules/Api/Auth.js +0 -43
  89. package/lib/esm/modules/Api/Info.js +0 -26
  90. package/lib/esm/modules/Api/index.js +0 -2
  91. package/lib/esm/modules/AudioStation/Song.js +0 -18
  92. package/lib/esm/modules/AudioStation/index.js +0 -7
  93. package/lib/esm/modules/FileStation/Info.js +0 -20
  94. package/lib/esm/modules/FileStation/List.js +0 -32
  95. package/lib/esm/types/index.js +0 -2
  96. package/lib/types/helpers.d.ts +0 -2
  97. package/lib/types/modules/Api/Auth.d.ts +0 -3
  98. package/lib/types/modules/Api/Info.d.ts +0 -2
  99. package/lib/types/modules/Api/index.d.ts +0 -2
  100. package/lib/types/modules/AudioStation/Song.d.ts +0 -22
  101. package/lib/types/modules/AudioStation/index.d.ts +0 -7
  102. package/lib/types/modules/index.d.ts +0 -16
  103. package/lib/types/types/index.d.ts +0 -2
  104. /package/lib/{types/cli → cli}/apis.d.ts +0 -0
  105. /package/lib/{types/cli → cli}/config.d.ts +0 -0
  106. /package/lib/{types/cli/index.d.ts → cli/core.d.ts} +0 -0
  107. /package/lib/{types/constants.d.ts → constants.d.ts} +0 -0
  108. /package/lib/{esm/constants.js → constants.js} +0 -0
  109. /package/lib/{esm/modules/FileStation/File.js → decorators/bindMethods.d.ts} +0 -0
  110. /package/lib/{types/modules/FileStation/File.d.ts → modules/AudioStation/Cover.d.ts} +0 -0
  111. /package/lib/types/{types/request.d.ts → request.d.ts} +0 -0
  112. /package/lib/{esm/types → types}/request.js +0 -0
@@ -0,0 +1,30 @@
1
+ import { FileStationApi } from "../../types/index.js";
2
+ import { isUndfined } from "../../utils.js";
3
+ export async function getFileList(params = {}) {
4
+ const { additional = ["real_path", "size", "owner", "time"], filetype = "all" } = params;
5
+ if (isUndfined(params.folder_path)) {
6
+ throw new Error("folder_path is required");
7
+ }
8
+ const res = await this.run(FileStationApi.List, {
9
+ params: {
10
+ method: "list",
11
+ additional: JSON.stringify(additional),
12
+ filetype: filetype,
13
+ folder_path: params.folder_path,
14
+ ...params,
15
+ },
16
+ });
17
+ return res;
18
+ }
19
+ export async function getFileListShare(params = {}) {
20
+ const { additional = ["real_path", "size", "owner", "time"], onlywritable = false } = params;
21
+ const res = await this.run(FileStationApi.List, {
22
+ params: {
23
+ method: "list_share",
24
+ additional: JSON.stringify(additional),
25
+ onlywritable: onlywritable,
26
+ ...params,
27
+ },
28
+ });
29
+ return res;
30
+ }
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * reference :https://global.download.synology.com/download/Document/Software/DeveloperGuide/Package/FileStation/All/enu/Synology_File_Station_API_Guide.pdf
3
3
  */
4
- import { getInfo } from "./Info";
5
- import { getFileList, getFileListShare } from "./List";
4
+ import { getInfo } from "./Info.js";
5
+ import { getFileList, getFileListShare } from "./List.js";
6
6
  export declare const METHODS: {
7
7
  getInfo: typeof getInfo;
8
8
  getFileList: typeof getFileList;
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * reference :https://global.download.synology.com/download/Document/Software/DeveloperGuide/Package/FileStation/All/enu/Synology_File_Station_API_Guide.pdf
3
3
  */
4
- import { getInfo } from "./Info";
5
- import { getFileList, getFileListShare } from "./List";
4
+ import { getInfo } from "./Info.js";
5
+ import { getFileList, getFileListShare } from "./List.js";
6
6
  // fs methods
7
7
  export const METHODS = {
8
8
  getInfo,
@@ -0,0 +1,48 @@
1
+ import { SynologyApiResponse } from "../../types/index.js";
2
+ export type VideoStationFileSetWatchStatusParams = {
3
+ id: number;
4
+ position: number;
5
+ };
6
+ export declare function setWatchStatus(params: VideoStationFileSetWatchStatusParams): Promise<SynologyApiResponse<any>>;
7
+ export type VideoStationGetTrackInfoResponse = SynologyApiResponse<{
8
+ audio: Array<{
9
+ bitrate: number;
10
+ channel: number;
11
+ channel_layout: string;
12
+ codec: string;
13
+ codec_raw: string;
14
+ frequency: number;
15
+ id: string;
16
+ is_default: boolean;
17
+ language: string;
18
+ profile: string;
19
+ sample_rate: number;
20
+ streamid: number;
21
+ track: string;
22
+ }>;
23
+ video: Array<{
24
+ bitrate: number;
25
+ codec: string;
26
+ codec_raw: string;
27
+ codec_tag: string;
28
+ display_x: number;
29
+ display_y: number;
30
+ framerate: number;
31
+ framerate_den: number;
32
+ framerate_num: number;
33
+ id: string;
34
+ language: string;
35
+ level: number;
36
+ pix_fmt: string;
37
+ profile: string;
38
+ resolutionx: number;
39
+ resolutiony: number;
40
+ rotate: number;
41
+ sample_aspect_ratio_den: number;
42
+ sample_aspect_ratio_num: number;
43
+ track: string;
44
+ }>;
45
+ }>;
46
+ export declare function getTrackInfo(params: {
47
+ id: number;
48
+ }): Promise<VideoStationGetTrackInfoResponse>;
@@ -0,0 +1,20 @@
1
+ import { VideoStationApi } from "../../types/index.js";
2
+ // 设置观看进度
3
+ export async function setWatchStatus(params) {
4
+ const res = await this.run(VideoStationApi.File, {
5
+ params: {
6
+ method: "set_watchstatus",
7
+ ...params,
8
+ },
9
+ });
10
+ return res;
11
+ }
12
+ // 获取媒体信息
13
+ export async function getTrackInfo(params) {
14
+ return await this.run(VideoStationApi.File, {
15
+ params: {
16
+ method: "get_track_info",
17
+ ...params,
18
+ },
19
+ });
20
+ }
@@ -0,0 +1,6 @@
1
+ import { SynologyApiResponse } from "../../types/index.js";
2
+ export type VideoStationFileSetWatchStatusParams = {
3
+ id: number;
4
+ position: number;
5
+ };
6
+ export declare function getFileVideoInfo(params: VideoStationFileSetWatchStatusParams): Promise<SynologyApiResponse<any>>;
@@ -0,0 +1,10 @@
1
+ import { VideoStationApi } from "../../types/index.js";
2
+ export async function getFileVideoInfo(params) {
3
+ const res = await this.run(VideoStationApi.File, {
4
+ params: {
5
+ method: "set_watchstatus",
6
+ ...params,
7
+ },
8
+ });
9
+ return res;
10
+ }
@@ -0,0 +1,44 @@
1
+ import { SynologyApiResponse } from "../../types/index.js";
2
+ export interface AmeStatus {
3
+ ame_major_version: number;
4
+ has_aac: boolean;
5
+ has_hevc: boolean;
6
+ has_license: boolean;
7
+ is_aac_activated: boolean;
8
+ is_ame_broken: boolean;
9
+ is_ame_install: boolean;
10
+ is_ame_v2: boolean;
11
+ is_ame_v3: boolean;
12
+ }
13
+ export interface Privilege {
14
+ dtv: boolean;
15
+ offline_conversion: boolean;
16
+ renderer: boolean;
17
+ sharing: boolean;
18
+ }
19
+ export interface TranscodingCapability {
20
+ dtv_transcode: boolean;
21
+ fhd_hardware_transcode: boolean;
22
+ hardware_transcode: boolean;
23
+ remux: boolean;
24
+ software_transcode: boolean;
25
+ transcode: boolean;
26
+ }
27
+ /**
28
+ * get filestation info
29
+ */
30
+ export type VideoStationInfoResponse = SynologyApiResponse<{
31
+ ame_status: AmeStatus;
32
+ is_dtv_enabled: boolean;
33
+ is_manager: boolean;
34
+ is_subtitle_search_enabled: boolean;
35
+ need_aac: boolean;
36
+ need_hevc: boolean;
37
+ privilege: Privilege;
38
+ timezone: string;
39
+ timezone_offset: number;
40
+ transcoding_capability: TranscodingCapability;
41
+ version: string;
42
+ version_string: string;
43
+ }>;
44
+ export declare function getInfo(): Promise<VideoStationInfoResponse>;
@@ -0,0 +1,9 @@
1
+ import { VideoStationApi } from "../../types/index.js";
2
+ export async function getInfo() {
3
+ const res = await this.run(VideoStationApi.Info, {
4
+ params: {
5
+ method: "get",
6
+ },
7
+ });
8
+ return res;
9
+ }
@@ -0,0 +1,70 @@
1
+ import { SynologyApiResponse } from "../../types/index.js";
2
+ export type VideoStationAcrossLibraryParams = {
3
+ policy?: string;
4
+ limit?: number;
5
+ additional?: string[];
6
+ };
7
+ interface File {
8
+ audio_bitrate: number;
9
+ audio_codec: string;
10
+ channel: number;
11
+ container_type: string;
12
+ display_x: number;
13
+ display_y: number;
14
+ duration: string;
15
+ ff_video_profile: number;
16
+ filesize: number;
17
+ frame_bitrate: number;
18
+ frame_rate_den: number;
19
+ frame_rate_num: number;
20
+ frequency: number;
21
+ id: number;
22
+ path: string;
23
+ position: number;
24
+ resolutionx: number;
25
+ resolutiony: number;
26
+ rotation: number;
27
+ sharepath: string;
28
+ video_bitrate: number;
29
+ video_codec: string;
30
+ video_level: number;
31
+ video_profile: number;
32
+ watched_ratio: number;
33
+ }
34
+ export type Additional = {
35
+ file: File[];
36
+ watched_ratio: number;
37
+ };
38
+ export type VideoStationAcrossLibraryResponse = SynologyApiResponse<{
39
+ movie: Array<{
40
+ additional: Additional;
41
+ certificate: string;
42
+ create_time: number;
43
+ id: number;
44
+ last_watched: number;
45
+ library_id: number;
46
+ mapper_id: number;
47
+ original_available: string;
48
+ rating: number;
49
+ sort_title: string;
50
+ tagline: string;
51
+ title: string;
52
+ }>;
53
+ }>;
54
+ export declare function getAcrossLibrary(params?: VideoStationAcrossLibraryParams): Promise<VideoStationAcrossLibraryResponse>;
55
+ export type VideoStationLibraryParams = {
56
+ limit?: number;
57
+ };
58
+ export type VideoStationLibraryResponse = SynologyApiResponse<{
59
+ offset: number;
60
+ total: number;
61
+ library: Array<{
62
+ id: number;
63
+ is_public: boolean;
64
+ title: string;
65
+ type: string;
66
+ visible: boolean;
67
+ }>;
68
+ }>;
69
+ export declare function getLibrary(params?: VideoStationLibraryParams): Promise<VideoStationLibraryResponse>;
70
+ export {};
@@ -0,0 +1,23 @@
1
+ import { VideoStationApi } from "../../types/index.js";
2
+ export async function getAcrossLibrary(params = {}) {
3
+ const { additional = ["summary", "poster_mtime", "backdrop_mtime", "file"], policy = "top_rating", limit = 20, } = params;
4
+ const res = await this.run(VideoStationApi.AcrossLibrary, {
5
+ params: {
6
+ method: "list_movie",
7
+ additional: JSON.stringify(additional),
8
+ policy,
9
+ limit,
10
+ ...params,
11
+ },
12
+ });
13
+ return res;
14
+ }
15
+ export async function getLibrary(params = {}) {
16
+ const res = await this.run(VideoStationApi.Library, {
17
+ params: {
18
+ method: "list",
19
+ ...params,
20
+ },
21
+ });
22
+ return res;
23
+ }
@@ -0,0 +1,27 @@
1
+ import { SynologyApiResponse } from "../../types/index.js";
2
+ import { VideoFile } from "./types.js";
3
+ export type VideoStationGetMoiveInfoParams = {
4
+ id: number[];
5
+ additional?: string[];
6
+ };
7
+ export type Additional = {
8
+ file: VideoFile[];
9
+ watched_ratio: number;
10
+ };
11
+ export type VideoStationAcrossLibraryResponse = SynologyApiResponse<{
12
+ movie: Array<{
13
+ additional: Additional;
14
+ certificate: string;
15
+ create_time: number;
16
+ id: number;
17
+ last_watched: number;
18
+ library_id: number;
19
+ mapper_id: number;
20
+ original_available: string;
21
+ rating: number;
22
+ sort_title: string;
23
+ tagline: string;
24
+ title: string;
25
+ }>;
26
+ }>;
27
+ export declare function getMoiveInfo(params: VideoStationGetMoiveInfoParams): Promise<VideoStationAcrossLibraryResponse>;
@@ -0,0 +1,13 @@
1
+ import { VideoStationApi } from "../../types/index.js";
2
+ export async function getMoiveInfo(params) {
3
+ const { additional = ["file"], id } = params;
4
+ const res = await this.run(VideoStationApi.Movie, {
5
+ params: {
6
+ ...params,
7
+ method: "getinfo",
8
+ id: JSON.stringify(id),
9
+ additional: JSON.stringify(additional),
10
+ },
11
+ });
12
+ return res;
13
+ }
@@ -0,0 +1,11 @@
1
+ import { SynologyApiResponse } from "../../types/index.js";
2
+ export type VideoStationGetStreamUrlParams = {
3
+ stream_id: string;
4
+ tid: string;
5
+ };
6
+ export type VideoStationGetStreamUrlResponse = SynologyApiResponse<string>;
7
+ export declare function getStreamUrl(params: VideoStationGetStreamUrlParams): Promise<string>;
8
+ export declare function getStreamId(id: number): Promise<SynologyApiResponse<{
9
+ format: string;
10
+ stream_id: string;
11
+ }>>;
@@ -0,0 +1,24 @@
1
+ import { buildUrlWithQuery } from "../../utils.js";
2
+ import { VideoStationApi } from "../../types/index.js";
3
+ export async function getStreamUrl(params) {
4
+ const url = `${this.baseUrl}entry.cgi/1.mp4`;
5
+ const query = {
6
+ ...params,
7
+ api: VideoStationApi.Streaming,
8
+ method: "stream",
9
+ format: "raw",
10
+ version: 2,
11
+ _sid: this.authInfo?.sid,
12
+ };
13
+ return buildUrlWithQuery(url, query);
14
+ }
15
+ // 基于视频ID获取播放流ID
16
+ export async function getStreamId(id) {
17
+ return await this.run(VideoStationApi.Streaming, {
18
+ params: {
19
+ method: "open",
20
+ raw: JSON.stringify({}),
21
+ file: JSON.stringify({ id }),
22
+ },
23
+ });
24
+ }
@@ -0,0 +1,15 @@
1
+ import { getInfo } from "./Info.js";
2
+ import { getAcrossLibrary, getLibrary } from "./Library.js";
3
+ import { getStreamUrl, getStreamId } from "./Streaming.js";
4
+ import { getMoiveInfo } from "./Movie.js";
5
+ export declare const METHODS: {
6
+ getInfo: typeof getInfo;
7
+ getAcrossLibrary: typeof getAcrossLibrary;
8
+ getLibrary: typeof getLibrary;
9
+ getStreamUrl: typeof getStreamUrl;
10
+ getMoiveInfo: typeof getMoiveInfo;
11
+ getStreamId: typeof getStreamId;
12
+ };
13
+ export declare const SPELLING_KEY = "VideoStation";
14
+ export declare const SIMPLIFY_KEY = "vs";
15
+ export type TMethods = typeof METHODS;
@@ -0,0 +1,16 @@
1
+ import { getInfo } from "./Info.js";
2
+ import { getAcrossLibrary, getLibrary } from "./Library.js";
3
+ import { getStreamUrl, getStreamId } from "./Streaming.js";
4
+ import { getMoiveInfo } from "./Movie.js";
5
+ // fs methods
6
+ export const METHODS = {
7
+ getInfo,
8
+ getAcrossLibrary,
9
+ getLibrary,
10
+ getStreamUrl,
11
+ getMoiveInfo,
12
+ getStreamId,
13
+ };
14
+ // name space
15
+ export const SPELLING_KEY = "VideoStation";
16
+ export const SIMPLIFY_KEY = "vs";
@@ -0,0 +1,27 @@
1
+ export type VideoFile = {
2
+ audio_bitrate: number;
3
+ audio_codec: string;
4
+ channel: number;
5
+ container_type: string;
6
+ display_x: number;
7
+ display_y: number;
8
+ duration: string;
9
+ ff_video_profile: number;
10
+ filesize: number;
11
+ frame_bitrate: number;
12
+ frame_rate_den: number;
13
+ frame_rate_num: number;
14
+ frequency: number;
15
+ id: number;
16
+ path: string;
17
+ position: number;
18
+ resolutionx: number;
19
+ resolutiony: number;
20
+ rotation: number;
21
+ sharepath: string;
22
+ video_bitrate: number;
23
+ video_codec: string;
24
+ video_level: number;
25
+ video_profile: number;
26
+ watched_ratio: number;
27
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ import * as AudioStation from "./AudioStation/index.js";
2
+ import * as FileStation from "./FileStation/index.js";
3
+ import * as VideoStation from "./VideoStation/index.js";
4
+ import * as Auth from "./Auth/index.js";
5
+ export declare const SynologyApiKeys: {
6
+ FileStation: string;
7
+ fs: string;
8
+ AudioStation: string;
9
+ as: string;
10
+ VideoStation: string;
11
+ vs: string;
12
+ Auth: string;
13
+ au: string;
14
+ };
15
+ export type SynologyApiMethods = FileStation.TMethods | AudioStation.TMethods | VideoStation.TMethods | Auth.TMethods;
16
+ export declare class BaseSynologyApi {
17
+ [AudioStation.SPELLING_KEY]: AudioStation.TMethods;
18
+ [AudioStation.SIMPLIFY_KEY]: AudioStation.TMethods;
19
+ [FileStation.SPELLING_KEY]: FileStation.TMethods;
20
+ [FileStation.SIMPLIFY_KEY]: FileStation.TMethods;
21
+ [VideoStation.SPELLING_KEY]: VideoStation.TMethods;
22
+ [VideoStation.SIMPLIFY_KEY]: VideoStation.TMethods;
23
+ [Auth.SPELLING_KEY]: Auth.TMethods;
24
+ [Auth.SIMPLIFY_KEY]: Auth.TMethods;
25
+ constructor();
26
+ }
@@ -1,16 +1,22 @@
1
- import * as AudioStation from "./AudioStation";
2
- import * as FileStation from "./FileStation";
1
+ import * as AudioStation from "./AudioStation/index.js";
2
+ import * as FileStation from "./FileStation/index.js";
3
+ import * as VideoStation from "./VideoStation/index.js";
4
+ import * as Auth from "./Auth/index.js";
3
5
  export const SynologyApiKeys = {
4
6
  FileStation: FileStation.SPELLING_KEY,
5
7
  fs: FileStation.SIMPLIFY_KEY,
6
8
  AudioStation: AudioStation.SPELLING_KEY,
7
9
  as: AudioStation.SIMPLIFY_KEY,
10
+ VideoStation: VideoStation.SPELLING_KEY,
11
+ vs: VideoStation.SIMPLIFY_KEY,
12
+ Auth: Auth.SPELLING_KEY,
13
+ au: Auth.SIMPLIFY_KEY,
8
14
  };
9
15
  // export type BaseSynologyApiKeyMethods = FileStation.IKeyMethods
10
16
  export class BaseSynologyApi {
17
+ static { AudioStation.SPELLING_KEY, AudioStation.SIMPLIFY_KEY, FileStation.SPELLING_KEY, FileStation.SIMPLIFY_KEY, VideoStation.SPELLING_KEY, VideoStation.SIMPLIFY_KEY, Auth.SPELLING_KEY, Auth.SIMPLIFY_KEY; }
11
18
  constructor() { }
12
19
  }
13
- AudioStation.SPELLING_KEY, AudioStation.SIMPLIFY_KEY, FileStation.SPELLING_KEY, FileStation.SIMPLIFY_KEY;
14
20
  // bind methods to BaseSynologyApi instance
15
21
  function methodsBundler(instance, methods) {
16
22
  const output = {};
@@ -43,4 +49,26 @@ Object.defineProperties(BaseSynologyApi.prototype, {
43
49
  return methodsBundler(this, AudioStation.METHODS);
44
50
  },
45
51
  },
52
+ // VideoStation
53
+ [SynologyApiKeys.VideoStation]: {
54
+ get() {
55
+ return methodsBundler(this, VideoStation.METHODS);
56
+ },
57
+ },
58
+ [SynologyApiKeys.vs]: {
59
+ get() {
60
+ return methodsBundler(this, VideoStation.METHODS);
61
+ },
62
+ },
63
+ // Auth
64
+ [SynologyApiKeys.Auth]: {
65
+ get() {
66
+ return methodsBundler(this, Auth.METHODS);
67
+ },
68
+ },
69
+ [SynologyApiKeys.au]: {
70
+ get() {
71
+ return methodsBundler(this, Auth.METHODS);
72
+ },
73
+ },
46
74
  });
@@ -4,7 +4,8 @@
4
4
  export declare enum SynologyApiInfo {
5
5
  Auth = "SYNO.API.Auth",
6
6
  Info = "SYNO.API.Info",
7
- OTP = "SYNO.API.OTP"
7
+ OTP = "SYNO.API.OTP",
8
+ AuthKey = "SYNO.API.Auth.Key"
8
9
  }
9
10
  /**
10
11
  * AudioStation
@@ -13,7 +14,7 @@ export declare enum AudioStationApi {
13
14
  Song = "SYNO.AudioStation.Song",
14
15
  Album = "SYNO.AudioStation.Album",
15
16
  Artist = "SYNO.AudioStation.Artist",
16
- Genre = "SYNO.AudioStation.Genre",
17
+ Search = "SYNO.AudioStation.Search",
17
18
  Playlist = "SYNO.AudioStation.Playlist",
18
19
  Folder = "SYNO.AudioStation.Folder",
19
20
  Cover = "SYNO.AudioStation.Cover",
@@ -37,3 +38,15 @@ export declare enum FileStationApi {
37
38
  Thumb = "SYNO.FileStation.Thumb",
38
39
  Upload = "SYNO.FileStation.Upload"
39
40
  }
41
+ /**
42
+ * VideoStation API
43
+ */
44
+ export declare enum VideoStationApi {
45
+ Info = "SYNO.VideoStation2.Info",
46
+ Library = "SYNO.VideoStation2.Library",
47
+ AcrossLibrary = "SYNO.VideoStation2.AcrossLibrary",
48
+ HomeVideo = "SYNO.VideoStation2.HomeVideo",
49
+ File = "SYNO.VideoStation2.File",
50
+ Streaming = "SYNO.VideoStation2.Streaming",
51
+ Movie = "SYNO.VideoStation2.Movie"
52
+ }
@@ -6,6 +6,7 @@ export var SynologyApiInfo;
6
6
  SynologyApiInfo["Auth"] = "SYNO.API.Auth";
7
7
  SynologyApiInfo["Info"] = "SYNO.API.Info";
8
8
  SynologyApiInfo["OTP"] = "SYNO.API.OTP";
9
+ SynologyApiInfo["AuthKey"] = "SYNO.API.Auth.Key";
9
10
  })(SynologyApiInfo || (SynologyApiInfo = {}));
10
11
  /**
11
12
  * AudioStation
@@ -15,7 +16,7 @@ export var AudioStationApi;
15
16
  AudioStationApi["Song"] = "SYNO.AudioStation.Song";
16
17
  AudioStationApi["Album"] = "SYNO.AudioStation.Album";
17
18
  AudioStationApi["Artist"] = "SYNO.AudioStation.Artist";
18
- AudioStationApi["Genre"] = "SYNO.AudioStation.Genre";
19
+ AudioStationApi["Search"] = "SYNO.AudioStation.Search";
19
20
  AudioStationApi["Playlist"] = "SYNO.AudioStation.Playlist";
20
21
  AudioStationApi["Folder"] = "SYNO.AudioStation.Folder";
21
22
  AudioStationApi["Cover"] = "SYNO.AudioStation.Cover";
@@ -40,3 +41,16 @@ export var FileStationApi;
40
41
  FileStationApi["Thumb"] = "SYNO.FileStation.Thumb";
41
42
  FileStationApi["Upload"] = "SYNO.FileStation.Upload";
42
43
  })(FileStationApi || (FileStationApi = {}));
44
+ /**
45
+ * VideoStation API
46
+ */
47
+ export var VideoStationApi;
48
+ (function (VideoStationApi) {
49
+ VideoStationApi["Info"] = "SYNO.VideoStation2.Info";
50
+ VideoStationApi["Library"] = "SYNO.VideoStation2.Library";
51
+ VideoStationApi["AcrossLibrary"] = "SYNO.VideoStation2.AcrossLibrary";
52
+ VideoStationApi["HomeVideo"] = "SYNO.VideoStation2.HomeVideo";
53
+ VideoStationApi["File"] = "SYNO.VideoStation2.File";
54
+ VideoStationApi["Streaming"] = "SYNO.VideoStation2.Streaming";
55
+ VideoStationApi["Movie"] = "SYNO.VideoStation2.Movie";
56
+ })(VideoStationApi || (VideoStationApi = {}));
@@ -1,5 +1,2 @@
1
- import { SynologyApi } from "./core";
2
- export * from "./types";
3
- export * from "./core";
4
- export * from "./cli";
5
- export default SynologyApi;
1
+ export * from "./request.js";
2
+ export * from "./apiInfo.js";
@@ -0,0 +1,2 @@
1
+ export * from "./request.js";
2
+ export * from "./apiInfo.js";
@@ -3,3 +3,4 @@ export declare function queryObjToString(params: Record<string, any>): string;
3
3
  export declare function isHttpUrl(url: string): boolean;
4
4
  export declare function isUndfined(value: any): boolean;
5
5
  export declare function getApiKey(apiName: string): string;
6
+ export declare function buildUrlWithQuery(url: string, query: Record<string, any>): string;
@@ -18,3 +18,6 @@ export function isUndfined(value) {
18
18
  export function getApiKey(apiName) {
19
19
  return apiName.split('.')[1];
20
20
  }
21
+ export function buildUrlWithQuery(url, query) {
22
+ return `${url}?${queryObjToString(query)}`;
23
+ }