@babacarthiamdev/contracts 1.0.25 → 1.0.26

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.
@@ -5,4 +5,5 @@ export declare const PROTO_PATHS: {
5
5
  readonly MEDIA: string;
6
6
  readonly MOVIES: string;
7
7
  readonly CATEGORY: string;
8
+ readonly THEATER: string;
8
9
  };
@@ -9,4 +9,5 @@ exports.PROTO_PATHS = {
9
9
  MEDIA: (0, node_path_1.join)(__dirname, '../../proto/media.proto'),
10
10
  MOVIES: (0, node_path_1.join)(__dirname, '../../proto/movies.proto'),
11
11
  CATEGORY: (0, node_path_1.join)(__dirname, '../../proto/category.proto'),
12
+ THEATER: (0, node_path_1.join)(__dirname, '../../proto/theater.proto')
12
13
  };
package/gen/theater.ts ADDED
@@ -0,0 +1,337 @@
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: theater.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 = "theater.v1";
14
+
15
+ export interface ListTheatersResponse {
16
+ theaters: Theater[];
17
+ }
18
+
19
+ export interface GetMovieRequest {
20
+ id: string;
21
+ }
22
+
23
+ export interface GetMovieResponse {
24
+ theater: Theater | undefined;
25
+ }
26
+
27
+ export interface CreateTheaterRequest {
28
+ name: string;
29
+ address: string;
30
+ }
31
+
32
+ export interface CreateTheaterResponse {
33
+ ok: boolean;
34
+ }
35
+
36
+ export interface Theater {
37
+ id: string;
38
+ name: string;
39
+ address: string;
40
+ }
41
+
42
+ export const THEATER_V1_PACKAGE_NAME = "theater.v1";
43
+
44
+ function createBaseListTheatersResponse(): ListTheatersResponse {
45
+ return { theaters: [] };
46
+ }
47
+
48
+ export const ListTheatersResponse: MessageFns<ListTheatersResponse> = {
49
+ encode(message: ListTheatersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
50
+ for (const v of message.theaters) {
51
+ Theater.encode(v!, writer.uint32(10).fork()).join();
52
+ }
53
+ return writer;
54
+ },
55
+
56
+ decode(input: BinaryReader | Uint8Array, length?: number): ListTheatersResponse {
57
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
58
+ const end = length === undefined ? reader.len : reader.pos + length;
59
+ const message = createBaseListTheatersResponse();
60
+ while (reader.pos < end) {
61
+ const tag = reader.uint32();
62
+ switch (tag >>> 3) {
63
+ case 1: {
64
+ if (tag !== 10) {
65
+ break;
66
+ }
67
+
68
+ message.theaters.push(Theater.decode(reader, reader.uint32()));
69
+ continue;
70
+ }
71
+ }
72
+ if ((tag & 7) === 4 || tag === 0) {
73
+ break;
74
+ }
75
+ reader.skip(tag & 7);
76
+ }
77
+ return message;
78
+ },
79
+ };
80
+
81
+ function createBaseGetMovieRequest(): GetMovieRequest {
82
+ return { id: "" };
83
+ }
84
+
85
+ export const GetMovieRequest: MessageFns<GetMovieRequest> = {
86
+ encode(message: GetMovieRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
87
+ if (message.id !== "") {
88
+ writer.uint32(10).string(message.id);
89
+ }
90
+ return writer;
91
+ },
92
+
93
+ decode(input: BinaryReader | Uint8Array, length?: number): GetMovieRequest {
94
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
95
+ const end = length === undefined ? reader.len : reader.pos + length;
96
+ const message = createBaseGetMovieRequest();
97
+ while (reader.pos < end) {
98
+ const tag = reader.uint32();
99
+ switch (tag >>> 3) {
100
+ case 1: {
101
+ if (tag !== 10) {
102
+ break;
103
+ }
104
+
105
+ message.id = reader.string();
106
+ continue;
107
+ }
108
+ }
109
+ if ((tag & 7) === 4 || tag === 0) {
110
+ break;
111
+ }
112
+ reader.skip(tag & 7);
113
+ }
114
+ return message;
115
+ },
116
+ };
117
+
118
+ function createBaseGetMovieResponse(): GetMovieResponse {
119
+ return { theater: undefined };
120
+ }
121
+
122
+ export const GetMovieResponse: MessageFns<GetMovieResponse> = {
123
+ encode(message: GetMovieResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
124
+ if (message.theater !== undefined) {
125
+ Theater.encode(message.theater, writer.uint32(10).fork()).join();
126
+ }
127
+ return writer;
128
+ },
129
+
130
+ decode(input: BinaryReader | Uint8Array, length?: number): GetMovieResponse {
131
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
132
+ const end = length === undefined ? reader.len : reader.pos + length;
133
+ const message = createBaseGetMovieResponse();
134
+ while (reader.pos < end) {
135
+ const tag = reader.uint32();
136
+ switch (tag >>> 3) {
137
+ case 1: {
138
+ if (tag !== 10) {
139
+ break;
140
+ }
141
+
142
+ message.theater = Theater.decode(reader, reader.uint32());
143
+ continue;
144
+ }
145
+ }
146
+ if ((tag & 7) === 4 || tag === 0) {
147
+ break;
148
+ }
149
+ reader.skip(tag & 7);
150
+ }
151
+ return message;
152
+ },
153
+ };
154
+
155
+ function createBaseCreateTheaterRequest(): CreateTheaterRequest {
156
+ return { name: "", address: "" };
157
+ }
158
+
159
+ export const CreateTheaterRequest: MessageFns<CreateTheaterRequest> = {
160
+ encode(message: CreateTheaterRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
161
+ if (message.name !== "") {
162
+ writer.uint32(10).string(message.name);
163
+ }
164
+ if (message.address !== "") {
165
+ writer.uint32(18).string(message.address);
166
+ }
167
+ return writer;
168
+ },
169
+
170
+ decode(input: BinaryReader | Uint8Array, length?: number): CreateTheaterRequest {
171
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
172
+ const end = length === undefined ? reader.len : reader.pos + length;
173
+ const message = createBaseCreateTheaterRequest();
174
+ while (reader.pos < end) {
175
+ const tag = reader.uint32();
176
+ switch (tag >>> 3) {
177
+ case 1: {
178
+ if (tag !== 10) {
179
+ break;
180
+ }
181
+
182
+ message.name = reader.string();
183
+ continue;
184
+ }
185
+ case 2: {
186
+ if (tag !== 18) {
187
+ break;
188
+ }
189
+
190
+ message.address = reader.string();
191
+ continue;
192
+ }
193
+ }
194
+ if ((tag & 7) === 4 || tag === 0) {
195
+ break;
196
+ }
197
+ reader.skip(tag & 7);
198
+ }
199
+ return message;
200
+ },
201
+ };
202
+
203
+ function createBaseCreateTheaterResponse(): CreateTheaterResponse {
204
+ return { ok: false };
205
+ }
206
+
207
+ export const CreateTheaterResponse: MessageFns<CreateTheaterResponse> = {
208
+ encode(message: CreateTheaterResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
209
+ if (message.ok !== false) {
210
+ writer.uint32(8).bool(message.ok);
211
+ }
212
+ return writer;
213
+ },
214
+
215
+ decode(input: BinaryReader | Uint8Array, length?: number): CreateTheaterResponse {
216
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
217
+ const end = length === undefined ? reader.len : reader.pos + length;
218
+ const message = createBaseCreateTheaterResponse();
219
+ while (reader.pos < end) {
220
+ const tag = reader.uint32();
221
+ switch (tag >>> 3) {
222
+ case 1: {
223
+ if (tag !== 8) {
224
+ break;
225
+ }
226
+
227
+ message.ok = reader.bool();
228
+ continue;
229
+ }
230
+ }
231
+ if ((tag & 7) === 4 || tag === 0) {
232
+ break;
233
+ }
234
+ reader.skip(tag & 7);
235
+ }
236
+ return message;
237
+ },
238
+ };
239
+
240
+ function createBaseTheater(): Theater {
241
+ return { id: "", name: "", address: "" };
242
+ }
243
+
244
+ export const Theater: MessageFns<Theater> = {
245
+ encode(message: Theater, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
246
+ if (message.id !== "") {
247
+ writer.uint32(10).string(message.id);
248
+ }
249
+ if (message.name !== "") {
250
+ writer.uint32(18).string(message.name);
251
+ }
252
+ if (message.address !== "") {
253
+ writer.uint32(26).string(message.address);
254
+ }
255
+ return writer;
256
+ },
257
+
258
+ decode(input: BinaryReader | Uint8Array, length?: number): Theater {
259
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
260
+ const end = length === undefined ? reader.len : reader.pos + length;
261
+ const message = createBaseTheater();
262
+ while (reader.pos < end) {
263
+ const tag = reader.uint32();
264
+ switch (tag >>> 3) {
265
+ case 1: {
266
+ if (tag !== 10) {
267
+ break;
268
+ }
269
+
270
+ message.id = reader.string();
271
+ continue;
272
+ }
273
+ case 2: {
274
+ if (tag !== 18) {
275
+ break;
276
+ }
277
+
278
+ message.name = reader.string();
279
+ continue;
280
+ }
281
+ case 3: {
282
+ if (tag !== 26) {
283
+ break;
284
+ }
285
+
286
+ message.address = reader.string();
287
+ continue;
288
+ }
289
+ }
290
+ if ((tag & 7) === 4 || tag === 0) {
291
+ break;
292
+ }
293
+ reader.skip(tag & 7);
294
+ }
295
+ return message;
296
+ },
297
+ };
298
+
299
+ export interface TheaterServiceClient {
300
+ listTheaters(request: Empty): Observable<ListTheatersResponse>;
301
+
302
+ getTheater(request: GetMovieRequest): Observable<GetMovieResponse>;
303
+
304
+ createTheater(request: CreateTheaterRequest): Observable<CreateTheaterResponse>;
305
+ }
306
+
307
+ export interface TheaterServiceController {
308
+ listTheaters(request: Empty): Promise<ListTheatersResponse> | Observable<ListTheatersResponse> | ListTheatersResponse;
309
+
310
+ getTheater(request: GetMovieRequest): Promise<GetMovieResponse> | Observable<GetMovieResponse> | GetMovieResponse;
311
+
312
+ createTheater(
313
+ request: CreateTheaterRequest,
314
+ ): Promise<CreateTheaterResponse> | Observable<CreateTheaterResponse> | CreateTheaterResponse;
315
+ }
316
+
317
+ export function TheaterServiceControllerMethods() {
318
+ return function (constructor: Function) {
319
+ const grpcMethods: string[] = ["listTheaters", "getTheater", "createTheater"];
320
+ for (const method of grpcMethods) {
321
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
322
+ GrpcMethod("TheaterService", method)(constructor.prototype[method], method, descriptor);
323
+ }
324
+ const grpcStreamMethods: string[] = [];
325
+ for (const method of grpcStreamMethods) {
326
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
327
+ GrpcStreamMethod("TheaterService", method)(constructor.prototype[method], method, descriptor);
328
+ }
329
+ };
330
+ }
331
+
332
+ export const THEATER_SERVICE_NAME = "TheaterService";
333
+
334
+ export interface MessageFns<T> {
335
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
336
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
337
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babacarthiamdev/contracts",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "description": "Protobuf definitions and generated TypeScript types",
5
5
  "main": "./dist/index.js",
6
6
  "type": "./dist/index.d.ts",
@@ -0,0 +1,39 @@
1
+ syntax = "proto3";
2
+
3
+ package theater.v1;
4
+
5
+ import "google/protobuf/empty.proto";
6
+
7
+ service TheaterService {
8
+ rpc ListTheaters (google.protobuf.Empty) returns (ListTheatersResponse);
9
+ rpc GetTheater (GetMovieRequest) returns (GetMovieResponse);
10
+
11
+ rpc CreateTheater (CreateTheaterRequest) returns (CreateTheaterResponse);
12
+ }
13
+
14
+ message ListTheatersResponse {
15
+ repeated Theater theaters = 1;
16
+ }
17
+
18
+ message GetMovieRequest {
19
+ string id = 1;
20
+ }
21
+
22
+ message GetMovieResponse {
23
+ Theater theater = 1;
24
+ }
25
+
26
+ message CreateTheaterRequest {
27
+ string name = 1;
28
+ string address = 2;
29
+ }
30
+
31
+ message CreateTheaterResponse {
32
+ bool ok = 1;
33
+ }
34
+
35
+ message Theater {
36
+ string id = 1;
37
+ string name = 2;
38
+ string address = 3;
39
+ }