@mediaryorg/contracts 1.0.10 → 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.
@@ -2,6 +2,14 @@ export declare const PROTO_PATH: {
2
2
  readonly AUTH: string;
3
3
  readonly USER: string;
4
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;
5
13
  };
6
14
  /**
7
15
  * Root directories for protobuf imports.
@@ -7,6 +7,14 @@ 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
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"),
10
18
  };
11
19
  /**
12
20
  * Root directories for protobuf imports.
@@ -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";
@@ -0,0 +1,140 @@
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: image/v1/image.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "image.v1";
12
+
13
+ /** TMDB poster size variants accepted by the legacy controller. */
14
+ export enum TmdbPosterSize {
15
+ TMDB_POSTER_SIZE_UNSPECIFIED = 0,
16
+ TMDB_POSTER_SIZE_W92 = 1,
17
+ TMDB_POSTER_SIZE_W154 = 2,
18
+ TMDB_POSTER_SIZE_W185 = 3,
19
+ TMDB_POSTER_SIZE_W342 = 4,
20
+ TMDB_POSTER_SIZE_W500 = 5,
21
+ TMDB_POSTER_SIZE_W780 = 6,
22
+ TMDB_POSTER_SIZE_ORIGINAL = 7,
23
+ UNRECOGNIZED = -1,
24
+ }
25
+
26
+ export interface ProxyImageRequest {
27
+ url: string;
28
+ width?: number | undefined;
29
+ height?: number | undefined;
30
+ }
31
+
32
+ export interface ProxyImageResponse {
33
+ data: Uint8Array;
34
+ contentType: string;
35
+ contentLength: number;
36
+ }
37
+
38
+ export interface GetTmdbPosterUrlRequest {
39
+ posterPath: string;
40
+ size: TmdbPosterSize;
41
+ }
42
+
43
+ export interface GetTmdbPosterUrlResponse {
44
+ url: string;
45
+ }
46
+
47
+ export interface UploadImageRequest {
48
+ /**
49
+ * Raw file bytes. Allowed mime types: image/jpeg, image/png, image/webp.
50
+ * Max size: 4 MiB.
51
+ */
52
+ data: Uint8Array;
53
+ originalName: string;
54
+ mimeType: string;
55
+ }
56
+
57
+ export interface UploadImageResponse {
58
+ url: string;
59
+ originalName: string;
60
+ size: number;
61
+ }
62
+
63
+ export interface DeleteImageRequest {
64
+ /** Either a full URL (with public-host prefix) or just the storage key. */
65
+ urlOrKey: string;
66
+ }
67
+
68
+ export interface DeleteImageResponse {
69
+ }
70
+
71
+ export const IMAGE_V1_PACKAGE_NAME = "image.v1";
72
+
73
+ export interface ImageServiceClient {
74
+ /**
75
+ * Returns the binary image (proxied + optionally resized).
76
+ * Useful when the gateway streams it back to the client. Size hints are
77
+ * advisory; the implementation may ignore them.
78
+ */
79
+
80
+ proxyImage(request: ProxyImageRequest): Observable<ProxyImageResponse>;
81
+
82
+ /** Resolves a TMDB poster path (e.g. "/abc.jpg") to an absolute URL. */
83
+
84
+ getTmdbPosterUrl(request: GetTmdbPosterUrlRequest): Observable<GetTmdbPosterUrlResponse>;
85
+
86
+ /** Uploads a single image to object storage (R2) and returns its public URL. */
87
+
88
+ uploadImage(request: UploadImageRequest): Observable<UploadImageResponse>;
89
+
90
+ /** Removes an image from object storage by its public URL or key. */
91
+
92
+ deleteImage(request: DeleteImageRequest): Observable<DeleteImageResponse>;
93
+ }
94
+
95
+ export interface ImageServiceController {
96
+ /**
97
+ * Returns the binary image (proxied + optionally resized).
98
+ * Useful when the gateway streams it back to the client. Size hints are
99
+ * advisory; the implementation may ignore them.
100
+ */
101
+
102
+ proxyImage(
103
+ request: ProxyImageRequest,
104
+ ): Promise<ProxyImageResponse> | Observable<ProxyImageResponse> | ProxyImageResponse;
105
+
106
+ /** Resolves a TMDB poster path (e.g. "/abc.jpg") to an absolute URL. */
107
+
108
+ getTmdbPosterUrl(
109
+ request: GetTmdbPosterUrlRequest,
110
+ ): Promise<GetTmdbPosterUrlResponse> | Observable<GetTmdbPosterUrlResponse> | GetTmdbPosterUrlResponse;
111
+
112
+ /** Uploads a single image to object storage (R2) and returns its public URL. */
113
+
114
+ uploadImage(
115
+ request: UploadImageRequest,
116
+ ): Promise<UploadImageResponse> | Observable<UploadImageResponse> | UploadImageResponse;
117
+
118
+ /** Removes an image from object storage by its public URL or key. */
119
+
120
+ deleteImage(
121
+ request: DeleteImageRequest,
122
+ ): Promise<DeleteImageResponse> | Observable<DeleteImageResponse> | DeleteImageResponse;
123
+ }
124
+
125
+ export function ImageServiceControllerMethods() {
126
+ return function (constructor: Function) {
127
+ const grpcMethods: string[] = ["proxyImage", "getTmdbPosterUrl", "uploadImage", "deleteImage"];
128
+ for (const method of grpcMethods) {
129
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
130
+ GrpcMethod("ImageService", method)(constructor.prototype[method], method, descriptor);
131
+ }
132
+ const grpcStreamMethods: string[] = [];
133
+ for (const method of grpcStreamMethods) {
134
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
135
+ GrpcStreamMethod("ImageService", method)(constructor.prototype[method], method, descriptor);
136
+ }
137
+ };
138
+ }
139
+
140
+ export const IMAGE_SERVICE_NAME = "ImageService";