onecore 0.0.16 → 0.0.20
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 +2 -2
- package/src/index.ts +7 -2
- package/src/location.ts +64 -18
- package/src/metadata.ts +2 -1
- package/src/model.ts +13 -3
- package/src/mq.ts +61 -0
- package/src/repository/GenericSearchRepository.ts +2 -2
- package/src/repository/SearchRepository.ts +2 -2
- package/src/repository/ViewRepository.ts +3 -3
- package/src/repository/ViewSearchRepository.ts +2 -2
- package/src/service/GenericSearchDiffApprService.ts +2 -2
- package/src/service/GenericSearchService.ts +2 -2
- package/src/service/SearchService.ts +2 -2
- package/src/service/ViewSearchService.ts +2 -2
- package/src/service/ViewService.ts +2 -2
- package/src/video.ts +146 -94
- package/tsconfig.json +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onecore",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
4
4
|
"description": "onecore",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
|
-
"url": "git@github.com/
|
|
20
|
+
"url": "git@github.com/core-ts/onecore"
|
|
21
21
|
},
|
|
22
22
|
"keywords": [
|
|
23
23
|
"one",
|
package/src/index.ts
CHANGED
|
@@ -7,8 +7,7 @@ export {LocaleFormatter} from './formatter';
|
|
|
7
7
|
export {StringFormatter} from './formatter';
|
|
8
8
|
export {LocaleStringFormatter} from './formatter';
|
|
9
9
|
|
|
10
|
-
export
|
|
11
|
-
export {Attribute} from './metadata';
|
|
10
|
+
export * from './metadata';
|
|
12
11
|
|
|
13
12
|
export {CacheService} from './cache';
|
|
14
13
|
export {SyncCacheService} from './cache';
|
|
@@ -27,12 +26,18 @@ export {DataLoader} from './loader';
|
|
|
27
26
|
|
|
28
27
|
export * from './model';
|
|
29
28
|
|
|
29
|
+
import {GenericSearchRepository} from './repository/GenericSearchRepository';
|
|
30
|
+
export {GenericSearchRepository as Repository};
|
|
31
|
+
|
|
30
32
|
export * from './repository/ViewRepository';
|
|
31
33
|
export * from './repository/GenericRepository';
|
|
32
34
|
export * from './repository/SearchRepository';
|
|
33
35
|
export * from './repository/ViewSearchRepository';
|
|
34
36
|
export * from './repository/GenericSearchRepository';
|
|
35
37
|
|
|
38
|
+
import {GenericSearchService} from './service/GenericSearchService';
|
|
39
|
+
export {GenericSearchService as Service};
|
|
40
|
+
|
|
36
41
|
export * from './service/ViewService';
|
|
37
42
|
export * from './service/GenericService';
|
|
38
43
|
export * from './service/SearchService';
|
package/src/location.ts
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {DateRange, Filter, NumberRange} from './model';
|
|
2
2
|
|
|
3
3
|
export interface Article {
|
|
4
4
|
id?: string;
|
|
5
5
|
title?: string;
|
|
6
|
+
type?: string;
|
|
6
7
|
description?: string;
|
|
7
8
|
content?: string;
|
|
8
9
|
tags?: string[];
|
|
9
10
|
status?: string;
|
|
10
11
|
}
|
|
11
|
-
export interface
|
|
12
|
+
export interface ArticleFilter extends Filter {
|
|
12
13
|
id?: string;
|
|
13
|
-
|
|
14
|
+
title?: string;
|
|
14
15
|
type?: string;
|
|
16
|
+
tags?: string[];
|
|
15
17
|
status?: string[]|string;
|
|
16
18
|
}
|
|
19
|
+
|
|
17
20
|
export interface Location {
|
|
18
21
|
id?: string;
|
|
19
22
|
name?: string;
|
|
@@ -23,11 +26,11 @@ export interface Location {
|
|
|
23
26
|
imageURL?: string;
|
|
24
27
|
latitude?: number;
|
|
25
28
|
longitude?: number;
|
|
26
|
-
|
|
29
|
+
customURL?: string;
|
|
27
30
|
info?: LocationInfo;
|
|
28
31
|
}
|
|
29
32
|
export interface LocationInfo {
|
|
30
|
-
id?: string;
|
|
33
|
+
id?: string;
|
|
31
34
|
viewCount: number;
|
|
32
35
|
rate: number;
|
|
33
36
|
rate1: number;
|
|
@@ -36,6 +39,16 @@ export interface LocationInfo {
|
|
|
36
39
|
rate4: number;
|
|
37
40
|
rate5: number;
|
|
38
41
|
}
|
|
42
|
+
export interface LocationFilter extends Filter {
|
|
43
|
+
id?: string;
|
|
44
|
+
name?: string;
|
|
45
|
+
type?: string;
|
|
46
|
+
status?: string[]|string;
|
|
47
|
+
latitude?: number;
|
|
48
|
+
longitude?: number;
|
|
49
|
+
radius?: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
39
52
|
export interface Event {
|
|
40
53
|
id?: string;
|
|
41
54
|
name?: string;
|
|
@@ -43,12 +56,25 @@ export interface Event {
|
|
|
43
56
|
description?: string;
|
|
44
57
|
status?: string;
|
|
45
58
|
imageURL?: string;
|
|
46
|
-
startTime
|
|
47
|
-
endTime
|
|
59
|
+
startTime?: Date;
|
|
60
|
+
endTime?: Date;
|
|
48
61
|
latitude?: number;
|
|
49
62
|
longitude?: number;
|
|
63
|
+
customURL?: string;
|
|
50
64
|
locationId?: string;
|
|
51
65
|
}
|
|
66
|
+
export interface EventFilter extends Filter {
|
|
67
|
+
id?: string;
|
|
68
|
+
name?: string;
|
|
69
|
+
type?: string;
|
|
70
|
+
status?: string[]|string;
|
|
71
|
+
startTime?: Date|DateRange;
|
|
72
|
+
endTime?: Date|DateRange;
|
|
73
|
+
latitude?: number;
|
|
74
|
+
longitude?: number;
|
|
75
|
+
locationId?: string[]|string;
|
|
76
|
+
}
|
|
77
|
+
|
|
52
78
|
export interface Bookable {
|
|
53
79
|
id?: string;
|
|
54
80
|
name?: string;
|
|
@@ -56,9 +82,19 @@ export interface Bookable {
|
|
|
56
82
|
description?: string;
|
|
57
83
|
status?: string;
|
|
58
84
|
imageURL?: string;
|
|
85
|
+
customURL?: string;
|
|
59
86
|
capacity?: number;
|
|
60
87
|
locationId?: string;
|
|
61
88
|
}
|
|
89
|
+
export interface BookableFilter extends Filter {
|
|
90
|
+
id?: string;
|
|
91
|
+
name?: string;
|
|
92
|
+
type?: string;
|
|
93
|
+
status?: string[]|string;
|
|
94
|
+
capacity?: number|NumberRange;
|
|
95
|
+
locationId?: string[]|string;
|
|
96
|
+
}
|
|
97
|
+
|
|
62
98
|
export interface Booking {
|
|
63
99
|
bookingId?: string;
|
|
64
100
|
id?: string;
|
|
@@ -71,27 +107,37 @@ export interface Booking {
|
|
|
71
107
|
endTime: Date;
|
|
72
108
|
status?: string;
|
|
73
109
|
}
|
|
74
|
-
export interface
|
|
110
|
+
export interface BookingFilter extends Filter {
|
|
111
|
+
bookingId?: string;
|
|
75
112
|
id?: string;
|
|
113
|
+
userId?: string;
|
|
76
114
|
name?: string;
|
|
77
115
|
type?: string;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
116
|
+
description?: string;
|
|
117
|
+
subject?: string;
|
|
118
|
+
startTime?: Date|DateRange;
|
|
119
|
+
endTime?: Date|DateRange;
|
|
120
|
+
status?: string;
|
|
81
121
|
}
|
|
82
|
-
|
|
122
|
+
|
|
123
|
+
export interface Tour {
|
|
83
124
|
id?: string;
|
|
84
125
|
name?: string;
|
|
85
126
|
type?: string;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
127
|
+
description?: string;
|
|
128
|
+
status?: string;
|
|
129
|
+
imageURL?: string;
|
|
130
|
+
startTime?: Date;
|
|
131
|
+
endTime?: Date;
|
|
132
|
+
locations: string[]|Location[];
|
|
133
|
+
customURL?: string;
|
|
90
134
|
}
|
|
91
|
-
export interface
|
|
135
|
+
export interface TourFilter extends Filter {
|
|
92
136
|
id?: string;
|
|
93
137
|
name?: string;
|
|
94
138
|
type?: string;
|
|
95
139
|
status?: string[]|string;
|
|
96
|
-
|
|
140
|
+
startTime?: Date|DateRange;
|
|
141
|
+
endTime?: Date|DateRange;
|
|
142
|
+
locations?: string[];
|
|
97
143
|
}
|
package/src/metadata.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type DataType = 'ObjectId' | 'date' | 'datetime' | 'time'
|
|
2
2
|
| 'boolean' | 'number' | 'integer' | 'string' | 'text'
|
|
3
|
-
| 'object' | 'array' | '
|
|
3
|
+
| 'object' | 'array' | 'binary'
|
|
4
|
+
| 'primitives' | 'booleans' | 'numbers' | 'integers' | 'strings' | 'dates' | 'datetimes' | 'times';
|
|
4
5
|
export type FormatType = 'currency' | 'percentage' | 'email' | 'url' | 'phone' | 'fax' | 'ipv4' | 'ipv6';
|
|
5
6
|
export type MatchType = 'equal' | 'prefix' | 'contain' | 'max' | 'min'; // contain: default for string, min: default for Date, number
|
|
6
7
|
|
package/src/model.ts
CHANGED
|
@@ -58,21 +58,31 @@ export interface CodeText {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
export interface DateRange {
|
|
61
|
+
min?: Date;
|
|
62
|
+
max?: Date;
|
|
63
|
+
bottom?: Date;
|
|
64
|
+
top?: Date;
|
|
61
65
|
startDate?: Date;
|
|
62
66
|
endDate?: Date;
|
|
63
67
|
}
|
|
64
68
|
export interface TimeRange {
|
|
69
|
+
min?: Date;
|
|
70
|
+
max?: Date;
|
|
71
|
+
bottom?: Date;
|
|
72
|
+
top?: Date;
|
|
65
73
|
startTime?: Date;
|
|
66
74
|
endTime?: Date;
|
|
67
75
|
}
|
|
68
76
|
export interface NumberRange {
|
|
69
77
|
min?: number;
|
|
70
78
|
max?: number;
|
|
79
|
+
bottom?: number;
|
|
80
|
+
top?: number;
|
|
71
81
|
lower?: number;
|
|
72
82
|
upper?: number;
|
|
73
83
|
}
|
|
74
84
|
|
|
75
|
-
export interface
|
|
85
|
+
export interface Filter {
|
|
76
86
|
page?: number;
|
|
77
87
|
limit?: number;
|
|
78
88
|
firstLimit?: number;
|
|
@@ -114,14 +124,14 @@ export interface DiffModel<T, ID> {
|
|
|
114
124
|
value: T;
|
|
115
125
|
}
|
|
116
126
|
|
|
117
|
-
export interface
|
|
127
|
+
export interface UserFilter extends Filter {
|
|
118
128
|
userId?: string;
|
|
119
129
|
username?: string;
|
|
120
130
|
email?: string;
|
|
121
131
|
displayName?: string;
|
|
122
132
|
status?: string[]|string;
|
|
123
133
|
}
|
|
124
|
-
export interface
|
|
134
|
+
export interface RoleFilter extends Filter {
|
|
125
135
|
roleId?: string;
|
|
126
136
|
roleName?: string;
|
|
127
137
|
status?: string[]|string;
|
package/src/mq.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
interface StringMap {
|
|
2
|
+
[key: string]: string;
|
|
3
|
+
}
|
|
4
|
+
export interface Message<T, ID, R> {
|
|
5
|
+
id?: ID;
|
|
6
|
+
data?: T;
|
|
7
|
+
attributes?: StringMap;
|
|
8
|
+
timestamp?: Date;
|
|
9
|
+
raw?: R;
|
|
10
|
+
}
|
|
11
|
+
export interface Producer<T, R, ID> {
|
|
12
|
+
produce(data: T, attributes?: StringMap, id?: ID): Promise<R>;
|
|
13
|
+
}
|
|
14
|
+
export interface Publisher<T, R, ID> {
|
|
15
|
+
publish(data: T, attributes?: StringMap, id?: ID): Promise<R>;
|
|
16
|
+
}
|
|
17
|
+
export interface Sender<T, R, ID> {
|
|
18
|
+
send(data: T, attributes?: StringMap, id?: ID): Promise<R>;
|
|
19
|
+
}
|
|
20
|
+
export interface Writer<T, R, ID> {
|
|
21
|
+
write(data: T, attributes?: StringMap, id?: ID): Promise<R>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface SimpleProducer<T, R, ID> {
|
|
25
|
+
produce(to: string, data: T, attributes?: StringMap, id?: ID): Promise<R>;
|
|
26
|
+
}
|
|
27
|
+
export interface SimplePublisher<T, R, ID> {
|
|
28
|
+
publish(to: string, data: T, attributes?: StringMap, id?: ID): Promise<R>;
|
|
29
|
+
}
|
|
30
|
+
export interface SimpleSender<T, R, ID> {
|
|
31
|
+
send(to: string, data: T, attributes?: StringMap, id?: ID): Promise<R>;
|
|
32
|
+
}
|
|
33
|
+
export interface SimpleWriter<T, R, ID> {
|
|
34
|
+
write(to: string, data: T, attributes?: StringMap, id?: ID): Promise<R>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface SimpleConsumer<T> {
|
|
38
|
+
consume(handle: (data: T, attributes?: StringMap) => Promise<number>): void;
|
|
39
|
+
}
|
|
40
|
+
export interface SimpleSubscriber<T, R> {
|
|
41
|
+
subscribe(handle: (data: T, attributes?: StringMap) => Promise<number>): void;
|
|
42
|
+
}
|
|
43
|
+
export interface SimpleReceiver<T> {
|
|
44
|
+
receive(handle: (data: T, attributes?: StringMap) => Promise<number>): void;
|
|
45
|
+
}
|
|
46
|
+
export interface SimpleReader<T> {
|
|
47
|
+
read(handle: (data: T, attributes?: StringMap) => Promise<number>): void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface Consumer<T, ID, R> {
|
|
51
|
+
consume(data: Message<T, ID, R>): void;
|
|
52
|
+
}
|
|
53
|
+
export interface Subscriber<T, ID, R> {
|
|
54
|
+
subscribe(handle: (data: Message<T, ID, R>) => Promise<number>): void;
|
|
55
|
+
}
|
|
56
|
+
export interface Receiver<T, ID, R> {
|
|
57
|
+
receive(handle: (data: Message<T, ID, R>) => Promise<number>): void;
|
|
58
|
+
}
|
|
59
|
+
export interface Reader<T, ID, R> {
|
|
60
|
+
read(handle: (data: Message<T, ID, R>) => Promise<number>): void;
|
|
61
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Filter} from '../model';
|
|
2
2
|
import {GenericRepository} from './GenericRepository';
|
|
3
3
|
import {SearchRepository} from './SearchRepository';
|
|
4
4
|
|
|
5
|
-
export interface GenericSearchRepository<T, ID, R, S extends
|
|
5
|
+
export interface GenericSearchRepository<T, ID, R, S extends Filter>
|
|
6
6
|
extends GenericRepository<T, ID, R>, SearchRepository<T, S> {
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Filter} from '../model';
|
|
2
2
|
import {SearchResult} from '../model';
|
|
3
3
|
|
|
4
|
-
export interface SearchRepository<T, S extends
|
|
4
|
+
export interface SearchRepository<T, S extends Filter> {
|
|
5
5
|
search(s: S, limit?: number, offset?: number|string, fields?: string[], ctx?: any): Promise<SearchResult<T>>;
|
|
6
6
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {Attributes} from '../metadata';
|
|
2
2
|
|
|
3
3
|
export interface ViewRepository<T, ID> {
|
|
4
|
-
metadata(): Attributes;
|
|
5
|
-
keys(): string[];
|
|
4
|
+
metadata?(): Attributes|undefined;
|
|
5
|
+
keys?(): string[];
|
|
6
6
|
all?(ctx?: any): Promise<T[]>;
|
|
7
|
-
load(id: ID, ctx?: any): Promise<T>;
|
|
7
|
+
load(id: ID, ctx?: any): Promise<T|null>;
|
|
8
8
|
exist?(id: ID, ctx?: any): Promise<boolean>;
|
|
9
9
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Filter} from '../model';
|
|
2
2
|
import {SearchRepository} from './SearchRepository';
|
|
3
3
|
import {ViewRepository} from './ViewRepository';
|
|
4
4
|
|
|
5
|
-
export interface ViewSearchRepository<T, ID, S extends
|
|
5
|
+
export interface ViewSearchRepository<T, ID, S extends Filter>
|
|
6
6
|
extends ViewRepository<T, ID>, SearchRepository<T, S> {
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Filter} from '../model';
|
|
2
2
|
import {DiffApprService} from './DiffApprService';
|
|
3
3
|
import {GenericSearchService} from './GenericSearchService';
|
|
4
4
|
|
|
5
|
-
export interface GenericSearchDiffApprService<T, ID, R, S extends
|
|
5
|
+
export interface GenericSearchDiffApprService<T, ID, R, S extends Filter> extends GenericSearchService<T, ID, R, S>, DiffApprService<T, ID> {
|
|
6
6
|
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Filter} from '../model';
|
|
2
2
|
import {GenericService} from './GenericService';
|
|
3
3
|
import {SearchService} from './SearchService';
|
|
4
4
|
|
|
5
|
-
export interface GenericSearchService<T, ID, R, S extends
|
|
5
|
+
export interface GenericSearchService<T, ID, R, S extends Filter>
|
|
6
6
|
extends GenericService<T, ID, R>, SearchService<T, S> {
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Filter} from '../model';
|
|
2
2
|
import {SearchResult} from '../model';
|
|
3
3
|
|
|
4
|
-
export interface SearchService<T, S extends
|
|
4
|
+
export interface SearchService<T, S extends Filter> {
|
|
5
5
|
keys?(): string[];
|
|
6
6
|
search(s: S, limit?: number, offset?: number|string, fields?: string[], ctx?: any): Promise<SearchResult<T>>;
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Filter} from '../model';
|
|
2
2
|
import {SearchService} from './SearchService';
|
|
3
3
|
import {ViewService} from './ViewService';
|
|
4
4
|
|
|
5
|
-
export interface ViewSearchService<T, ID, S extends
|
|
5
|
+
export interface ViewSearchService<T, ID, S extends Filter>
|
|
6
6
|
extends ViewService<T, ID>, SearchService<T, S> {
|
|
7
7
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {Attributes} from '../metadata';
|
|
2
2
|
|
|
3
3
|
export interface ViewService<T, ID> {
|
|
4
|
-
metadata?(): Attributes;
|
|
4
|
+
metadata?(): Attributes|undefined;
|
|
5
5
|
keys?(): string[];
|
|
6
6
|
all?(ctx?: any): Promise<T[]>;
|
|
7
|
-
load(id: ID, ctx?: any): Promise<T>;
|
|
7
|
+
load(id: ID, ctx?: any): Promise<T|null>;
|
|
8
8
|
exist?(id: ID, ctx?: any): Promise<boolean>;
|
|
9
9
|
}
|
package/src/video.ts
CHANGED
|
@@ -1,13 +1,72 @@
|
|
|
1
|
+
export interface TopLevelCommentSnippet {
|
|
2
|
+
videoId: string;
|
|
3
|
+
topLevelComment: TopLevelComment;
|
|
4
|
+
canReply: boolean;
|
|
5
|
+
totalReplyCount: number;
|
|
6
|
+
isPublic: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface TopLevelComment {
|
|
9
|
+
kind: string;
|
|
10
|
+
etag: string;
|
|
11
|
+
id: string;
|
|
12
|
+
snippet: TopLevelCommentSubSnippet;
|
|
13
|
+
}
|
|
14
|
+
export interface TopLevelCommentSubSnippet extends CommentInfo, YoutubeAuthor {
|
|
15
|
+
videoId: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface CommentThead extends Author, CommentInfo {
|
|
19
|
+
videoId: string;
|
|
20
|
+
canReply: boolean;
|
|
21
|
+
totalReplyCount: number;
|
|
22
|
+
isPublic: boolean;
|
|
23
|
+
nextPageToken?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface Comment extends Author, CommentInfo {
|
|
27
|
+
parentId: string;
|
|
28
|
+
}
|
|
29
|
+
export interface AuthorChannelId {
|
|
30
|
+
value: string;
|
|
31
|
+
}
|
|
32
|
+
export interface AuthorInfo {
|
|
33
|
+
authorDisplayName: string;
|
|
34
|
+
authorChannelUrl: string;
|
|
35
|
+
authorProfileImageUrl: string;
|
|
36
|
+
}
|
|
37
|
+
export interface Author extends AuthorInfo {
|
|
38
|
+
authorChannelId: string;
|
|
39
|
+
}
|
|
40
|
+
export interface YoutubeAuthor extends AuthorInfo {
|
|
41
|
+
authorChannelId: AuthorChannelId;
|
|
42
|
+
}
|
|
43
|
+
export interface CommentInfo {
|
|
44
|
+
id: string;
|
|
45
|
+
textDisplay: string;
|
|
46
|
+
textOriginal: string;
|
|
47
|
+
canRate: boolean;
|
|
48
|
+
viewerRating: string;
|
|
49
|
+
likeCount: number;
|
|
50
|
+
publishedAt: Date;
|
|
51
|
+
updatedAt: Date;
|
|
52
|
+
}
|
|
53
|
+
export interface CommentSnippet extends CommentInfo, YoutubeAuthor {
|
|
54
|
+
parentId: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface StringMap {
|
|
58
|
+
[key: string]: string;
|
|
59
|
+
}
|
|
1
60
|
export interface ListResult<T> {
|
|
2
61
|
list?: T[];
|
|
3
62
|
total?: number;
|
|
4
63
|
limit?: number;
|
|
5
64
|
nextPageToken?: string;
|
|
6
65
|
}
|
|
66
|
+
export type ChannelSortType = 'title' | 'count' | 'date';
|
|
7
67
|
export interface ChannelSM {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
nextPageToken?: string;
|
|
68
|
+
q?: string;
|
|
69
|
+
sort?: SortType; // date, rating, relevance, title, count (for channels)
|
|
11
70
|
forMine?: boolean;
|
|
12
71
|
channelId?: string;
|
|
13
72
|
channelType?: string; // any, show
|
|
@@ -18,10 +77,10 @@ export interface ChannelSM {
|
|
|
18
77
|
safeSearch?: string; // moderate, none, strict
|
|
19
78
|
topicId?: string;
|
|
20
79
|
}
|
|
80
|
+
export type PlaylistSortType = 'title' | 'count' | 'date';
|
|
21
81
|
export interface PlaylistSM {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
nextPageToken?: string;
|
|
82
|
+
q?: string;
|
|
83
|
+
sort?: SortType; // date, rating, relevance, title, count (for channels), viewCount (for live broadcast)
|
|
25
84
|
forMine?: boolean;
|
|
26
85
|
channelId?: string;
|
|
27
86
|
channelType?: string; // any, show
|
|
@@ -31,31 +90,42 @@ export interface PlaylistSM {
|
|
|
31
90
|
relevanceLanguage?: string;
|
|
32
91
|
safeSearch?: string; // moderate, none, strict
|
|
33
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' | '';
|
|
34
105
|
export interface ItemSM {
|
|
35
|
-
|
|
36
|
-
type?:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
nextPageToken?: string;
|
|
106
|
+
q?: string;
|
|
107
|
+
type?: ItemType; // video, channel, playlist
|
|
108
|
+
duration?: Duration; // any, long (more than 20 minutes), medium (from 4 minutes to 20 minutes), short (less than 4 minutes)
|
|
109
|
+
sort?: SortType; // date, rating, relevance, title, videoCount (for channels), viewCount (for live broadcast) => title, date => publishedAt, relevance => rank, count => videoCount
|
|
40
110
|
relatedToVideoId?: string;
|
|
41
111
|
forMine?: boolean;
|
|
42
112
|
channelId?: string;
|
|
43
|
-
channelType?:
|
|
44
|
-
eventType?:
|
|
113
|
+
channelType?: ChannelType; // any, show
|
|
114
|
+
eventType?: EventType; // completed, live, upcoming
|
|
45
115
|
publishedAfter?: Date;
|
|
46
116
|
publishedBefore?: Date;
|
|
47
117
|
regionCode?: string;
|
|
48
118
|
relevanceLanguage?: string;
|
|
49
119
|
safeSearch?: string; // moderate, none, strict
|
|
50
120
|
topicId?: string;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
videoType?:
|
|
121
|
+
categoryId?: string;
|
|
122
|
+
caption?: Caption; // any, closedCaption, none
|
|
123
|
+
definition?: Definition; // any, high, standard
|
|
124
|
+
dimension?: Dimension; // 2d, 3d, any
|
|
125
|
+
embeddable?: EmbeddableType; // any, true
|
|
126
|
+
license?: LicenseType; // any, creativeCommon, youtube
|
|
127
|
+
syndicated?: SyndicatedType; // any, true
|
|
128
|
+
videoType?: SyndicatedType; // any, episode, movie
|
|
59
129
|
}
|
|
60
130
|
export interface Item extends Title, Thumbnail, ChannelInfo {
|
|
61
131
|
kind?: string; // video, channel, playlist
|
|
@@ -79,13 +149,14 @@ export interface Channel extends ItemInfo {
|
|
|
79
149
|
likes?: string;
|
|
80
150
|
favorites?: string;
|
|
81
151
|
uploads?: string;
|
|
82
|
-
|
|
152
|
+
lastUpload?: Date;
|
|
83
153
|
count?: number;
|
|
84
154
|
itemCount?: number;
|
|
85
155
|
playlistCount?: number;
|
|
86
156
|
playlistItemCount?: number;
|
|
87
157
|
playlistVideoCount?: number;
|
|
88
158
|
playlistVideoItemCount?: number;
|
|
159
|
+
channels?: string[]|Channel[];
|
|
89
160
|
}
|
|
90
161
|
export interface Playlist extends ItemInfo, BigThumbnail {
|
|
91
162
|
count?: number;
|
|
@@ -98,6 +169,12 @@ export interface PlaylistItemInfo {
|
|
|
98
169
|
videoOwnerChannelTitle?: string;
|
|
99
170
|
}
|
|
100
171
|
export interface PlaylistVideo extends ItemInfo, BigThumbnail, PlaylistItemInfo {
|
|
172
|
+
duration?: number;
|
|
173
|
+
dimension?: string;
|
|
174
|
+
definition?: number; // 0: 144, 1: 240, 2: 360, 3: 480, 4: 720, 5: 1080, 6: 1440, 7: 2160
|
|
175
|
+
caption?: boolean;
|
|
176
|
+
licensedContent?: boolean;
|
|
177
|
+
projection?: string;
|
|
101
178
|
}
|
|
102
179
|
export interface VideoInfo {
|
|
103
180
|
tags?: string[];
|
|
@@ -109,6 +186,8 @@ export interface VideoInfo {
|
|
|
109
186
|
export interface Video extends ItemInfo, BigThumbnail, VideoDetail, VideoInfo {
|
|
110
187
|
videoOwnerChannelId?: string;
|
|
111
188
|
videoOwnerChannelTitle?: string;
|
|
189
|
+
blockedRegions?: string[];
|
|
190
|
+
allowedRegions?: string[];
|
|
112
191
|
}
|
|
113
192
|
export interface VideoDetail {
|
|
114
193
|
duration: number;
|
|
@@ -171,6 +250,10 @@ export interface VideoItemDetail {
|
|
|
171
250
|
videoId: string;
|
|
172
251
|
videoPublishedAt: Date;
|
|
173
252
|
}
|
|
253
|
+
export interface RegionRestriction {
|
|
254
|
+
allow?: string[];
|
|
255
|
+
blocked?: string[];
|
|
256
|
+
}
|
|
174
257
|
export interface YoutubeVideoDetail {
|
|
175
258
|
duration: string;
|
|
176
259
|
dimension: string;
|
|
@@ -178,6 +261,7 @@ export interface YoutubeVideoDetail {
|
|
|
178
261
|
caption: string;
|
|
179
262
|
licensedContent: boolean;
|
|
180
263
|
projection: string;
|
|
264
|
+
regionRestriction?: RegionRestriction;
|
|
181
265
|
}
|
|
182
266
|
export interface BaseSnippet extends Title, ChannelInfo {
|
|
183
267
|
thumbnails: Thumbnails;
|
|
@@ -229,73 +313,35 @@ export interface CategorySnippet {
|
|
|
229
313
|
assignable: boolean;
|
|
230
314
|
channelId: string;
|
|
231
315
|
}
|
|
232
|
-
|
|
233
|
-
export interface TopLevelCommentSnippet {
|
|
234
|
-
videoId: string;
|
|
235
|
-
topLevelComment: TopLevelComment;
|
|
236
|
-
canReply: boolean;
|
|
237
|
-
totalReplyCount: number;
|
|
238
|
-
isPublic: boolean;
|
|
239
|
-
}
|
|
240
|
-
export interface TopLevelComment {
|
|
241
|
-
kind: string;
|
|
242
|
-
etag: string;
|
|
316
|
+
export interface ChannelSubscriptions {
|
|
243
317
|
id: string;
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
export interface TopLevelCommentSubSnippet extends CommentInfo, YoutubeAuthor {
|
|
247
|
-
videoId: string;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
export interface CommentThead extends Author, CommentInfo {
|
|
251
|
-
videoId: string;
|
|
252
|
-
canReply: boolean;
|
|
253
|
-
totalReplyCount: number;
|
|
254
|
-
isPublic: boolean;
|
|
255
|
-
nextPageToken?: string;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
export interface Comment extends Author, CommentInfo {
|
|
259
|
-
parentId: string;
|
|
260
|
-
}
|
|
261
|
-
export interface AuthorChannelId {
|
|
262
|
-
value: string;
|
|
318
|
+
data: Channel[]|string[];
|
|
263
319
|
}
|
|
264
|
-
export interface
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}
|
|
269
|
-
export interface Author extends AuthorInfo {
|
|
270
|
-
authorChannelId: string;
|
|
271
|
-
}
|
|
272
|
-
export interface YoutubeAuthor extends AuthorInfo {
|
|
273
|
-
authorChannelId: AuthorChannelId;
|
|
274
|
-
}
|
|
275
|
-
export interface CommentInfo {
|
|
276
|
-
id: string;
|
|
277
|
-
textDisplay: string;
|
|
278
|
-
textOriginal: string;
|
|
279
|
-
canRate: boolean;
|
|
280
|
-
viewerRating: string;
|
|
281
|
-
likeCount: number;
|
|
282
|
-
publishedAt: Date;
|
|
283
|
-
updatedAt: Date;
|
|
320
|
+
export interface SubscriptionSnippet extends Title {
|
|
321
|
+
title: string;
|
|
322
|
+
resourceId: SubscriptionResource;
|
|
323
|
+
thumbnails: Thumbnails;
|
|
284
324
|
}
|
|
285
|
-
export interface
|
|
286
|
-
|
|
325
|
+
export interface SubscriptionResource {
|
|
326
|
+
kind: string;
|
|
327
|
+
channelId: string;
|
|
287
328
|
}
|
|
288
329
|
|
|
289
330
|
export interface ChannelSync {
|
|
290
331
|
id: string;
|
|
291
332
|
uploads?: string;
|
|
292
|
-
|
|
333
|
+
syncTime?: Date;
|
|
293
334
|
level?: number;
|
|
294
335
|
}
|
|
295
336
|
export interface PlaylistCollection {
|
|
296
337
|
id: string;
|
|
297
338
|
videos: string[];
|
|
298
339
|
}
|
|
340
|
+
export interface CategoryCollection {
|
|
341
|
+
id: string;
|
|
342
|
+
data: VideoCategory[];
|
|
343
|
+
}
|
|
344
|
+
|
|
299
345
|
export interface SyncRepository {
|
|
300
346
|
getChannelSync(channelId: string): Promise<ChannelSync>;
|
|
301
347
|
saveChannel(channel: Channel): Promise<number>;
|
|
@@ -311,7 +357,8 @@ export interface SyncClient {
|
|
|
311
357
|
getPlaylist(id: string): Promise<Playlist>;
|
|
312
358
|
getChannelPlaylists(channelId: string, max?: number, nextPageToken?: string): Promise<ListResult<Playlist>>;
|
|
313
359
|
getPlaylistVideos(playlistId: string, max?: number, nextPageToken?: string): Promise<ListResult<PlaylistVideo>>;
|
|
314
|
-
getVideos(ids: string[]
|
|
360
|
+
getVideos(ids: string[]): Promise<Video[]>;
|
|
361
|
+
getSubscriptions(channelId: string): Promise<Channel[]>;
|
|
315
362
|
}
|
|
316
363
|
export interface SyncService {
|
|
317
364
|
syncChannel(channelId: string): Promise<number>;
|
|
@@ -320,32 +367,37 @@ export interface SyncService {
|
|
|
320
367
|
syncPlaylists(playlistIds: string[], level?: number): Promise<number>;
|
|
321
368
|
}
|
|
322
369
|
|
|
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' | '';
|
|
323
375
|
export interface VideoService {
|
|
324
376
|
getCagetories(regionCode?: string): Promise<VideoCategory[]>;
|
|
325
|
-
getChannels(ids: string[]): Promise<Channel[]>;
|
|
326
|
-
getChannel(id: string): Promise<Channel>;
|
|
327
|
-
getChannelPlaylists(channelId: string, max?: number, nextPageToken?: string): Promise<ListResult<Playlist>>;
|
|
328
|
-
getPlaylists(ids: string[]): Promise<Playlist[]>;
|
|
329
|
-
getPlaylist(id: string): Promise<Playlist>;
|
|
330
|
-
getChannelVideos(channelId: string, max?: number, nextPageToken?: string): Promise<ListResult<PlaylistVideo>>;
|
|
331
|
-
getPlaylistVideos(playlistId: string, max?: number, nextPageToken?: string): Promise<ListResult<PlaylistVideo>>;
|
|
332
|
-
getPopularVideos(regionCode?: string, videoCategoryId?: string, max?: number, nextPageToken?: string): Promise<ListResult<Video>>;
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
searchPlaylists?(sm: PlaylistSM, max?: number, nextPageToken?: string|number): Promise<ListResult<Playlist>>;
|
|
341
|
-
searchChannels?(sm: ChannelSM, max?: number, nextPageToken?: string|number): Promise<ListResult<Channel>>;
|
|
377
|
+
getChannels(ids: string[], fields?: string[]): Promise<Channel[]>;
|
|
378
|
+
getChannel(id: string, fields?: string[]): Promise<Channel>;
|
|
379
|
+
getChannelPlaylists(channelId: string, max?: number, nextPageToken?: string, fields?: string[]): Promise<ListResult<Playlist>>;
|
|
380
|
+
getPlaylists(ids: string[], fields?: string[]): Promise<Playlist[]>;
|
|
381
|
+
getPlaylist(id: string, fields?: string[]): Promise<Playlist>;
|
|
382
|
+
getChannelVideos(channelId: string, max?: number, nextPageToken?: string, fields?: string[]): Promise<ListResult<PlaylistVideo>>;
|
|
383
|
+
getPlaylistVideos(playlistId: string, max?: number, nextPageToken?: string, fields?: string[]): Promise<ListResult<PlaylistVideo>>;
|
|
384
|
+
getPopularVideos(regionCode?: string, videoCategoryId?: string, max?: number, nextPageToken?: string, fields?: string[]): Promise<ListResult<Video>>;
|
|
385
|
+
getVideos(ids: string[], fields?: string[]): Promise<Video[]>;
|
|
386
|
+
getVideo(id: string, fields?: string[]): Promise<Video>;
|
|
387
|
+
search(sm: ItemSM, max?: number, nextPageToken?: string | number, fields?: string[]): Promise<ListResult<Item>>;
|
|
388
|
+
getRelatedVideos?(videoId: string, max?: number, nextPageToken?: string, fields?: string[]): Promise<ListResult<Item>>;
|
|
389
|
+
searchVideos?(sm: ItemSM, max?: number, nextPageToken?: string | number, fields?: string[]): Promise<ListResult<Item>>;
|
|
390
|
+
searchPlaylists?(sm: PlaylistSM, max?: number, nextPageToken?: string | number, fields?: string[]): Promise<ListResult<Playlist>>;
|
|
391
|
+
searchChannels?(sm: ChannelSM, max?: number, nextPageToken?: string | number, fields?: string[]): Promise<ListResult<Channel>>;
|
|
342
392
|
/**
|
|
343
393
|
* @param videoId
|
|
344
394
|
* @param order relevance, time (default)
|
|
345
395
|
* @param nextPageToken
|
|
346
396
|
*/
|
|
347
|
-
getCommentThreads?(videoId: string, order?:
|
|
397
|
+
getCommentThreads?(videoId: string, order?: CommentOrder, max?: number, nextPageToken?: string): Promise<ListResult<CommentThead>>;
|
|
348
398
|
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>>;
|
|
349
401
|
}
|
|
350
402
|
export interface CacheItem<T> {
|
|
351
403
|
item: T;
|