@smartico/public-api 0.0.217 → 0.0.218
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/Inbox/GetInboxMessagesRequest.d.ts +2 -0
- package/dist/Inbox/InboxCategories.d.ts +5 -0
- package/dist/Inbox/InboxMessage.d.ts +2 -0
- package/dist/Inbox/index.d.ts +1 -0
- package/dist/SmarticoAPI.d.ts +3 -2
- package/dist/WSAPI/WSAPI.d.ts +3 -1
- package/dist/WSAPI/WSAPITypes.d.ts +3 -0
- package/dist/index.js +16 -6
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +17 -7
- package/dist/index.modern.mjs.map +1 -1
- package/docs/classes/WSAPI.md +1 -0
- package/docs/interfaces/TInboxMessage.md +8 -0
- package/package.json +1 -1
- package/src/Inbox/GetInboxMessagesRequest.ts +2 -0
- package/src/Inbox/GetInboxMessagesResponse.ts +1 -0
- package/src/Inbox/InboxCategories.ts +5 -0
- package/src/Inbox/InboxMessage.ts +3 -0
- package/src/Inbox/index.ts +1 -0
- package/src/SmarticoAPI.ts +5 -1
- package/src/WSAPI/WSAPI.ts +4 -3
- package/src/WSAPI/WSAPITypes.ts +3 -0
package/docs/classes/WSAPI.md
CHANGED
|
@@ -726,6 +726,7 @@ The "onUpdate" callback will be triggered when the user receives a new message.
|
|
|
726
726
|
| `params.from?` | `number` |
|
|
727
727
|
| `params.to?` | `number` |
|
|
728
728
|
| `params.onlyFavorite?` | `boolean` |
|
|
729
|
+
| `params.category_id?` | `InboxCategories` |
|
|
729
730
|
| `params.onUpdate?` | (`data`: [`TInboxMessage`](../interfaces/TInboxMessage.md)[]) => `void` |
|
|
730
731
|
|
|
731
732
|
#### Returns
|
|
@@ -31,3 +31,11 @@ ___
|
|
|
31
31
|
• **favorite**: `boolean`
|
|
32
32
|
|
|
33
33
|
Indicator if a message is added to favorites
|
|
34
|
+
|
|
35
|
+
___
|
|
36
|
+
|
|
37
|
+
### category_id
|
|
38
|
+
|
|
39
|
+
• **category_id**: `InboxCategories`
|
|
40
|
+
|
|
41
|
+
Category id per inbox message, can be part of System inboxes, Personal inboxes or General inbox messages
|
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { InboxCategories } from './InboxCategories';
|
|
1
2
|
import { ProtocolMessage } from '../Base/ProtocolMessage';
|
|
2
3
|
|
|
3
4
|
export interface GetInboxMessagesRequest extends ProtocolMessage {
|
|
4
5
|
limit?: number;
|
|
5
6
|
offset?: number;
|
|
6
7
|
starred_only?: boolean;
|
|
8
|
+
category_id?: InboxCategories;
|
|
7
9
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TInboxMessageBody } from '../WSAPI/WSAPITypes';
|
|
2
|
+
import { InboxCategories } from './InboxCategories';
|
|
2
3
|
import { InboxMessageType } from './InboxMessageType';
|
|
3
4
|
import { OpenLinksType } from './OpenLinksType';
|
|
4
5
|
|
|
@@ -42,6 +43,8 @@ export interface InboxMessage {
|
|
|
42
43
|
is_starred: boolean;
|
|
43
44
|
// flag that indicates if the message was deleted by the user. Such messages are not returned in the response and property is used only internaly in Smartico
|
|
44
45
|
is_deleted?: boolean;
|
|
46
|
+
// category id of the inbox message, could be categorized as System/Personal/General messages in mentioned tabs
|
|
47
|
+
category_id?: InboxCategories;
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
export const InboxMessageBodyTransform = (item: InboxMessageBody): TInboxMessageBody => {
|
package/src/Inbox/index.ts
CHANGED
package/src/SmarticoAPI.ts
CHANGED
|
@@ -123,6 +123,7 @@ import { GetRelatedAchTourRequest } from './Missions/GetRelatedAchTourRequest';
|
|
|
123
123
|
import { GetRelatedAchTourResponse } from './Missions/GetRelatedAchTourResponse';
|
|
124
124
|
import { GetRafflesResponse } from './Raffle/GetRafflesResponse';
|
|
125
125
|
import { GetRafflesRequest } from './Raffle/GetRafflesRequest';
|
|
126
|
+
import { InboxCategories } from './Inbox/InboxCategories';
|
|
126
127
|
|
|
127
128
|
const PUBLIC_API_URL = 'https://papi{ENV_ID}.smartico.ai/services/public';
|
|
128
129
|
const C_SOCKET_PROD = 'wss://api{ENV_ID}.smartico.ai/websocket/services';
|
|
@@ -971,6 +972,7 @@ class SmarticoAPI {
|
|
|
971
972
|
limit: number = 20,
|
|
972
973
|
offset: number = 0,
|
|
973
974
|
starred_only: boolean,
|
|
975
|
+
category_id?: InboxCategories,
|
|
974
976
|
): Promise<GetInboxMessagesResponse> {
|
|
975
977
|
const message = this.buildMessage<GetInboxMessagesRequest, GetInboxMessagesResponse>(
|
|
976
978
|
user_ext_id,
|
|
@@ -979,6 +981,7 @@ class SmarticoAPI {
|
|
|
979
981
|
limit,
|
|
980
982
|
offset,
|
|
981
983
|
starred_only,
|
|
984
|
+
category_id,
|
|
982
985
|
},
|
|
983
986
|
);
|
|
984
987
|
return await this.send<GetInboxMessagesResponse>(message, ClassId.GET_INBOX_MESSAGES_RESPONSE);
|
|
@@ -989,11 +992,12 @@ class SmarticoAPI {
|
|
|
989
992
|
from: number = 0,
|
|
990
993
|
to: number = 20,
|
|
991
994
|
favoriteOnly: boolean = false,
|
|
995
|
+
categoryId?: InboxCategories,
|
|
992
996
|
): Promise<TInboxMessage[]> {
|
|
993
997
|
const limit = to - from > 20 ? 20 : to - from;
|
|
994
998
|
const offset = from;
|
|
995
999
|
|
|
996
|
-
return InboxMessagesTransform((await this.getInboxMessages(user_ext_id, limit, offset, favoriteOnly)).log);
|
|
1000
|
+
return InboxMessagesTransform((await this.getInboxMessages(user_ext_id, limit, offset, favoriteOnly, categoryId)).log);
|
|
997
1001
|
}
|
|
998
1002
|
|
|
999
1003
|
public async getInboxMessageBody(messageGuid: string): Promise<InboxMessageBody> {
|
package/src/WSAPI/WSAPI.ts
CHANGED
|
@@ -52,6 +52,7 @@ import { GetTournamentsResponse } from '../Tournaments';
|
|
|
52
52
|
import { GetAchievementMapResponse } from '../Missions';
|
|
53
53
|
import { GetRelatedAchTourResponse } from 'src/Missions/GetRelatedAchTourResponse';
|
|
54
54
|
import { GetRafflesResponse } from '../Raffle/GetRafflesResponse';
|
|
55
|
+
import { InboxCategories } from '../Inbox/InboxCategories';
|
|
55
56
|
|
|
56
57
|
/** @hidden */
|
|
57
58
|
const CACHE_DATA_SEC = 30;
|
|
@@ -758,15 +759,15 @@ export class WSAPI {
|
|
|
758
759
|
from,
|
|
759
760
|
to,
|
|
760
761
|
onlyFavorite,
|
|
762
|
+
categoryId,
|
|
761
763
|
onUpdate,
|
|
762
|
-
}: { from?: number; to?: number; onlyFavorite?: boolean; onUpdate?: (data: TInboxMessage[]) => void } = {}): Promise<
|
|
764
|
+
}: { from?: number; to?: number; onlyFavorite?: boolean; categoryId?: InboxCategories, onUpdate?: (data: TInboxMessage[]) => void } = {}): Promise<
|
|
763
765
|
TInboxMessage[]
|
|
764
766
|
> {
|
|
765
767
|
if (onUpdate) {
|
|
766
768
|
this.onUpdateCallback.set(onUpdateContextKey.InboxMessages, onUpdate);
|
|
767
769
|
}
|
|
768
|
-
|
|
769
|
-
return await this.api.getInboxMessagesT(null, from, to, onlyFavorite);
|
|
770
|
+
return await this.api.getInboxMessagesT(null, from, to, onlyFavorite, categoryId);
|
|
770
771
|
}
|
|
771
772
|
|
|
772
773
|
/**
|
package/src/WSAPI/WSAPITypes.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { LeaderBoardPeriodType } from '../Leaderboard';
|
|
|
6
6
|
import { AchCustomLayoutTheme, AchCustomSectionType, AchMissionsTabsOptions, AchOverviewMissionsFilter } from '../CustomSections';
|
|
7
7
|
import { BonusStatus , BonusTemplateMetaMap, BonusMetaMap} from '../Bonuses';
|
|
8
8
|
import { PrizeModifiers } from '../MiniGames/PrizeModifiers';
|
|
9
|
+
import { InboxCategories } from '../Inbox/InboxCategories';
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
type TRibbon = 'sale' | 'hot' | 'new' | 'vip' | string;
|
|
@@ -686,6 +687,8 @@ export interface TInboxMessage {
|
|
|
686
687
|
read: boolean;
|
|
687
688
|
/** Indicator if a message is added to favorites */
|
|
688
689
|
favorite: boolean;
|
|
690
|
+
/** Category id per inbox message, can be part of System inboxes, Personal inboxes or General inbox messages */
|
|
691
|
+
category_id?: InboxCategories;
|
|
689
692
|
}
|
|
690
693
|
|
|
691
694
|
export interface TInboxMessageBody {
|