@babacarthiamdev/contracts 1.0.22 → 1.0.23
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 +2 -0
- package/dist/proto/paths.js +2 -0
- package/gen/category.ts +153 -0
- package/gen/google/protobuf/timestamp.ts +183 -0
- package/gen/movies.ts +512 -0
- package/package.json +1 -1
- package/proto/category.proto +19 -0
- package/proto/movies.proto +57 -0
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -7,4 +7,6 @@ exports.PROTO_PATHS = {
|
|
|
7
7
|
ACCOUNT: (0, node_path_1.join)(__dirname, '../../proto/account.proto'),
|
|
8
8
|
USERS: (0, node_path_1.join)(__dirname, '../../proto/users.proto'),
|
|
9
9
|
MEDIA: (0, node_path_1.join)(__dirname, '../../proto/media.proto'),
|
|
10
|
+
MOVIES: (0, node_path_1.join)(__dirname, '../../proto/movies.proto'),
|
|
11
|
+
CATEGORY: (0, node_path_1.join)(__dirname, '../../proto/category.proto'),
|
|
10
12
|
};
|
package/gen/category.ts
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.10.1
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: category.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
9
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
10
|
+
import { Observable } from "rxjs";
|
|
11
|
+
import { Empty } from "./google/protobuf/empty";
|
|
12
|
+
|
|
13
|
+
export const protobufPackage = "category.v1";
|
|
14
|
+
|
|
15
|
+
export interface GetAllCategoriesResponse {
|
|
16
|
+
categories: Category[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface Category {
|
|
20
|
+
id: string;
|
|
21
|
+
title: string;
|
|
22
|
+
slug: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const CATEGORY_V1_PACKAGE_NAME = "category.v1";
|
|
26
|
+
|
|
27
|
+
function createBaseGetAllCategoriesResponse(): GetAllCategoriesResponse {
|
|
28
|
+
return { categories: [] };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const GetAllCategoriesResponse: MessageFns<GetAllCategoriesResponse> = {
|
|
32
|
+
encode(message: GetAllCategoriesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
33
|
+
for (const v of message.categories) {
|
|
34
|
+
Category.encode(v!, writer.uint32(10).fork()).join();
|
|
35
|
+
}
|
|
36
|
+
return writer;
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
decode(input: BinaryReader | Uint8Array, length?: number): GetAllCategoriesResponse {
|
|
40
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
41
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
42
|
+
const message = createBaseGetAllCategoriesResponse();
|
|
43
|
+
while (reader.pos < end) {
|
|
44
|
+
const tag = reader.uint32();
|
|
45
|
+
switch (tag >>> 3) {
|
|
46
|
+
case 1: {
|
|
47
|
+
if (tag !== 10) {
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
message.categories.push(Category.decode(reader, reader.uint32()));
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
reader.skip(tag & 7);
|
|
59
|
+
}
|
|
60
|
+
return message;
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
function createBaseCategory(): Category {
|
|
65
|
+
return { id: "", title: "", slug: "" };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export const Category: MessageFns<Category> = {
|
|
69
|
+
encode(message: Category, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
70
|
+
if (message.id !== "") {
|
|
71
|
+
writer.uint32(10).string(message.id);
|
|
72
|
+
}
|
|
73
|
+
if (message.title !== "") {
|
|
74
|
+
writer.uint32(18).string(message.title);
|
|
75
|
+
}
|
|
76
|
+
if (message.slug !== "") {
|
|
77
|
+
writer.uint32(26).string(message.slug);
|
|
78
|
+
}
|
|
79
|
+
return writer;
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
decode(input: BinaryReader | Uint8Array, length?: number): Category {
|
|
83
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
84
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
85
|
+
const message = createBaseCategory();
|
|
86
|
+
while (reader.pos < end) {
|
|
87
|
+
const tag = reader.uint32();
|
|
88
|
+
switch (tag >>> 3) {
|
|
89
|
+
case 1: {
|
|
90
|
+
if (tag !== 10) {
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
message.id = reader.string();
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
case 2: {
|
|
98
|
+
if (tag !== 18) {
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
message.title = reader.string();
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
case 3: {
|
|
106
|
+
if (tag !== 26) {
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
message.slug = reader.string();
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
reader.skip(tag & 7);
|
|
118
|
+
}
|
|
119
|
+
return message;
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export interface CategoryServiceClient {
|
|
124
|
+
getAllCategories(request: Empty): Observable<GetAllCategoriesResponse>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface CategoryServiceController {
|
|
128
|
+
getAllCategories(
|
|
129
|
+
request: Empty,
|
|
130
|
+
): Promise<GetAllCategoriesResponse> | Observable<GetAllCategoriesResponse> | GetAllCategoriesResponse;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function CategoryServiceControllerMethods() {
|
|
134
|
+
return function (constructor: Function) {
|
|
135
|
+
const grpcMethods: string[] = ["getAllCategories"];
|
|
136
|
+
for (const method of grpcMethods) {
|
|
137
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
138
|
+
GrpcMethod("CategoryService", method)(constructor.prototype[method], method, descriptor);
|
|
139
|
+
}
|
|
140
|
+
const grpcStreamMethods: string[] = [];
|
|
141
|
+
for (const method of grpcStreamMethods) {
|
|
142
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
143
|
+
GrpcStreamMethod("CategoryService", method)(constructor.prototype[method], method, descriptor);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export const CATEGORY_SERVICE_NAME = "CategoryService";
|
|
149
|
+
|
|
150
|
+
export interface MessageFns<T> {
|
|
151
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
152
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
153
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.10.1
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: google/protobuf/timestamp.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
9
|
+
|
|
10
|
+
export const protobufPackage = "google.protobuf";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A Timestamp represents a point in time independent of any time zone or local
|
|
14
|
+
* calendar, encoded as a count of seconds and fractions of seconds at
|
|
15
|
+
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
|
16
|
+
* January 1, 1970, in the proleptic Gregorian calendar which extends the
|
|
17
|
+
* Gregorian calendar backwards to year one.
|
|
18
|
+
*
|
|
19
|
+
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
|
20
|
+
* second table is needed for interpretation, using a [24-hour linear
|
|
21
|
+
* smear](https://developers.google.com/time/smear).
|
|
22
|
+
*
|
|
23
|
+
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
|
24
|
+
* restricting to that range, we ensure that we can convert to and from [RFC
|
|
25
|
+
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
|
26
|
+
*
|
|
27
|
+
* # Examples
|
|
28
|
+
*
|
|
29
|
+
* Example 1: Compute Timestamp from POSIX `time()`.
|
|
30
|
+
*
|
|
31
|
+
* Timestamp timestamp;
|
|
32
|
+
* timestamp.set_seconds(time(NULL));
|
|
33
|
+
* timestamp.set_nanos(0);
|
|
34
|
+
*
|
|
35
|
+
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
|
36
|
+
*
|
|
37
|
+
* struct timeval tv;
|
|
38
|
+
* gettimeofday(&tv, NULL);
|
|
39
|
+
*
|
|
40
|
+
* Timestamp timestamp;
|
|
41
|
+
* timestamp.set_seconds(tv.tv_sec);
|
|
42
|
+
* timestamp.set_nanos(tv.tv_usec * 1000);
|
|
43
|
+
*
|
|
44
|
+
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
|
45
|
+
*
|
|
46
|
+
* FILETIME ft;
|
|
47
|
+
* GetSystemTimeAsFileTime(&ft);
|
|
48
|
+
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
|
49
|
+
*
|
|
50
|
+
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
|
51
|
+
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
|
52
|
+
* Timestamp timestamp;
|
|
53
|
+
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
|
54
|
+
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
|
55
|
+
*
|
|
56
|
+
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
|
57
|
+
*
|
|
58
|
+
* long millis = System.currentTimeMillis();
|
|
59
|
+
*
|
|
60
|
+
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
|
61
|
+
* .setNanos((int) ((millis % 1000) * 1000000)).build();
|
|
62
|
+
*
|
|
63
|
+
* Example 5: Compute Timestamp from Java `Instant.now()`.
|
|
64
|
+
*
|
|
65
|
+
* Instant now = Instant.now();
|
|
66
|
+
*
|
|
67
|
+
* Timestamp timestamp =
|
|
68
|
+
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
|
69
|
+
* .setNanos(now.getNano()).build();
|
|
70
|
+
*
|
|
71
|
+
* Example 6: Compute Timestamp from current time in Python.
|
|
72
|
+
*
|
|
73
|
+
* timestamp = Timestamp()
|
|
74
|
+
* timestamp.GetCurrentTime()
|
|
75
|
+
*
|
|
76
|
+
* # JSON Mapping
|
|
77
|
+
*
|
|
78
|
+
* In JSON format, the Timestamp type is encoded as a string in the
|
|
79
|
+
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
|
80
|
+
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
|
81
|
+
* where {year} is always expressed using four digits while {month}, {day},
|
|
82
|
+
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
|
83
|
+
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
|
84
|
+
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
|
85
|
+
* is required. A proto3 JSON serializer should always use UTC (as indicated by
|
|
86
|
+
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
|
87
|
+
* able to accept both UTC and other timezones (as indicated by an offset).
|
|
88
|
+
*
|
|
89
|
+
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
|
90
|
+
* 01:30 UTC on January 15, 2017.
|
|
91
|
+
*
|
|
92
|
+
* In JavaScript, one can convert a Date object to this format using the
|
|
93
|
+
* standard
|
|
94
|
+
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
|
95
|
+
* method. In Python, a standard `datetime.datetime` object can be converted
|
|
96
|
+
* to this format using
|
|
97
|
+
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
|
98
|
+
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
|
99
|
+
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
|
100
|
+
* http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
|
|
101
|
+
* ) to obtain a formatter capable of generating timestamps in this format.
|
|
102
|
+
*/
|
|
103
|
+
export interface Timestamp {
|
|
104
|
+
/**
|
|
105
|
+
* Represents seconds of UTC time since Unix epoch
|
|
106
|
+
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
|
107
|
+
* 9999-12-31T23:59:59Z inclusive.
|
|
108
|
+
*/
|
|
109
|
+
seconds: number;
|
|
110
|
+
/**
|
|
111
|
+
* Non-negative fractions of a second at nanosecond resolution. Negative
|
|
112
|
+
* second values with fractions must still have non-negative nanos values
|
|
113
|
+
* that count forward in time. Must be from 0 to 999,999,999
|
|
114
|
+
* inclusive.
|
|
115
|
+
*/
|
|
116
|
+
nanos: number;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
|
|
120
|
+
|
|
121
|
+
function createBaseTimestamp(): Timestamp {
|
|
122
|
+
return { seconds: 0, nanos: 0 };
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export const Timestamp: MessageFns<Timestamp> = {
|
|
126
|
+
encode(message: Timestamp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
127
|
+
if (message.seconds !== 0) {
|
|
128
|
+
writer.uint32(8).int64(message.seconds);
|
|
129
|
+
}
|
|
130
|
+
if (message.nanos !== 0) {
|
|
131
|
+
writer.uint32(16).int32(message.nanos);
|
|
132
|
+
}
|
|
133
|
+
return writer;
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
decode(input: BinaryReader | Uint8Array, length?: number): Timestamp {
|
|
137
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
138
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
139
|
+
const message = createBaseTimestamp();
|
|
140
|
+
while (reader.pos < end) {
|
|
141
|
+
const tag = reader.uint32();
|
|
142
|
+
switch (tag >>> 3) {
|
|
143
|
+
case 1: {
|
|
144
|
+
if (tag !== 8) {
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
message.seconds = longToNumber(reader.int64());
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
case 2: {
|
|
152
|
+
if (tag !== 16) {
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
message.nanos = reader.int32();
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
reader.skip(tag & 7);
|
|
164
|
+
}
|
|
165
|
+
return message;
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
function longToNumber(int64: { toString(): string }): number {
|
|
170
|
+
const num = globalThis.Number(int64.toString());
|
|
171
|
+
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
|
172
|
+
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
173
|
+
}
|
|
174
|
+
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
|
175
|
+
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
|
176
|
+
}
|
|
177
|
+
return num;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export interface MessageFns<T> {
|
|
181
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
182
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
183
|
+
}
|
package/gen/movies.ts
ADDED
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.10.1
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: movies.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
9
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
10
|
+
import { Observable } from "rxjs";
|
|
11
|
+
import { Timestamp } from "./google/protobuf/timestamp";
|
|
12
|
+
|
|
13
|
+
export const protobufPackage = "movies.v1";
|
|
14
|
+
|
|
15
|
+
export interface ListMoviesRequest {
|
|
16
|
+
category: string;
|
|
17
|
+
random: boolean;
|
|
18
|
+
limit: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ListMoviesResponse {
|
|
22
|
+
movies: Movie[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface GetMovieRequest {
|
|
26
|
+
id?: string | undefined;
|
|
27
|
+
slug?: string | undefined;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface GetMovieResponse {
|
|
31
|
+
movie: MovieDetails | undefined;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface Movie {
|
|
35
|
+
id: string;
|
|
36
|
+
title: string;
|
|
37
|
+
slug: string;
|
|
38
|
+
poster: string;
|
|
39
|
+
ratingAge: string;
|
|
40
|
+
releaseDate: Timestamp | undefined;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface MovieDetails {
|
|
44
|
+
id: string;
|
|
45
|
+
title: string;
|
|
46
|
+
slug: string;
|
|
47
|
+
description: string;
|
|
48
|
+
poster: string;
|
|
49
|
+
banner: string;
|
|
50
|
+
duration: number;
|
|
51
|
+
ratingAge: string;
|
|
52
|
+
country: string;
|
|
53
|
+
releaseDate: Timestamp | undefined;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const MOVIES_V1_PACKAGE_NAME = "movies.v1";
|
|
57
|
+
|
|
58
|
+
function createBaseListMoviesRequest(): ListMoviesRequest {
|
|
59
|
+
return { category: "", random: false, limit: 0 };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const ListMoviesRequest: MessageFns<ListMoviesRequest> = {
|
|
63
|
+
encode(message: ListMoviesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
64
|
+
if (message.category !== "") {
|
|
65
|
+
writer.uint32(10).string(message.category);
|
|
66
|
+
}
|
|
67
|
+
if (message.random !== false) {
|
|
68
|
+
writer.uint32(16).bool(message.random);
|
|
69
|
+
}
|
|
70
|
+
if (message.limit !== 0) {
|
|
71
|
+
writer.uint32(24).int32(message.limit);
|
|
72
|
+
}
|
|
73
|
+
return writer;
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
decode(input: BinaryReader | Uint8Array, length?: number): ListMoviesRequest {
|
|
77
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
78
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
79
|
+
const message = createBaseListMoviesRequest();
|
|
80
|
+
while (reader.pos < end) {
|
|
81
|
+
const tag = reader.uint32();
|
|
82
|
+
switch (tag >>> 3) {
|
|
83
|
+
case 1: {
|
|
84
|
+
if (tag !== 10) {
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
message.category = reader.string();
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
case 2: {
|
|
92
|
+
if (tag !== 16) {
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
message.random = reader.bool();
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
case 3: {
|
|
100
|
+
if (tag !== 24) {
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
message.limit = reader.int32();
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
reader.skip(tag & 7);
|
|
112
|
+
}
|
|
113
|
+
return message;
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
function createBaseListMoviesResponse(): ListMoviesResponse {
|
|
118
|
+
return { movies: [] };
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const ListMoviesResponse: MessageFns<ListMoviesResponse> = {
|
|
122
|
+
encode(message: ListMoviesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
123
|
+
for (const v of message.movies) {
|
|
124
|
+
Movie.encode(v!, writer.uint32(10).fork()).join();
|
|
125
|
+
}
|
|
126
|
+
return writer;
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
decode(input: BinaryReader | Uint8Array, length?: number): ListMoviesResponse {
|
|
130
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
131
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
132
|
+
const message = createBaseListMoviesResponse();
|
|
133
|
+
while (reader.pos < end) {
|
|
134
|
+
const tag = reader.uint32();
|
|
135
|
+
switch (tag >>> 3) {
|
|
136
|
+
case 1: {
|
|
137
|
+
if (tag !== 10) {
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
message.movies.push(Movie.decode(reader, reader.uint32()));
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
reader.skip(tag & 7);
|
|
149
|
+
}
|
|
150
|
+
return message;
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
function createBaseGetMovieRequest(): GetMovieRequest {
|
|
155
|
+
return {};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export const GetMovieRequest: MessageFns<GetMovieRequest> = {
|
|
159
|
+
encode(message: GetMovieRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
160
|
+
if (message.id !== undefined) {
|
|
161
|
+
writer.uint32(10).string(message.id);
|
|
162
|
+
}
|
|
163
|
+
if (message.slug !== undefined) {
|
|
164
|
+
writer.uint32(18).string(message.slug);
|
|
165
|
+
}
|
|
166
|
+
return writer;
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
decode(input: BinaryReader | Uint8Array, length?: number): GetMovieRequest {
|
|
170
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
171
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
172
|
+
const message = createBaseGetMovieRequest();
|
|
173
|
+
while (reader.pos < end) {
|
|
174
|
+
const tag = reader.uint32();
|
|
175
|
+
switch (tag >>> 3) {
|
|
176
|
+
case 1: {
|
|
177
|
+
if (tag !== 10) {
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
message.id = reader.string();
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
case 2: {
|
|
185
|
+
if (tag !== 18) {
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
message.slug = reader.string();
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
reader.skip(tag & 7);
|
|
197
|
+
}
|
|
198
|
+
return message;
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
function createBaseGetMovieResponse(): GetMovieResponse {
|
|
203
|
+
return { movie: undefined };
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export const GetMovieResponse: MessageFns<GetMovieResponse> = {
|
|
207
|
+
encode(message: GetMovieResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
208
|
+
if (message.movie !== undefined) {
|
|
209
|
+
MovieDetails.encode(message.movie, writer.uint32(10).fork()).join();
|
|
210
|
+
}
|
|
211
|
+
return writer;
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
decode(input: BinaryReader | Uint8Array, length?: number): GetMovieResponse {
|
|
215
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
216
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
217
|
+
const message = createBaseGetMovieResponse();
|
|
218
|
+
while (reader.pos < end) {
|
|
219
|
+
const tag = reader.uint32();
|
|
220
|
+
switch (tag >>> 3) {
|
|
221
|
+
case 1: {
|
|
222
|
+
if (tag !== 10) {
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
message.movie = MovieDetails.decode(reader, reader.uint32());
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
reader.skip(tag & 7);
|
|
234
|
+
}
|
|
235
|
+
return message;
|
|
236
|
+
},
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
function createBaseMovie(): Movie {
|
|
240
|
+
return { id: "", title: "", slug: "", poster: "", ratingAge: "", releaseDate: undefined };
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export const Movie: MessageFns<Movie> = {
|
|
244
|
+
encode(message: Movie, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
245
|
+
if (message.id !== "") {
|
|
246
|
+
writer.uint32(10).string(message.id);
|
|
247
|
+
}
|
|
248
|
+
if (message.title !== "") {
|
|
249
|
+
writer.uint32(18).string(message.title);
|
|
250
|
+
}
|
|
251
|
+
if (message.slug !== "") {
|
|
252
|
+
writer.uint32(26).string(message.slug);
|
|
253
|
+
}
|
|
254
|
+
if (message.poster !== "") {
|
|
255
|
+
writer.uint32(34).string(message.poster);
|
|
256
|
+
}
|
|
257
|
+
if (message.ratingAge !== "") {
|
|
258
|
+
writer.uint32(42).string(message.ratingAge);
|
|
259
|
+
}
|
|
260
|
+
if (message.releaseDate !== undefined) {
|
|
261
|
+
Timestamp.encode(message.releaseDate, writer.uint32(50).fork()).join();
|
|
262
|
+
}
|
|
263
|
+
return writer;
|
|
264
|
+
},
|
|
265
|
+
|
|
266
|
+
decode(input: BinaryReader | Uint8Array, length?: number): Movie {
|
|
267
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
268
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
269
|
+
const message = createBaseMovie();
|
|
270
|
+
while (reader.pos < end) {
|
|
271
|
+
const tag = reader.uint32();
|
|
272
|
+
switch (tag >>> 3) {
|
|
273
|
+
case 1: {
|
|
274
|
+
if (tag !== 10) {
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
message.id = reader.string();
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
case 2: {
|
|
282
|
+
if (tag !== 18) {
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
message.title = reader.string();
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
case 3: {
|
|
290
|
+
if (tag !== 26) {
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
message.slug = reader.string();
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
case 4: {
|
|
298
|
+
if (tag !== 34) {
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
message.poster = reader.string();
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
case 5: {
|
|
306
|
+
if (tag !== 42) {
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
message.ratingAge = reader.string();
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
case 6: {
|
|
314
|
+
if (tag !== 50) {
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
message.releaseDate = Timestamp.decode(reader, reader.uint32());
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
reader.skip(tag & 7);
|
|
326
|
+
}
|
|
327
|
+
return message;
|
|
328
|
+
},
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
function createBaseMovieDetails(): MovieDetails {
|
|
332
|
+
return {
|
|
333
|
+
id: "",
|
|
334
|
+
title: "",
|
|
335
|
+
slug: "",
|
|
336
|
+
description: "",
|
|
337
|
+
poster: "",
|
|
338
|
+
banner: "",
|
|
339
|
+
duration: 0,
|
|
340
|
+
ratingAge: "",
|
|
341
|
+
country: "",
|
|
342
|
+
releaseDate: undefined,
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export const MovieDetails: MessageFns<MovieDetails> = {
|
|
347
|
+
encode(message: MovieDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
348
|
+
if (message.id !== "") {
|
|
349
|
+
writer.uint32(10).string(message.id);
|
|
350
|
+
}
|
|
351
|
+
if (message.title !== "") {
|
|
352
|
+
writer.uint32(18).string(message.title);
|
|
353
|
+
}
|
|
354
|
+
if (message.slug !== "") {
|
|
355
|
+
writer.uint32(26).string(message.slug);
|
|
356
|
+
}
|
|
357
|
+
if (message.description !== "") {
|
|
358
|
+
writer.uint32(34).string(message.description);
|
|
359
|
+
}
|
|
360
|
+
if (message.poster !== "") {
|
|
361
|
+
writer.uint32(42).string(message.poster);
|
|
362
|
+
}
|
|
363
|
+
if (message.banner !== "") {
|
|
364
|
+
writer.uint32(50).string(message.banner);
|
|
365
|
+
}
|
|
366
|
+
if (message.duration !== 0) {
|
|
367
|
+
writer.uint32(56).int32(message.duration);
|
|
368
|
+
}
|
|
369
|
+
if (message.ratingAge !== "") {
|
|
370
|
+
writer.uint32(66).string(message.ratingAge);
|
|
371
|
+
}
|
|
372
|
+
if (message.country !== "") {
|
|
373
|
+
writer.uint32(74).string(message.country);
|
|
374
|
+
}
|
|
375
|
+
if (message.releaseDate !== undefined) {
|
|
376
|
+
Timestamp.encode(message.releaseDate, writer.uint32(82).fork()).join();
|
|
377
|
+
}
|
|
378
|
+
return writer;
|
|
379
|
+
},
|
|
380
|
+
|
|
381
|
+
decode(input: BinaryReader | Uint8Array, length?: number): MovieDetails {
|
|
382
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
383
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
384
|
+
const message = createBaseMovieDetails();
|
|
385
|
+
while (reader.pos < end) {
|
|
386
|
+
const tag = reader.uint32();
|
|
387
|
+
switch (tag >>> 3) {
|
|
388
|
+
case 1: {
|
|
389
|
+
if (tag !== 10) {
|
|
390
|
+
break;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
message.id = reader.string();
|
|
394
|
+
continue;
|
|
395
|
+
}
|
|
396
|
+
case 2: {
|
|
397
|
+
if (tag !== 18) {
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
message.title = reader.string();
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
case 3: {
|
|
405
|
+
if (tag !== 26) {
|
|
406
|
+
break;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
message.slug = reader.string();
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
case 4: {
|
|
413
|
+
if (tag !== 34) {
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
message.description = reader.string();
|
|
418
|
+
continue;
|
|
419
|
+
}
|
|
420
|
+
case 5: {
|
|
421
|
+
if (tag !== 42) {
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
message.poster = reader.string();
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
428
|
+
case 6: {
|
|
429
|
+
if (tag !== 50) {
|
|
430
|
+
break;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
message.banner = reader.string();
|
|
434
|
+
continue;
|
|
435
|
+
}
|
|
436
|
+
case 7: {
|
|
437
|
+
if (tag !== 56) {
|
|
438
|
+
break;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
message.duration = reader.int32();
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
case 8: {
|
|
445
|
+
if (tag !== 66) {
|
|
446
|
+
break;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
message.ratingAge = reader.string();
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
case 9: {
|
|
453
|
+
if (tag !== 74) {
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
message.country = reader.string();
|
|
458
|
+
continue;
|
|
459
|
+
}
|
|
460
|
+
case 10: {
|
|
461
|
+
if (tag !== 82) {
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
message.releaseDate = Timestamp.decode(reader, reader.uint32());
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
470
|
+
break;
|
|
471
|
+
}
|
|
472
|
+
reader.skip(tag & 7);
|
|
473
|
+
}
|
|
474
|
+
return message;
|
|
475
|
+
},
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
export interface MoviesServiceClient {
|
|
479
|
+
listMovies(request: ListMoviesRequest): Observable<ListMoviesResponse>;
|
|
480
|
+
|
|
481
|
+
getMovie(request: GetMovieRequest): Observable<GetMovieResponse>;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
export interface MoviesServiceController {
|
|
485
|
+
listMovies(
|
|
486
|
+
request: ListMoviesRequest,
|
|
487
|
+
): Promise<ListMoviesResponse> | Observable<ListMoviesResponse> | ListMoviesResponse;
|
|
488
|
+
|
|
489
|
+
getMovie(request: GetMovieRequest): Promise<GetMovieResponse> | Observable<GetMovieResponse> | GetMovieResponse;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
export function MoviesServiceControllerMethods() {
|
|
493
|
+
return function (constructor: Function) {
|
|
494
|
+
const grpcMethods: string[] = ["listMovies", "getMovie"];
|
|
495
|
+
for (const method of grpcMethods) {
|
|
496
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
497
|
+
GrpcMethod("MoviesService", method)(constructor.prototype[method], method, descriptor);
|
|
498
|
+
}
|
|
499
|
+
const grpcStreamMethods: string[] = [];
|
|
500
|
+
for (const method of grpcStreamMethods) {
|
|
501
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
502
|
+
GrpcStreamMethod("MoviesService", method)(constructor.prototype[method], method, descriptor);
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
export const MOVIES_SERVICE_NAME = "MoviesService";
|
|
508
|
+
|
|
509
|
+
export interface MessageFns<T> {
|
|
510
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
511
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
512
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package category.v1;
|
|
4
|
+
|
|
5
|
+
import "google/protobuf/empty.proto";
|
|
6
|
+
|
|
7
|
+
service CategoryService {
|
|
8
|
+
rpc GetAllCategories (google.protobuf.Empty) returns (GetAllCategoriesResponse);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
message GetAllCategoriesResponse {
|
|
12
|
+
repeated Category categories = 1;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
message Category {
|
|
16
|
+
string id = 1;
|
|
17
|
+
string title = 2;
|
|
18
|
+
string slug = 3;
|
|
19
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package movies.v1;
|
|
4
|
+
|
|
5
|
+
import "google/protobuf/timestamp.proto";
|
|
6
|
+
|
|
7
|
+
service MoviesService {
|
|
8
|
+
rpc ListMovies (ListMoviesRequest) returns (ListMoviesResponse);
|
|
9
|
+
rpc GetMovie (GetMovieRequest) returns (GetMovieResponse);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
message ListMoviesRequest {
|
|
13
|
+
string category = 1;
|
|
14
|
+
bool random = 2;
|
|
15
|
+
int32 limit = 3;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
message ListMoviesResponse {
|
|
19
|
+
repeated Movie movies = 1;
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
message GetMovieRequest {
|
|
24
|
+
oneof key {
|
|
25
|
+
string id = 1;
|
|
26
|
+
string slug = 2;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
message GetMovieResponse {
|
|
31
|
+
MovieDetails movie = 1;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
message Movie {
|
|
35
|
+
string id =1;
|
|
36
|
+
string title = 2;
|
|
37
|
+
string slug = 3;
|
|
38
|
+
string poster = 4;
|
|
39
|
+
string rating_age = 5;
|
|
40
|
+
google.protobuf.Timestamp release_date = 6;
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
message MovieDetails {
|
|
45
|
+
string id =1;
|
|
46
|
+
string title = 2;
|
|
47
|
+
string slug = 3;
|
|
48
|
+
string description = 4;
|
|
49
|
+
string poster = 5;
|
|
50
|
+
string banner = 6;
|
|
51
|
+
int32 duration = 7;
|
|
52
|
+
string rating_age = 8;
|
|
53
|
+
string country = 9;
|
|
54
|
+
google.protobuf.Timestamp release_date = 10;
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
}
|