onecore 0.0.28 → 0.0.29

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "onecore",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "description": "onecore",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./src/index.ts",
package/src/location.ts CHANGED
@@ -141,3 +141,12 @@ export interface TourFilter extends Filter {
141
141
  endTime?: Date|DateRange;
142
142
  locations?: string[];
143
143
  }
144
+ export interface Rate {
145
+ id: string;
146
+ locationId: string;
147
+ rateTime: Date;
148
+ userId: string;
149
+ rate: number;
150
+ review: string;
151
+ version?: number;
152
+ }
package/src/model.ts CHANGED
@@ -144,9 +144,9 @@ export interface UserFilter extends Filter {
144
144
  displayName?: string;
145
145
  dateOfBirth?: DateRange;
146
146
  status?: string[]|string;
147
- interests: string[];
148
- skills: Skill[];
149
- achievements: Achievement[];
147
+ interests?: string[];
148
+ skills?: Skill[];
149
+ achievements?: Achievement[];
150
150
  }
151
151
  export interface RoleFilter extends Filter {
152
152
  roleId?: string;
@@ -3,14 +3,14 @@ import {ViewRepository} from './ViewRepository';
3
3
  export interface GenericRepository<T, ID> extends ViewRepository<T, ID> {
4
4
  insert(obj: T, ctx?: any): Promise<number>;
5
5
  update(obj: T, ctx?: any): Promise<number>;
6
- patch?(obj: T, ctx?: any): Promise<number>;
6
+ patch(obj: T, ctx?: any): Promise<number>;
7
7
  save?(obj: T, ctx?: any): Promise<number>;
8
- delete?(id: ID, ctx?: any): Promise<number>;
8
+ delete(id: ID, ctx?: any): Promise<number>;
9
9
  }
10
10
  export interface Repository<T, ID> extends ViewRepository<T, ID> {
11
11
  insert(obj: T, ctx?: any): Promise<number>;
12
12
  update(obj: T, ctx?: any): Promise<number>;
13
- patch?(obj: T, ctx?: any): Promise<number>;
13
+ patch(obj: T, ctx?: any): Promise<number>;
14
14
  save?(obj: T, ctx?: any): Promise<number>;
15
- delete?(id: ID, ctx?: any): Promise<number>;
15
+ delete(id: ID, ctx?: any): Promise<number>;
16
16
  }
@@ -3,7 +3,7 @@ import {ViewService} from './ViewService';
3
3
  export interface GenericService<T, ID, R> extends ViewService<T, ID> {
4
4
  insert(obj: T, ctx?: any): Promise<R>;
5
5
  update(obj: T, ctx?: any): Promise<R>;
6
- patch?(obj: T, ctx?: any): Promise<R>;
6
+ patch(obj: T, ctx?: any): Promise<R>;
7
7
  save?(obj: T, ctx?: any): Promise<R>;
8
- delete?(id: ID, ctx?: any): Promise<number>;
8
+ delete(id: ID, ctx?: any): Promise<number>;
9
9
  }
package/src/video.ts CHANGED
@@ -58,7 +58,7 @@ export interface StringMap {
58
58
  [key: string]: string;
59
59
  }
60
60
  export interface ListResult<T> {
61
- list?: T[];
61
+ list: T[];
62
62
  total?: number;
63
63
  limit?: number;
64
64
  nextPageToken?: string;
@@ -90,18 +90,18 @@ export interface PlaylistFilter {
90
90
  relevanceLanguage?: string;
91
91
  safeSearch?: string; // moderate, none, strict
92
92
  }
93
- export type ChannelType = 'show' | 'any' | '';
94
- export type EventType = 'completed' | 'live' | 'upcoming' | '';
95
- export type ItemType = 'video' | 'channel' | 'playlist' | 'any' | '';
96
- export type Duration = 'long' | 'medium' | 'short' | 'any' | '';
97
- export type Caption = 'closedCaption' | 'none' | 'any' | '';
98
- export type Definition = 'high' | 'standard' | 'any' | '';
99
- export type Dimension = '2d' | '3d' | 'any' | '';
100
- export type EmbeddableType = 'true' | 'any' | '';
101
- export type LicenseType = 'creativeCommon' | 'youtube' | 'any' | '';
102
- export type SyndicatedType = 'true' | 'any' | '';
103
- export type VideoType = 'movie' | 'episode' | 'any' | '';
104
- export type SortType = 'rating' | 'date' | 'count' | 'relevance' | 'title' | 'viewCount' | '';
93
+ export type ChannelType = 'show' | 'any';
94
+ export type EventType = 'completed' | 'live' | 'upcoming';
95
+ export type ItemType = 'video' | 'channel' | 'playlist' | 'any';
96
+ export type Duration = 'long' | 'medium' | 'short' | 'any';
97
+ export type Caption = 'closedCaption' | 'none' | 'any';
98
+ export type Definition = 'high' | 'standard' | 'any';
99
+ export type Dimension = '2d' | '3d' | 'any';
100
+ export type EmbeddableType = 'true' | 'any';
101
+ export type LicenseType = 'creativeCommon' | 'youtube' | 'any';
102
+ export type SyndicatedType = 'true' | 'any';
103
+ export type VideoType = 'movie' | 'episode' | 'any';
104
+ export type SortType = 'rating' | 'date' | 'count' | 'relevance' | 'title' | 'viewCount';
105
105
  export interface ItemFilter {
106
106
  q?: string;
107
107
  type?: ItemType; // video, channel, playlist
@@ -129,13 +129,15 @@ export interface ItemFilter {
129
129
  }
130
130
  export interface VideoItem extends Title, Thumbnail, ChannelInfo {
131
131
  kind?: string; // video, channel, playlist
132
- id?: string;
132
+ id: string;
133
133
  liveBroadcastContent?: string; // upcoming, live, none
134
134
  publishTime: Date;
135
+ duration?: number;
136
+ definition?: number; // 0: 144, 1: 240, 2: 360, 3: 480, 4: 720, 5: 1080, 6: 1440, 7: 2160
135
137
  }
136
138
  export interface ItemInfo extends Title, Thumbnail, ChannelInfo, LocalizedTitle {
137
139
  kind?: string;
138
- id?: string;
140
+ id: string;
139
141
  }
140
142
  export interface VideoCategory {
141
143
  id: string;
@@ -192,10 +194,10 @@ export interface Video extends ItemInfo, BigThumbnail, VideoDetail, VideoInfo {
192
194
  export interface VideoDetail {
193
195
  duration: number;
194
196
  dimension: string;
195
- definition: number; // 0: 144, 1: 240, 2: 360, 3: 480, 4: 720, 5: 1080, 6: 1440, 7: 2160
196
- caption: boolean;
197
+ definition?: number; // 0: 144, 1: 240, 2: 360, 3: 480, 4: 720, 5: 1080, 6: 1440, 7: 2160
198
+ caption?: boolean;
197
199
  licensedContent: boolean;
198
- projection: string;
200
+ projection?: string;
199
201
  }
200
202
  export interface Thumbnail {
201
203
  thumbnail?: string;
@@ -221,7 +223,7 @@ export interface Thumbnails {
221
223
  export interface Title {
222
224
  title?: string;
223
225
  description?: string;
224
- publishedAt?: Date;
226
+ publishedAt: Date;
225
227
  }
226
228
  export interface LocalizedTitle {
227
229
  localizedTitle?: string;
@@ -244,7 +246,7 @@ export interface ChannelDetail {
244
246
  export interface RelatedPlaylists {
245
247
  likes?: string;
246
248
  favorites?: string;
247
- uploads?: string;
249
+ uploads: string;
248
250
  }
249
251
  export interface VideoItemDetail {
250
252
  videoId: string;
@@ -270,7 +272,7 @@ export interface BaseSnippet extends Title, ChannelInfo {
270
272
  export interface SearchSnippet extends Title, ChannelInfo {
271
273
  thumbnails: Thumbnails;
272
274
  liveBroadcastContent?: string;
273
- publishTime?: Date;
275
+ publishTime: Date;
274
276
  }
275
277
  export interface SearchId {
276
278
  kind?: string;
@@ -305,90 +307,34 @@ export interface YoutubeListResult<T> extends YoutubeKind {
305
307
  export interface ListItem<ID, T, D> extends YoutubeKind {
306
308
  id: ID;
307
309
  etag?: string;
308
- snippet?: T;
309
- contentDetails?: D;
310
+ snippet: T;
311
+ contentDetails: D;
310
312
  }
311
313
  export interface CategorySnippet {
312
314
  title: string;
313
315
  assignable: boolean;
314
316
  channelId: string;
315
317
  }
316
- export interface ChannelSubscriptions {
317
- id: string;
318
- data: Channel[]|string[];
319
- }
320
- export interface SubscriptionSnippet extends Title {
321
- title: string;
322
- resourceId: SubscriptionResource;
323
- thumbnails: Thumbnails;
324
- }
325
- export interface SubscriptionResource {
326
- kind: string;
327
- channelId: string;
328
- }
329
-
330
- export interface ChannelSync {
331
- id: string;
332
- uploads?: string;
333
- syncTime?: Date;
334
- level?: number;
335
- }
336
- export interface PlaylistCollection {
337
- id: string;
338
- videos: string[];
339
- }
340
- export interface CategoryCollection {
341
- id: string;
342
- data: VideoCategory[];
343
- }
344
-
345
- export interface SyncRepository {
346
- getChannelSync(channelId: string): Promise<ChannelSync>;
347
- saveChannel(channel: Channel): Promise<number>;
348
- savePlaylist(playlist: Playlist): Promise<number>;
349
- savePlaylists(playlist: Playlist[]): Promise<number>;
350
- saveChannelSync(channel: ChannelSync): Promise<number>;
351
- saveVideos(videos: Video[]): Promise<number>;
352
- savePlaylistVideos(playlistId: string, videos: string[]): Promise<number>;
353
- getVideoIds(id: string[]): Promise<string[]>;
354
- }
355
- export interface SyncClient {
356
- getChannel(id: string): Promise<Channel>;
357
- getPlaylist(id: string): Promise<Playlist>;
358
- getChannelPlaylists(channelId: string, max?: number, nextPageToken?: string): Promise<ListResult<Playlist>>;
359
- getPlaylistVideos(playlistId: string, max?: number, nextPageToken?: string): Promise<ListResult<PlaylistVideo>>;
360
- getVideos(ids: string[]): Promise<Video[]>;
361
- getSubscriptions(channelId: string): Promise<Channel[]>;
362
- }
363
- export interface SyncService {
364
- syncChannel(channelId: string): Promise<number>;
365
- syncChannels(channelIds: string[]): Promise<number>;
366
- syncPlaylist(playlistId: string, level?: number): Promise<number>;
367
- syncPlaylists(playlistIds: string[], level?: number): Promise<number>;
368
- }
369
318
 
370
- export interface SubscriptionsService {
371
- getSubscriptions(channelId: string, fields?: string[]): Promise<Channel[]>;
372
- }
373
- export type CommentOrder = 'time' | 'relevance' | '';
374
- export type TextFormat = 'html' | 'plainText' | '';
319
+ export type CommentOrder = 'time' | 'relevance';
320
+ export type TextFormat = 'html' | 'plainText';
375
321
  export interface VideoService {
376
322
  getCagetories(regionCode?: string): Promise<VideoCategory[]>;
377
323
  getChannels(ids: string[], fields?: string[]): Promise<Channel[]>;
378
- getChannel(id: string, fields?: string[]): Promise<Channel>;
324
+ getChannel(id: string, fields?: string[]): Promise<Channel|null|undefined>;
379
325
  getChannelPlaylists(channelId: string, max?: number, nextPageToken?: string, fields?: string[]): Promise<ListResult<Playlist>>;
380
326
  getPlaylists(ids: string[], fields?: string[]): Promise<Playlist[]>;
381
- getPlaylist(id: string, fields?: string[]): Promise<Playlist>;
327
+ getPlaylist(id: string, fields?: string[]): Promise<Playlist|null|undefined>;
382
328
  getChannelVideos(channelId: string, max?: number, nextPageToken?: string, fields?: string[]): Promise<ListResult<PlaylistVideo>>;
383
329
  getPlaylistVideos(playlistId: string, max?: number, nextPageToken?: string, fields?: string[]): Promise<ListResult<PlaylistVideo>>;
384
330
  getPopularVideos(regionCode?: string, videoCategoryId?: string, max?: number, nextPageToken?: string, fields?: string[]): Promise<ListResult<Video>>;
385
331
  getVideos(ids: string[], fields?: string[]): Promise<Video[]>;
386
- getVideo(id: string, fields?: string[]): Promise<Video>;
332
+ getVideo(id: string, fields?: string[]): Promise<Video|null|undefined>;
387
333
  search(sm: ItemFilter, max?: number, nextPageToken?: string | number, fields?: string[]): Promise<ListResult<VideoItem>>;
388
334
  getRelatedVideos?(videoId: string, max?: number, nextPageToken?: string, fields?: string[]): Promise<ListResult<VideoItem>>;
389
- searchVideos?(sm: ItemFilter, max?: number, nextPageToken?: string | number, fields?: string[]): Promise<ListResult<VideoItem>>;
390
- searchPlaylists?(sm: PlaylistFilter, max?: number, nextPageToken?: string | number, fields?: string[]): Promise<ListResult<Playlist>>;
391
- searchChannels?(sm: ChannelFilter, max?: number, nextPageToken?: string | number, fields?: string[]): Promise<ListResult<Channel>>;
335
+ searchVideos(sm: ItemFilter, max?: number, nextPageToken?: string | number, fields?: string[]): Promise<ListResult<VideoItem>>;
336
+ searchPlaylists(sm: PlaylistFilter, max?: number, nextPageToken?: string | number, fields?: string[]): Promise<ListResult<Playlist>>;
337
+ searchChannels(sm: ChannelFilter, max?: number, nextPageToken?: string | number, fields?: string[]): Promise<ListResult<Channel>>;
392
338
  /**
393
339
  * @param videoId
394
340
  * @param order relevance, time (default)
@@ -396,13 +342,6 @@ export interface VideoService {
396
342
  */
397
343
  getCommentThreads?(videoId: string, order?: CommentOrder, max?: number, nextPageToken?: string): Promise<ListResult<CommentThead>>;
398
344
  getComments?(id: string, max?: number, nextPageToken?: string): Promise<ListResult<Comment>>;
399
- getPopularVideosByRegion?(regionCode?: string, max?: number, nextPageToken?: string, fields?: string[]): Promise<ListResult<Video>>;
400
- getPopularVideosByCategory?(videoCategoryId?: string, max?: number, nextPageToken?: string, fields?: string[]): Promise<ListResult<Video>>;
401
- }
402
- export interface CacheItem<T> {
403
- item: T;
404
- timestamp: Date;
405
- }
406
- export interface Cache<T> {
407
- [key: string]: CacheItem<T>;
345
+ getPopularVideosByRegion(regionCode?: string, max?: number, nextPageToken?: string, fields?: string[]): Promise<ListResult<Video>>;
346
+ getPopularVideosByCategory(videoCategoryId?: string, max?: number, nextPageToken?: string, fields?: string[]): Promise<ListResult<Video>>;
408
347
  }