@segha/watchmode 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 (46) hide show
  1. package/IdMapping.ts +15 -0
  2. package/README.md +178 -0
  3. package/index.ts +4 -0
  4. package/json-schemas/API/APIEndpoints.json +23 -0
  5. package/json-schemas/API/BaseUrl.json +6 -0
  6. package/json-schemas/API/ConfigurationSchema.json +13 -0
  7. package/json-schemas/API/DatasetsBaseUrl.json +6 -0
  8. package/json-schemas/API/DatasetsEndpoints.json +10 -0
  9. package/json-schemas/API/EndpointsSchema.json +50 -0
  10. package/json-schemas/API/IDMappingDatasetEndpoint.json +6 -0
  11. package/json-schemas/API/ListSourcesEndpoint.json +6 -0
  12. package/json-schemas/API/MethodsSchema.json +528 -0
  13. package/json-schemas/API/SourcesEndpoints.json +10 -0
  14. package/json-schemas/API/SpecSchema.json +554 -0
  15. package/json-schemas/API/TitleSourcesEndpoint.json +6 -0
  16. package/json-schemas/API/TitlesEndpoints.json +10 -0
  17. package/json-schemas/API/Version.json +6 -0
  18. package/json-schemas/API/index.json +1241 -0
  19. package/json-schemas/FreeServiceType.json +6 -0
  20. package/json-schemas/IdMappingEntrySchema.json +38 -0
  21. package/json-schemas/IdMappingSchema.json +41 -0
  22. package/json-schemas/PurchaseServiceType.json +6 -0
  23. package/json-schemas/Sources/FreeServiceType.json +6 -0
  24. package/json-schemas/Sources/PurchaseServiceType.json +6 -0
  25. package/json-schemas/Sources/StreamingSourceSchema.json +129 -0
  26. package/json-schemas/Sources/StreamingSourceTypeSchema.json +26 -0
  27. package/json-schemas/Sources/StreamingSourcesParametersSchema.json +18 -0
  28. package/json-schemas/Sources/StreamingSourcesSchema.json +132 -0
  29. package/json-schemas/Sources/SubscriptionServiceType.json +6 -0
  30. package/json-schemas/Sources/TVEServiceType.json +6 -0
  31. package/json-schemas/Sources/index.json +336 -0
  32. package/json-schemas/StreamingSourceSchema.json +129 -0
  33. package/json-schemas/StreamingSourceTypeSchema.json +26 -0
  34. package/json-schemas/StreamingSourcesParametersSchema.json +18 -0
  35. package/json-schemas/StreamingSourcesSchema.json +132 -0
  36. package/json-schemas/SubscriptionServiceType.json +6 -0
  37. package/json-schemas/TVEServiceType.json +6 -0
  38. package/json-schemas/TitleStreamingSourceSchema.json +169 -0
  39. package/json-schemas/TitleStreamingSourcesParametersSchema.json +13 -0
  40. package/json-schemas/TitleStreamingSourcesSchema.json +172 -0
  41. package/json-schemas/Titles/TitleStreamingSourceSchema.json +169 -0
  42. package/json-schemas/Titles/TitleStreamingSourcesParametersSchema.json +13 -0
  43. package/json-schemas/Titles/TitleStreamingSourcesSchema.json +172 -0
  44. package/json-schemas/Titles/index.json +361 -0
  45. package/json-schemas/index.json +769 -0
  46. package/package.json +51 -0
package/IdMapping.ts ADDED
@@ -0,0 +1,15 @@
1
+ import z from "zod"
2
+
3
+ export const IdMappingEntrySchema = z.object({
4
+ 'Watchmode ID': z.string().describe('Watchmode ID'),
5
+ 'IMDB ID': z.string().describe('IMDB ID'),
6
+ 'TMDB ID': z.string().describe('TMDB ID'),
7
+ 'TMDB Type': z.string().describe('TMDB Type'),
8
+ 'Title': z.string().describe('Title'),
9
+ 'Year': z.string().describe('Year'),
10
+ });
11
+
12
+ export const IdMappingSchema = z.array(IdMappingEntrySchema);
13
+
14
+ export type IdMappingEntry = z.infer<typeof IdMappingEntrySchema>;
15
+ export type IdMapping = z.infer<typeof IdMappingSchema>;
package/README.md ADDED
@@ -0,0 +1,178 @@
1
+ # @segha/watchmode
2
+
3
+ [![npm version](https://img.shields.io/npm/v/%40segha%2Fwatchmode.svg)](https://www.npmjs.com/package/@segha/watchmode) [![npm downloads](https://img.shields.io/npm/dm/%40segha%2Fwatchmode.svg)](https://www.npmjs.com/package/@segha/watchmode) [![license](https://img.shields.io/npm/l/%40segha%2Fwatchmode.svg)](https://github.com/aitorllj93/segha) [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/) [![zod](https://img.shields.io/badge/zod-schema-3068b7.svg)](https://zod.dev/)
4
+
5
+ Schemas for Watchmode
6
+
7
+ ## Requirements
8
+
9
+ - `zod`
10
+
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ pnpm add @segha/watchmode
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ```typescript
21
+ import { FreeServiceTypeSchema, IdMappingEntrySchema, IdMappingSchema, ... } from '@segha/watchmode';
22
+
23
+ // Validate data
24
+ const result = FreeServiceTypeSchema.parse(data);
25
+
26
+ // Infer TypeScript types
27
+ type FreeServiceType = z.infer<typeof FreeServiceTypeSchema>;
28
+ ```
29
+
30
+ You can also import specific submodules:
31
+
32
+ ```typescript
33
+ import { SpecSchema, ConfigurationSchema } from '@segha/watchmode/api';
34
+ ```
35
+
36
+ ### Schemas
37
+
38
+ - [FreeServiceType](#freeservicetype)
39
+ - [IdMappingEntry](#idmappingentry)
40
+ - [IdMapping](#idmapping)
41
+ - [PurchaseServiceType](#purchaseservicetype)
42
+ - [StreamingSource](#streamingsource)
43
+ - [StreamingSourceType](#streamingsourcetype)
44
+ - [StreamingSourcesParameters](#streamingsourcesparameters)
45
+ - [StreamingSources](#streamingsources)
46
+ - [SubscriptionServiceType](#subscriptionservicetype)
47
+ - [TVEServiceType](#tveservicetype)
48
+ - [TitleStreamingSource](#titlestreamingsource)
49
+ - [TitleStreamingSourcesParameters](#titlestreamingsourcesparameters)
50
+ - [TitleStreamingSources](#titlestreamingsources)
51
+
52
+ ## API Reference
53
+
54
+ ## FreeServiceType
55
+
56
+ Free ad-supported services (Tubi, Pluto TV, etc.)
57
+
58
+ _Literal `'free'` value._
59
+
60
+ ## IdMappingEntry
61
+
62
+ _Object containing the following properties:_
63
+
64
+ | Property | Description | Type |
65
+ | :---------------------- | :----------- | :------- |
66
+ | **`Watchmode ID`** (\*) | Watchmode ID | `string` |
67
+ | **`IMDB ID`** (\*) | IMDB ID | `string` |
68
+ | **`TMDB ID`** (\*) | TMDB ID | `string` |
69
+ | **`TMDB Type`** (\*) | TMDB Type | `string` |
70
+ | **`Title`** (\*) | Title | `string` |
71
+ | **`Year`** (\*) | Year | `string` |
72
+
73
+ _(\*) Required._
74
+
75
+ ## IdMapping
76
+
77
+ _Array of [IdMappingEntry](#idmappingentry) items._
78
+
79
+ ## PurchaseServiceType
80
+
81
+ Rental/purchase services (iTunes, Vudu, etc.)
82
+
83
+ _Literal `'purchase'` value._
84
+
85
+ ## StreamingSource
86
+
87
+ _Object containing the following properties:_
88
+
89
+ | Property | Description | Type |
90
+ | :------------------------------- | :--------------------- | :------------------------------------------ |
91
+ | **`id`** (\*) | ID | `number` |
92
+ | **`name`** (\*) | Name | `string` |
93
+ | **`type`** (\*) | Streaming source type | [StreamingSourceType](#streamingsourcetype) |
94
+ | **`logo_100px`** (\*) | Logo 100px | `string` |
95
+ | **`ios_appstore_url`** (\*) | iOS App Store URL | `string` (_nullable_) |
96
+ | **`android_playstore_url`** (\*) | Android Play Store URL | `string` (_nullable_) |
97
+ | **`android_tv_url`** (\*) | Android TV URL | `string` (_nullable_) |
98
+ | **`fire_tv_url`** (\*) | Fire TV URL | `string` (_nullable_) |
99
+ | **`roku_url`** (\*) | Roku URL | `string` (_nullable_) |
100
+ | **`tvos_url`** (\*) | tvOS URL | `string` (_nullable_) |
101
+ | **`regions`** (\*) | Regions | `Array<string>` |
102
+
103
+ _(\*) Required._
104
+
105
+ ## StreamingSourceType
106
+
107
+ Streaming source type
108
+
109
+ _Union of the following possible types:_
110
+
111
+ - [SubscriptionServiceType](#subscriptionservicetype)
112
+ - [PurchaseServiceType](#purchaseservicetype)
113
+ - [FreeServiceType](#freeservicetype)
114
+ - [TVEServiceType](#tveservicetype)
115
+
116
+ ## StreamingSourcesParameters
117
+
118
+ _Object containing the following properties:_
119
+
120
+ | Property | Description | Type |
121
+ | :----------------- | :------------------------------------------------------------------------------------------------------ | :------- |
122
+ | **`regions`** (\*) | Filter sources by region. Pass one or multiple 2-letter country codes comma-separated (e.g., US,GB,CA). | `string` |
123
+ | **`types`** (\*) | Filter sources by type. Pass one or multiple types comma-separated. | `string` |
124
+
125
+ _(\*) Required._
126
+
127
+ ## StreamingSources
128
+
129
+ _Array of [StreamingSource](#streamingsource) items._
130
+
131
+ ## SubscriptionServiceType
132
+
133
+ Subscription services (Netflix, Hulu, etc.)
134
+
135
+ _Literal `'sub'` value._
136
+
137
+ ## TVEServiceType
138
+
139
+ TV Channel App (cable login required)
140
+
141
+ _Literal `'tve'` value._
142
+
143
+ ## TitleStreamingSource
144
+
145
+ _Object containing the following properties:_
146
+
147
+ | Property | Description | Type |
148
+ | :------------------------ | :---------------------------------------------------------------------------------------- | :------------------------------------------ |
149
+ | **`source_id`** (\*) | Source ID | `number` |
150
+ | **`name`** (\*) | Name | `string` |
151
+ | **`type`** (\*) | Streaming source type | [StreamingSourceType](#streamingsourcetype) |
152
+ | **`region`** (\*) | Region | `string` |
153
+ | **`ios_url`** (\*) | iOS deep link URL. For free plans, returns "Deeplinks available for paid plans only." | `string` (_nullable_) |
154
+ | **`android_url`** (\*) | Android deep link URL. For free plans, returns "Deeplinks available for paid plans only." | `string` (_nullable_) |
155
+ | **`web_url`** (\*) | Web URL to watch the title | `string` (_nullable_) |
156
+ | **`tvos_url`** (\*) | tvOS deep link. Only included if TV links are enabled for your account. | `string` (_nullable_) |
157
+ | **`android_tv_url`** (\*) | Android TV deep link. Only included if TV links are enabled for your account. | `string` (_nullable_) |
158
+ | **`roku_url`** (\*) | Roku deep link. Only included if TV links are enabled for your account. | `string` (_nullable_) |
159
+ | **`format`** (\*) | Video quality (HD, 4K, etc.) | `string` (_nullable_) |
160
+ | **`price`** (\*) | Price for rent/buy sources | `number` (_nullable_) |
161
+ | **`seasons`** (\*) | Number of seasons available (for TV) | `number` (_nullable_) |
162
+ | **`episodes`** (\*) | Number of episodes available (for TV) | `number` (_nullable_) |
163
+
164
+ _(\*) Required._
165
+
166
+ ## TitleStreamingSourcesParameters
167
+
168
+ _Object containing the following properties:_
169
+
170
+ | Property | Description | Type |
171
+ | :----------------- | :------------------------------------------------------------------------------------------------------ | :------- |
172
+ | **`regions`** (\*) | Filter sources by region. Pass one or multiple 2-letter country codes comma-separated (e.g., US,GB,CA). | `string` |
173
+
174
+ _(\*) Required._
175
+
176
+ ## TitleStreamingSources
177
+
178
+ _Array of [TitleStreamingSource](#titlestreamingsource) items._
package/index.ts ADDED
@@ -0,0 +1,4 @@
1
+
2
+ export * from './Sources';
3
+ export * from './Titles';
4
+ export * from './IdMapping';
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "anyOf": [
4
+ {
5
+ "anyOf": [
6
+ {
7
+ "type": "string",
8
+ "const": "/sources",
9
+ "description": "List all sources"
10
+ }
11
+ ]
12
+ },
13
+ {
14
+ "anyOf": [
15
+ {
16
+ "type": "string",
17
+ "const": "/title/{title_id}/sources",
18
+ "description": "Title sources"
19
+ }
20
+ ]
21
+ }
22
+ ]
23
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "string",
4
+ "const": "https://api.watchmode.com/v1",
5
+ "description": "Base URL for the API"
6
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "apiKey": {
6
+ "type": "string",
7
+ "description": "Your Watchmode API key"
8
+ }
9
+ },
10
+ "required": [
11
+ "apiKey"
12
+ ]
13
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "string",
4
+ "const": "https://api.watchmode.com/datasets",
5
+ "description": "Base URL for datasets"
6
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "anyOf": [
4
+ {
5
+ "type": "string",
6
+ "const": "/title_id_map.csv",
7
+ "description": "ID mapping dataset"
8
+ }
9
+ ]
10
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "datasets": {
6
+ "type": "object",
7
+ "properties": {
8
+ "id_mapping": {
9
+ "type": "string",
10
+ "const": "/title_id_map.csv",
11
+ "description": "ID mapping dataset"
12
+ }
13
+ },
14
+ "required": [
15
+ "id_mapping"
16
+ ]
17
+ },
18
+ "sources": {
19
+ "type": "object",
20
+ "properties": {
21
+ "list": {
22
+ "type": "string",
23
+ "const": "/sources",
24
+ "description": "List all sources"
25
+ }
26
+ },
27
+ "required": [
28
+ "list"
29
+ ]
30
+ },
31
+ "titles": {
32
+ "type": "object",
33
+ "properties": {
34
+ "sources": {
35
+ "type": "string",
36
+ "const": "/title/{title_id}/sources",
37
+ "description": "Title sources"
38
+ }
39
+ },
40
+ "required": [
41
+ "sources"
42
+ ]
43
+ }
44
+ },
45
+ "required": [
46
+ "datasets",
47
+ "sources",
48
+ "titles"
49
+ ]
50
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "string",
4
+ "const": "/title_id_map.csv",
5
+ "description": "ID mapping dataset"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "string",
4
+ "const": "/sources",
5
+ "description": "List all sources"
6
+ }