@barumetric/contracts 1.4.19 → 1.4.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/gen/ts/account.ts +133 -0
- package/gen/ts/auth.ts +236 -0
- package/gen/ts/balance.ts +67 -0
- package/gen/ts/categories.ts +354 -0
- package/gen/ts/google/protobuf/empty.ts +1 -1
- package/gen/ts/google/protobuf/struct.ts +197 -0
- package/gen/ts/google/protobuf/timestamp.ts +1 -1
- package/gen/ts/images.ts +60 -0
- package/gen/ts/listings.ts +202 -0
- package/gen/ts/media.ts +77 -0
- package/gen/ts/messages.ts +211 -0
- package/gen/ts/payment.ts +190 -0
- package/gen/ts/presence.ts +127 -0
- package/gen/ts/session.ts +110 -0
- package/gen/ts/users.ts +277 -0
- package/package.json +1 -1
- package/proto/presence.proto +1 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.0
|
|
4
|
+
// protoc v6.33.2
|
|
5
|
+
// source: listings.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { wrappers } from "protobufjs";
|
|
10
|
+
import { Observable } from "rxjs";
|
|
11
|
+
import { Struct } from "./google/protobuf/struct";
|
|
12
|
+
|
|
13
|
+
export const protobufPackage = "listings.v1";
|
|
14
|
+
|
|
15
|
+
/** Статусы объявлений */
|
|
16
|
+
export enum ListingStatus {
|
|
17
|
+
UNSPECIFIED = 0,
|
|
18
|
+
/** DRAFT - Черновик */
|
|
19
|
+
DRAFT = 1,
|
|
20
|
+
/** ACTIVE - Активные */
|
|
21
|
+
ACTIVE = 2,
|
|
22
|
+
/** UNPUBLISHED - Неопубликованные */
|
|
23
|
+
UNPUBLISHED = 3,
|
|
24
|
+
/** WITH_ERRORS - С ошибками */
|
|
25
|
+
WITH_ERRORS = 4,
|
|
26
|
+
/** ARCHIVED - Архив */
|
|
27
|
+
ARCHIVED = 5,
|
|
28
|
+
/** DELETED - Удаленные */
|
|
29
|
+
DELETED = 6,
|
|
30
|
+
/** PENDING_REVIEW - На модерации (внутренний) */
|
|
31
|
+
PENDING_REVIEW = 7,
|
|
32
|
+
/** REJECTED - Отклонено (внутренний) */
|
|
33
|
+
REJECTED = 8,
|
|
34
|
+
/** SUSPENDED - Приостановлено (внутренний) */
|
|
35
|
+
SUSPENDED = 9,
|
|
36
|
+
UNRECOGNIZED = -1,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface CreateListingRequest {
|
|
40
|
+
userId: string;
|
|
41
|
+
title: string;
|
|
42
|
+
description?: string | undefined;
|
|
43
|
+
price?: number | undefined;
|
|
44
|
+
categoryId: string;
|
|
45
|
+
latitude?: number | undefined;
|
|
46
|
+
longitude?: number | undefined;
|
|
47
|
+
videoUrl?: string | undefined;
|
|
48
|
+
status?: string | undefined;
|
|
49
|
+
attributes?: { [key: string]: any } | undefined;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface CreateListingResponse {
|
|
53
|
+
id: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface UpdateListingRequest {
|
|
57
|
+
id: string;
|
|
58
|
+
userId: string;
|
|
59
|
+
title: string;
|
|
60
|
+
description?: string | undefined;
|
|
61
|
+
price?: number | undefined;
|
|
62
|
+
categoryId: string;
|
|
63
|
+
latitude?: number | undefined;
|
|
64
|
+
longitude?: number | undefined;
|
|
65
|
+
videoUrl?: string | undefined;
|
|
66
|
+
status?: string | undefined;
|
|
67
|
+
attributes?: { [key: string]: any } | undefined;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface UpdateListingResponse {
|
|
71
|
+
id: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface GetListingRequest {
|
|
75
|
+
id: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface DeleteListingRequest {
|
|
79
|
+
id: string;
|
|
80
|
+
userId: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface DeleteListingResponse {
|
|
84
|
+
ok: boolean;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface GetListingsByUserRequest {
|
|
88
|
+
userId: string;
|
|
89
|
+
status?: ListingStatus | undefined;
|
|
90
|
+
take?: number | undefined;
|
|
91
|
+
skip?: number | undefined;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface GetListingsByCategoryRequest {
|
|
95
|
+
categoryId: string;
|
|
96
|
+
status?: ListingStatus | undefined;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Ответы */
|
|
100
|
+
export interface GetListingResponse {
|
|
101
|
+
listing: Listing | undefined;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface GetListingsByUserResponse {
|
|
105
|
+
listings: Listing[];
|
|
106
|
+
total: number;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface GetListingsByCategoryResponse {
|
|
110
|
+
listings: Listing[];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** Модели */
|
|
114
|
+
export interface Listing {
|
|
115
|
+
id: string;
|
|
116
|
+
title: string;
|
|
117
|
+
description?: string | undefined;
|
|
118
|
+
price?: number | undefined;
|
|
119
|
+
categoryId: string;
|
|
120
|
+
userId: string;
|
|
121
|
+
latitude?: number | undefined;
|
|
122
|
+
longitude?: number | undefined;
|
|
123
|
+
videoUrl?: string | undefined;
|
|
124
|
+
status: ListingStatus;
|
|
125
|
+
viewsCount: number;
|
|
126
|
+
favoritesCount: number;
|
|
127
|
+
imagesCount: number;
|
|
128
|
+
/** JSON строка */
|
|
129
|
+
attributes: string;
|
|
130
|
+
createdAt: string;
|
|
131
|
+
updatedAt: string;
|
|
132
|
+
publishedAt?: string | undefined;
|
|
133
|
+
deletedAt?: string | undefined;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export const LISTINGS_V1_PACKAGE_NAME = "listings.v1";
|
|
137
|
+
|
|
138
|
+
wrappers[".google.protobuf.Struct"] = { fromObject: Struct.wrap, toObject: Struct.unwrap } as any;
|
|
139
|
+
|
|
140
|
+
export interface ListingsServiceClient {
|
|
141
|
+
getListing(request: GetListingRequest): Observable<GetListingResponse>;
|
|
142
|
+
|
|
143
|
+
getListingsByUser(request: GetListingsByUserRequest): Observable<GetListingsByUserResponse>;
|
|
144
|
+
|
|
145
|
+
getListingsByCategory(request: GetListingsByCategoryRequest): Observable<GetListingsByCategoryResponse>;
|
|
146
|
+
|
|
147
|
+
createListing(request: CreateListingRequest): Observable<CreateListingResponse>;
|
|
148
|
+
|
|
149
|
+
updateListing(request: UpdateListingRequest): Observable<UpdateListingResponse>;
|
|
150
|
+
|
|
151
|
+
deleteListing(request: DeleteListingRequest): Observable<DeleteListingResponse>;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export interface ListingsServiceController {
|
|
155
|
+
getListing(
|
|
156
|
+
request: GetListingRequest,
|
|
157
|
+
): Promise<GetListingResponse> | Observable<GetListingResponse> | GetListingResponse;
|
|
158
|
+
|
|
159
|
+
getListingsByUser(
|
|
160
|
+
request: GetListingsByUserRequest,
|
|
161
|
+
): Promise<GetListingsByUserResponse> | Observable<GetListingsByUserResponse> | GetListingsByUserResponse;
|
|
162
|
+
|
|
163
|
+
getListingsByCategory(
|
|
164
|
+
request: GetListingsByCategoryRequest,
|
|
165
|
+
): Promise<GetListingsByCategoryResponse> | Observable<GetListingsByCategoryResponse> | GetListingsByCategoryResponse;
|
|
166
|
+
|
|
167
|
+
createListing(
|
|
168
|
+
request: CreateListingRequest,
|
|
169
|
+
): Promise<CreateListingResponse> | Observable<CreateListingResponse> | CreateListingResponse;
|
|
170
|
+
|
|
171
|
+
updateListing(
|
|
172
|
+
request: UpdateListingRequest,
|
|
173
|
+
): Promise<UpdateListingResponse> | Observable<UpdateListingResponse> | UpdateListingResponse;
|
|
174
|
+
|
|
175
|
+
deleteListing(
|
|
176
|
+
request: DeleteListingRequest,
|
|
177
|
+
): Promise<DeleteListingResponse> | Observable<DeleteListingResponse> | DeleteListingResponse;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export function ListingsServiceControllerMethods() {
|
|
181
|
+
return function (constructor: Function) {
|
|
182
|
+
const grpcMethods: string[] = [
|
|
183
|
+
"getListing",
|
|
184
|
+
"getListingsByUser",
|
|
185
|
+
"getListingsByCategory",
|
|
186
|
+
"createListing",
|
|
187
|
+
"updateListing",
|
|
188
|
+
"deleteListing",
|
|
189
|
+
];
|
|
190
|
+
for (const method of grpcMethods) {
|
|
191
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
192
|
+
GrpcMethod("ListingsService", method)(constructor.prototype[method], method, descriptor);
|
|
193
|
+
}
|
|
194
|
+
const grpcStreamMethods: string[] = [];
|
|
195
|
+
for (const method of grpcStreamMethods) {
|
|
196
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
197
|
+
GrpcStreamMethod("ListingsService", method)(constructor.prototype[method], method, descriptor);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export const LISTINGS_SERVICE_NAME = "ListingsService";
|
package/gen/ts/media.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.0
|
|
4
|
+
// protoc v6.33.2
|
|
5
|
+
// source: media.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "media.v1";
|
|
12
|
+
|
|
13
|
+
export interface UploadRequest {
|
|
14
|
+
fileName: string;
|
|
15
|
+
folder: string;
|
|
16
|
+
contentType: string;
|
|
17
|
+
data: Uint8Array;
|
|
18
|
+
resizeWidth?: number | undefined;
|
|
19
|
+
resizeHeight?: number | undefined;
|
|
20
|
+
watermark?: boolean | undefined;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface UploadResponse {
|
|
24
|
+
key: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface GetRequest {
|
|
28
|
+
key: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface GetResponse {
|
|
32
|
+
data: Uint8Array;
|
|
33
|
+
contentType: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface DeleteRequest {
|
|
37
|
+
key: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface DeleteResponse {
|
|
41
|
+
ok: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const MEDIA_V1_PACKAGE_NAME = "media.v1";
|
|
45
|
+
|
|
46
|
+
export interface MediaServiceClient {
|
|
47
|
+
upload(request: UploadRequest): Observable<UploadResponse>;
|
|
48
|
+
|
|
49
|
+
get(request: GetRequest): Observable<GetResponse>;
|
|
50
|
+
|
|
51
|
+
delete(request: DeleteRequest): Observable<DeleteResponse>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface MediaServiceController {
|
|
55
|
+
upload(request: UploadRequest): Promise<UploadResponse> | Observable<UploadResponse> | UploadResponse;
|
|
56
|
+
|
|
57
|
+
get(request: GetRequest): Promise<GetResponse> | Observable<GetResponse> | GetResponse;
|
|
58
|
+
|
|
59
|
+
delete(request: DeleteRequest): Promise<DeleteResponse> | Observable<DeleteResponse> | DeleteResponse;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function MediaServiceControllerMethods() {
|
|
63
|
+
return function (constructor: Function) {
|
|
64
|
+
const grpcMethods: string[] = ["upload", "get", "delete"];
|
|
65
|
+
for (const method of grpcMethods) {
|
|
66
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
67
|
+
GrpcMethod("MediaService", method)(constructor.prototype[method], method, descriptor);
|
|
68
|
+
}
|
|
69
|
+
const grpcStreamMethods: string[] = [];
|
|
70
|
+
for (const method of grpcStreamMethods) {
|
|
71
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
72
|
+
GrpcStreamMethod("MediaService", method)(constructor.prototype[method], method, descriptor);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const MEDIA_SERVICE_NAME = "MediaService";
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.0
|
|
4
|
+
// protoc v6.33.2
|
|
5
|
+
// source: messages.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
import { Timestamp } from "./google/protobuf/timestamp";
|
|
11
|
+
|
|
12
|
+
export const protobufPackage = "messages.v1";
|
|
13
|
+
|
|
14
|
+
export enum MessageType {
|
|
15
|
+
UNSPECIFIED = 0,
|
|
16
|
+
TEXT = 1,
|
|
17
|
+
IMAGE = 2,
|
|
18
|
+
FILE = 3,
|
|
19
|
+
VOICE = 4,
|
|
20
|
+
LOCATION = 5,
|
|
21
|
+
SYSTEM = 6,
|
|
22
|
+
UNRECOGNIZED = -1,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface GetConversationsRequest {
|
|
26
|
+
userId: string;
|
|
27
|
+
take?: number | undefined;
|
|
28
|
+
skip?: number | undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface GetConversationsResponse {
|
|
32
|
+
conversations: Conversation[];
|
|
33
|
+
total: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface GetConversationRequest {
|
|
37
|
+
conversationId: string;
|
|
38
|
+
userId: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface GetConversationResponse {
|
|
42
|
+
conversation: Conversation | undefined;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface CreateConversationRequest {
|
|
46
|
+
userId: string;
|
|
47
|
+
listingId: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface CreateConversationResponse {
|
|
51
|
+
id: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface GetMessagesRequest {
|
|
55
|
+
conversationId: string;
|
|
56
|
+
userId: string;
|
|
57
|
+
take?: number | undefined;
|
|
58
|
+
skip?: number | undefined;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface GetMessagesResponse {
|
|
62
|
+
messages: Message[];
|
|
63
|
+
total: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface SendMessageRequest {
|
|
67
|
+
conversationId: string;
|
|
68
|
+
senderId: string;
|
|
69
|
+
text?: string | undefined;
|
|
70
|
+
type: MessageType;
|
|
71
|
+
imageUrl?: string | undefined;
|
|
72
|
+
fileUrl?: string | undefined;
|
|
73
|
+
fileName?: string | undefined;
|
|
74
|
+
fileSize?: number | undefined;
|
|
75
|
+
mimeType?: string | undefined;
|
|
76
|
+
replyToIds: string[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface SendMessageResponse {
|
|
80
|
+
message: Message | undefined;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface MarkAsReadRequest {
|
|
84
|
+
conversationId: string;
|
|
85
|
+
userId: string;
|
|
86
|
+
/** if empty -> all unread from other participant */
|
|
87
|
+
messageIds: string[];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface MarkAsReadResponse {
|
|
91
|
+
markedCount: number;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface SearchMessagesRequest {
|
|
95
|
+
userId: string;
|
|
96
|
+
conversationId: string;
|
|
97
|
+
query: string;
|
|
98
|
+
take?: number | undefined;
|
|
99
|
+
skip?: number | undefined;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface SearchMessagesResponse {
|
|
103
|
+
messages: Message[];
|
|
104
|
+
total: number;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface Conversation {
|
|
108
|
+
id: string;
|
|
109
|
+
/** optional */
|
|
110
|
+
listingId: string;
|
|
111
|
+
/** participants */
|
|
112
|
+
sellerId: string;
|
|
113
|
+
buyerId: string;
|
|
114
|
+
lastMessageAt?: Timestamp | undefined;
|
|
115
|
+
lastMessageId?: string | undefined;
|
|
116
|
+
lastMessagePreview?: string | undefined;
|
|
117
|
+
unreadCount: number;
|
|
118
|
+
createdAt: Timestamp | undefined;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface Message {
|
|
122
|
+
id: string;
|
|
123
|
+
conversationId: string;
|
|
124
|
+
senderId: string;
|
|
125
|
+
text?: string | undefined;
|
|
126
|
+
type: MessageType;
|
|
127
|
+
imageUrl?: string | undefined;
|
|
128
|
+
fileUrl?: string | undefined;
|
|
129
|
+
fileName?: string | undefined;
|
|
130
|
+
fileSize?: number | undefined;
|
|
131
|
+
mimeType?: string | undefined;
|
|
132
|
+
read: boolean;
|
|
133
|
+
readAt?: Timestamp | undefined;
|
|
134
|
+
delivered: boolean;
|
|
135
|
+
deliveredAt?: Timestamp | undefined;
|
|
136
|
+
replyToIds: string[];
|
|
137
|
+
createdAt: Timestamp | undefined;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export const MESSAGES_V1_PACKAGE_NAME = "messages.v1";
|
|
141
|
+
|
|
142
|
+
export interface MessagesServiceClient {
|
|
143
|
+
getConversations(request: GetConversationsRequest): Observable<GetConversationsResponse>;
|
|
144
|
+
|
|
145
|
+
getConversation(request: GetConversationRequest): Observable<GetConversationResponse>;
|
|
146
|
+
|
|
147
|
+
createConversation(request: CreateConversationRequest): Observable<CreateConversationResponse>;
|
|
148
|
+
|
|
149
|
+
getMessages(request: GetMessagesRequest): Observable<GetMessagesResponse>;
|
|
150
|
+
|
|
151
|
+
sendMessage(request: SendMessageRequest): Observable<SendMessageResponse>;
|
|
152
|
+
|
|
153
|
+
markAsRead(request: MarkAsReadRequest): Observable<MarkAsReadResponse>;
|
|
154
|
+
|
|
155
|
+
searchMessages(request: SearchMessagesRequest): Observable<SearchMessagesResponse>;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface MessagesServiceController {
|
|
159
|
+
getConversations(
|
|
160
|
+
request: GetConversationsRequest,
|
|
161
|
+
): Promise<GetConversationsResponse> | Observable<GetConversationsResponse> | GetConversationsResponse;
|
|
162
|
+
|
|
163
|
+
getConversation(
|
|
164
|
+
request: GetConversationRequest,
|
|
165
|
+
): Promise<GetConversationResponse> | Observable<GetConversationResponse> | GetConversationResponse;
|
|
166
|
+
|
|
167
|
+
createConversation(
|
|
168
|
+
request: CreateConversationRequest,
|
|
169
|
+
): Promise<CreateConversationResponse> | Observable<CreateConversationResponse> | CreateConversationResponse;
|
|
170
|
+
|
|
171
|
+
getMessages(
|
|
172
|
+
request: GetMessagesRequest,
|
|
173
|
+
): Promise<GetMessagesResponse> | Observable<GetMessagesResponse> | GetMessagesResponse;
|
|
174
|
+
|
|
175
|
+
sendMessage(
|
|
176
|
+
request: SendMessageRequest,
|
|
177
|
+
): Promise<SendMessageResponse> | Observable<SendMessageResponse> | SendMessageResponse;
|
|
178
|
+
|
|
179
|
+
markAsRead(
|
|
180
|
+
request: MarkAsReadRequest,
|
|
181
|
+
): Promise<MarkAsReadResponse> | Observable<MarkAsReadResponse> | MarkAsReadResponse;
|
|
182
|
+
|
|
183
|
+
searchMessages(
|
|
184
|
+
request: SearchMessagesRequest,
|
|
185
|
+
): Promise<SearchMessagesResponse> | Observable<SearchMessagesResponse> | SearchMessagesResponse;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export function MessagesServiceControllerMethods() {
|
|
189
|
+
return function (constructor: Function) {
|
|
190
|
+
const grpcMethods: string[] = [
|
|
191
|
+
"getConversations",
|
|
192
|
+
"getConversation",
|
|
193
|
+
"createConversation",
|
|
194
|
+
"getMessages",
|
|
195
|
+
"sendMessage",
|
|
196
|
+
"markAsRead",
|
|
197
|
+
"searchMessages",
|
|
198
|
+
];
|
|
199
|
+
for (const method of grpcMethods) {
|
|
200
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
201
|
+
GrpcMethod("MessagesService", method)(constructor.prototype[method], method, descriptor);
|
|
202
|
+
}
|
|
203
|
+
const grpcStreamMethods: string[] = [];
|
|
204
|
+
for (const method of grpcStreamMethods) {
|
|
205
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
206
|
+
GrpcStreamMethod("MessagesService", method)(constructor.prototype[method], method, descriptor);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export const MESSAGES_SERVICE_NAME = "MessagesService";
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.0
|
|
4
|
+
// protoc v6.33.2
|
|
5
|
+
// source: payment.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
import { Timestamp } from "./google/protobuf/timestamp";
|
|
11
|
+
|
|
12
|
+
export const protobufPackage = "payment.v1";
|
|
13
|
+
|
|
14
|
+
export enum PaymentStatus {
|
|
15
|
+
UNSPECIFIED = 0,
|
|
16
|
+
PENDING = 1,
|
|
17
|
+
SUCCESS = 2,
|
|
18
|
+
FAILED = 3,
|
|
19
|
+
REFUNDED = 4,
|
|
20
|
+
UNRECOGNIZED = -1,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Запрос на пополнение баланса */
|
|
24
|
+
export interface TopUpBalanceRequest {
|
|
25
|
+
userId: string;
|
|
26
|
+
/** сумма в минимальных единицах (копейки/центы) */
|
|
27
|
+
amount: number;
|
|
28
|
+
paymentMethodId?: string | undefined;
|
|
29
|
+
savePaymentMethod: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Ответ — ссылка на оплату */
|
|
33
|
+
export interface TopUpBalanceResponse {
|
|
34
|
+
url: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ProcessPaymentEventRequest {
|
|
38
|
+
/** succeeded / failed / etc */
|
|
39
|
+
event: string;
|
|
40
|
+
paymentId: string;
|
|
41
|
+
userId: string;
|
|
42
|
+
savePaymentMethod: boolean;
|
|
43
|
+
providerMethodId?: string | undefined;
|
|
44
|
+
cardFirst6?: string | undefined;
|
|
45
|
+
cardLast4?: string | undefined;
|
|
46
|
+
bank?: string | undefined;
|
|
47
|
+
brand?: string | undefined;
|
|
48
|
+
amount?: number | undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface ProcessPaymentEventResponse {
|
|
52
|
+
ok: boolean;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface GetUserPaymentMethodsRequest {
|
|
56
|
+
userId: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface GetUserPaymentMethodsResponse {
|
|
60
|
+
methods: PaymentMethodItem[];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface CreatePaymentMethodRequest {
|
|
64
|
+
userId: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface CreatePaymentMethodResponse {
|
|
68
|
+
id: string;
|
|
69
|
+
url: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface VerifyPaymentMethodRequest {
|
|
73
|
+
userId: string;
|
|
74
|
+
methodId: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface VerifyPaymentMethodResponse {
|
|
78
|
+
ok: boolean;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface DeletePaymentMethodRequest {
|
|
82
|
+
userId: string;
|
|
83
|
+
methodId: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface DeletePaymentMethodResponse {
|
|
87
|
+
ok: boolean;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface PaymentMethodItem {
|
|
91
|
+
id: string;
|
|
92
|
+
bank: string;
|
|
93
|
+
brand: string;
|
|
94
|
+
first6: string;
|
|
95
|
+
last4: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** История платежей пользователя */
|
|
99
|
+
export interface GetUserPaymentsRequest {
|
|
100
|
+
userId: string;
|
|
101
|
+
status?: PaymentStatus | undefined;
|
|
102
|
+
take?: number | undefined;
|
|
103
|
+
skip?: number | undefined;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface GetUserPaymentsResponse {
|
|
107
|
+
payments: PaymentItem[];
|
|
108
|
+
total: number;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface PaymentItem {
|
|
112
|
+
id: string;
|
|
113
|
+
/** сумма в минимальных единицах (копейки) */
|
|
114
|
+
amount: number;
|
|
115
|
+
status: PaymentStatus;
|
|
116
|
+
createdAt: Timestamp | undefined;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export const PAYMENT_V1_PACKAGE_NAME = "payment.v1";
|
|
120
|
+
|
|
121
|
+
export interface PaymentServiceClient {
|
|
122
|
+
topUpBalance(request: TopUpBalanceRequest): Observable<TopUpBalanceResponse>;
|
|
123
|
+
|
|
124
|
+
processPaymentEvent(request: ProcessPaymentEventRequest): Observable<ProcessPaymentEventResponse>;
|
|
125
|
+
|
|
126
|
+
getUserPaymentMethods(request: GetUserPaymentMethodsRequest): Observable<GetUserPaymentMethodsResponse>;
|
|
127
|
+
|
|
128
|
+
createPaymentMethod(request: CreatePaymentMethodRequest): Observable<CreatePaymentMethodResponse>;
|
|
129
|
+
|
|
130
|
+
verifyPaymentMethod(request: VerifyPaymentMethodRequest): Observable<VerifyPaymentMethodResponse>;
|
|
131
|
+
|
|
132
|
+
deletePaymentMethod(request: DeletePaymentMethodRequest): Observable<DeletePaymentMethodResponse>;
|
|
133
|
+
|
|
134
|
+
getUserPayments(request: GetUserPaymentsRequest): Observable<GetUserPaymentsResponse>;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface PaymentServiceController {
|
|
138
|
+
topUpBalance(
|
|
139
|
+
request: TopUpBalanceRequest,
|
|
140
|
+
): Promise<TopUpBalanceResponse> | Observable<TopUpBalanceResponse> | TopUpBalanceResponse;
|
|
141
|
+
|
|
142
|
+
processPaymentEvent(
|
|
143
|
+
request: ProcessPaymentEventRequest,
|
|
144
|
+
): Promise<ProcessPaymentEventResponse> | Observable<ProcessPaymentEventResponse> | ProcessPaymentEventResponse;
|
|
145
|
+
|
|
146
|
+
getUserPaymentMethods(
|
|
147
|
+
request: GetUserPaymentMethodsRequest,
|
|
148
|
+
): Promise<GetUserPaymentMethodsResponse> | Observable<GetUserPaymentMethodsResponse> | GetUserPaymentMethodsResponse;
|
|
149
|
+
|
|
150
|
+
createPaymentMethod(
|
|
151
|
+
request: CreatePaymentMethodRequest,
|
|
152
|
+
): Promise<CreatePaymentMethodResponse> | Observable<CreatePaymentMethodResponse> | CreatePaymentMethodResponse;
|
|
153
|
+
|
|
154
|
+
verifyPaymentMethod(
|
|
155
|
+
request: VerifyPaymentMethodRequest,
|
|
156
|
+
): Promise<VerifyPaymentMethodResponse> | Observable<VerifyPaymentMethodResponse> | VerifyPaymentMethodResponse;
|
|
157
|
+
|
|
158
|
+
deletePaymentMethod(
|
|
159
|
+
request: DeletePaymentMethodRequest,
|
|
160
|
+
): Promise<DeletePaymentMethodResponse> | Observable<DeletePaymentMethodResponse> | DeletePaymentMethodResponse;
|
|
161
|
+
|
|
162
|
+
getUserPayments(
|
|
163
|
+
request: GetUserPaymentsRequest,
|
|
164
|
+
): Promise<GetUserPaymentsResponse> | Observable<GetUserPaymentsResponse> | GetUserPaymentsResponse;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function PaymentServiceControllerMethods() {
|
|
168
|
+
return function (constructor: Function) {
|
|
169
|
+
const grpcMethods: string[] = [
|
|
170
|
+
"topUpBalance",
|
|
171
|
+
"processPaymentEvent",
|
|
172
|
+
"getUserPaymentMethods",
|
|
173
|
+
"createPaymentMethod",
|
|
174
|
+
"verifyPaymentMethod",
|
|
175
|
+
"deletePaymentMethod",
|
|
176
|
+
"getUserPayments",
|
|
177
|
+
];
|
|
178
|
+
for (const method of grpcMethods) {
|
|
179
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
180
|
+
GrpcMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
|
|
181
|
+
}
|
|
182
|
+
const grpcStreamMethods: string[] = [];
|
|
183
|
+
for (const method of grpcStreamMethods) {
|
|
184
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
185
|
+
GrpcStreamMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export const PAYMENT_SERVICE_NAME = "PaymentService";
|