@mediaryorg/contracts 1.0.8 → 2.0.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/dist/proto/paths.d.ts +9 -0
- package/dist/proto/paths.js +9 -0
- package/generated/auth/v1/auth.ts +58 -51
- package/generated/collection/v1/collection.ts +235 -0
- package/generated/favorite/v1/favorite.ts +146 -0
- package/generated/image/v1/image.ts +140 -0
- package/generated/library/v1/library.ts +216 -0
- package/generated/media/v1/media.ts +294 -0
- package/generated/media_request/v1/media_request.ts +223 -0
- package/generated/profile/v1/profile.ts +73 -0
- package/generated/recommendation/v1/recommendation.ts +126 -0
- package/generated/search/v1/search.ts +103 -0
- package/generated/user/v1/user.ts +103 -2
- package/package.json +3 -3
- package/proto/auth/v1/auth.proto +56 -52
- package/proto/collection/v1/collection.proto +120 -0
- package/proto/favorite/v1/favorite.proto +79 -0
- package/proto/image/v1/image.proto +73 -0
- package/proto/library/v1/library.proto +144 -0
- package/proto/media/v1/media.proto +197 -0
- package/proto/media_request/v1/media_request.proto +142 -0
- package/proto/profile/v1/profile.proto +35 -0
- package/proto/recommendation/v1/recommendation.proto +60 -0
- package/proto/search/v1/search.proto +62 -0
- package/proto/user/v1/user.proto +66 -4
package/dist/proto/paths.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
export declare const PROTO_PATH: {
|
|
2
2
|
readonly AUTH: string;
|
|
3
3
|
readonly USER: string;
|
|
4
|
+
readonly PROFILE: string;
|
|
5
|
+
readonly MEDIA: string;
|
|
6
|
+
readonly COLLECTION: string;
|
|
7
|
+
readonly LIBRARY: string;
|
|
8
|
+
readonly FAVORITE: string;
|
|
9
|
+
readonly MEDIA_REQUEST: string;
|
|
10
|
+
readonly IMAGE: string;
|
|
11
|
+
readonly SEARCH: string;
|
|
12
|
+
readonly RECOMMENDATION: string;
|
|
4
13
|
};
|
|
5
14
|
/**
|
|
6
15
|
* Root directories for protobuf imports.
|
package/dist/proto/paths.js
CHANGED
|
@@ -6,6 +6,15 @@ const PROTO_DIR = (0, path_1.join)(__dirname, "../../proto");
|
|
|
6
6
|
exports.PROTO_PATH = {
|
|
7
7
|
AUTH: (0, path_1.join)(PROTO_DIR, "auth/v1/auth.proto"),
|
|
8
8
|
USER: (0, path_1.join)(PROTO_DIR, "user/v1/user.proto"),
|
|
9
|
+
PROFILE: (0, path_1.join)(PROTO_DIR, "profile/v1/profile.proto"),
|
|
10
|
+
MEDIA: (0, path_1.join)(PROTO_DIR, "media/v1/media.proto"),
|
|
11
|
+
COLLECTION: (0, path_1.join)(PROTO_DIR, "collection/v1/collection.proto"),
|
|
12
|
+
LIBRARY: (0, path_1.join)(PROTO_DIR, "library/v1/library.proto"),
|
|
13
|
+
FAVORITE: (0, path_1.join)(PROTO_DIR, "favorite/v1/favorite.proto"),
|
|
14
|
+
MEDIA_REQUEST: (0, path_1.join)(PROTO_DIR, "media_request/v1/media_request.proto"),
|
|
15
|
+
IMAGE: (0, path_1.join)(PROTO_DIR, "image/v1/image.proto"),
|
|
16
|
+
SEARCH: (0, path_1.join)(PROTO_DIR, "search/v1/search.proto"),
|
|
17
|
+
RECOMMENDATION: (0, path_1.join)(PROTO_DIR, "recommendation/v1/recommendation.proto"),
|
|
9
18
|
};
|
|
10
19
|
/**
|
|
11
20
|
* Root directories for protobuf imports.
|
|
@@ -7,60 +7,15 @@
|
|
|
7
7
|
/* eslint-disable */
|
|
8
8
|
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
9
|
import { Observable } from "rxjs";
|
|
10
|
-
import { User } from "../../user/v1/user";
|
|
11
10
|
|
|
12
11
|
export const protobufPackage = "auth.v1";
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export interface ConfirmEmailResponse {
|
|
21
|
-
user: User | undefined;
|
|
22
|
-
sessionId: string;
|
|
23
|
-
maxAgeMs: number;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface OauthCallbackResponse {
|
|
27
|
-
user: User | undefined;
|
|
28
|
-
sessionId: string;
|
|
29
|
-
maxAgeMs: number;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface AdminLoginResponse {
|
|
33
|
-
user: User | undefined;
|
|
34
|
-
sessionId: string;
|
|
35
|
-
maxAgeMs: number;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface ValidateSessionResponse {
|
|
39
|
-
valid: boolean;
|
|
40
|
-
user: User | undefined;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface AdminValidateSessionResponse {
|
|
44
|
-
valid: boolean;
|
|
45
|
-
user: User | undefined;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface ResendVerificationResponse {
|
|
49
|
-
message: string;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface RequestPasswordResetResponse {
|
|
53
|
-
message: string;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface SetNewPasswordResponse {
|
|
57
|
-
message: string;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface LogoutResponse {
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface AdminLogoutResponse {
|
|
13
|
+
/** Identity-only view of a user emitted by auth-service. */
|
|
14
|
+
export interface AuthUser {
|
|
15
|
+
id: string;
|
|
16
|
+
email: string;
|
|
17
|
+
role: string;
|
|
18
|
+
isVerified: boolean;
|
|
64
19
|
}
|
|
65
20
|
|
|
66
21
|
export interface RegisterRequest {
|
|
@@ -80,33 +35,65 @@ export interface LoginRequest {
|
|
|
80
35
|
password: string;
|
|
81
36
|
}
|
|
82
37
|
|
|
38
|
+
export interface LoginResponse {
|
|
39
|
+
user: AuthUser | undefined;
|
|
40
|
+
sessionId: string;
|
|
41
|
+
maxAgeMs: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
83
44
|
export interface LogoutRequest {
|
|
84
45
|
sessionId: string;
|
|
85
46
|
}
|
|
86
47
|
|
|
48
|
+
export interface LogoutResponse {
|
|
49
|
+
}
|
|
50
|
+
|
|
87
51
|
export interface ValidateSessionRequest {
|
|
88
52
|
sessionId: string;
|
|
89
53
|
}
|
|
90
54
|
|
|
55
|
+
export interface ValidateSessionResponse {
|
|
56
|
+
valid: boolean;
|
|
57
|
+
user: AuthUser | undefined;
|
|
58
|
+
}
|
|
59
|
+
|
|
91
60
|
export interface ConfirmEmailRequest {
|
|
92
61
|
email: string;
|
|
93
62
|
code: string;
|
|
94
63
|
}
|
|
95
64
|
|
|
65
|
+
export interface ConfirmEmailResponse {
|
|
66
|
+
user: AuthUser | undefined;
|
|
67
|
+
sessionId: string;
|
|
68
|
+
maxAgeMs: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
96
71
|
export interface ResendVerificationRequest {
|
|
97
72
|
email: string;
|
|
98
73
|
}
|
|
99
74
|
|
|
75
|
+
export interface ResendVerificationResponse {
|
|
76
|
+
message: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
100
79
|
export interface RequestPasswordResetRequest {
|
|
101
80
|
email: string;
|
|
102
81
|
}
|
|
103
82
|
|
|
83
|
+
export interface RequestPasswordResetResponse {
|
|
84
|
+
message: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
104
87
|
export interface SetNewPasswordRequest {
|
|
105
88
|
email: string;
|
|
106
89
|
code: string;
|
|
107
90
|
password: string;
|
|
108
91
|
}
|
|
109
92
|
|
|
93
|
+
export interface SetNewPasswordResponse {
|
|
94
|
+
message: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
110
97
|
export interface OauthConnectRequest {
|
|
111
98
|
provider: string;
|
|
112
99
|
}
|
|
@@ -121,19 +108,39 @@ export interface OauthCallbackRequest {
|
|
|
121
108
|
state: string;
|
|
122
109
|
}
|
|
123
110
|
|
|
111
|
+
export interface OauthCallbackResponse {
|
|
112
|
+
user: AuthUser | undefined;
|
|
113
|
+
sessionId: string;
|
|
114
|
+
maxAgeMs: number;
|
|
115
|
+
}
|
|
116
|
+
|
|
124
117
|
export interface AdminLoginRequest {
|
|
125
118
|
email: string;
|
|
126
119
|
password: string;
|
|
127
120
|
}
|
|
128
121
|
|
|
122
|
+
export interface AdminLoginResponse {
|
|
123
|
+
user: AuthUser | undefined;
|
|
124
|
+
sessionId: string;
|
|
125
|
+
maxAgeMs: number;
|
|
126
|
+
}
|
|
127
|
+
|
|
129
128
|
export interface AdminLogoutRequest {
|
|
130
129
|
sessionId: string;
|
|
131
130
|
}
|
|
132
131
|
|
|
132
|
+
export interface AdminLogoutResponse {
|
|
133
|
+
}
|
|
134
|
+
|
|
133
135
|
export interface AdminValidateSessionRequest {
|
|
134
136
|
sessionId: string;
|
|
135
137
|
}
|
|
136
138
|
|
|
139
|
+
export interface AdminValidateSessionResponse {
|
|
140
|
+
valid: boolean;
|
|
141
|
+
user: AuthUser | undefined;
|
|
142
|
+
}
|
|
143
|
+
|
|
137
144
|
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
138
145
|
|
|
139
146
|
export interface AuthServiceClient {
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.6
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: collection/v1/collection.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "collection.v1";
|
|
12
|
+
|
|
13
|
+
export interface Collection {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
/** Number of Media records linked to the collection (returned by list/get). */
|
|
19
|
+
mediaCount: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface CollectionWithUserStatus {
|
|
23
|
+
collection: Collection | undefined;
|
|
24
|
+
isAdded: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface UserCollection {
|
|
28
|
+
id: string;
|
|
29
|
+
userId: string;
|
|
30
|
+
collectionId: string;
|
|
31
|
+
collection: Collection | undefined;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
updatedAt: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ListCollectionsRequest {
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface ListCollectionsResponse {
|
|
40
|
+
items: Collection[];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface GetCollectionByIdRequest {
|
|
44
|
+
collectionId: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface GetCollectionByIdResponse {
|
|
48
|
+
collection: Collection | undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface GetCollectionByNameRequest {
|
|
52
|
+
name: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface GetCollectionByNameResponse {
|
|
56
|
+
collection: Collection | undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface SeedInitialCollectionsRequest {
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface SeedInitialCollectionsResponse {
|
|
63
|
+
items: Collection[];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface GetUserCollectionsRequest {
|
|
67
|
+
userId: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface GetUserCollectionsResponse {
|
|
71
|
+
items: Collection[];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface GetAllCollectionsWithUserStatusRequest {
|
|
75
|
+
userId: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface GetAllCollectionsWithUserStatusResponse {
|
|
79
|
+
items: CollectionWithUserStatus[];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface GetAvailableCollectionsRequest {
|
|
83
|
+
userId: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface GetAvailableCollectionsResponse {
|
|
87
|
+
items: Collection[];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface AddCollectionToUserRequest {
|
|
91
|
+
userId: string;
|
|
92
|
+
collectionId: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface AddCollectionToUserResponse {
|
|
96
|
+
userCollection: UserCollection | undefined;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface RemoveCollectionFromUserRequest {
|
|
100
|
+
userId: string;
|
|
101
|
+
collectionId: string;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface RemoveCollectionFromUserResponse {
|
|
105
|
+
collectionId: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface InitializeDefaultCollectionsRequest {
|
|
109
|
+
userId: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface InitializeDefaultCollectionsResponse {
|
|
113
|
+
items: UserCollection[];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export const COLLECTION_V1_PACKAGE_NAME = "collection.v1";
|
|
117
|
+
|
|
118
|
+
export interface CollectionServiceClient {
|
|
119
|
+
/** Global catalog of media collections (Movies, Series, Books, ...). */
|
|
120
|
+
|
|
121
|
+
listCollections(request: ListCollectionsRequest): Observable<ListCollectionsResponse>;
|
|
122
|
+
|
|
123
|
+
getCollectionById(request: GetCollectionByIdRequest): Observable<GetCollectionByIdResponse>;
|
|
124
|
+
|
|
125
|
+
getCollectionByName(request: GetCollectionByNameRequest): Observable<GetCollectionByNameResponse>;
|
|
126
|
+
|
|
127
|
+
seedInitialCollections(request: SeedInitialCollectionsRequest): Observable<SeedInitialCollectionsResponse>;
|
|
128
|
+
|
|
129
|
+
/** Per-user enabled collections. */
|
|
130
|
+
|
|
131
|
+
getUserCollections(request: GetUserCollectionsRequest): Observable<GetUserCollectionsResponse>;
|
|
132
|
+
|
|
133
|
+
getAllCollectionsWithUserStatus(
|
|
134
|
+
request: GetAllCollectionsWithUserStatusRequest,
|
|
135
|
+
): Observable<GetAllCollectionsWithUserStatusResponse>;
|
|
136
|
+
|
|
137
|
+
getAvailableCollections(request: GetAvailableCollectionsRequest): Observable<GetAvailableCollectionsResponse>;
|
|
138
|
+
|
|
139
|
+
addCollectionToUser(request: AddCollectionToUserRequest): Observable<AddCollectionToUserResponse>;
|
|
140
|
+
|
|
141
|
+
removeCollectionFromUser(request: RemoveCollectionFromUserRequest): Observable<RemoveCollectionFromUserResponse>;
|
|
142
|
+
|
|
143
|
+
initializeDefaultCollections(
|
|
144
|
+
request: InitializeDefaultCollectionsRequest,
|
|
145
|
+
): Observable<InitializeDefaultCollectionsResponse>;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface CollectionServiceController {
|
|
149
|
+
/** Global catalog of media collections (Movies, Series, Books, ...). */
|
|
150
|
+
|
|
151
|
+
listCollections(
|
|
152
|
+
request: ListCollectionsRequest,
|
|
153
|
+
): Promise<ListCollectionsResponse> | Observable<ListCollectionsResponse> | ListCollectionsResponse;
|
|
154
|
+
|
|
155
|
+
getCollectionById(
|
|
156
|
+
request: GetCollectionByIdRequest,
|
|
157
|
+
): Promise<GetCollectionByIdResponse> | Observable<GetCollectionByIdResponse> | GetCollectionByIdResponse;
|
|
158
|
+
|
|
159
|
+
getCollectionByName(
|
|
160
|
+
request: GetCollectionByNameRequest,
|
|
161
|
+
): Promise<GetCollectionByNameResponse> | Observable<GetCollectionByNameResponse> | GetCollectionByNameResponse;
|
|
162
|
+
|
|
163
|
+
seedInitialCollections(
|
|
164
|
+
request: SeedInitialCollectionsRequest,
|
|
165
|
+
):
|
|
166
|
+
| Promise<SeedInitialCollectionsResponse>
|
|
167
|
+
| Observable<SeedInitialCollectionsResponse>
|
|
168
|
+
| SeedInitialCollectionsResponse;
|
|
169
|
+
|
|
170
|
+
/** Per-user enabled collections. */
|
|
171
|
+
|
|
172
|
+
getUserCollections(
|
|
173
|
+
request: GetUserCollectionsRequest,
|
|
174
|
+
): Promise<GetUserCollectionsResponse> | Observable<GetUserCollectionsResponse> | GetUserCollectionsResponse;
|
|
175
|
+
|
|
176
|
+
getAllCollectionsWithUserStatus(
|
|
177
|
+
request: GetAllCollectionsWithUserStatusRequest,
|
|
178
|
+
):
|
|
179
|
+
| Promise<GetAllCollectionsWithUserStatusResponse>
|
|
180
|
+
| Observable<GetAllCollectionsWithUserStatusResponse>
|
|
181
|
+
| GetAllCollectionsWithUserStatusResponse;
|
|
182
|
+
|
|
183
|
+
getAvailableCollections(
|
|
184
|
+
request: GetAvailableCollectionsRequest,
|
|
185
|
+
):
|
|
186
|
+
| Promise<GetAvailableCollectionsResponse>
|
|
187
|
+
| Observable<GetAvailableCollectionsResponse>
|
|
188
|
+
| GetAvailableCollectionsResponse;
|
|
189
|
+
|
|
190
|
+
addCollectionToUser(
|
|
191
|
+
request: AddCollectionToUserRequest,
|
|
192
|
+
): Promise<AddCollectionToUserResponse> | Observable<AddCollectionToUserResponse> | AddCollectionToUserResponse;
|
|
193
|
+
|
|
194
|
+
removeCollectionFromUser(
|
|
195
|
+
request: RemoveCollectionFromUserRequest,
|
|
196
|
+
):
|
|
197
|
+
| Promise<RemoveCollectionFromUserResponse>
|
|
198
|
+
| Observable<RemoveCollectionFromUserResponse>
|
|
199
|
+
| RemoveCollectionFromUserResponse;
|
|
200
|
+
|
|
201
|
+
initializeDefaultCollections(
|
|
202
|
+
request: InitializeDefaultCollectionsRequest,
|
|
203
|
+
):
|
|
204
|
+
| Promise<InitializeDefaultCollectionsResponse>
|
|
205
|
+
| Observable<InitializeDefaultCollectionsResponse>
|
|
206
|
+
| InitializeDefaultCollectionsResponse;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export function CollectionServiceControllerMethods() {
|
|
210
|
+
return function (constructor: Function) {
|
|
211
|
+
const grpcMethods: string[] = [
|
|
212
|
+
"listCollections",
|
|
213
|
+
"getCollectionById",
|
|
214
|
+
"getCollectionByName",
|
|
215
|
+
"seedInitialCollections",
|
|
216
|
+
"getUserCollections",
|
|
217
|
+
"getAllCollectionsWithUserStatus",
|
|
218
|
+
"getAvailableCollections",
|
|
219
|
+
"addCollectionToUser",
|
|
220
|
+
"removeCollectionFromUser",
|
|
221
|
+
"initializeDefaultCollections",
|
|
222
|
+
];
|
|
223
|
+
for (const method of grpcMethods) {
|
|
224
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
225
|
+
GrpcMethod("CollectionService", method)(constructor.prototype[method], method, descriptor);
|
|
226
|
+
}
|
|
227
|
+
const grpcStreamMethods: string[] = [];
|
|
228
|
+
for (const method of grpcStreamMethods) {
|
|
229
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
230
|
+
GrpcStreamMethod("CollectionService", method)(constructor.prototype[method], method, descriptor);
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export const COLLECTION_SERVICE_NAME = "CollectionService";
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.6
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: favorite/v1/favorite.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "favorite.v1";
|
|
12
|
+
|
|
13
|
+
export interface Favorite {
|
|
14
|
+
id: string;
|
|
15
|
+
userId: string;
|
|
16
|
+
mediaId: string;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface CheckMultipleFavoritesRequest {
|
|
21
|
+
userId: string;
|
|
22
|
+
mediaIds: string[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** `results` is a `media_id -> bool` map (matches the legacy REST shape). */
|
|
26
|
+
export interface CheckMultipleFavoritesResponse {
|
|
27
|
+
results: { [key: string]: boolean };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface CheckMultipleFavoritesResponse_ResultsEntry {
|
|
31
|
+
key: string;
|
|
32
|
+
value: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface ToggleFavoriteRequest {
|
|
36
|
+
userId: string;
|
|
37
|
+
mediaId: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ToggleFavoriteResponse {
|
|
41
|
+
isInFavorites: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface IsFavoriteRequest {
|
|
45
|
+
userId: string;
|
|
46
|
+
mediaId: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface IsFavoriteResponse {
|
|
50
|
+
isInFavorites: boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface ListUserFavoritesRequest {
|
|
54
|
+
userId: string;
|
|
55
|
+
search?: string | undefined;
|
|
56
|
+
collectionId?: string | undefined;
|
|
57
|
+
page: number;
|
|
58
|
+
limit: number;
|
|
59
|
+
sortBy: string;
|
|
60
|
+
sortOrder: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface FavoritePaginationMeta {
|
|
64
|
+
page: number;
|
|
65
|
+
limit: number;
|
|
66
|
+
total: number;
|
|
67
|
+
totalPages: number;
|
|
68
|
+
hasNextPage: boolean;
|
|
69
|
+
hasPrevPage: boolean;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface ListUserFavoritesResponse {
|
|
73
|
+
data: Favorite[];
|
|
74
|
+
meta: FavoritePaginationMeta | undefined;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Used as a side-effect by library/media when content disappears. */
|
|
78
|
+
export interface RemoveAllForMediaRequest {
|
|
79
|
+
mediaId: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface RemoveAllForMediaResponse {
|
|
83
|
+
removedCount: number;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const FAVORITE_V1_PACKAGE_NAME = "favorite.v1";
|
|
87
|
+
|
|
88
|
+
export interface FavoriteServiceClient {
|
|
89
|
+
checkMultipleFavorites(request: CheckMultipleFavoritesRequest): Observable<CheckMultipleFavoritesResponse>;
|
|
90
|
+
|
|
91
|
+
toggleFavorite(request: ToggleFavoriteRequest): Observable<ToggleFavoriteResponse>;
|
|
92
|
+
|
|
93
|
+
isFavorite(request: IsFavoriteRequest): Observable<IsFavoriteResponse>;
|
|
94
|
+
|
|
95
|
+
listUserFavorites(request: ListUserFavoritesRequest): Observable<ListUserFavoritesResponse>;
|
|
96
|
+
|
|
97
|
+
removeAllForMedia(request: RemoveAllForMediaRequest): Observable<RemoveAllForMediaResponse>;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface FavoriteServiceController {
|
|
101
|
+
checkMultipleFavorites(
|
|
102
|
+
request: CheckMultipleFavoritesRequest,
|
|
103
|
+
):
|
|
104
|
+
| Promise<CheckMultipleFavoritesResponse>
|
|
105
|
+
| Observable<CheckMultipleFavoritesResponse>
|
|
106
|
+
| CheckMultipleFavoritesResponse;
|
|
107
|
+
|
|
108
|
+
toggleFavorite(
|
|
109
|
+
request: ToggleFavoriteRequest,
|
|
110
|
+
): Promise<ToggleFavoriteResponse> | Observable<ToggleFavoriteResponse> | ToggleFavoriteResponse;
|
|
111
|
+
|
|
112
|
+
isFavorite(
|
|
113
|
+
request: IsFavoriteRequest,
|
|
114
|
+
): Promise<IsFavoriteResponse> | Observable<IsFavoriteResponse> | IsFavoriteResponse;
|
|
115
|
+
|
|
116
|
+
listUserFavorites(
|
|
117
|
+
request: ListUserFavoritesRequest,
|
|
118
|
+
): Promise<ListUserFavoritesResponse> | Observable<ListUserFavoritesResponse> | ListUserFavoritesResponse;
|
|
119
|
+
|
|
120
|
+
removeAllForMedia(
|
|
121
|
+
request: RemoveAllForMediaRequest,
|
|
122
|
+
): Promise<RemoveAllForMediaResponse> | Observable<RemoveAllForMediaResponse> | RemoveAllForMediaResponse;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export function FavoriteServiceControllerMethods() {
|
|
126
|
+
return function (constructor: Function) {
|
|
127
|
+
const grpcMethods: string[] = [
|
|
128
|
+
"checkMultipleFavorites",
|
|
129
|
+
"toggleFavorite",
|
|
130
|
+
"isFavorite",
|
|
131
|
+
"listUserFavorites",
|
|
132
|
+
"removeAllForMedia",
|
|
133
|
+
];
|
|
134
|
+
for (const method of grpcMethods) {
|
|
135
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
136
|
+
GrpcMethod("FavoriteService", method)(constructor.prototype[method], method, descriptor);
|
|
137
|
+
}
|
|
138
|
+
const grpcStreamMethods: string[] = [];
|
|
139
|
+
for (const method of grpcStreamMethods) {
|
|
140
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
141
|
+
GrpcStreamMethod("FavoriteService", method)(constructor.prototype[method], method, descriptor);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export const FAVORITE_SERVICE_NAME = "FavoriteService";
|