11/**
2- * Type Definitions for Sendbird SDK v3.0.154
2+ * Type Definitions for Sendbird SDK v3.0.155
33 * homepage: https://sendbird.com/
44 * git: https://github.com/sendbird/Sendbird-SDK-JavaScript
55 */
@@ -26,6 +26,13 @@ declare namespace SendBird {
2626 message : string ;
2727 }
2828
29+ /**
30+ * @deprecated
31+ */
32+ type voidErrorLastCallback = ( result : null , error : SendBirdError ) => void ;
33+ type voidErrorFirstCallback = ( error : SendBirdError ) => void ;
34+ type voidCallback = voidErrorFirstCallback | voidErrorLastCallback ;
35+
2936 type userCallback = ( user : User , error : SendBirdError ) => void ;
3037 type pushSettingCallback = ( response : string , error : SendBirdError ) => void ;
3138
@@ -75,6 +82,12 @@ declare namespace SendBird {
7582 ADMIN : 'ADMM'
7683 } ;
7784
85+ type PollStatus = {
86+ OPEN : 'open' ,
87+ CLOSED : 'closed' ,
88+ REMOVED : 'removed'
89+ } ;
90+
7891 interface DiscoveryObject {
7992 friendDiscoveryKey : string ;
8093 friendName ?: string ;
@@ -95,6 +108,12 @@ declare namespace SendBird {
95108 FileMessage : FileMessageStatic ;
96109 AdminMessage : AdminMessageStatic ;
97110
111+ MessageMetaArray : MessageMetaArray ;
112+ Options : Options ;
113+
114+ Poll : PollStatic ;
115+ PollOption : PollOptionStatic ;
116+
98117 SessionHandler : SessionHandlerStatic ;
99118 UserEventHandler : UserEventHandlerStatic ;
100119 ChannelHandler : ChannelHandlerStatic ;
@@ -112,8 +131,11 @@ declare namespace SendBird {
112131 MessageListParams : MessageListParams ;
113132 ThreadedMessageListParams : ThreadedMessageListParams ;
114133 MessageChangeLogsParams : MessageChangeLogsParams ;
115- MessageMetaArray : MessageMetaArray ;
116- Options : Options ;
134+ PollParams : PollParams ;
135+ PollRetrievalParams : PollRetrievalParams ;
136+
137+ PollListQuery : PollListQuery ;
138+ PollVoterListQuery : PollVoterListQuery ;
117139
118140 currentUser : User ;
119141 appInfo : AppInfo ;
@@ -295,6 +317,7 @@ declare namespace SendBird {
295317 useMemberAsMessageSender : boolean ;
296318 typingIndicatorThrottle : number ;
297319 websocketResponseTimeout : number ;
320+ includePollDetails : boolean ;
298321 }
299322 interface AppInfo {
300323 uploadSizeLimit : number ;
@@ -378,11 +401,13 @@ declare namespace SendBird {
378401 onMetaCountersUpdated ( channel : OpenChannel | GroupChannel , metaCounter : Object ) : void ;
379402 onMetaCountersDeleted ( channel : OpenChannel | GroupChannel , metaCounterKeys : Array < string > ) : void ;
380403 onChannelHidden ( channel : GroupChannel ) : void ;
381- onReactionUpdated ( channel : OpenChannel | GroupChannel , reactionEvent : ReactionEvent ) : void ;
404+ onReactionUpdated ( channel : OpenChannel | GroupChannel , event : ReactionEvent ) : void ;
382405 onMentionReceived ( channel : OpenChannel | GroupChannel , message : AdminMessage | UserMessage | FileMessage ) : void ;
383- onThreadInfoUpdated ( channel : OpenChannel | GroupChannel , threadInfoUpdateEvent : ThreadInfoUpdateEvent ) : void ;
406+ onThreadInfoUpdated ( channel : OpenChannel | GroupChannel , event : ThreadInfoUpdateEvent ) : void ;
384407 onChannelMemberCountChanged ( channels : Array < GroupChannel > ) : void ;
385408 onChannelParticipantCountChanged ( channels : Array < OpenChannel > ) : void ;
409+ onPollUpdated ( event : PollUpdateEvent ) : void ;
410+ onPollVoted ( event : PollVoteEvent ) : void ;
386411 }
387412
388413 interface ConnectionHandlerStatic {
@@ -433,7 +458,7 @@ declare namespace SendBird {
433458 params : ThreadedMessageListParams ,
434459 callback ?: messageListCallback
435460 ) : Promise < Object > ;
436- applyThreadInfoUpdateEvent ( threadInfoUpdateEvent : ThreadInfoUpdateEvent ) : boolean ;
461+ applyThreadInfoUpdateEvent ( event : ThreadInfoUpdateEvent ) : boolean ;
437462
438463 /**
439464 * @deprecated
@@ -478,19 +503,6 @@ declare namespace SendBird {
478503 emojiCategories : Array < EmojiCategory > ;
479504 }
480505
481- interface Plugin {
482- type : string ;
483- vendor : string ;
484- detail : { } ;
485- }
486-
487- interface AppleCriticalAlertOptions {
488- name : string ;
489- volume : number ;
490-
491- serialize ( ) : Object ;
492- }
493-
494506 interface UserMessageParams {
495507 new ( ) : UserMessageParams ;
496508 message : string ;
@@ -528,6 +540,8 @@ declare namespace SendBird {
528540 messageSurvivalSeconds : number ;
529541 plugins : Array < Plugin > ;
530542 isResendable ( ) : boolean ;
543+ applyPollUpdateEvent ( event : PollUpdateEvent ) ;
544+ applyPollVoteEvent ( event : PollVoteEvent ) ;
531545 }
532546 interface UserMessageStatic {
533547 buildFromSerializedData ( serializedObject : Object ) : UserMessage ;
@@ -586,8 +600,10 @@ declare namespace SendBird {
586600 channelType : string ;
587601 messageId : number ;
588602 includeMetaArray : boolean ;
603+ includeReactions : boolean ;
589604 includeParentMessageText : boolean ;
590605 includeThreadInfo : boolean ;
606+ includePollDetails : boolean ;
591607 }
592608 interface MessageListParams {
593609 new ( ) : MessageListParams ;
@@ -612,6 +628,7 @@ declare namespace SendBird {
612628 includeParentMessageText : boolean ;
613629 includeThreadInfo : boolean ;
614630 showSubchannelMessagesOnly : boolean ;
631+ includePollDetails : boolean ;
615632 }
616633 interface ThreadedMessageListParams {
617634 new ( ) : ThreadedMessageListParams ;
@@ -633,6 +650,7 @@ declare namespace SendBird {
633650 includeReaction : boolean ;
634651 includeReactions : boolean ;
635652 includeParentMessageText : boolean ;
653+ includePollDetails : boolean ;
636654 }
637655 interface MessageChangeLogsParams {
638656 new ( ) : MessageChangeLogsParams ;
@@ -643,8 +661,9 @@ declare namespace SendBird {
643661 includeReaction : boolean ;
644662 includeReactions : boolean ;
645663 includeReplies : boolean ;
646- includeParentMessageText : string ;
664+ includeParentMessageText : boolean ;
647665 includeThreadInfo : boolean ;
666+ includePollDetails : boolean ;
648667 }
649668
650669 interface ThumbnailObject {
@@ -716,7 +735,7 @@ declare namespace SendBird {
716735 complete : ( error : SendBirdError ) => void ;
717736 } ;
718737 type messageCallback = ( message : UserMessage | FileMessage | AdminMessage , error : SendBirdError ) => void ;
719- type reactionEventCallback = ( reactionEvent : ReactionEvent , error : SendBirdError ) => void ;
738+ type reactionEventCallback = ( event : ReactionEvent , error : SendBirdError ) => void ;
720739 type cancelUploadingFileMessageCallback = ( isSuccess : boolean , error : SendBirdError ) => void ;
721740 type fileUploadprogressHandler = ( event : ProgressEvent ) => void ;
722741 type messageChangeLogs = {
@@ -807,6 +826,9 @@ declare namespace SendBird {
807826 createMessageListQuery ( ) : MessageListQuery ;
808827 createPreviousMessageListQuery ( ) : PreviousMessageListQuery ;
809828
829+ createPollListQuery ( ) : PollListQuery ;
830+ createPollVoterListQuery ( pollId : number , optionId : number ) : PollVoterListQuery ;
831+
810832 /**
811833 * @deprecated since version v3.0.123, please use {@link getMessagesByTimestamp()} instead
812834 */
@@ -1522,6 +1544,7 @@ declare namespace SendBird {
15221544 includeParentMessageText : boolean ;
15231545 includeThreadInfo : boolean ;
15241546 showSubchannelMessagesOnly : boolean ;
1547+ includePollDetails : boolean ;
15251548
15261549 load ( limit : number , reverse : boolean , messageType ?: number | string , callback ?: messageListCallback ) : Array < UserMessage | FileMessage | AdminMessage > ;
15271550 load ( callback ?: messageListCallback ) : Array < UserMessage | FileMessage | AdminMessage > ;
@@ -1890,6 +1913,138 @@ declare namespace SendBird {
18901913 alt : string ;
18911914 }
18921915
1916+ interface Plugin {
1917+ type : string ;
1918+ vendor : string ;
1919+ detail : { } ;
1920+ }
1921+
1922+ interface AppleCriticalAlertOptions {
1923+ name : string ;
1924+ volume : number ;
1925+
1926+ serialize ( ) : Object ;
1927+ }
1928+
1929+ /**
1930+ * @deprecated
1931+ */
1932+ type pollErrorLastCallback = ( poll : Poll , error : SendBirdError ) => void ;
1933+ type pollErrorFirstCallback = ( error : SendBirdError , poll : Poll ) => void ;
1934+ type pollCallback = pollErrorFirstCallback | pollErrorLastCallback ;
1935+ /**
1936+ * @deprecated
1937+ */
1938+ type pollOptionErrorLastCallback = ( option : PollOption , error : SendBirdError ) => void ;
1939+ type pollOptionErrorFirstCallback = ( error : SendBirdError , option : PollOption ) => void ;
1940+ type pollOptionCallback = pollOptionErrorFirstCallback | pollOptionErrorLastCallback ;
1941+ /**
1942+ * @deprecated
1943+ */
1944+ type pollListQueryErrorLastCallback = ( polls : Array < Poll > , error : SendBirdError ) => void ;
1945+ type pollListQueryErrorFirstCallback = ( error : SendBirdError , polls : Array < Poll > ) => void ;
1946+ type pollListQueryCallback = pollListQueryErrorFirstCallback | pollListQueryErrorLastCallback ;
1947+
1948+ interface PollStatic {
1949+ Status : PollStatus ;
1950+
1951+ get ( params : PollRetrievalParams , callback ?: pollCallback ) : Promise < Poll > ;
1952+ create ( pollParams : PollParams , callback ?: pollCallback ) : Promise < Poll > ;
1953+ }
1954+ interface Poll {
1955+ id : number ;
1956+ title : string ;
1957+ details : PollDetails ;
1958+
1959+ update ( pollParams : PollParams , callback ?: pollCallback ) : Promise < Poll > ;
1960+ delete ( callback ?: voidCallback ) : Promise < void > ;
1961+ addOption ( channelUrl : string , text : string , callback ?: pollCallback ) : Promise < Poll > ;
1962+ vote ( channelUrl : string , optionIds : Array < number > , callback ?: pollCallback ) : Promise < Poll > ;
1963+ close ( callback ?: pollCallback ) : Promise < Poll > ;
1964+ }
1965+ interface PollDetails {
1966+ options : Array < PollOption > ;
1967+ data : object ;
1968+ isAnonymous : boolean ;
1969+ allowUserSuggestion : boolean ;
1970+ allowMultipleVotes : boolean ;
1971+ closeAt : number ;
1972+ voterCount : number ;
1973+ status : PollStatus [ keyof PollStatus ] ;
1974+ createdBy : string ;
1975+ createdAt : number ;
1976+ updatedAt : number ;
1977+ }
1978+ interface PollOptionStatic {
1979+ get ( channelUrl : string , pollId : number , optionId : number , callback ?: pollOptionCallback ) : Promise < PollOption > ;
1980+ }
1981+ interface PollOption {
1982+ pollId : number ;
1983+ id : number ;
1984+ text : string ;
1985+ voteCount : number ;
1986+ partialVoters : User [ ] ;
1987+ createdBy : string ;
1988+ createdAt : number ;
1989+ updatedAt : number ;
1990+
1991+ update ( text : string , callback ?: pollCallback ) : Promise < Poll > ;
1992+ delete ( callback ?: voidCallback ) : Promise < void > ;
1993+ }
1994+
1995+ interface PollParams {
1996+ new ( ) : PollParams ;
1997+
1998+ title : string ;
1999+ options : Array < string > ;
2000+ data ?: string ;
2001+ isAnonymous ?: boolean ;
2002+ allowUserSuggestion ?: boolean ;
2003+ allowMultipleVotes ?: boolean ;
2004+ closeAt ?: number ;
2005+ }
2006+ interface PollRetrievalParams {
2007+ new ( ) : PollRetrievalParams ;
2008+
2009+ channelUrl : string ;
2010+ pollId : number ;
2011+ showPartialVoters ?: boolean ;
2012+ }
2013+
2014+ interface PollListQuery {
2015+ token ?: string ;
2016+ limit ?: number ;
2017+ readonly hasNext : boolean ;
2018+ readonly isLoading : boolean ;
2019+ next ( callback ?: pollListQueryCallback ) : Promise < Array < Poll > > ;
2020+ }
2021+
2022+ interface PollVoterListQuery {
2023+ pollId : number ;
2024+ optionId : number ;
2025+ token ?: string ;
2026+ limit ?: number ;
2027+ readonly hasNext : boolean ;
2028+ readonly isLoading : boolean ;
2029+ next ( callback ?: userListQueryCallback ) : Promise < Array < User > > ;
2030+ }
2031+
2032+ interface PollUpdateEvent {
2033+ new ( ) : PollUpdateEvent ;
2034+ poll : Poll ;
2035+ status : PollStatus [ keyof PollStatus ] ;
2036+ }
2037+ interface PollUpdatedVoteCount {
2038+ optionId : number ;
2039+ voteCount : number ;
2040+ }
2041+ interface PollVoteEvent {
2042+ new ( ) : PollVoteEvent ;
2043+ pollId : number ;
2044+ updatedVoteCounts : Array < PollUpdatedVoteCount > ;
2045+ ts : number ;
2046+ }
2047+
18932048 type groupChannelCallback = ( groupChannel : GroupChannel , error : SendBirdError ) => void ;
18942049 type distinctGroupChannelCallback = ( response : DistinctGroupChannelResponse , error : SendBirdError ) => void ;
18952050 type getPushPreferenceCallback = ( isPushOn : boolean , error : SendBirdError ) => void ;
@@ -2193,7 +2348,7 @@ declare namespace SendBird {
21932348 customTypesFilter : Array < string > ;
21942349 customTypeStartsWithFilter : string ;
21952350 channelUrlsFilter : Array < string > ;
2196- superChannelFilter : 'all' | 'super' | 'nonsuper' ;
2351+ superChannelFilter : 'all' | 'super' | 'nonsuper' | 'broadcast_only' ;
21972352 publicChannelFilter : 'all' | 'public' | 'private' ;
21982353 metadataOrderKeyFilter : string ;
21992354 metadataKey : string ;
@@ -2219,7 +2374,7 @@ declare namespace SendBird {
22192374 channelUrlsFilter : Array < string > ;
22202375 customTypesFilter : Array < string > ;
22212376 customTypeStartsWithFilter : string ;
2222- superChannelFilter : 'all' | 'super' | 'nonsuper' ;
2377+ superChannelFilter : 'all' | 'super' | 'nonsuper' | 'broadcast_only' ;
22232378 membershipFilter : 'all' | 'joined' ;
22242379 metadataOrderKeyFilter : string ;
22252380 metadataKey : string ;
0 commit comments