@@ -54,6 +54,7 @@ export async function getGroups({
5454 sort,
5555 includeChannels,
5656 includeUsers,
57+ includeNotSeenCount,
5758} ) {
5859 const request = {
5960 pageSize : pageSize || Config . tablePageSize ,
@@ -62,6 +63,7 @@ export async function getGroups({
6263 sort : objectOrStringToString ( sort ) ,
6364 includeChannels,
6465 includeUsers,
66+ includeNotSeenCount,
6567 } ;
6668 const requestUrl = `${
6769 Endpoints . PROJECT . NOTIFICATIONS . SERVER_EVENTS . GET_GROUPS
@@ -83,6 +85,38 @@ export async function getGroups({
8385 return response ;
8486}
8587
88+ export async function getGroup ( {
89+ secretKey,
90+ id,
91+ includeChannels,
92+ includeUsers,
93+ includeNotSeenCount,
94+ } ) {
95+ const request = {
96+ includeChannels,
97+ includeUsers,
98+ includeNotSeenCount,
99+ } ;
100+ const requestUrl = `${ Endpoints . PROJECT . NOTIFICATIONS . SERVER_EVENTS . GET_GROUP (
101+ id
102+ ) } ?${ toQueryString ( request ) } `;
103+
104+ const response = await server . loadJson (
105+ `${ Config . eventsApiUrl } ${ requestUrl } ` ,
106+ {
107+ method : 'GET' ,
108+ headers : {
109+ 'X-CM-ProjectId' : Config . projectId ,
110+ Authorization : `Bearer ${ secretKey || Config . secretKey } ` ,
111+ Accept : 'application/json' ,
112+ 'Content-Type' : 'application/json' ,
113+ } ,
114+ body : null ,
115+ }
116+ ) ;
117+ return response ;
118+ }
119+
86120export async function createChannel ( { secretKey, groupId, title, meta, users} ) {
87121 const response = await server . loadJson (
88122 `${
@@ -163,7 +197,13 @@ export async function getChannels({
163197 return response ;
164198}
165199
166- export async function sendMessage ( { secretKey, channelId, message, meta} ) {
200+ export async function sendMessage ( {
201+ secretKey,
202+ channelId,
203+ message,
204+ meta,
205+ fileIds,
206+ } ) {
167207 const response = await server . loadJson (
168208 `${ Config . eventsApiUrl } ${ Endpoints . PROJECT . NOTIFICATIONS . SERVER_EVENTS . SEND_MESSAGE } ` ,
169209 {
@@ -178,6 +218,28 @@ export async function sendMessage({secretKey, channelId, message, meta}) {
178218 channelId,
179219 message,
180220 meta,
221+ fileIds,
222+ } ) ,
223+ }
224+ ) ;
225+
226+ return response ;
227+ }
228+
229+ export async function readMessages ( { secretKey, channelId, ids} ) {
230+ const response = await server . loadJson (
231+ `${ Config . eventsApiUrl } ${ Endpoints . PROJECT . NOTIFICATIONS . SERVER_EVENTS . READ_MESSAGES } ` ,
232+ {
233+ method : 'POST' ,
234+ headers : {
235+ 'X-CM-ProjectId' : Config . projectId ,
236+ Authorization : `Bearer ${ secretKey || Config . secretKey } ` ,
237+ Accept : 'application/json' ,
238+ 'Content-Type' : 'application/json' ,
239+ } ,
240+ body : JSON . stringify ( {
241+ channelId,
242+ ids,
181243 } ) ,
182244 }
183245 ) ;
0 commit comments