@apicity/youtube 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Justin Tanner
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # @apicity/youtube
2
+
3
+ [![npm](https://img.shields.io/npm/v/@apicity/youtube?color=cb0000)](https://www.npmjs.com/package/@apicity/youtube)
4
+ [![zero dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)](package.json)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-strict-blue?logo=typescript&logoColor=white)](tsconfig.json)
6
+
7
+ YouTube Data API v3 provider for posting content.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @apicity/youtube
13
+ # or
14
+ pnpm add @apicity/youtube
15
+ ```
16
+
17
+ ## Quick Start
18
+
19
+ ```typescript
20
+ import { youtube as createYoutube } from "@apicity/youtube";
21
+
22
+ const youtube = createYoutube({ apiKey: process.env.YOUTUBE_API_KEY! });
23
+ ```
24
+
25
+ ## API Reference
26
+
27
+ 3 endpoints across 2 groups. Each method mirrors an upstream URL path.
28
+
29
+ ### channels
30
+
31
+ <details>
32
+ <summary><code>GET</code> <b><code>youtube.channels.list</code></b></summary>
33
+
34
+ <code>GET https://www.googleapis.com/youtube/v3/channels{query}</code>
35
+
36
+ [Upstream docs ↗](https://developers.google.com/youtube/v3/docs/channels/list)
37
+
38
+ ```typescript
39
+ const res = await youtube.channels.list({ /* ... */ });
40
+ ```
41
+
42
+ Source: [`packages/provider/youtube/src/youtube.ts`](src/youtube.ts)
43
+
44
+ </details>
45
+
46
+ ### videos
47
+
48
+ <details>
49
+ <summary><code>POST</code> <b><code>youtube.videos.insert</code></b></summary>
50
+
51
+ <code>POST https://www.googleapis.com/youtube/v3/videos{query}</code>
52
+
53
+ [Upstream docs ↗](https://developers.google.com/youtube/v3/docs/videos/insert)
54
+
55
+ ```typescript
56
+ const res = await youtube.videos.insert({ /* ... */ });
57
+ ```
58
+
59
+ Source: [`packages/provider/youtube/src/youtube.ts`](src/youtube.ts)
60
+
61
+ </details>
62
+
63
+ <details>
64
+ <summary><code>GET</code> <b><code>youtube.videos.list</code></b></summary>
65
+
66
+ <code>GET https://www.googleapis.com/youtube/v3/videos{query}</code>
67
+
68
+ [Upstream docs ↗](https://developers.google.com/youtube/v3/docs/videos/list)
69
+
70
+ ```typescript
71
+ const res = await youtube.videos.list({ /* ... */ });
72
+ ```
73
+
74
+ Source: [`packages/provider/youtube/src/youtube.ts`](src/youtube.ts)
75
+
76
+ </details>
77
+
78
+ ## Middleware
79
+
80
+ ```typescript
81
+ import { youtube as createYoutube, withRetry } from "@apicity/youtube";
82
+
83
+ const youtube = createYoutube({ apiKey: process.env.YOUTUBE_API_KEY! });
84
+ const models = withRetry(youtube.get.v1.models, { retries: 3 });
85
+ ```
86
+
87
+ Part of the [apicity](https://github.com/justintanner/apicity) monorepo.
88
+
89
+ ## License
90
+
91
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,8 @@
1
+ export interface EndpointExample {
2
+ source: string;
3
+ payload: unknown;
4
+ }
5
+ declare const EXAMPLES: Record<string, EndpointExample>;
6
+ export default EXAMPLES;
7
+ export declare function attachExamples<T>(provider: T): T;
8
+ //# sourceMappingURL=example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../../src/example.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,QAAA,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAM,CAAC;AAErD,eAAe,QAAQ,CAAC;AAOxB,wBAAgB,cAAc,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CA6ChD"}
@@ -0,0 +1,85 @@
1
+ // Auto-generated by `pnpm run gen:examples` — do not edit by hand.
2
+ // Source: tests/recordings/<provider>_*/<test>_*/recording.har
3
+ //
4
+ // Each entry is the green-path payload for one endpoint, mined from a real
5
+ // integration-test recording. `attachExamples` walks the provider tree and
6
+ // hangs the matching entry off each endpoint function as `.example`.
7
+ const EXAMPLES = {};
8
+ export default EXAMPLES;
9
+ // Walks each "<METHOD> <dotPath>" key onto the provider's tree. Tries the
10
+ // standard `provider.<method>.<dotPath>` shape first, then a few fallbacks
11
+ // to cover providers with non-standard layouts (fal's `.run.` namespace,
12
+ // kie's sub-providers, `free`'s flat root). Returns the same provider for
13
+ // drop-in use as `return attachExamples({ ... });`.
14
+ export function attachExamples(provider) {
15
+ const root = provider;
16
+ const HTTP_KEYS = new Set(["post", "get", "put", "delete", "patch", "head"]);
17
+ for (const [key, example] of Object.entries(EXAMPLES)) {
18
+ const sp = key.indexOf(" ");
19
+ if (sp < 0)
20
+ continue;
21
+ const method = key.slice(0, sp).toLowerCase();
22
+ const segs = key.slice(sp + 1).split(".");
23
+ const candidates = [
24
+ root[method],
25
+ root[method]?.run,
26
+ root,
27
+ ];
28
+ if (segs.length > 1) {
29
+ const sub = root[segs[0]];
30
+ if (sub && typeof sub === "object") {
31
+ const subMethod = sub[method];
32
+ if (subMethod)
33
+ candidates.push({ __nested: subMethod, __segs: segs.slice(1) });
34
+ }
35
+ }
36
+ let attached = false;
37
+ for (const c of candidates) {
38
+ const fn = walkToFn(c, segs);
39
+ if (fn) {
40
+ Object.assign(fn, { example });
41
+ attached = true;
42
+ break;
43
+ }
44
+ }
45
+ if (attached)
46
+ continue;
47
+ for (const k of Object.keys(root)) {
48
+ if (HTTP_KEYS.has(k))
49
+ continue;
50
+ if (!segs.includes(k))
51
+ continue;
52
+ const sub = root[k];
53
+ if (!sub || typeof sub !== "object")
54
+ continue;
55
+ const subMethod = sub[method];
56
+ if (!subMethod)
57
+ continue;
58
+ const fn = walkToFn(subMethod, segs);
59
+ if (fn) {
60
+ Object.assign(fn, { example });
61
+ break;
62
+ }
63
+ }
64
+ }
65
+ return provider;
66
+ }
67
+ function walkToFn(start, segs) {
68
+ if (start && typeof start === "object" && "__nested" in start) {
69
+ const wrapper = start;
70
+ return walkToFn(wrapper.__nested, wrapper.__segs);
71
+ }
72
+ let cur = start;
73
+ for (const seg of segs) {
74
+ if (cur === null || cur === undefined)
75
+ return null;
76
+ const t = typeof cur;
77
+ if (t !== "object" && t !== "function")
78
+ return null;
79
+ cur = cur[seg];
80
+ }
81
+ return typeof cur === "function"
82
+ ? cur
83
+ : null;
84
+ }
85
+ //# sourceMappingURL=example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.js","sourceRoot":"","sources":["../../src/example.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,+DAA+D;AAC/D,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,qEAAqE;AAOrE,MAAM,QAAQ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M,OAAO,GAAG,KAAgD,CAAC;QACjE,OAAO,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;IACD,IAAI,GAAG,GAAY,KAAK,CAAC;IACzB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC;QACnD,MAAM,CAAC,GAAG,OAAO,GAAG,CAAC;QACrB,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,UAAU;YAAE,OAAO,IAAI,CAAC;QACpD,GAAG,GAAI,GAA+B,CAAC,GAAG,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,OAAO,GAAG,KAAK,UAAU;QAC9B,CAAC,CAAE,GAAuC;QAC1C,CAAC,CAAC,IAAI,CAAC;AACX,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { youtube } from "./youtube";
2
+ export { YouTubeError } from "./types";
3
+ export type { YouTubeProvider, YouTubeVideo, YouTubeVideoSnippet, YouTubeVideosListResponse, YouTubeVideosListMethod, YouTubeVideosNamespace, YouTubeVideoSnippetInput, YouTubeVideoStatusInput, YouTubeRecordingDetailsInput, YouTubeLocalizationsInput, YouTubeVideosInsertResponse, YouTubeVideosInsertMethod, YouTubeVideoStatusResponse, YouTubeVideoResource, YouTubeChannelsListResponse, YouTubeChannel, YouTubeChannelSnippet, YouTubePageInfo, } from "./types";
4
+ export type { YouTubeOptions, YouTubeChannelsListRequest, YouTubeVideosInsertRequest, } from "./zod";
5
+ export { YouTubeOptionsSchema, YouTubeChannelsListRequestSchema, YouTubeVideosInsertRequestSchema, } from "./zod";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,YAAY,EACV,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACvB,4BAA4B,EAC5B,yBAAyB,EACzB,2BAA2B,EAC3B,yBAAyB,EACzB,0BAA0B,EAC1B,oBAAoB,EACpB,2BAA2B,EAC3B,cAAc,EACd,qBAAqB,EACrB,eAAe,GAChB,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,cAAc,EACd,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,oBAAoB,EACpB,gCAAgC,EAChC,gCAAgC,GACjC,MAAM,OAAO,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { youtube } from "./youtube.js";
2
+ export { YouTubeError } from "./types.js";
3
+ export { YouTubeOptionsSchema, YouTubeChannelsListRequestSchema, YouTubeVideosInsertRequestSchema, } from "./zod.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA6BvC,OAAO,EACL,oBAAoB,EACpB,gCAAgC,EAChC,gCAAgC,GACjC,MAAM,OAAO,CAAC"}
@@ -0,0 +1,148 @@
1
+ import type { z } from "zod";
2
+ import type { YouTubeChannelsListRequest } from "./zod";
3
+ export declare class YouTubeError extends Error {
4
+ readonly status: number;
5
+ readonly body: unknown;
6
+ readonly code?: string;
7
+ constructor(message: string, status: number, body?: unknown, code?: string);
8
+ }
9
+ export interface YouTubeVideoSnippet {
10
+ publishedAt: string;
11
+ channelId: string;
12
+ title: string;
13
+ description: string;
14
+ channelTitle: string;
15
+ }
16
+ export interface YouTubeVideo {
17
+ kind: string;
18
+ etag: string;
19
+ id: string;
20
+ snippet?: YouTubeVideoSnippet;
21
+ }
22
+ export interface YouTubeVideosListResponse {
23
+ kind: string;
24
+ etag: string;
25
+ items: YouTubeVideo[];
26
+ pageInfo?: {
27
+ totalResults: number;
28
+ resultsPerPage: number;
29
+ };
30
+ }
31
+ export interface YouTubeVideosListRequest {
32
+ part: string;
33
+ id?: string;
34
+ chart?: string;
35
+ maxResults?: number;
36
+ pageToken?: string;
37
+ }
38
+ export interface YouTubeVideosListMethod {
39
+ (req: YouTubeVideosListRequest, signal?: AbortSignal): Promise<YouTubeVideosListResponse>;
40
+ }
41
+ export interface YouTubeVideoSnippetInput {
42
+ title: string;
43
+ description?: string;
44
+ tags?: string[];
45
+ categoryId?: string;
46
+ defaultLanguage?: string;
47
+ }
48
+ export interface YouTubeVideoStatusInput {
49
+ embeddable?: boolean;
50
+ license?: "youtube" | "creativeCommon";
51
+ privacyStatus?: "public" | "unlisted" | "private";
52
+ publicStatsViewable?: boolean;
53
+ publishAt?: string;
54
+ selfDeclaredMadeForKids?: boolean;
55
+ containsSyntheticMedia?: boolean;
56
+ }
57
+ export interface YouTubeRecordingDetailsInput {
58
+ recordingDate?: string;
59
+ }
60
+ export interface YouTubeLocalizationsInput {
61
+ [key: string]: {
62
+ title: string;
63
+ description?: string;
64
+ };
65
+ }
66
+ export interface YouTubeVideosInsertRequest {
67
+ snippet?: YouTubeVideoSnippetInput;
68
+ status?: YouTubeVideoStatusInput;
69
+ recordingDetails?: YouTubeRecordingDetailsInput;
70
+ localizations?: YouTubeLocalizationsInput;
71
+ video: Blob;
72
+ notifySubscribers?: boolean;
73
+ onBehalfOfContentOwner?: string;
74
+ onBehalfOfContentOwnerChannel?: string;
75
+ }
76
+ export interface YouTubeVideoStatusResponse {
77
+ uploadStatus?: string;
78
+ failureReason?: string;
79
+ rejectionReason?: string;
80
+ privacyStatus?: string;
81
+ publishAt?: string;
82
+ license?: string;
83
+ embeddable?: boolean;
84
+ publicStatsViewable?: boolean;
85
+ madeForKids?: boolean;
86
+ selfDeclaredMadeForKids?: boolean;
87
+ containsSyntheticMedia?: boolean;
88
+ }
89
+ export interface YouTubeVideoResource extends YouTubeVideo {
90
+ status?: YouTubeVideoStatusResponse;
91
+ contentDetails?: unknown;
92
+ recordingDetails?: {
93
+ recordingDate?: string;
94
+ };
95
+ localizations?: Record<string, {
96
+ title: string;
97
+ description?: string;
98
+ }>;
99
+ }
100
+ export type YouTubeVideosInsertResponse = YouTubeVideoResource;
101
+ export interface YouTubeVideosInsertMethod {
102
+ (req: YouTubeVideosInsertRequest, signal?: AbortSignal): Promise<YouTubeVideosInsertResponse>;
103
+ }
104
+ export interface YouTubeVideosNamespace {
105
+ list: YouTubeVideosListMethod;
106
+ insert: YouTubeVideosInsertMethod;
107
+ }
108
+ export interface YouTubePageInfo {
109
+ totalResults: number;
110
+ resultsPerPage: number;
111
+ }
112
+ export interface YouTubeChannelSnippet {
113
+ title: string;
114
+ description: string;
115
+ publishedAt: string;
116
+ customUrl?: string;
117
+ thumbnails?: Record<string, {
118
+ url: string;
119
+ width?: number;
120
+ height?: number;
121
+ }>;
122
+ }
123
+ export interface YouTubeChannel {
124
+ kind: string;
125
+ etag: string;
126
+ id: string;
127
+ snippet?: YouTubeChannelSnippet;
128
+ }
129
+ export interface YouTubeChannelsListResponse {
130
+ kind: string;
131
+ etag: string;
132
+ nextPageToken?: string;
133
+ pageInfo: YouTubePageInfo;
134
+ items: YouTubeChannel[];
135
+ }
136
+ export interface YouTubeChannelsListMethod {
137
+ (req: YouTubeChannelsListRequest, signal?: AbortSignal): Promise<YouTubeChannelsListResponse>;
138
+ schema: z.ZodType<YouTubeChannelsListRequest>;
139
+ }
140
+ export interface YouTubeChannelsNamespace {
141
+ list: YouTubeChannelsListMethod;
142
+ }
143
+ export interface YouTubeProvider {
144
+ videos: YouTubeVideosNamespace;
145
+ channels: YouTubeChannelsNamespace;
146
+ }
147
+ export type { YouTubeOptions } from "./zod";
148
+ //# sourceM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IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/E;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,qBAAqB,CAAC;CACjC;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,yBAAyB;IACxC,CACE,GAAG,EAAE,0BAA0B,EAC/B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACxC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,yBAAyB,CAAC;CACjC;AAID,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,sBAAsB,CAAC;IAC/B,QAAQ,EAAE,wBAAwB,CAAC;CACpC;AAED,YAAY,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC"}
@@ -0,0 +1,13 @@
1
+ export class YouTubeError extends Error {
2
+ status;
3
+ body;
4
+ code;
5
+ constructor(message, status, body, code) {
6
+ super(message);
7
+ this.name = "YouTubeError";
8
+ this.status = status;
9
+ this.body = body ?? null;
10
+ this.code = code;
11
+ }
12
+ }
13
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,YAAa,SAAQ,KAAK;IAC5B,MAAM,CAAS;IACf,IAAI,CAAU;IACd,IAAI,CAAU;IAEvB,YAAY,OAAe,EAAE,MAAc,EAAE,IAAc,EAAE,IAAa;QACxE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ import { YouTubeOptions, YouTubeProvider } from "./types";
2
+ export declare function youtube(opts: YouTubeOptions): YouTubeProvider;
3
+ //# sourceMappingURL=youtube.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"youtube.d.ts","sourceRoot":"","sources":["../../src/youtube.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,eAAe,EAIhB,MAAM,SAAS,CAAC;AAMjB,wBAAgB,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,eAAe,CA4Q7D"}
@@ -0,0 +1,203 @@
1
+ import { YouTubeError, } from "./types.js";
2
+ import { YouTubeChannelsListRequestSchema, YouTubeVideosInsertRequestSchema, } from "./zod.js";
3
+ export function youtube(opts) {
4
+ const baseURL = opts.baseURL ?? "https://www.googleapis.com/youtube/v3";
5
+ const doFetch = opts.fetch ?? fetch;
6
+ const timeout = opts.timeout ?? 30000;
7
+ function attachAbortHandler(signal, controller) {
8
+ if (signal.aborted) {
9
+ controller.abort();
10
+ return;
11
+ }
12
+ signal.addEventListener("abort", () => controller.abort(), { once: true });
13
+ }
14
+ // YouTube Data API errors come as
15
+ // `{ error: { code, message, errors: [...], status } }`.
16
+ function formatErrorMessage(status, body) {
17
+ if (typeof body === "object" && body !== null) {
18
+ const b = body;
19
+ if (b.error?.errors && b.error.errors.length > 0) {
20
+ const first = b.error.errors[0];
21
+ if (first?.message) {
22
+ return `YouTube API error ${status}: ${first.message}`;
23
+ }
24
+ }
25
+ if (b.error?.message) {
26
+ return `YouTube API error ${status}: ${b.error.message}`;
27
+ }
28
+ }
29
+ return `YouTube API error: ${status}`;
30
+ }
31
+ async function makeJsonRequest(method, path, body, signal) {
32
+ const controller = new AbortController();
33
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
34
+ if (signal) {
35
+ attachAbortHandler(signal, controller);
36
+ }
37
+ try {
38
+ const headers = {
39
+ Authorization: `Bearer ${opts.accessToken}`,
40
+ };
41
+ const init = {
42
+ method,
43
+ headers,
44
+ signal: controller.signal,
45
+ };
46
+ if (body !== undefined) {
47
+ headers["Content-Type"] = "application/json";
48
+ init.body = JSON.stringify(body);
49
+ }
50
+ const res = await doFetch(`${baseURL}${path}`, init);
51
+ clearTimeout(timeoutId);
52
+ if (!res.ok) {
53
+ let resBody = null;
54
+ try {
55
+ resBody = await res.json();
56
+ }
57
+ catch {
58
+ // ignore parse errors
59
+ }
60
+ throw new YouTubeError(formatErrorMessage(res.status, resBody), res.status, resBody);
61
+ }
62
+ return (await res.json());
63
+ }
64
+ catch (error) {
65
+ clearTimeout(timeoutId);
66
+ if (error instanceof YouTubeError)
67
+ throw error;
68
+ throw new YouTubeError(`YouTube request failed: ${error}`, 500);
69
+ }
70
+ }
71
+ function buildQuery(params) {
72
+ const qs = new URLSearchParams();
73
+ for (const [key, value] of Object.entries(params)) {
74
+ if (value !== undefined) {
75
+ qs.append(key, String(value));
76
+ }
77
+ }
78
+ const query = qs.toString();
79
+ return query ? `?${query}` : "";
80
+ }
81
+ // sig-ok: namespace follows YouTube API method naming (`videos.list`)
82
+ // GET https://www.googleapis.com/youtube/v3/videos{query}
83
+ // Docs: https://developers.google.com/youtube/v3/docs/videos/list
84
+ async function videosList(req, signal) {
85
+ const query = buildQuery({
86
+ part: req.part,
87
+ id: req.id,
88
+ chart: req.chart,
89
+ maxResults: req.maxResults,
90
+ pageToken: req.pageToken,
91
+ });
92
+ return makeJsonRequest("GET", `/videos${query}`, undefined, signal);
93
+ }
94
+ // sig-ok: namespace follows YouTube API method naming (`videos.insert`)
95
+ // POST https://www.googleapis.com/youtube/v3/videos{query}
96
+ // Docs: https://developers.google.com/youtube/v3/docs/videos/insert
97
+ const videosInsert = Object.assign(async (req, signal) => {
98
+ const boundary = "foo_bar_baz";
99
+ const resource = {};
100
+ if (req.snippet !== undefined)
101
+ resource.snippet = req.snippet;
102
+ if (req.status !== undefined)
103
+ resource.status = req.status;
104
+ if (req.recordingDetails !== undefined)
105
+ resource.recordingDetails = req.recordingDetails;
106
+ if (req.localizations !== undefined)
107
+ resource.localizations = req.localizations;
108
+ const parts = [];
109
+ if (req.snippet !== undefined)
110
+ parts.push("snippet");
111
+ if (req.status !== undefined)
112
+ parts.push("status");
113
+ if (req.recordingDetails !== undefined)
114
+ parts.push("recordingDetails");
115
+ if (req.localizations !== undefined)
116
+ parts.push("localizations");
117
+ const metadataPart = new Blob([
118
+ `--${boundary}\r\n`,
119
+ `Content-Type: application/json; charset=UTF-8\r\n\r\n`,
120
+ JSON.stringify(resource),
121
+ `\r\n`,
122
+ ]);
123
+ const mediaPartHeader = new Blob([
124
+ `--${boundary}\r\n`,
125
+ `Content-Type: ${req.video.type || "application/octet-stream"}\r\n\r\n`,
126
+ ]);
127
+ const closingPart = new Blob([`\r\n--${boundary}--`]);
128
+ const body = new Blob([
129
+ metadataPart,
130
+ mediaPartHeader,
131
+ req.video,
132
+ closingPart,
133
+ ]);
134
+ const query = buildQuery({
135
+ uploadType: "multipart",
136
+ part: parts.join(","),
137
+ notifySubscribers: req.notifySubscribers === undefined
138
+ ? undefined
139
+ : String(req.notifySubscribers),
140
+ onBehalfOfContentOwner: req.onBehalfOfContentOwner,
141
+ onBehalfOfContentOwnerChannel: req.onBehalfOfContentOwnerChannel,
142
+ });
143
+ const uploadBaseURL = baseURL.replace("/youtube/v3", "/upload/youtube/v3");
144
+ const controller = new AbortController();
145
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
146
+ if (signal) {
147
+ attachAbortHandler(signal, controller);
148
+ }
149
+ try {
150
+ const res = await doFetch(`${uploadBaseURL}/videos${query}`, {
151
+ method: "POST",
152
+ headers: {
153
+ Authorization: `Bearer ${opts.accessToken}`,
154
+ "Content-Type": `multipart/related; boundary=${boundary}`,
155
+ },
156
+ body,
157
+ signal: controller.signal,
158
+ });
159
+ clearTimeout(timeoutId);
160
+ if (!res.ok) {
161
+ let resBody = null;
162
+ try {
163
+ resBody = await res.json();
164
+ }
165
+ catch {
166
+ // ignore parse errors
167
+ }
168
+ throw new YouTubeError(formatErrorMessage(res.status, resBody), res.status, resBody);
169
+ }
170
+ return (await res.json());
171
+ }
172
+ catch (error) {
173
+ clearTimeout(timeoutId);
174
+ if (error instanceof YouTubeError)
175
+ throw error;
176
+ throw new YouTubeError(`YouTube request failed: ${error}`, 500);
177
+ }
178
+ }, { schema: YouTubeVideosInsertRequestSchema });
179
+ // sig-ok: namespace follows YouTube API method naming (`channels.list`)
180
+ // GET https://www.googleapis.com/youtube/v3/channels{query}
181
+ // Docs: https://developers.google.com/youtube/v3/docs/channels/list
182
+ const channelsList = Object.assign(async (req, signal) => {
183
+ const query = buildQuery({
184
+ part: req.part,
185
+ id: req.id,
186
+ mine: req.mine === undefined ? undefined : String(req.mine),
187
+ forUsername: req.forUsername,
188
+ maxResults: req.maxResults,
189
+ pageToken: req.pageToken,
190
+ });
191
+ return makeJsonRequest("GET", `/channels${query}`, undefined, signal);
192
+ }, { schema: YouTubeChannelsListRequestSchema });
193
+ return {
194
+ videos: {
195
+ list: videosList,
196
+ insert: videosInsert,
197
+ },
198
+ channels: {
199
+ list: channelsList,
200
+ },
201
+ };
202
+ }
203
+ //# sourceMappingURL=youtube.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"youtube.js","sourceRoot":"","sources":["../../src/youtube.ts"],"names":[],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B,UAAU,EAAE,GAAG,CAAC,UAAU;YAC1B,SAAS,EAAE,GAAG,CAAC,SAAS;SACzB,CAAC,CAAC;QACH,OAAO,eAAe,CACpB,KAAK,EACL,YAAY,KAAK,EAAE,EACnB,SAAS,EACT,MAAM,CACP,CAAC;IACJ,CAAC,EACD,EAAE,MAAM,EAAE,gCAAgC,EAAE,CAC7C,CAAC;IAEF,OAAO;QACL,MAAM,EAAE;YACN,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,YAAY;SACrB;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,YAAY;SACnB;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,227 @@
1
+ import { z } from "zod";
2
+ export declare const YouTubeOptionsSchema: z.ZodObject<{
3
+ accessToken: z.ZodString;
4
+ baseURL: z.ZodOptional<z.ZodString>;
5
+ timeout: z.ZodOptional<z.ZodNumber>;
6
+ fetch: z.ZodOptional<z.ZodType<typeof fetch, z.ZodTypeDef, typeof fetch>>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ accessToken: string;
9
+ baseURL?: string | undefined;
10
+ timeout?: number | undefined;
11
+ fetch?: typeof fetch | undefined;
12
+ }, {
13
+ accessToken: string;
14
+ baseURL?: string | undefined;
15
+ timeout?: number | undefined;
16
+ fetch?: typeof fetch | undefined;
17
+ }>;
18
+ export type YouTubeOptions = z.infer<typeof YouTubeOptionsSchema>;
19
+ export declare const YouTubeChannelsListRequestSchema: z.ZodObject<{
20
+ part: z.ZodString;
21
+ id: z.ZodOptional<z.ZodString>;
22
+ mine: z.ZodOptional<z.ZodBoolean>;
23
+ forUsername: z.ZodOptional<z.ZodString>;
24
+ maxResults: z.ZodOptional<z.ZodNumber>;
25
+ pageToken: z.ZodOptional<z.ZodString>;
26
+ }, "strip", z.ZodTypeAny, {
27
+ part: string;
28
+ id?: string | undefined;
29
+ mine?: boolean | undefined;
30
+ forUsername?: string | undefined;
31
+ maxResults?: number | undefined;
32
+ pageToken?: string | undefined;
33
+ }, {
34
+ part: string;
35
+ id?: string | undefined;
36
+ mine?: boolean | undefined;
37
+ forUsername?: string | undefined;
38
+ maxResults?: number | undefined;
39
+ pageToken?: string | undefined;
40
+ }>;
41
+ export type YouTubeChannelsListRequest = z.infer<typeof YouTubeChannelsListRequestSchema>;
42
+ export declare const YouTubeVideoSnippetInputSchema: z.ZodObject<{
43
+ title: z.ZodString;
44
+ description: z.ZodOptional<z.ZodString>;
45
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
46
+ categoryId: z.ZodOptional<z.ZodString>;
47
+ defaultLanguage: z.ZodOptional<z.ZodString>;
48
+ }, "strip", z.ZodTypeAny, {
49
+ title: string;
50
+ description?: string | undefined;
51
+ tags?: string[] | undefined;
52
+ categoryId?: string | undefined;
53
+ defaultLanguage?: string | undefined;
54
+ }, {
55
+ title: string;
56
+ description?: string | undefined;
57
+ tags?: string[] | undefined;
58
+ categoryId?: string | undefined;
59
+ defaultLanguage?: string | undefined;
60
+ }>;
61
+ export declare const YouTubeVideoStatusInputSchema: z.ZodObject<{
62
+ embeddable: z.ZodOptional<z.ZodBoolean>;
63
+ license: z.ZodOptional<z.ZodEnum<["youtube", "creativeCommon"]>>;
64
+ privacyStatus: z.ZodOptional<z.ZodEnum<["public", "unlisted", "private"]>>;
65
+ publicStatsViewable: z.ZodOptional<z.ZodBoolean>;
66
+ publishAt: z.ZodOptional<z.ZodString>;
67
+ selfDeclaredMadeForKids: z.ZodOptional<z.ZodBoolean>;
68
+ containsSyntheticMedia: z.ZodOptional<z.ZodBoolean>;
69
+ }, "strip", z.ZodTypeAny, {
70
+ embeddable?: boolean | undefined;
71
+ license?: "youtube" | "creativeCommon" | undefined;
72
+ privacyStatus?: "public" | "unlisted" | "private" | undefined;
73
+ publicStatsViewable?: boolean | undefined;
74
+ publishAt?: string | undefined;
75
+ selfDeclaredMadeForKids?: boolean | undefined;
76
+ containsSyntheticMedia?: boolean | undefined;
77
+ }, {
78
+ embeddable?: boolean | undefined;
79
+ license?: "youtube" | "creativeCommon" | undefined;
80
+ privacyStatus?: "public" | "unlisted" | "private" | undefined;
81
+ publicStatsViewable?: boolean | undefined;
82
+ publishAt?: string | undefined;
83
+ selfDeclaredMadeForKids?: boolean | undefined;
84
+ containsSyntheticMedia?: boolean | undefined;
85
+ }>;
86
+ export declare const YouTubeRecordingDetailsInputSchema: z.ZodObject<{
87
+ recordingDate: z.ZodOptional<z.ZodString>;
88
+ }, "strip", z.ZodTypeAny, {
89
+ recordingDate?: string | undefined;
90
+ }, {
91
+ recordingDate?: string | undefined;
92
+ }>;
93
+ export declare const YouTubeLocalizationsInputSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
94
+ title: z.ZodString;
95
+ description: z.ZodOptional<z.ZodString>;
96
+ }, "strip", z.ZodTypeAny, {
97
+ title: string;
98
+ description?: string | undefined;
99
+ }, {
100
+ title: string;
101
+ description?: string | undefined;
102
+ }>>;
103
+ export declare const YouTubeVideosInsertRequestSchema: z.ZodObject<{
104
+ snippet: z.ZodOptional<z.ZodObject<{
105
+ title: z.ZodString;
106
+ description: z.ZodOptional<z.ZodString>;
107
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
108
+ categoryId: z.ZodOptional<z.ZodString>;
109
+ defaultLanguage: z.ZodOptional<z.ZodString>;
110
+ }, "strip", z.ZodTypeAny, {
111
+ title: string;
112
+ description?: string | undefined;
113
+ tags?: string[] | undefined;
114
+ categoryId?: string | undefined;
115
+ defaultLanguage?: string | undefined;
116
+ }, {
117
+ title: string;
118
+ description?: string | undefined;
119
+ tags?: string[] | undefined;
120
+ categoryId?: string | undefined;
121
+ defaultLanguage?: string | undefined;
122
+ }>>;
123
+ status: z.ZodOptional<z.ZodObject<{
124
+ embeddable: z.ZodOptional<z.ZodBoolean>;
125
+ license: z.ZodOptional<z.ZodEnum<["youtube", "creativeCommon"]>>;
126
+ privacyStatus: z.ZodOptional<z.ZodEnum<["public", "unlisted", "private"]>>;
127
+ publicStatsViewable: z.ZodOptional<z.ZodBoolean>;
128
+ publishAt: z.ZodOptional<z.ZodString>;
129
+ selfDeclaredMadeForKids: z.ZodOptional<z.ZodBoolean>;
130
+ containsSyntheticMedia: z.ZodOptional<z.ZodBoolean>;
131
+ }, "strip", z.ZodTypeAny, {
132
+ embeddable?: boolean | undefined;
133
+ license?: "youtube" | "creativeCommon" | undefined;
134
+ privacyStatus?: "public" | "unlisted" | "private" | undefined;
135
+ publicStatsViewable?: boolean | undefined;
136
+ publishAt?: string | undefined;
137
+ selfDeclaredMadeForKids?: boolean | undefined;
138
+ containsSyntheticMedia?: boolean | undefined;
139
+ }, {
140
+ embeddable?: boolean | undefined;
141
+ license?: "youtube" | "creativeCommon" | undefined;
142
+ privacyStatus?: "public" | "unlisted" | "private" | undefined;
143
+ publicStatsViewable?: boolean | undefined;
144
+ publishAt?: string | undefined;
145
+ selfDeclaredMadeForKids?: boolean | undefined;
146
+ containsSyntheticMedia?: boolean | undefined;
147
+ }>>;
148
+ recordingDetails: z.ZodOptional<z.ZodObject<{
149
+ recordingDate: z.ZodOptional<z.ZodString>;
150
+ }, "strip", z.ZodTypeAny, {
151
+ recordingDate?: string | undefined;
152
+ }, {
153
+ recordingDate?: string | undefined;
154
+ }>>;
155
+ localizations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
156
+ title: z.ZodString;
157
+ description: z.ZodOptional<z.ZodString>;
158
+ }, "strip", z.ZodTypeAny, {
159
+ title: string;
160
+ description?: string | undefined;
161
+ }, {
162
+ title: string;
163
+ description?: string | undefined;
164
+ }>>>;
165
+ video: z.ZodType<Blob, z.ZodTypeDef, Blob>;
166
+ notifySubscribers: z.ZodOptional<z.ZodBoolean>;
167
+ onBehalfOfContentOwner: z.ZodOptional<z.ZodString>;
168
+ onBehalfOfContentOwnerChannel: z.ZodOptional<z.ZodString>;
169
+ }, "strip", z.ZodTypeAny, {
170
+ video: Blob;
171
+ status?: {
172
+ embeddable?: boolean | undefined;
173
+ license?: "youtube" | "creativeCommon" | undefined;
174
+ privacyStatus?: "public" | "unlisted" | "private" | undefined;
175
+ publicStatsViewable?: boolean | undefined;
176
+ publishAt?: string | undefined;
177
+ selfDeclaredMadeForKids?: boolean | undefined;
178
+ containsSyntheticMedia?: boolean | undefined;
179
+ } | undefined;
180
+ snippet?: {
181
+ title: string;
182
+ description?: string | undefined;
183
+ tags?: string[] | undefined;
184
+ categoryId?: string | undefined;
185
+ defaultLanguage?: string | undefined;
186
+ } | undefined;
187
+ recordingDetails?: {
188
+ recordingDate?: string | undefined;
189
+ } | undefined;
190
+ localizations?: Record<string, {
191
+ title: string;
192
+ description?: string | undefined;
193
+ }> | undefined;
194
+ notifySubscribers?: boolean | undefined;
195
+ onBehalfOfContentOwner?: string | undefined;
196
+ onBehalfOfContentOwnerChannel?: string | undefined;
197
+ }, {
198
+ video: Blob;
199
+ status?: {
200
+ embeddable?: boolean | undefined;
201
+ license?: "youtube" | "creativeCommon" | undefined;
202
+ privacyStatus?: "public" | "unlisted" | "private" | undefined;
203
+ publicStatsViewable?: boolean | undefined;
204
+ publishAt?: string | undefined;
205
+ selfDeclaredMadeForKids?: boolean | undefined;
206
+ containsSyntheticMedia?: boolean | undefined;
207
+ } | undefined;
208
+ snippet?: {
209
+ title: string;
210
+ description?: string | undefined;
211
+ tags?: string[] | undefined;
212
+ categoryId?: string | undefined;
213
+ defaultLanguage?: string | undefined;
214
+ } | undefined;
215
+ recordingDetails?: {
216
+ recordingDate?: string | undefined;
217
+ } | undefined;
218
+ localizations?: Record<string, {
219
+ title: string;
220
+ description?: string | undefined;
221
+ }> | undefined;
222
+ notifySubscribers?: boolean | undefined;
223
+ onBehalfOfContentOwner?: string | undefined;
224
+ onBehalfOfContentOwnerChannel?: string | undefined;
225
+ }>;
226
+ export type YouTubeVideosInsertRequest = z.infer<typeof YouTubeVideosInsertRequestSchema>;
227
+ //# sourceMappingURL=zod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../src/zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;EAK/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAMlE,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;EAO3C,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,gCAAgC,CACxC,CAAC;AAQF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;EAMzC,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;EAQxC,CAAC;AAEH,eAAO,MAAM,kCAAkC;;;;;;EAE7C,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;;;;;;GAK3C,CAAC;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS3C,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,gCAAgC,CACxC,CAAC"}
@@ -0,0 +1,63 @@
1
+ import { z } from "zod";
2
+ // ---------------------------------------------------------------------------
3
+ // Provider options
4
+ // ---------------------------------------------------------------------------
5
+ // YouTube Data API v3 requires an OAuth 2.0 access token with the
6
+ // appropriate scopes (youtube.upload, youtube.force-ssl, etc.). The caller
7
+ // obtains the token externally and supplies it here; this package does not
8
+ // implement the OAuth dance.
9
+ export const YouTubeOptionsSchema = z.object({
10
+ accessToken: z.string().min(1),
11
+ baseURL: z.string().optional(),
12
+ timeout: z.number().optional(),
13
+ fetch: z.custom().optional(),
14
+ });
15
+ // ---------------------------------------------------------------------------
16
+ // GET /youtube/v3/channels
17
+ // ---------------------------------------------------------------------------
18
+ export const YouTubeChannelsListRequestSchema = z.object({
19
+ part: z.string().min(1),
20
+ id: z.string().optional(),
21
+ mine: z.boolean().optional(),
22
+ forUsername: z.string().optional(),
23
+ maxResults: z.number().int().min(1).max(50).optional(),
24
+ pageToken: z.string().optional(),
25
+ });
26
+ // ---------------------------------------------------------------------------
27
+ // POST /upload/youtube/v3/videos
28
+ // ---------------------------------------------------------------------------
29
+ const blobSchema = z.instanceof(Blob);
30
+ export const YouTubeVideoSnippetInputSchema = z.object({
31
+ title: z.string().min(1),
32
+ description: z.string().optional(),
33
+ tags: z.array(z.string()).optional(),
34
+ categoryId: z.string().optional(),
35
+ defaultLanguage: z.string().optional(),
36
+ });
37
+ export const YouTubeVideoStatusInputSchema = z.object({
38
+ embeddable: z.boolean().optional(),
39
+ license: z.enum(["youtube", "creativeCommon"]).optional(),
40
+ privacyStatus: z.enum(["public", "unlisted", "private"]).optional(),
41
+ publicStatsViewable: z.boolean().optional(),
42
+ publishAt: z.string().optional(),
43
+ selfDeclaredMadeForKids: z.boolean().optional(),
44
+ containsSyntheticMedia: z.boolean().optional(),
45
+ });
46
+ export const YouTubeRecordingDetailsInputSchema = z.object({
47
+ recordingDate: z.string().optional(),
48
+ });
49
+ export const YouTubeLocalizationsInputSchema = z.record(z.object({
50
+ title: z.string(),
51
+ description: z.string().optional(),
52
+ }));
53
+ export const YouTubeVideosInsertRequestSchema = z.object({
54
+ snippet: YouTubeVideoSnippetInputSchema.optional(),
55
+ status: YouTubeVideoStatusInputSchema.optional(),
56
+ recordingDetails: YouTubeRecordingDetailsInputSchema.optional(),
57
+ localizations: YouTubeLocalizationsInputSchema.optional(),
58
+ video: blobSchema,
59
+ notifySubscribers: z.boolean().optional(),
60
+ onBehalfOfContentOwner: z.string().optional(),
61
+ onBehalfOfContentOwnerChannel: z.string().optional(),
62
+ });
63
+ //# sourceMappingURL=zod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"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CAAC,CAAC,MAAM,CACrD,CAAC,CAAC,MAAM,CAAC;IACP,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CACH,CAAC;AAEF,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IACvD,OAAO,EAAE,8BAA8B,CAAC,QAAQ,EAAE;IAClD,MAAM,EAAE,6BAA6B,CAAC,QAAQ,EAAE;IAChD,gBAAgB,EAAE,kCAAkC,CAAC,QAAQ,EAAE;IAC/D,aAAa,EAAE,+BAA+B,CAAC,QAAQ,EAAE;IACzD,KAAK,EAAE,UAAU;IACjB,iBAAiB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACzC,sBAAsB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7C,6BAA6B,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACrD,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@apicity/youtube",
3
+ "version": "0.1.0",
4
+ "description": "YouTube Data API v3 provider for posting content.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/justintanner/apicity.git",
9
+ "directory": "provider/youtube"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "type": "module",
15
+ "main": "dist/src/index.js",
16
+ "types": "dist/src/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "import": "./dist/src/index.js",
20
+ "types": "./dist/src/index.d.ts"
21
+ },
22
+ "./zod": {
23
+ "import": "./dist/src/zod.js",
24
+ "types": "./dist/src/zod.d.ts"
25
+ }
26
+ },
27
+ "peerDependencies": {
28
+ "zod": "^3.24.0"
29
+ },
30
+ "peerDependenciesMeta": {
31
+ "zod": {
32
+ "optional": true
33
+ }
34
+ },
35
+ "files": [
36
+ "dist",
37
+ "README.md",
38
+ "LICENSE"
39
+ ],
40
+ "sideEffects": false,
41
+ "keywords": [
42
+ "youtube",
43
+ "youtube-data-api",
44
+ "video",
45
+ "upload",
46
+ "comment",
47
+ "playlist",
48
+ "apicity"
49
+ ],
50
+ "author": "Justin Tanner",
51
+ "engines": {
52
+ "node": ">=18.0.0"
53
+ },
54
+ "homepage": "https://github.com/justintanner/apicity#readme",
55
+ "bugs": {
56
+ "url": "https://github.com/justintanner/apicity/issues"
57
+ },
58
+ "scripts": {
59
+ "build": "tsc -p tsconfig.json && node scripts/dist.mjs"
60
+ }
61
+ }