@superdurable/connector-google-youtube 0.0.0-stage → 0.2.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 +21 -0
- package/README.md +10 -2
- package/dex-connector.json +400 -0
- package/dist/chunk-UAP7AK3Z.js +422 -0
- package/dist/connection-cA6SHIc_.d.ts +332 -0
- package/dist/index.d.ts +364 -0
- package/dist/index.js +953 -0
- package/dist/mock.d.ts +163 -0
- package/dist/mock.js +397 -0
- package/package.json +64 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import { A as AddPlaylistItemInput, a as AddedPlaylistItem, C as Connection, G as GetChannelInput, b as Channel, c as GetVideoInput, V as Video, L as ListPlaylistItemsInput, P as PlaylistItemPage, S as SearchVideosInput, d as VideoSearchPage, e as CredentialSource, f as Config, O as Operations } from './connection-cA6SHIc_.js';
|
|
2
|
+
export { g as AddPlaylistItemInputSchema, h as AddedPlaylistItemSchema, i as ChannelSchema, j as ConfigSchema, k as Credentials, l as GetChannelInputSchema, m as GetVideoInputSchema, n as ListPlaylistItemsInputSchema, o as PlaylistItem, p as PlaylistItemPageSchema, q as PlaylistItemSchema, r as SearchVideosInputSchema, s as VideoSchema, t as VideoSearchPageSchema, u as VideoSearchResult, v as VideoSearchResultSchema, w as decodeCredentials, x as decodeSharedCredentials, y as newConnection, z as newConnectionWithOperations } from './connection-cA6SHIc_.js';
|
|
3
|
+
import * as _superdurable_connectors_sdk from '@superdurable/connectors-sdk';
|
|
4
|
+
import { MutationDefinition, QueryDefinition, MutationStepConfig, Mutation, MutationResult, QueryStepConfig, Query, QueryResult, MutationStep, QueryStep, Call, QueryAttempt, MutationAttempt } from '@superdurable/connectors-sdk';
|
|
5
|
+
import { StepTarget } from '@superdurable/dex';
|
|
6
|
+
import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
|
|
7
|
+
import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
|
|
8
|
+
import { Fence } from '@superdurable/connectors-sdk/singledispatch';
|
|
9
|
+
import 'zod';
|
|
10
|
+
|
|
11
|
+
/** Stable connector identity. */
|
|
12
|
+
declare const ConnectorID = "google-youtube";
|
|
13
|
+
/** Provider identity for named connections. */
|
|
14
|
+
declare const ProviderID = "google";
|
|
15
|
+
/** Branch IDs for searchVideos. */
|
|
16
|
+
declare const SearchVideosBranch: {
|
|
17
|
+
readonly Searched: "searched";
|
|
18
|
+
readonly QuotaExhausted: "quotaExhausted";
|
|
19
|
+
readonly ProviderRejected: "providerRejected";
|
|
20
|
+
readonly InvalidResponse: "invalidResponse";
|
|
21
|
+
readonly Defect: "defect";
|
|
22
|
+
};
|
|
23
|
+
/** YouTube returned one page of matching videos; the page may be empty. */
|
|
24
|
+
declare const SearchVideosBranchSearched: "searched";
|
|
25
|
+
/** The project's daily YouTube Data API quota is spent; it resets at midnight Pacific Time. */
|
|
26
|
+
declare const SearchVideosBranchQuotaExhausted: "quotaExhausted";
|
|
27
|
+
/** YouTube conclusively rejected the search, such as an invalid parameter, a missing scope, or a revoked grant. */
|
|
28
|
+
declare const SearchVideosBranchProviderRejected: "providerRejected";
|
|
29
|
+
/** YouTube returned an invalid or oversized search response. */
|
|
30
|
+
declare const SearchVideosBranchInvalidResponse: "invalidResponse";
|
|
31
|
+
/** Local input, connection configuration, or credentials are invalid. */
|
|
32
|
+
declare const SearchVideosBranchDefect: "defect";
|
|
33
|
+
/** Manifest definition for searchVideos. */
|
|
34
|
+
declare const SearchVideosDefinition: QueryDefinition;
|
|
35
|
+
/** Manifest metadata for searchVideos. */
|
|
36
|
+
declare const SearchVideosMetadata: {
|
|
37
|
+
readonly kind: "query";
|
|
38
|
+
readonly idempotency: "none";
|
|
39
|
+
readonly authorization: "required";
|
|
40
|
+
};
|
|
41
|
+
/** Branch IDs for getVideo. */
|
|
42
|
+
declare const GetVideoBranch: {
|
|
43
|
+
readonly Found: "found";
|
|
44
|
+
readonly NotFound: "notFound";
|
|
45
|
+
readonly QuotaExhausted: "quotaExhausted";
|
|
46
|
+
readonly ProviderRejected: "providerRejected";
|
|
47
|
+
readonly InvalidResponse: "invalidResponse";
|
|
48
|
+
readonly Defect: "defect";
|
|
49
|
+
};
|
|
50
|
+
/** The video exists and the account can see it. */
|
|
51
|
+
declare const GetVideoBranchFound: "found";
|
|
52
|
+
/** No visible video has the ID, such as a deleted or private video. */
|
|
53
|
+
declare const GetVideoBranchNotFound: "notFound";
|
|
54
|
+
/** The project's daily YouTube Data API quota is spent; it resets at midnight Pacific Time. */
|
|
55
|
+
declare const GetVideoBranchQuotaExhausted: "quotaExhausted";
|
|
56
|
+
/** YouTube conclusively rejected the read, such as a missing scope or a revoked grant. */
|
|
57
|
+
declare const GetVideoBranchProviderRejected: "providerRejected";
|
|
58
|
+
/** YouTube returned an invalid or oversized video response. */
|
|
59
|
+
declare const GetVideoBranchInvalidResponse: "invalidResponse";
|
|
60
|
+
/** Local input, connection configuration, or credentials are invalid. */
|
|
61
|
+
declare const GetVideoBranchDefect: "defect";
|
|
62
|
+
/** Manifest definition for getVideo. */
|
|
63
|
+
declare const GetVideoDefinition: QueryDefinition;
|
|
64
|
+
/** Manifest metadata for getVideo. */
|
|
65
|
+
declare const GetVideoMetadata: {
|
|
66
|
+
readonly kind: "query";
|
|
67
|
+
readonly idempotency: "none";
|
|
68
|
+
readonly authorization: "required";
|
|
69
|
+
};
|
|
70
|
+
/** Branch IDs for getChannel. */
|
|
71
|
+
declare const GetChannelBranch: {
|
|
72
|
+
readonly Found: "found";
|
|
73
|
+
readonly NotFound: "notFound";
|
|
74
|
+
readonly QuotaExhausted: "quotaExhausted";
|
|
75
|
+
readonly ProviderRejected: "providerRejected";
|
|
76
|
+
readonly InvalidResponse: "invalidResponse";
|
|
77
|
+
readonly Defect: "defect";
|
|
78
|
+
};
|
|
79
|
+
/** The channel exists and was returned. */
|
|
80
|
+
declare const GetChannelBranchFound: "found";
|
|
81
|
+
/** No channel has the ID or handle, or the authorized account has no channel. */
|
|
82
|
+
declare const GetChannelBranchNotFound: "notFound";
|
|
83
|
+
/** The project's daily YouTube Data API quota is spent; it resets at midnight Pacific Time. */
|
|
84
|
+
declare const GetChannelBranchQuotaExhausted: "quotaExhausted";
|
|
85
|
+
/** YouTube conclusively rejected the read, such as a missing scope or a revoked grant. */
|
|
86
|
+
declare const GetChannelBranchProviderRejected: "providerRejected";
|
|
87
|
+
/** YouTube returned an invalid or oversized channel response. */
|
|
88
|
+
declare const GetChannelBranchInvalidResponse: "invalidResponse";
|
|
89
|
+
/** Local input, connection configuration, or credentials are invalid. */
|
|
90
|
+
declare const GetChannelBranchDefect: "defect";
|
|
91
|
+
/** Manifest definition for getChannel. */
|
|
92
|
+
declare const GetChannelDefinition: QueryDefinition;
|
|
93
|
+
/** Manifest metadata for getChannel. */
|
|
94
|
+
declare const GetChannelMetadata: {
|
|
95
|
+
readonly kind: "query";
|
|
96
|
+
readonly idempotency: "none";
|
|
97
|
+
readonly authorization: "required";
|
|
98
|
+
};
|
|
99
|
+
/** Branch IDs for listPlaylistItems. */
|
|
100
|
+
declare const ListPlaylistItemsBranch: {
|
|
101
|
+
readonly Listed: "listed";
|
|
102
|
+
readonly NotFound: "notFound";
|
|
103
|
+
readonly QuotaExhausted: "quotaExhausted";
|
|
104
|
+
readonly ProviderRejected: "providerRejected";
|
|
105
|
+
readonly InvalidResponse: "invalidResponse";
|
|
106
|
+
readonly Defect: "defect";
|
|
107
|
+
};
|
|
108
|
+
/** YouTube returned one page of playlist items; the page may be empty. */
|
|
109
|
+
declare const ListPlaylistItemsBranchListed: "listed";
|
|
110
|
+
/** No playlist visible to the account has the ID. */
|
|
111
|
+
declare const ListPlaylistItemsBranchNotFound: "notFound";
|
|
112
|
+
/** The project's daily YouTube Data API quota is spent; it resets at midnight Pacific Time. */
|
|
113
|
+
declare const ListPlaylistItemsBranchQuotaExhausted: "quotaExhausted";
|
|
114
|
+
/** YouTube conclusively rejected the listing, such as a private playlist of another account or a revoked grant. */
|
|
115
|
+
declare const ListPlaylistItemsBranchProviderRejected: "providerRejected";
|
|
116
|
+
/** YouTube returned an invalid or oversized playlist page. */
|
|
117
|
+
declare const ListPlaylistItemsBranchInvalidResponse: "invalidResponse";
|
|
118
|
+
/** Local input, connection configuration, or credentials are invalid. */
|
|
119
|
+
declare const ListPlaylistItemsBranchDefect: "defect";
|
|
120
|
+
/** Manifest definition for listPlaylistItems. */
|
|
121
|
+
declare const ListPlaylistItemsDefinition: QueryDefinition;
|
|
122
|
+
/** Manifest metadata for listPlaylistItems. */
|
|
123
|
+
declare const ListPlaylistItemsMetadata: {
|
|
124
|
+
readonly kind: "query";
|
|
125
|
+
readonly idempotency: "none";
|
|
126
|
+
readonly authorization: "required";
|
|
127
|
+
};
|
|
128
|
+
/** Branch IDs for addPlaylistItem. */
|
|
129
|
+
declare const AddPlaylistItemBranch: {
|
|
130
|
+
readonly Added: "added";
|
|
131
|
+
readonly NotFound: "notFound";
|
|
132
|
+
readonly QuotaExhausted: "quotaExhausted";
|
|
133
|
+
readonly ProviderRejected: "providerRejected";
|
|
134
|
+
readonly InvalidResponse: "invalidResponse";
|
|
135
|
+
readonly Uncertain: "uncertain";
|
|
136
|
+
readonly Defect: "defect";
|
|
137
|
+
};
|
|
138
|
+
/** The playlist holds the video, added now or found already present. */
|
|
139
|
+
declare const AddPlaylistItemBranchAdded: "added";
|
|
140
|
+
/** No playlist the account can manage or no visible video has the ID. */
|
|
141
|
+
declare const AddPlaylistItemBranchNotFound: "notFound";
|
|
142
|
+
/** The project's daily YouTube Data API quota is spent; it resets at midnight Pacific Time. */
|
|
143
|
+
declare const AddPlaylistItemBranchQuotaExhausted: "quotaExhausted";
|
|
144
|
+
/** YouTube conclusively rejected the insert, such as a playlist of another account, a full playlist, or a revoked grant. */
|
|
145
|
+
declare const AddPlaylistItemBranchProviderRejected: "providerRejected";
|
|
146
|
+
/** YouTube returned an invalid or oversized check response, or an invalid item after accepting the insert. */
|
|
147
|
+
declare const AddPlaylistItemBranchInvalidResponse: "invalidResponse";
|
|
148
|
+
/** An earlier insert may have added the video, but the playlist listing does not show it; check the playlist before adding it again. */
|
|
149
|
+
declare const AddPlaylistItemBranchUncertain: "uncertain";
|
|
150
|
+
/** Local input, connection configuration, or credentials are invalid. */
|
|
151
|
+
declare const AddPlaylistItemBranchDefect: "defect";
|
|
152
|
+
/** Manifest definition for addPlaylistItem. */
|
|
153
|
+
declare const AddPlaylistItemDefinition: MutationDefinition;
|
|
154
|
+
/** Manifest metadata for addPlaylistItem. */
|
|
155
|
+
declare const AddPlaylistItemMetadata: {
|
|
156
|
+
readonly kind: "mutation";
|
|
157
|
+
readonly idempotency: "required";
|
|
158
|
+
readonly authorization: "required";
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
/** Configuration for the searchVideos connector Step. */
|
|
162
|
+
interface SearchVideosStepConfig<StepInput, OperationInput = SearchVideosInput, OperationOutput = VideoSearchPage> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
163
|
+
/** Named connection supplying this operation. */
|
|
164
|
+
connection: Connection<{
|
|
165
|
+
searchVideos(): Query<OperationInput, OperationOutput>;
|
|
166
|
+
}>;
|
|
167
|
+
/** Name matching the bound connection. */
|
|
168
|
+
connectionName: string;
|
|
169
|
+
/** YouTube returned one page of matching videos; the page may be empty. */
|
|
170
|
+
searched: StepTarget<QueryResult<OperationOutput>>;
|
|
171
|
+
/** The project's daily YouTube Data API quota is spent; it resets at midnight Pacific Time. */
|
|
172
|
+
quotaExhausted?: StepTarget<QueryResult<OperationOutput>>;
|
|
173
|
+
/** YouTube conclusively rejected the search, such as an invalid parameter, a missing scope, or a revoked grant. */
|
|
174
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
175
|
+
/** YouTube returned an invalid or oversized search response. */
|
|
176
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
177
|
+
/** Local input, connection configuration, or credentials are invalid. */
|
|
178
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
179
|
+
}
|
|
180
|
+
/** Build the searchVideos Step from a named connection. */
|
|
181
|
+
declare function newSearchVideosStep<StepInput, OperationInput = SearchVideosInput, OperationOutput = VideoSearchPage>(configuration: SearchVideosStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
182
|
+
/** Configuration for the getVideo connector Step. */
|
|
183
|
+
interface GetVideoStepConfig<StepInput, OperationInput = GetVideoInput, OperationOutput = Video> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
184
|
+
/** Named connection supplying this operation. */
|
|
185
|
+
connection: Connection<{
|
|
186
|
+
getVideo(): Query<OperationInput, OperationOutput>;
|
|
187
|
+
}>;
|
|
188
|
+
/** Name matching the bound connection. */
|
|
189
|
+
connectionName: string;
|
|
190
|
+
/** The video exists and the account can see it. */
|
|
191
|
+
found: StepTarget<QueryResult<OperationOutput>>;
|
|
192
|
+
/** No visible video has the ID, such as a deleted or private video. */
|
|
193
|
+
notFound?: StepTarget<QueryResult<OperationOutput>>;
|
|
194
|
+
/** The project's daily YouTube Data API quota is spent; it resets at midnight Pacific Time. */
|
|
195
|
+
quotaExhausted?: StepTarget<QueryResult<OperationOutput>>;
|
|
196
|
+
/** YouTube conclusively rejected the read, such as a missing scope or a revoked grant. */
|
|
197
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
198
|
+
/** YouTube returned an invalid or oversized video response. */
|
|
199
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
200
|
+
/** Local input, connection configuration, or credentials are invalid. */
|
|
201
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
202
|
+
}
|
|
203
|
+
/** Build the getVideo Step from a named connection. */
|
|
204
|
+
declare function newGetVideoStep<StepInput, OperationInput = GetVideoInput, OperationOutput = Video>(configuration: GetVideoStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
205
|
+
/** Configuration for the getChannel connector Step. */
|
|
206
|
+
interface GetChannelStepConfig<StepInput, OperationInput = GetChannelInput, OperationOutput = Channel> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
207
|
+
/** Named connection supplying this operation. */
|
|
208
|
+
connection: Connection<{
|
|
209
|
+
getChannel(): Query<OperationInput, OperationOutput>;
|
|
210
|
+
}>;
|
|
211
|
+
/** Name matching the bound connection. */
|
|
212
|
+
connectionName: string;
|
|
213
|
+
/** The channel exists and was returned. */
|
|
214
|
+
found: StepTarget<QueryResult<OperationOutput>>;
|
|
215
|
+
/** No channel has the ID or handle, or the authorized account has no channel. */
|
|
216
|
+
notFound?: StepTarget<QueryResult<OperationOutput>>;
|
|
217
|
+
/** The project's daily YouTube Data API quota is spent; it resets at midnight Pacific Time. */
|
|
218
|
+
quotaExhausted?: StepTarget<QueryResult<OperationOutput>>;
|
|
219
|
+
/** YouTube conclusively rejected the read, such as a missing scope or a revoked grant. */
|
|
220
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
221
|
+
/** YouTube returned an invalid or oversized channel response. */
|
|
222
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
223
|
+
/** Local input, connection configuration, or credentials are invalid. */
|
|
224
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
225
|
+
}
|
|
226
|
+
/** Build the getChannel Step from a named connection. */
|
|
227
|
+
declare function newGetChannelStep<StepInput, OperationInput = GetChannelInput, OperationOutput = Channel>(configuration: GetChannelStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
228
|
+
/** Configuration for the listPlaylistItems connector Step. */
|
|
229
|
+
interface ListPlaylistItemsStepConfig<StepInput, OperationInput = ListPlaylistItemsInput, OperationOutput = PlaylistItemPage> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
230
|
+
/** Named connection supplying this operation. */
|
|
231
|
+
connection: Connection<{
|
|
232
|
+
listPlaylistItems(): Query<OperationInput, OperationOutput>;
|
|
233
|
+
}>;
|
|
234
|
+
/** Name matching the bound connection. */
|
|
235
|
+
connectionName: string;
|
|
236
|
+
/** YouTube returned one page of playlist items; the page may be empty. */
|
|
237
|
+
listed: StepTarget<QueryResult<OperationOutput>>;
|
|
238
|
+
/** No playlist visible to the account has the ID. */
|
|
239
|
+
notFound?: StepTarget<QueryResult<OperationOutput>>;
|
|
240
|
+
/** The project's daily YouTube Data API quota is spent; it resets at midnight Pacific Time. */
|
|
241
|
+
quotaExhausted?: StepTarget<QueryResult<OperationOutput>>;
|
|
242
|
+
/** YouTube conclusively rejected the listing, such as a private playlist of another account or a revoked grant. */
|
|
243
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
244
|
+
/** YouTube returned an invalid or oversized playlist page. */
|
|
245
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
246
|
+
/** Local input, connection configuration, or credentials are invalid. */
|
|
247
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
248
|
+
}
|
|
249
|
+
/** Build the listPlaylistItems Step from a named connection. */
|
|
250
|
+
declare function newListPlaylistItemsStep<StepInput, OperationInput = ListPlaylistItemsInput, OperationOutput = PlaylistItemPage>(configuration: ListPlaylistItemsStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
251
|
+
/** Configuration for the addPlaylistItem connector Step. */
|
|
252
|
+
interface AddPlaylistItemStepConfig<StepInput, OperationInput = AddPlaylistItemInput, OperationOutput = AddedPlaylistItem> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
253
|
+
/** Named connection supplying this operation. */
|
|
254
|
+
connection: Connection<{
|
|
255
|
+
addPlaylistItem(): Mutation<OperationInput, OperationOutput>;
|
|
256
|
+
}>;
|
|
257
|
+
/** Name matching the bound connection. */
|
|
258
|
+
connectionName: string;
|
|
259
|
+
/** The playlist holds the video, added now or found already present. */
|
|
260
|
+
added: StepTarget<MutationResult<OperationOutput>>;
|
|
261
|
+
/** No playlist the account can manage or no visible video has the ID. */
|
|
262
|
+
notFound?: StepTarget<MutationResult<OperationOutput>>;
|
|
263
|
+
/** The project's daily YouTube Data API quota is spent; it resets at midnight Pacific Time. */
|
|
264
|
+
quotaExhausted?: StepTarget<MutationResult<OperationOutput>>;
|
|
265
|
+
/** YouTube conclusively rejected the insert, such as a playlist of another account, a full playlist, or a revoked grant. */
|
|
266
|
+
providerRejected?: StepTarget<MutationResult<OperationOutput>>;
|
|
267
|
+
/** YouTube returned an invalid or oversized check response, or an invalid item after accepting the insert. */
|
|
268
|
+
invalidResponse?: StepTarget<MutationResult<OperationOutput>>;
|
|
269
|
+
/** An earlier insert may have added the video, but the playlist listing does not show it; check the playlist before adding it again. */
|
|
270
|
+
uncertain?: StepTarget<MutationResult<OperationOutput>>;
|
|
271
|
+
/** Local input, connection configuration, or credentials are invalid. */
|
|
272
|
+
defect?: StepTarget<MutationResult<OperationOutput>>;
|
|
273
|
+
}
|
|
274
|
+
/** Build the addPlaylistItem Step from a named connection. */
|
|
275
|
+
declare function newAddPlaylistItemStep<StepInput, OperationInput = AddPlaylistItemInput, OperationOutput = AddedPlaylistItem>(configuration: AddPlaylistItemStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
|
|
276
|
+
|
|
277
|
+
/** Search one YouTube video page. */
|
|
278
|
+
declare class SearchVideosOperation implements Query<SearchVideosInput, VideoSearchPage> {
|
|
279
|
+
private readonly client;
|
|
280
|
+
/** Bind a client. */ constructor(client: YouTubeClient);
|
|
281
|
+
/** Return manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
|
|
282
|
+
/** Invoke the search query. */ invoke(call: Call, input: SearchVideosInput): Promise<QueryAttempt<VideoSearchPage>>;
|
|
283
|
+
}
|
|
284
|
+
/** Read one video. */
|
|
285
|
+
declare class GetVideoOperation implements Query<GetVideoInput, Video> {
|
|
286
|
+
private readonly client;
|
|
287
|
+
/** Bind a client. */ constructor(client: YouTubeClient);
|
|
288
|
+
/** Return manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
|
|
289
|
+
/** Invoke the video query. */ invoke(call: Call, input: GetVideoInput): Promise<QueryAttempt<Video>>;
|
|
290
|
+
}
|
|
291
|
+
/** Read one channel. */
|
|
292
|
+
declare class GetChannelOperation implements Query<GetChannelInput, Channel> {
|
|
293
|
+
private readonly client;
|
|
294
|
+
/** Bind a client. */ constructor(client: YouTubeClient);
|
|
295
|
+
/** Return manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
|
|
296
|
+
/** Invoke the channel query. */ invoke(call: Call, input: GetChannelInput): Promise<QueryAttempt<Channel>>;
|
|
297
|
+
}
|
|
298
|
+
/** List one playlist page. */
|
|
299
|
+
declare class ListPlaylistItemsOperation implements Query<ListPlaylistItemsInput, PlaylistItemPage> {
|
|
300
|
+
private readonly client;
|
|
301
|
+
/** Bind a client. */ constructor(client: YouTubeClient);
|
|
302
|
+
/** Return manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
|
|
303
|
+
/** Invoke the playlist query. */ invoke(call: Call, input: ListPlaylistItemsInput): Promise<QueryAttempt<PlaylistItemPage>>;
|
|
304
|
+
}
|
|
305
|
+
/** Add a video once after checking playlist membership. */
|
|
306
|
+
/**
|
|
307
|
+
* Add a video at most once per Step call after checking the playlist for it. YouTube has no idempotency key
|
|
308
|
+
* and its listing can lag behind an insert, so a single-dispatch fence forbids a second insert after one that
|
|
309
|
+
* may have reached YouTube; such a later attempt only reads the playlist back.
|
|
310
|
+
*/
|
|
311
|
+
declare class AddPlaylistItemOperation implements Mutation<AddPlaylistItemInput, AddedPlaylistItem> {
|
|
312
|
+
private readonly client;
|
|
313
|
+
/** Bind a client. */ constructor(client: YouTubeClient);
|
|
314
|
+
/** Return manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
|
|
315
|
+
/** Use the stable Call ID as the Dex idempotency key; YouTube does not accept it. */ idempotencyKey(callID: string): string;
|
|
316
|
+
/** Check membership and insert at most once per Step call. */ invoke(call: Call, input: AddPlaylistItemInput): Promise<MutationAttempt<AddedPlaylistItem>>;
|
|
317
|
+
/** List the playlist after an attempt that may have inserted; only a shown item confirms it. */
|
|
318
|
+
private confirmEarlierInsert;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/** Inject a provider transport for deterministic tests. */
|
|
322
|
+
interface YouTubeClientOptions {
|
|
323
|
+
send?: (request: ProviderRequest) => Promise<ProviderResponse>;
|
|
324
|
+
now?: () => Date;
|
|
325
|
+
}
|
|
326
|
+
/** One provider exchange. */
|
|
327
|
+
interface YouTubeResponse {
|
|
328
|
+
status: number;
|
|
329
|
+
headers: ProviderResponse['headers'];
|
|
330
|
+
body: Uint8Array;
|
|
331
|
+
isTooLarge: boolean;
|
|
332
|
+
}
|
|
333
|
+
/** YouTube API client using the generated OAuth refresh declaration. */
|
|
334
|
+
declare class YouTubeClient {
|
|
335
|
+
readonly credentials: CredentialSource;
|
|
336
|
+
readonly endpoint: string;
|
|
337
|
+
readonly maxResponseBytes: number;
|
|
338
|
+
readonly timeoutMs: number;
|
|
339
|
+
readonly now: () => Date;
|
|
340
|
+
private readonly send;
|
|
341
|
+
private readonly refreshDriver;
|
|
342
|
+
/** Validate the connection and bind host-owned renewable credentials. */
|
|
343
|
+
constructor(config: Config & {
|
|
344
|
+
timeoutMs?: number;
|
|
345
|
+
}, credentials: CredentialSource, options?: YouTubeClientOptions);
|
|
346
|
+
/** Bind the search query. */ searchVideos(): SearchVideosOperation;
|
|
347
|
+
/** Bind the video query. */ getVideo(): GetVideoOperation;
|
|
348
|
+
/** Bind the channel query. */ getChannel(): GetChannelOperation;
|
|
349
|
+
/** Bind the playlist query. */ listPlaylistItems(): ListPlaylistItemsOperation;
|
|
350
|
+
/** Bind the playlist mutation. */ addPlaylistItem(): AddPlaylistItemOperation;
|
|
351
|
+
/** Send one request, resolving and refreshing credentials as the host requires; a write fence sends it at most once. */
|
|
352
|
+
exchange(call: Call, operation: string, path: string, query: Record<string, string>, requiresManage?: boolean, body?: string, writeFence?: Fence): Promise<YouTubeResponse>;
|
|
353
|
+
/**
|
|
354
|
+
* Send once, resending after one refreshed 401, and classify the response. A fenced write retries as
|
|
355
|
+
* unprocessed only after a rate-limit refusal or a connection that never opened; any other failure, including 503, may have applied it.
|
|
356
|
+
*/
|
|
357
|
+
private sendAndClassify;
|
|
358
|
+
private request;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/** Open a named YouTube connection with generated private and shared credential decoders. */
|
|
362
|
+
declare function newProjectConnection(project: LoadedProject, connectionName: string, options?: YouTubeClientOptions): Connection<Operations>;
|
|
363
|
+
|
|
364
|
+
export { AddPlaylistItemBranch, AddPlaylistItemBranchAdded, AddPlaylistItemBranchDefect, AddPlaylistItemBranchInvalidResponse, AddPlaylistItemBranchNotFound, AddPlaylistItemBranchProviderRejected, AddPlaylistItemBranchQuotaExhausted, AddPlaylistItemBranchUncertain, AddPlaylistItemDefinition, AddPlaylistItemInput, AddPlaylistItemMetadata, AddPlaylistItemOperation, type AddPlaylistItemStepConfig, AddedPlaylistItem, Channel, Config, Connection, ConnectorID, CredentialSource, GetChannelBranch, GetChannelBranchDefect, GetChannelBranchFound, GetChannelBranchInvalidResponse, GetChannelBranchNotFound, GetChannelBranchProviderRejected, GetChannelBranchQuotaExhausted, GetChannelDefinition, GetChannelInput, GetChannelMetadata, GetChannelOperation, type GetChannelStepConfig, GetVideoBranch, GetVideoBranchDefect, GetVideoBranchFound, GetVideoBranchInvalidResponse, GetVideoBranchNotFound, GetVideoBranchProviderRejected, GetVideoBranchQuotaExhausted, GetVideoDefinition, GetVideoInput, GetVideoMetadata, GetVideoOperation, type GetVideoStepConfig, ListPlaylistItemsBranch, ListPlaylistItemsBranchDefect, ListPlaylistItemsBranchInvalidResponse, ListPlaylistItemsBranchListed, ListPlaylistItemsBranchNotFound, ListPlaylistItemsBranchProviderRejected, ListPlaylistItemsBranchQuotaExhausted, ListPlaylistItemsDefinition, ListPlaylistItemsInput, ListPlaylistItemsMetadata, ListPlaylistItemsOperation, type ListPlaylistItemsStepConfig, PlaylistItemPage, ProviderID, SearchVideosBranch, SearchVideosBranchDefect, SearchVideosBranchInvalidResponse, SearchVideosBranchProviderRejected, SearchVideosBranchQuotaExhausted, SearchVideosBranchSearched, SearchVideosDefinition, SearchVideosInput, SearchVideosMetadata, SearchVideosOperation, type SearchVideosStepConfig, Video, VideoSearchPage, YouTubeClient, type YouTubeClientOptions, newAddPlaylistItemStep, newGetChannelStep, newGetVideoStep, newListPlaylistItemsStep, newProjectConnection, newSearchVideosStep };
|