@@ -27,6 +27,8 @@ type ChannelMember struct {
27
27
InviteAcceptedAt * time.Time `json:"invite_accepted_at,omitempty"`
28
28
InviteRejectedAt * time.Time `json:"invite_rejected_at,omitempty"`
29
29
Role string `json:"role,omitempty"`
30
+ ArchivedAt * time.Time `json:"archived_at,omitempty"`
31
+ PinnedAt * time.Time `json:"pinned_at,omitempty"`
30
32
31
33
CreatedAt time.Time `json:"created_at,omitempty"`
32
34
UpdatedAt time.Time `json:"updated_at,omitempty"`
@@ -855,3 +857,44 @@ func (ch *Channel) Unmute(ctx context.Context, userID string) (*Response, error)
855
857
err := ch .client .makeRequest (ctx , http .MethodPost , "moderation/unmute/channel" , nil , data , & resp )
856
858
return & resp , err
857
859
}
860
+
861
+ type ChannelMemberResponse struct {
862
+ ChannelMember
863
+ Response
864
+ }
865
+
866
+ func (ch * Channel ) Pin (ctx context.Context , userID string ) (* ChannelMemberResponse , error ) {
867
+ if userID == "" {
868
+ return nil , errors .New ("user ID must be not empty" )
869
+ }
870
+
871
+ p := path .Join ("channels" , url .PathEscape (ch .Type ), url .PathEscape (ch .ID ), "members" , url .PathEscape (userID ))
872
+
873
+ data := map [string ]interface {}{
874
+ "set" : map [string ]interface {}{
875
+ "pinned" : true ,
876
+ },
877
+ }
878
+
879
+ resp := & ChannelMemberResponse {}
880
+ err := ch .client .makeRequest (ctx , http .MethodPost , p , nil , data , resp )
881
+ return resp , err
882
+ }
883
+
884
+ func (ch * Channel ) Unpin (ctx context.Context , userID string ) (* ChannelMemberResponse , error ) {
885
+ if userID == "" {
886
+ return nil , errors .New ("user ID must be not empty" )
887
+ }
888
+
889
+ p := path .Join ("channels" , url .PathEscape (ch .Type ), url .PathEscape (ch .ID ), "members" , url .PathEscape (userID ))
890
+
891
+ data := map [string ]interface {}{
892
+ "set" : map [string ]interface {}{
893
+ "pinned" : false ,
894
+ },
895
+ }
896
+
897
+ resp := & ChannelMemberResponse {}
898
+ err := ch .client .makeRequest (ctx , http .MethodPost , p , nil , data , resp )
899
+ return resp , err
900
+ }
0 commit comments