@@ -43,7 +43,6 @@ import type {
4343 MessageSetType ,
4444 PartialUpdateChannel ,
4545 PartialUpdateMember ,
46- PartialUpdateMemberAPIResponse ,
4746 PinnedMessagePaginationOptions ,
4847 PinnedMessagesSort ,
4948 PollVoteData ,
@@ -417,26 +416,6 @@ export class Channel {
417416 } ) ;
418417 }
419418
420- /**
421- * @deprecated Use `updateMemberPartial` instead
422- * partialUpdateMember - Partial update a member
423- *
424- * @param {string } user_id member user id
425- * @param {PartialUpdateMember } updates
426- *
427- * @return {Promise<ChannelMemberResponse> } Updated member
428- */
429- async partialUpdateMember ( user_id : string , updates : PartialUpdateMember ) {
430- if ( ! user_id ) {
431- throw Error ( 'Please specify the user id' ) ;
432- }
433-
434- return await this . getClient ( ) . api . patch < PartialUpdateMemberAPIResponse > (
435- this . _channelURL ( ) + `/member/${ encodeURIComponent ( user_id ) } ` ,
436- updates ,
437- ) ;
438- }
439-
440419 /**
441420 * sendReaction - Sends a reaction to a message. If offline support is enabled, it will make sure
442421 * that sending the reaction is queued up if it fails due to bad internet conditions and executed
@@ -950,79 +929,47 @@ export class Channel {
950929 * await channel.archive({user_id: userId});
951930 *
952931 */
953- async archive ( opts : { user_id ?: string } = { } ) {
954- const cli = this . getClient ( ) ;
955- const uid = opts . user_id || cli . userId ;
956- if ( ! uid ) {
957- throw Error ( 'A user_id is required for archiving a channel' ) ;
958- }
959- const resp = await this . partialUpdateMember ( uid , { set : { archived : true } } ) ;
932+ async archive ( ) {
933+ const resp = await this . updateMemberPartial ( { set : { archived : true } } ) ;
960934 return resp . channel_member ;
961935 }
962936
963937 /**
964938 * unarchive - unarchives the current channel
965- * @param {{ user_id?: string } } opts user_id if called server side
966939 * @return {Promise<ChannelMemberResponse> } The server response
967940 *
968941 * example:
969942 * await channel.unarchive();
970943 *
971- * example server side:
972- * await channel.unarchive({user_id: userId});
973- *
974944 */
975- async unarchive ( opts : { user_id ?: string } = { } ) {
976- const cli = this . getClient ( ) ;
977- const uid = opts . user_id || cli . userId ;
978- if ( ! uid ) {
979- throw Error ( 'A user_id is required for unarchiving a channel' ) ;
980- }
981- const resp = await this . partialUpdateMember ( uid , { set : { archived : false } } ) ;
945+ async unarchive ( ) {
946+ const resp = await this . updateMemberPartial ( { set : { archived : false } } ) ;
982947 return resp . channel_member ;
983948 }
984949
985950 /**
986951 * pin - pins the current channel
987- * @param {{ user_id?: string } } opts user_id if called server side
988952 * @return {Promise<ChannelMemberResponse> } The server response
989953 *
990954 * example:
991955 * await channel.pin();
992956 *
993- * example server side:
994- * await channel.pin({user_id: userId});
995- *
996957 */
997- async pin ( opts : { user_id ?: string } = { } ) {
998- const cli = this . getClient ( ) ;
999- const uid = opts . user_id || cli . userId ;
1000- if ( ! uid ) {
1001- throw new Error ( 'A user_id is required for pinning a channel' ) ;
1002- }
1003- const resp = await this . partialUpdateMember ( uid , { set : { pinned : true } } ) ;
958+ async pin ( ) {
959+ const resp = await this . updateMemberPartial ( { set : { pinned : true } } ) ;
1004960 return resp . channel_member ;
1005961 }
1006962
1007963 /**
1008964 * unpin - unpins the current channel
1009- * @param {{ user_id?: string } } opts user_id if called server side
1010965 * @return {Promise<ChannelMemberResponse> } The server response
1011966 *
1012967 * example:
1013968 * await channel.unpin();
1014969 *
1015- * example server side:
1016- * await channel.unpin({user_id: userId});
1017- *
1018970 */
1019- async unpin ( opts : { user_id ?: string } = { } ) {
1020- const cli = this . getClient ( ) ;
1021- const uid = opts . user_id || cli . userId ;
1022- if ( ! uid ) {
1023- throw new Error ( 'A user_id is required for unpinning a channel' ) ;
1024- }
1025- const resp = await this . partialUpdateMember ( uid , { set : { pinned : false } } ) ;
971+ async unpin ( ) {
972+ const resp = await this . updateMemberPartial ( { set : { pinned : false } } ) ;
1026973 return resp . channel_member ;
1027974 }
1028975
@@ -1319,13 +1266,13 @@ export class Channel {
13191266 /**
13201267 * getPinnedMessages - List list pinned messages of the channel
13211268 *
1322- * @param {PinnedMessagePaginationOptions & { user?: UserResponse; user_id?: string } } options Pagination params, ie {limit:10, id_lte: 10}
1269+ * @param {PinnedMessagePaginationOptions } options Pagination params, ie {limit:10, id_lte: 10}
13231270 * @param {PinnedMessagesSort } sort defines sorting direction of pinned messages
13241271 *
13251272 * @return {Promise<GetRepliesAPIResponse> } A response with a list of messages
13261273 */
13271274 async getPinnedMessages (
1328- options : PinnedMessagePaginationOptions & { user ?: UserResponse ; user_id ?: string } ,
1275+ options : PinnedMessagePaginationOptions ,
13291276 sort : PinnedMessagesSort = [ ] ,
13301277 ) {
13311278 return await this . getClient ( ) . api . get < GetRepliesAPIResponse > (
0 commit comments