@smartico/public-api 0.0.316 → 0.0.317
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/InboxReadStatus.d.ts +4 -0
- package/dist/Inbox/index.d.ts +1 -0
- package/dist/SmarticoAPI.d.ts +3 -3
- package/dist/WSAPI/WSAPI.d.ts +6 -2
- 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 +4 -1
- package/package.json +1 -1
- package/src/Inbox/GetInboxMessagesRequest.ts +2 -0
- package/src/Inbox/InboxReadStatus.ts +4 -0
- package/src/Inbox/index.ts +1 -0
- package/src/SmarticoAPI.ts +5 -1
- package/src/WSAPI/WSAPI.ts +7 -2
package/docs/classes/WSAPI.md
CHANGED
|
@@ -743,7 +743,9 @@ ___
|
|
|
743
743
|
▸ **getInboxMessages**(`params?`): `Promise`\<[`TInboxMessage`](../interfaces/TInboxMessage.md)[]\>
|
|
744
744
|
|
|
745
745
|
Returns inbox messages based on the provided parameters. "From" and "to" indicate the range of messages to be fetched.
|
|
746
|
-
The maximum number of messages per request is limited to 20.
|
|
746
|
+
The maximum number of messages per request is limited to 20.
|
|
747
|
+
An indicator "onlyFavorite" can be passed to get only messages marked as favorites.
|
|
748
|
+
An indicator "read_status" can be passed to get only messages marked as read or unread.
|
|
747
749
|
You can leave this params empty and by default it will return list of messages ranging from 0 to 20.
|
|
748
750
|
This functions return list of messages without the body of the message.
|
|
749
751
|
To get the body of the message you need to call getInboxMessageBody function and pass the message guid contained in each message of this request.
|
|
@@ -761,6 +763,7 @@ The "onUpdate" callback will be triggered when the user receives a new message.
|
|
|
761
763
|
| `params.to?` | `number` |
|
|
762
764
|
| `params.onlyFavorite?` | `boolean` |
|
|
763
765
|
| `params.categoryId?` | [`InboxCategories`](../enums/InboxCategories.md) |
|
|
766
|
+
| `params.read_status?` | `InboxReadStatus` |
|
|
764
767
|
| `params.onUpdate?` | (`data`: [`TInboxMessage`](../interfaces/TInboxMessage.md)[]) => `void` |
|
|
765
768
|
|
|
766
769
|
#### Returns
|
package/package.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { InboxCategories } from './InboxCategories';
|
|
2
2
|
import { ProtocolMessage } from '../Base/ProtocolMessage';
|
|
3
|
+
import { InboxReadStatus } from './InboxReadStatus';
|
|
3
4
|
|
|
4
5
|
export interface GetInboxMessagesRequest extends ProtocolMessage {
|
|
5
6
|
limit?: number;
|
|
6
7
|
offset?: number;
|
|
7
8
|
starred_only?: boolean;
|
|
8
9
|
category_id?: InboxCategories;
|
|
10
|
+
read_status?: InboxReadStatus;
|
|
9
11
|
}
|
package/src/Inbox/index.ts
CHANGED
package/src/SmarticoAPI.ts
CHANGED
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
InboxMessageBody,
|
|
35
35
|
InboxMessageBodyTransform,
|
|
36
36
|
InboxMessagesTransform,
|
|
37
|
+
InboxReadStatus,
|
|
37
38
|
MarkInboxMessageDeletedRequest,
|
|
38
39
|
MarkInboxMessageDeletedResponse,
|
|
39
40
|
MarkInboxMessageReadRequest,
|
|
@@ -1091,6 +1092,7 @@ class SmarticoAPI {
|
|
|
1091
1092
|
offset: number = 0,
|
|
1092
1093
|
starred_only: boolean,
|
|
1093
1094
|
category_id?: InboxCategories,
|
|
1095
|
+
read_status?: InboxReadStatus,
|
|
1094
1096
|
): Promise<GetInboxMessagesResponse> {
|
|
1095
1097
|
const message = this.buildMessage<GetInboxMessagesRequest, GetInboxMessagesResponse>(
|
|
1096
1098
|
user_ext_id,
|
|
@@ -1100,6 +1102,7 @@ class SmarticoAPI {
|
|
|
1100
1102
|
offset,
|
|
1101
1103
|
starred_only,
|
|
1102
1104
|
category_id,
|
|
1105
|
+
read_status,
|
|
1103
1106
|
},
|
|
1104
1107
|
);
|
|
1105
1108
|
return await this.send<GetInboxMessagesResponse>(message, ClassId.GET_INBOX_MESSAGES_RESPONSE);
|
|
@@ -1111,11 +1114,12 @@ class SmarticoAPI {
|
|
|
1111
1114
|
to: number = 20,
|
|
1112
1115
|
favoriteOnly: boolean = false,
|
|
1113
1116
|
categoryId?: InboxCategories,
|
|
1117
|
+
read_status?: InboxReadStatus,
|
|
1114
1118
|
): Promise<TInboxMessage[]> {
|
|
1115
1119
|
const limit = to - from > 20 ? 20 : to - from;
|
|
1116
1120
|
const offset = from;
|
|
1117
1121
|
|
|
1118
|
-
return InboxMessagesTransform((await this.getInboxMessages(user_ext_id, limit, offset, favoriteOnly, categoryId)).log);
|
|
1122
|
+
return InboxMessagesTransform((await this.getInboxMessages(user_ext_id, limit, offset, favoriteOnly, categoryId, read_status)).log);
|
|
1119
1123
|
}
|
|
1120
1124
|
|
|
1121
1125
|
public async getInboxUnreadCountT(
|
package/src/WSAPI/WSAPI.ts
CHANGED
|
@@ -57,6 +57,7 @@ import {
|
|
|
57
57
|
} from '../Raffle';
|
|
58
58
|
import { IntUtils } from '../IntUtils';
|
|
59
59
|
import { TGetJackpotEligibleGamesResponse } from '../Jackpots/GetJackpotEligibleGamesResponse';
|
|
60
|
+
import { InboxReadStatus } from '../Inbox/InboxReadStatus';
|
|
60
61
|
|
|
61
62
|
/** @hidden */
|
|
62
63
|
const CACHE_DATA_SEC = 30;
|
|
@@ -800,7 +801,9 @@ export class WSAPI {
|
|
|
800
801
|
}
|
|
801
802
|
|
|
802
803
|
/** Returns inbox messages based on the provided parameters. "From" and "to" indicate the range of messages to be fetched.
|
|
803
|
-
* The maximum number of messages per request is limited to 20.
|
|
804
|
+
* The maximum number of messages per request is limited to 20.
|
|
805
|
+
* An indicator "onlyFavorite" can be passed to get only messages marked as favorites.
|
|
806
|
+
* An indicator "read_status" can be passed to get only messages marked as read or unread.
|
|
804
807
|
* You can leave this params empty and by default it will return list of messages ranging from 0 to 20.
|
|
805
808
|
* This functions return list of messages without the body of the message.
|
|
806
809
|
* To get the body of the message you need to call getInboxMessageBody function and pass the message guid contained in each message of this request.
|
|
@@ -816,18 +819,20 @@ export class WSAPI {
|
|
|
816
819
|
to,
|
|
817
820
|
onlyFavorite,
|
|
818
821
|
categoryId,
|
|
822
|
+
read_status,
|
|
819
823
|
onUpdate,
|
|
820
824
|
}: {
|
|
821
825
|
from?: number;
|
|
822
826
|
to?: number;
|
|
823
827
|
onlyFavorite?: boolean;
|
|
824
828
|
categoryId?: InboxCategories;
|
|
829
|
+
read_status?: InboxReadStatus;
|
|
825
830
|
onUpdate?: (data: TInboxMessage[]) => void;
|
|
826
831
|
} = {}): Promise<TInboxMessage[]> {
|
|
827
832
|
if (onUpdate) {
|
|
828
833
|
this.onUpdateCallback.set(onUpdateContextKey.InboxMessages, onUpdate);
|
|
829
834
|
}
|
|
830
|
-
return await this.api.getInboxMessagesT(null, from, to, onlyFavorite, categoryId);
|
|
835
|
+
return await this.api.getInboxMessagesT(null, from, to, onlyFavorite, categoryId, read_status);
|
|
831
836
|
}
|
|
832
837
|
|
|
833
838
|
/**
|