@bytexbyte/ike-app-api 1.0.49 → 1.0.51
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.
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
import BxBApi from '@bytexbyte/bxb-api';
|
|
2
2
|
import { InAppNotificationType } from './type';
|
|
3
|
+
declare type CreateInAppNotificationResult = {
|
|
4
|
+
success: 'ok';
|
|
5
|
+
} | {
|
|
6
|
+
error: 'You are not authorized to call this API.' | 'Type is required.' | 'UserId is required.' | 'PushNotificationId is required.';
|
|
7
|
+
};
|
|
8
|
+
declare type PutInAppNotificationsResult = {
|
|
9
|
+
success: 'ok';
|
|
10
|
+
error?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
success?: undefined;
|
|
13
|
+
error: 'You are not authorized to call this API.';
|
|
14
|
+
};
|
|
15
|
+
declare type DeleteInAppNotificationsResult = PutInAppNotificationsResult;
|
|
16
|
+
declare type PutInAppNotificationResult = PutInAppNotificationsResult | {
|
|
17
|
+
error: 'Id is required.';
|
|
18
|
+
};
|
|
19
|
+
declare type DeleteInAppNotificationResult = PutInAppNotificationResult;
|
|
20
|
+
declare type CheckReadedInAppNotificationsResult = {
|
|
21
|
+
isAllRead: boolean;
|
|
22
|
+
error?: undefined;
|
|
23
|
+
} | {
|
|
24
|
+
isAllRead?: undefined;
|
|
25
|
+
error: 'You are not authorized to call this API.';
|
|
26
|
+
};
|
|
3
27
|
declare class IKEApInAppNotificationApi extends BxBApi {
|
|
4
28
|
constructor({ host, secretKey, secret, onSuccess, onError, }: {
|
|
5
29
|
host: string;
|
|
@@ -10,14 +34,15 @@ declare class IKEApInAppNotificationApi extends BxBApi {
|
|
|
10
34
|
});
|
|
11
35
|
createInAppNotification(body: {
|
|
12
36
|
receiverId: string;
|
|
13
|
-
|
|
14
|
-
raffleId?: number;
|
|
37
|
+
pushNotificationId?: number;
|
|
15
38
|
type: InAppNotificationType;
|
|
16
39
|
sendPushNotification: boolean;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
40
|
+
senderId?: string;
|
|
41
|
+
}): Promise<CreateInAppNotificationResult>;
|
|
42
|
+
putInAppNotification(notificationId: number): Promise<PutInAppNotificationResult>;
|
|
43
|
+
deleteInAppNotification(notificationId: number): Promise<DeleteInAppNotificationResult>;
|
|
44
|
+
putInAppNotifications(): Promise<PutInAppNotificationsResult>;
|
|
45
|
+
deleteInAppNotifications(): Promise<DeleteInAppNotificationsResult>;
|
|
46
|
+
checkReadedInAppNotifications(): Promise<CheckReadedInAppNotificationsResult>;
|
|
22
47
|
}
|
|
23
48
|
export default IKEApInAppNotificationApi;
|
|
@@ -84,6 +84,96 @@ var IKEApInAppNotificationApi = /** @class */ (function (_super) {
|
|
|
84
84
|
});
|
|
85
85
|
});
|
|
86
86
|
};
|
|
87
|
+
IKEApInAppNotificationApi.prototype.putInAppNotification = function (notificationId) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
89
|
+
var response;
|
|
90
|
+
return __generator(this, function (_a) {
|
|
91
|
+
switch (_a.label) {
|
|
92
|
+
case 0: return [4 /*yield*/, this.bxbFetch({
|
|
93
|
+
method: 'PUT',
|
|
94
|
+
headers: {
|
|
95
|
+
'Content-Type': 'application/json',
|
|
96
|
+
},
|
|
97
|
+
}, "".concat(notificationId))];
|
|
98
|
+
case 1:
|
|
99
|
+
response = _a.sent();
|
|
100
|
+
return [2 /*return*/, response.json()];
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
IKEApInAppNotificationApi.prototype.deleteInAppNotification = function (notificationId) {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
107
|
+
var response;
|
|
108
|
+
return __generator(this, function (_a) {
|
|
109
|
+
switch (_a.label) {
|
|
110
|
+
case 0: return [4 /*yield*/, this.bxbFetch({
|
|
111
|
+
method: 'DELETE',
|
|
112
|
+
headers: {
|
|
113
|
+
'Content-Type': 'application/json',
|
|
114
|
+
},
|
|
115
|
+
}, "".concat(notificationId))];
|
|
116
|
+
case 1:
|
|
117
|
+
response = _a.sent();
|
|
118
|
+
return [2 /*return*/, response.json()];
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
IKEApInAppNotificationApi.prototype.putInAppNotifications = function () {
|
|
124
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
125
|
+
var response;
|
|
126
|
+
return __generator(this, function (_a) {
|
|
127
|
+
switch (_a.label) {
|
|
128
|
+
case 0: return [4 /*yield*/, this.bxbFetch({
|
|
129
|
+
method: 'PUT',
|
|
130
|
+
headers: {
|
|
131
|
+
'Content-Type': 'application/json',
|
|
132
|
+
},
|
|
133
|
+
})];
|
|
134
|
+
case 1:
|
|
135
|
+
response = _a.sent();
|
|
136
|
+
return [2 /*return*/, response.json()];
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
IKEApInAppNotificationApi.prototype.deleteInAppNotifications = function () {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
143
|
+
var response;
|
|
144
|
+
return __generator(this, function (_a) {
|
|
145
|
+
switch (_a.label) {
|
|
146
|
+
case 0: return [4 /*yield*/, this.bxbFetch({
|
|
147
|
+
method: 'DELETE',
|
|
148
|
+
headers: {
|
|
149
|
+
'Content-Type': 'application/json',
|
|
150
|
+
},
|
|
151
|
+
})];
|
|
152
|
+
case 1:
|
|
153
|
+
response = _a.sent();
|
|
154
|
+
return [2 /*return*/, response.json()];
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
IKEApInAppNotificationApi.prototype.checkReadedInAppNotifications = function () {
|
|
160
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
161
|
+
var response;
|
|
162
|
+
return __generator(this, function (_a) {
|
|
163
|
+
switch (_a.label) {
|
|
164
|
+
case 0: return [4 /*yield*/, this.bxbFetch({
|
|
165
|
+
method: 'GET',
|
|
166
|
+
headers: {
|
|
167
|
+
'Content-Type': 'application/json',
|
|
168
|
+
},
|
|
169
|
+
}, 'checkRead')];
|
|
170
|
+
case 1:
|
|
171
|
+
response = _a.sent();
|
|
172
|
+
return [2 /*return*/, response.json()];
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
};
|
|
87
177
|
return IKEApInAppNotificationApi;
|
|
88
178
|
}(bxb_api_1.default));
|
|
89
179
|
exports.default = IKEApInAppNotificationApi;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare type InAppNotificationType = '
|
|
1
|
+
export declare type InAppNotificationType = 'pushNotification';
|