stream-chat-ruby 3.5.1 → 3.7.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +0 -26
- data/lib/stream-chat/channel.rb +65 -0
- data/lib/stream-chat/client.rb +9 -87
- data/lib/stream-chat/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9d9b7da9ed7b34e26558596b67c8163034c2fb7d15b5f484bd1183aa38a8977
|
4
|
+
data.tar.gz: 3b7a1bd942807c920c10208b64018422dac7893a6fb8432fd390892d594d52a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51087799d97d03e6d4f9530c3e39c9956b279d51d32ecc47fb0dcf242d12ef5c2bf1cccfb25b523d774ba31ff063284c3c013e30be8b8b0c75183648e457c728
|
7
|
+
data.tar.gz: 2fc7f5f3e3c3df330bd24980b5672767982bd2e66166ff245741042cbe1cdc02de2f17eeb55b82e7f60f09f854a5c62b636d28a69789aace2000061faa0234c9
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
4
4
|
|
5
|
+
## [3.7.0](https://github.com/GetStream/stream-chat-ruby/compare/v3.6.0...v3.7.0) (2024-12-09)
|
6
|
+
|
7
|
+
## [3.6.0](https://github.com/GetStream/stream-chat-ruby/compare/v3.5.1...v3.6.0) (2024-05-22)
|
8
|
+
|
9
|
+
|
10
|
+
### Features
|
11
|
+
|
12
|
+
* add test for `notifications_muted` as filter in `query_members` ([#140](https://github.com/GetStream/stream-chat-ruby/issues/140)) ([61102ac](https://github.com/GetStream/stream-chat-ruby/commit/61102ac16783ecfc502d8f7d21435ec64af28436))
|
13
|
+
|
5
14
|
### [3.5.1](https://github.com/GetStream/stream-chat-ruby/compare/v3.5.0...v3.5.1) (2024-04-18)
|
6
15
|
|
7
16
|
## [3.5.0](https://github.com/GetStream/stream-chat-ruby/compare/v3.4.0...v3.5.0) (2023-10-30)
|
data/README.md
CHANGED
@@ -165,32 +165,6 @@ status_response = client.get_export_channel_status(response['task_id'])
|
|
165
165
|
# status_response['status'] == 'pending', 'completed'
|
166
166
|
```
|
167
167
|
|
168
|
-
### Campaigns
|
169
|
-
|
170
|
-
```ruby
|
171
|
-
# Create a user or channel segment
|
172
|
-
client.create_segment({ name: 'test', type: 'user', filter: { uniq: 'a flag on users' } })
|
173
|
-
|
174
|
-
# Create a campaign that uses the segment
|
175
|
-
client.create_campaign({
|
176
|
-
name: 'test',
|
177
|
-
text: 'Hi',
|
178
|
-
sender_id: campaign_sender,
|
179
|
-
segment_id: segment_id,
|
180
|
-
channel_type: 'messaging'
|
181
|
-
})
|
182
|
-
|
183
|
-
# Schedule the campaign
|
184
|
-
client.schedule_campaign(campaign_id, Time.now.to_i)
|
185
|
-
|
186
|
-
# Query the campaign to check the status
|
187
|
-
response = client.query_campaigns(filter_conditions: { id: campaign_id })
|
188
|
-
response['campaigns'][0]['status'] == 'completed'
|
189
|
-
|
190
|
-
# Read sent information
|
191
|
-
client.query_recipients(filter_conditions: { campaign_id: campaign_id })
|
192
|
-
```
|
193
|
-
|
194
168
|
### Rate limits
|
195
169
|
|
196
170
|
```ruby
|
data/lib/stream-chat/channel.rb
CHANGED
@@ -16,6 +16,9 @@ module StreamChat
|
|
16
16
|
sig { returns(String) }
|
17
17
|
attr_reader :channel_type
|
18
18
|
|
19
|
+
sig { returns(String) }
|
20
|
+
attr_reader :cid
|
21
|
+
|
19
22
|
sig { returns(StringKeyHash) }
|
20
23
|
attr_reader :custom_data
|
21
24
|
|
@@ -166,6 +169,68 @@ module StreamChat
|
|
166
169
|
@client.post('moderation/unmute/channel', data: { 'user_id' => user_id, 'channel_cid' => @cid })
|
167
170
|
end
|
168
171
|
|
172
|
+
# Pins a channel for a user.
|
173
|
+
sig { params(user_id: String).returns(StreamChat::StreamResponse) }
|
174
|
+
def pin(user_id)
|
175
|
+
raise StreamChannelException, 'user ID must not be empty' if user_id.empty?
|
176
|
+
|
177
|
+
payload = {
|
178
|
+
set: {
|
179
|
+
pinned: true
|
180
|
+
}
|
181
|
+
}
|
182
|
+
@client.patch("#{url}/member/#{CGI.escape(user_id)}", data: payload)
|
183
|
+
end
|
184
|
+
|
185
|
+
# Unins a channel for a user.
|
186
|
+
sig { params(user_id: String).returns(StreamChat::StreamResponse) }
|
187
|
+
def unpin(user_id)
|
188
|
+
raise StreamChannelException, 'user ID must not be empty' if user_id.empty?
|
189
|
+
|
190
|
+
payload = {
|
191
|
+
set: {
|
192
|
+
pinned: false
|
193
|
+
}
|
194
|
+
}
|
195
|
+
@client.patch("#{url}/member/#{CGI.escape(user_id)}", data: payload)
|
196
|
+
end
|
197
|
+
|
198
|
+
# Archives a channel for a user.
|
199
|
+
sig { params(user_id: String).returns(StreamChat::StreamResponse) }
|
200
|
+
def archive(user_id)
|
201
|
+
raise StreamChannelException, 'user ID must not be empty' if user_id.empty?
|
202
|
+
|
203
|
+
payload = {
|
204
|
+
set: {
|
205
|
+
archived: true
|
206
|
+
}
|
207
|
+
}
|
208
|
+
@client.patch("#{url}/member/#{CGI.escape(user_id)}", data: payload)
|
209
|
+
end
|
210
|
+
|
211
|
+
# Archives a channel for a user.
|
212
|
+
sig { params(user_id: String).returns(StreamChat::StreamResponse) }
|
213
|
+
def unarchive(user_id)
|
214
|
+
raise StreamChannelException, 'user ID must not be empty' if user_id.empty?
|
215
|
+
|
216
|
+
payload = {
|
217
|
+
set: {
|
218
|
+
archived: false
|
219
|
+
}
|
220
|
+
}
|
221
|
+
@client.patch("#{url}/member/#{CGI.escape(user_id)}", data: payload)
|
222
|
+
end
|
223
|
+
|
224
|
+
# Updates a member partially in the channel.
|
225
|
+
sig { params(user_id: String, set: T.nilable(StringKeyHash), unset: T.nilable(T::Array[String])).returns(StreamChat::StreamResponse) }
|
226
|
+
def update_member_partial(user_id, set: nil, unset: nil)
|
227
|
+
raise StreamChannelException, 'user ID must not be empty' if user_id.empty?
|
228
|
+
raise StreamChannelException, 'set or unset is required' if set.nil? && unset.nil?
|
229
|
+
|
230
|
+
payload = { set: set, unset: unset }
|
231
|
+
@client.patch("#{url}/member/#{CGI.escape(user_id)}", data: payload)
|
232
|
+
end
|
233
|
+
|
169
234
|
# Adds members to the channel.
|
170
235
|
sig { params(user_ids: T::Array[String], options: T.untyped).returns(StreamChat::StreamResponse) }
|
171
236
|
def add_members(user_ids, **options)
|
data/lib/stream-chat/client.rb
CHANGED
@@ -258,13 +258,13 @@ module StreamChat
|
|
258
258
|
# Restores a user synchronously.
|
259
259
|
sig { params(user_id: String).returns(StreamChat::StreamResponse) }
|
260
260
|
def restore_user(user_id)
|
261
|
-
post(
|
261
|
+
post('users/restore', data: { user_ids: [user_id] })
|
262
262
|
end
|
263
263
|
|
264
264
|
# Restores users synchronously.
|
265
265
|
sig { params(user_ids: T::Array[String]).returns(StreamChat::StreamResponse) }
|
266
266
|
def restore_users(user_ids)
|
267
|
-
post(
|
267
|
+
post('users/restore', data: { user_ids: user_ids })
|
268
268
|
end
|
269
269
|
|
270
270
|
# Deactivates a user.
|
@@ -681,13 +681,13 @@ module StreamChat
|
|
681
681
|
before = T.cast(before, DateTime).rfc3339 if before.instance_of?(DateTime)
|
682
682
|
|
683
683
|
updates = []
|
684
|
-
user_ids.
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
684
|
+
user_ids.map do |user_id|
|
685
|
+
{
|
686
|
+
'id' => user_id,
|
687
|
+
'set' => {
|
688
|
+
'revoke_tokens_issued_before' => before
|
689
|
+
}
|
690
|
+
}
|
691
691
|
end
|
692
692
|
update_users_partial(updates)
|
693
693
|
end
|
@@ -890,84 +890,6 @@ module StreamChat
|
|
890
890
|
get('imports', params: options)
|
891
891
|
end
|
892
892
|
|
893
|
-
# Creates a campaign.
|
894
|
-
sig { params(campaign: StringKeyHash).returns(StreamChat::StreamResponse) }
|
895
|
-
def create_campaign(campaign)
|
896
|
-
post('campaigns', data: { campaign: campaign })
|
897
|
-
end
|
898
|
-
|
899
|
-
# Queries campaigns similar to query_channels or query_users.
|
900
|
-
sig { params(params: T.untyped).returns(StreamChat::StreamResponse) }
|
901
|
-
def query_campaigns(**params)
|
902
|
-
get('campaigns', params: { payload: params.to_json })
|
903
|
-
end
|
904
|
-
|
905
|
-
# Updates a campaign.
|
906
|
-
sig { params(campaign_id: String, campaign: StringKeyHash).returns(StreamChat::StreamResponse) }
|
907
|
-
def update_campaign(campaign_id, campaign)
|
908
|
-
put("campaigns/#{campaign_id}", data: { campaign: campaign })
|
909
|
-
end
|
910
|
-
|
911
|
-
# Deletes a campaign.
|
912
|
-
sig { params(campaign_id: String).returns(StreamChat::StreamResponse) }
|
913
|
-
def delete_campaign(campaign_id)
|
914
|
-
delete("campaigns/#{campaign_id}")
|
915
|
-
end
|
916
|
-
|
917
|
-
# Schedules a campaign.
|
918
|
-
sig { params(campaign_id: String, scheduled_for: Integer).returns(StreamChat::StreamResponse) }
|
919
|
-
def schedule_campaign(campaign_id, scheduled_for)
|
920
|
-
patch("campaigns/#{campaign_id}/schedule", data: { scheduled_for: scheduled_for })
|
921
|
-
end
|
922
|
-
|
923
|
-
# Stops a campaign.
|
924
|
-
sig { params(campaign_id: String).returns(StreamChat::StreamResponse) }
|
925
|
-
def stop_campaign(campaign_id)
|
926
|
-
patch("campaigns/#{campaign_id}/stop")
|
927
|
-
end
|
928
|
-
|
929
|
-
# Resumes a campaign.
|
930
|
-
sig { params(campaign_id: String).returns(StreamChat::StreamResponse) }
|
931
|
-
def resume_campaign(campaign_id)
|
932
|
-
patch("campaigns/#{campaign_id}/resume")
|
933
|
-
end
|
934
|
-
|
935
|
-
# Tests a campaign.
|
936
|
-
sig { params(campaign_id: String, users: T::Array[StringKeyHash]).returns(StreamChat::StreamResponse) }
|
937
|
-
def test_campaign(campaign_id, users)
|
938
|
-
post("campaigns/#{campaign_id}/test", data: { users: users })
|
939
|
-
end
|
940
|
-
|
941
|
-
# Creates a campaign segment.
|
942
|
-
sig { params(segment: StringKeyHash).returns(StreamChat::StreamResponse) }
|
943
|
-
def create_segment(segment)
|
944
|
-
post('segments', data: { segment: segment })
|
945
|
-
end
|
946
|
-
|
947
|
-
# Queries campaign segments.
|
948
|
-
sig { params(params: T.untyped).returns(StreamChat::StreamResponse) }
|
949
|
-
def query_segments(**params)
|
950
|
-
get('segments', params: { payload: params.to_json })
|
951
|
-
end
|
952
|
-
|
953
|
-
# Updates a campaign segment.
|
954
|
-
sig { params(segment_id: String, segment: StringKeyHash).returns(StreamChat::StreamResponse) }
|
955
|
-
def update_segment(segment_id, segment)
|
956
|
-
put("segments/#{segment_id}", data: { segment: segment })
|
957
|
-
end
|
958
|
-
|
959
|
-
# Deletes a campaign segment.
|
960
|
-
sig { params(segment_id: String).returns(StreamChat::StreamResponse) }
|
961
|
-
def delete_segment(segment_id)
|
962
|
-
delete("segments/#{segment_id}")
|
963
|
-
end
|
964
|
-
|
965
|
-
# Queries campaign recipients.
|
966
|
-
sig { params(params: T.untyped).returns(StreamChat::StreamResponse) }
|
967
|
-
def query_recipients(**params)
|
968
|
-
get('recipients', params: { payload: params.to_json })
|
969
|
-
end
|
970
|
-
|
971
893
|
private
|
972
894
|
|
973
895
|
sig { returns(T::Hash[String, String]) }
|
data/lib/stream-chat/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stream-chat-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- getstream.io
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|