@segha/watchmode 0.0.1 → 0.0.2

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.
@@ -0,0 +1,44 @@
1
+ import z from "zod";
2
+
3
+ export const IDMappingDatasetEndpoint = z.literal('/title_id_map.csv').describe('ID mapping dataset');
4
+
5
+ export const ListSourcesEndpoint = z.literal('/sources').describe('List all sources');
6
+ export const TitleSourcesEndpoint = z.literal('/title/{title_id}/sources').describe('Title sources');
7
+
8
+ export const DatasetsEndpoints = z.union([
9
+ IDMappingDatasetEndpoint,
10
+ ]);
11
+
12
+ export const SourcesEndpoints = z.union([
13
+ ListSourcesEndpoint,
14
+ ]);
15
+
16
+ export const TitlesEndpoints = z.union([
17
+ TitleSourcesEndpoint,
18
+ ]);
19
+
20
+ export const APIEndpoints = z.union([
21
+ SourcesEndpoints,
22
+ TitlesEndpoints,
23
+ ]);
24
+
25
+ export const EndpointsSchema = z.object({
26
+ datasets: z.object({
27
+ id_mapping: IDMappingDatasetEndpoint,
28
+ }),
29
+ sources: z.object({
30
+ list: ListSourcesEndpoint,
31
+ }),
32
+ titles: z.object({
33
+ sources: TitleSourcesEndpoint,
34
+ })
35
+ });
36
+
37
+
38
+
39
+ export type DatasetsEndpoints = z.infer<typeof DatasetsEndpoints>;
40
+ export type SourcesEndpoints = z.infer<typeof SourcesEndpoints>;
41
+ export type TitlesEndpoints = z.infer<typeof TitlesEndpoints>;
42
+ export type APIEndpoints = z.infer<typeof APIEndpoints>;
43
+
44
+ export type Endpoints = z.infer<typeof EndpointsSchema>;
package/API/Methods.ts ADDED
@@ -0,0 +1,51 @@
1
+ import z from "zod";
2
+
3
+ import { IDMappingDatasetEndpoint, ListSourcesEndpoint, TitleSourcesEndpoint } from "./Endpoints";
4
+ import { IdMappingSchema } from "../IdMapping";
5
+ import { StreamingSourcesParametersSchema, StreamingSourcesSchema } from "../Sources/StreamingSource";
6
+ import { TitleStreamingSourcesParametersSchema, TitleStreamingSourcesSchema } from "../Titles/StreamingSources";
7
+
8
+ export const MethodsSchema = z.object({
9
+ datasets: z.object({
10
+ id_mapping: z.object({
11
+ get: z.object({
12
+ endpoint: IDMappingDatasetEndpoint,
13
+ responses: z.object({
14
+ '200': IdMappingSchema.describe('ID mapping dataset (CSV content)'),
15
+ }),
16
+ }),
17
+ }),
18
+ }),
19
+ sources: z.object({
20
+ list: z.object({
21
+ get: z.object({
22
+ endpoint: ListSourcesEndpoint,
23
+ parameters: z.object({
24
+ query: StreamingSourcesParametersSchema,
25
+ }),
26
+ responses: z.object({
27
+ '200': StreamingSourcesSchema,
28
+ }),
29
+ }),
30
+ })
31
+ }),
32
+ titles: z.object({
33
+ sources: z.object({
34
+ get: z.object({
35
+ endpoint: TitleSourcesEndpoint,
36
+ parameters: z.object({
37
+ url: z.object({
38
+ title_id: z.number().describe('Title ID'),
39
+ }),
40
+ query: TitleStreamingSourcesParametersSchema,
41
+ }),
42
+ responses: z.object({
43
+ '200': TitleStreamingSourcesSchema,
44
+ }),
45
+ }),
46
+ })
47
+ })
48
+ })
49
+
50
+
51
+ export type Methods = z.infer<typeof MethodsSchema>;
package/API/index.ts ADDED
@@ -0,0 +1,20 @@
1
+ import z from "zod";
2
+ import { MethodsSchema } from "./Methods";
3
+
4
+ export const Version = z.literal("1").describe("API version");
5
+ export const BaseUrl = z.literal('https://api.watchmode.com/v1').describe('Base URL for the API');
6
+ export const DatasetsBaseUrl = z.literal('https://api.watchmode.com/datasets').describe('Base URL for datasets');
7
+
8
+ export const SpecSchema = z.object({
9
+ version: Version,
10
+ baseUrl: BaseUrl,
11
+ datasetsBaseUrl: DatasetsBaseUrl,
12
+ methods: MethodsSchema,
13
+ });
14
+
15
+ export const ConfigurationSchema = z.object({
16
+ apiKey: z.string().describe('Your Watchmode API key'),
17
+ });
18
+
19
+ export type Spec = z.infer<typeof SpecSchema>;
20
+ export type Configuration = z.infer<typeof ConfigurationSchema>;
@@ -0,0 +1,39 @@
1
+ import z from "zod";
2
+
3
+ export const SubscriptionServiceType = z.literal('sub').describe('Subscription services (Netflix, Hulu, etc.)');
4
+ export const PurchaseServiceType = z.literal('purchase').describe('Rental/purchase services (iTunes, Vudu, etc.)');
5
+ export const FreeServiceType = z.literal('free').describe('Free ad-supported services (Tubi, Pluto TV, etc.)');
6
+ export const TVEServiceType = z.literal('tve').describe('TV Channel App (cable login required)');
7
+
8
+ export const StreamingSourceTypeSchema = z.union([
9
+ SubscriptionServiceType,
10
+ PurchaseServiceType,
11
+ FreeServiceType,
12
+ TVEServiceType,
13
+ ]).describe('Streaming source type');
14
+
15
+ export const StreamingSourceSchema = z.object({
16
+ id: z.number().describe('ID'),
17
+ name: z.string().describe('Name'),
18
+ type: StreamingSourceTypeSchema,
19
+ logo_100px: z.string().describe('Logo 100px'),
20
+ ios_appstore_url: z.string().nullable().describe('iOS App Store URL'),
21
+ android_playstore_url: z.string().nullable().describe('Android Play Store URL'),
22
+ android_tv_url: z.string().nullable().describe('Android TV URL'),
23
+ fire_tv_url: z.string().nullable().describe('Fire TV URL'),
24
+ roku_url: z.string().nullable().describe('Roku URL'),
25
+ tvos_url: z.string().nullable().describe('tvOS URL'),
26
+ regions: z.array(z.string()).describe('Regions'),
27
+ });
28
+
29
+ export const StreamingSourcesSchema = z.array(StreamingSourceSchema);
30
+
31
+ export const StreamingSourcesParametersSchema = z.object({
32
+ regions: z.string().describe('Filter sources by region. Pass one or multiple 2-letter country codes comma-separated (e.g., US,GB,CA).'),
33
+ types: z.string().describe('Filter sources by type. Pass one or multiple types comma-separated.'),
34
+ });
35
+
36
+ export type StreamingSourceType = z.infer<typeof StreamingSourceTypeSchema>;
37
+ export type StreamingSource = z.infer<typeof StreamingSourceSchema>;
38
+ export type StreamingSources = z.infer<typeof StreamingSourcesSchema>;
39
+ export type StreamingSourcesParameters = z.infer<typeof StreamingSourcesParametersSchema>;
@@ -0,0 +1 @@
1
+ export * from './StreamingSource';
@@ -0,0 +1,29 @@
1
+ import z from "zod";
2
+ import { StreamingSourceTypeSchema } from "../Sources/StreamingSource";
3
+
4
+ export const TitleStreamingSourceSchema = z.object({
5
+ source_id: z.number().describe('Source ID'),
6
+ name: z.string().describe('Name'),
7
+ type: StreamingSourceTypeSchema,
8
+ region: z.string().describe('Region'),
9
+ ios_url: z.string().nullable().describe('iOS deep link URL. For free plans, returns "Deeplinks available for paid plans only."'),
10
+ android_url: z.string().nullable().describe('Android deep link URL. For free plans, returns "Deeplinks available for paid plans only."'),
11
+ web_url: z.string().nullable().describe('Web URL to watch the title'),
12
+ tvos_url: z.string().nullable().describe('tvOS deep link. Only included if TV links are enabled for your account.'),
13
+ android_tv_url: z.string().nullable().describe('Android TV deep link. Only included if TV links are enabled for your account.'),
14
+ roku_url: z.string().nullable().describe('Roku deep link. Only included if TV links are enabled for your account.'),
15
+ format: z.string().nullable().describe('Video quality (HD, 4K, etc.)'),
16
+ price: z.number().nullable().describe('Price for rent/buy sources'),
17
+ seasons: z.number().nullable().describe('Number of seasons available (for TV)'),
18
+ episodes: z.number().nullable().describe('Number of episodes available (for TV)'),
19
+ });
20
+
21
+ export const TitleStreamingSourcesParametersSchema = z.object({
22
+ regions: z.string().describe('Filter sources by region. Pass one or multiple 2-letter country codes comma-separated (e.g., US,GB,CA).'),
23
+ });
24
+
25
+ export const TitleStreamingSourcesSchema = z.array(TitleStreamingSourceSchema);
26
+
27
+ export type TitleStreamingSource = z.infer<typeof TitleStreamingSourceSchema>;
28
+ export type TitleStreamingSources = z.infer<typeof TitleStreamingSourcesSchema>;
29
+ export type TitleStreamingSourcesParameters = z.infer<typeof TitleStreamingSourcesParametersSchema>;
@@ -0,0 +1 @@
1
+ export * from './StreamingSources';
package/package.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "@segha/watchmode",
3
+ "version": "0.0.2",
3
4
  "description": "Schemas for Watchmode",
4
5
  "main": "index.ts",
5
6
  "keywords": [
@@ -7,7 +8,6 @@
7
8
  "zod",
8
9
  "watchmode"
9
10
  ],
10
- "version": "0.0.1",
11
11
  "author": "Aitor Llamas Jiménez <aitorllj93@gmail.com>",
12
12
  "homepage": "https://github.com/aitorllj93/segha",
13
13
  "repository": {
@@ -39,6 +39,7 @@
39
39
  },
40
40
  "files": [
41
41
  "*.ts",
42
+ "**/*.ts",
42
43
  "json-schemas/**/*.json",
43
44
  "README.md",
44
45
  "CHANGELOG.md"