@bytexbyte/ike-app-api 1.0.48 → 1.0.50

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,5 @@
1
1
  import BxBApi from '@bytexbyte/bxb-api';
2
- import { InAppNotificationType } from './type';
2
+ import { CheckReadedInAppNotificationsResult, CreateInAppNotificationResult, DeleteInAppNotificationResult, DeleteInAppNotificationsResult, InAppNotificationType, PutInAppNotificationResult, PutInAppNotificationsResult } from './type';
3
3
  declare class IKEApInAppNotificationApi extends BxBApi {
4
4
  constructor({ host, secretKey, secret, onSuccess, onError, }: {
5
5
  host: string;
@@ -10,14 +10,15 @@ declare class IKEApInAppNotificationApi extends BxBApi {
10
10
  });
11
11
  createInAppNotification(body: {
12
12
  receiverId: string;
13
- userId?: string;
14
- raffleId?: number;
13
+ pushNotificationId?: number;
15
14
  type: InAppNotificationType;
16
15
  sendPushNotification: boolean;
17
- }): Promise<{
18
- success: 'ok';
19
- } | {
20
- error: 'You are not authorized to call this API.' | 'Type is required.' | 'UserId is required.' | 'RaffleId is required.';
21
- }>;
16
+ senderId?: string;
17
+ }): Promise<CreateInAppNotificationResult>;
18
+ putInAppNotification(notificationId: number): Promise<PutInAppNotificationResult>;
19
+ deleteInAppNotification(notificationId: number): Promise<DeleteInAppNotificationResult>;
20
+ putInAppNotifications(): Promise<PutInAppNotificationsResult>;
21
+ deleteInAppNotifications(): Promise<DeleteInAppNotificationsResult>;
22
+ checkReadedInAppNotifications(): Promise<CheckReadedInAppNotificationsResult>;
22
23
  }
23
24
  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,25 @@
1
- export declare type InAppNotificationType = 'raffleStart' | 'raffleWinner';
1
+ export declare type CreateInAppNotificationResult = {
2
+ success: 'ok';
3
+ } | {
4
+ error: 'You are not authorized to call this API.' | 'Type is required.' | 'UserId is required.' | 'PushNotificationId is required.';
5
+ };
6
+ export declare type PutInAppNotificationsResult = {
7
+ success: 'ok';
8
+ error?: undefined;
9
+ } | {
10
+ success?: undefined;
11
+ error: 'You are not authorized to call this API.';
12
+ };
13
+ export declare type DeleteInAppNotificationsResult = PutInAppNotificationsResult;
14
+ export declare type PutInAppNotificationResult = PutInAppNotificationsResult | {
15
+ error: 'Id is required.';
16
+ };
17
+ export declare type DeleteInAppNotificationResult = PutInAppNotificationResult;
18
+ export declare type CheckReadedInAppNotificationsResult = {
19
+ isAllRead: boolean;
20
+ error?: undefined;
21
+ } | {
22
+ isAllRead?: undefined;
23
+ error: 'You are not authorized to call this API.';
24
+ };
25
+ export declare type InAppNotificationType = 'pushNotification';
@@ -6,7 +6,7 @@ declare type RegisterBody = {
6
6
  deviceId?: string;
7
7
  };
8
8
  declare type RegisterResult = {
9
- error?: 'You are not logged in.';
9
+ error?: 'You are not logged in.' | 'Invalid request';
10
10
  };
11
11
  declare class IKEAppRegisterDeviceCodeApi extends BxBApi {
12
12
  constructor({ host, onSuccess, onError }: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytexbyte/ike-app-api",
3
- "version": "1.0.48",
3
+ "version": "1.0.50",
4
4
  "description": "app api",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",