stream-chat-ruby 3.26.2 → 3.27.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 +13 -0
- data/lib/stream-chat/channel.rb +17 -0
- data/lib/stream-chat/client.rb +89 -0
- 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: 4a99c43d6a3163fd4978c76884ae662c86b2651ab15f99fa088f2ef9e8f4126a
|
|
4
|
+
data.tar.gz: b3243d7e83eb1e03e0ed9e270cfa4d439882a67836e04382c4d169e6594f01e1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9f80e08e784f75111e85c56b4cecf159375fc2ffca2eab9d53aa8cd488365a39d9fcef93001351b2ecb0e9d29e900184507fafc067cbfcdab0c92ec331075d86
|
|
7
|
+
data.tar.gz: f3f66091808fdfcaa3980fd33338d94a41afe37631e39b9561cad90c955db4ddc8eca273ae44f30e91e8b84b8577f298f06f0f32f9b7a666537f3176d3f008de
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
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.27.0](https://github.com/GetStream/stream-chat-ruby/compare/v3.26.2...v3.27.0) (2026-10-29)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add scheduled messages support (CHA-5933) ([#221](https://github.com/GetStream/stream-chat-ruby/issues/221)) ([65f5573](https://github.com/GetStream/stream-chat-ruby/commit/65f55738d23fb9e6d011c6eab6b2ded48c129c43))
|
|
11
|
+
* add history window team methods: `set_history_window_teams`, `delete_history_window_teams`, `get_history_window_teams` (CHA-5958) ([#225](https://github.com/GetStream/stream-chat-ruby/issues/225)) ([f581079](https://github.com/GetStream/stream-chat-ruby/commit/f581079f39a5b97c6518320c00bab29c85568936))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Other
|
|
15
|
+
|
|
16
|
+
* run scheduled message specs unconditionally ([#224](https://github.com/GetStream/stream-chat-ruby/issues/224)) ([b7352bf](https://github.com/GetStream/stream-chat-ruby/commit/b7352bf5575a1940bbe465f74f7f7a8dbc6ba59d))
|
|
17
|
+
|
|
5
18
|
### [3.26.2](https://github.com/GetStream/stream-chat-ruby/compare/v3.26.1...v3.26.2) (2026-06-30)
|
|
6
19
|
|
|
7
20
|
|
data/lib/stream-chat/channel.rb
CHANGED
|
@@ -55,6 +55,23 @@ module StreamChat
|
|
|
55
55
|
@client.post("#{url}/message", data: payload)
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
+
# Schedules a message to be sent to this channel at a later time.
|
|
59
|
+
#
|
|
60
|
+
# The message is not sent now: it is stored and sent at scheduled_at on
|
|
61
|
+
# behalf of user_id. The response carries `scheduled_message`, whose `id`
|
|
62
|
+
# is used to update, delete or send the scheduled message now.
|
|
63
|
+
#
|
|
64
|
+
# @param [StringKeyHash] message The message to send
|
|
65
|
+
# @param [String] user_id The ID of the user the message is sent as
|
|
66
|
+
# @param [DateTime, Time, String] scheduled_at When to send the message
|
|
67
|
+
# (at least 1 minute and at most the app's maximum lead time from now)
|
|
68
|
+
# @param [Hash] options Additional SendMessage options, e.g. skip_push
|
|
69
|
+
# @return [StreamChat::StreamResponse]
|
|
70
|
+
sig { params(message: StringKeyHash, user_id: String, scheduled_at: T.any(DateTime, Time, String), options: T.untyped).returns(StreamChat::StreamResponse) }
|
|
71
|
+
def schedule_message(message, user_id, scheduled_at, **options)
|
|
72
|
+
send_message(message, user_id, **options, scheduled_at: StreamChat.normalize_timestamp(scheduled_at))
|
|
73
|
+
end
|
|
74
|
+
|
|
58
75
|
# Sends an event on this channel.
|
|
59
76
|
sig { params(event: StringKeyHash, user_id: String).returns(StreamChat::StreamResponse) }
|
|
60
77
|
def send_event(event, user_id)
|
data/lib/stream-chat/client.rb
CHANGED
|
@@ -1222,6 +1222,58 @@ module StreamChat
|
|
|
1222
1222
|
post('reminders/query', data: params)
|
|
1223
1223
|
end
|
|
1224
1224
|
|
|
1225
|
+
# Updates a scheduled message. Schedule a message with Channel#schedule_message.
|
|
1226
|
+
#
|
|
1227
|
+
# At least one of message or scheduled_at is required. The message, when
|
|
1228
|
+
# given, replaces the scheduled message as a whole; the sender stays the
|
|
1229
|
+
# user the message was scheduled for.
|
|
1230
|
+
#
|
|
1231
|
+
# @param id [String] The ID of the scheduled message
|
|
1232
|
+
# @param message [StringKeyHash, nil] The new message
|
|
1233
|
+
# @param scheduled_at [DateTime, Time, String, nil] The new send time
|
|
1234
|
+
# @return [StreamChat::StreamResponse] API response with scheduled_message
|
|
1235
|
+
sig { params(id: String, message: T.nilable(StringKeyHash), scheduled_at: T.nilable(T.any(DateTime, Time, String))).returns(StreamChat::StreamResponse) }
|
|
1236
|
+
def update_scheduled_message(id, message: nil, scheduled_at: nil)
|
|
1237
|
+
data = {}
|
|
1238
|
+
data[:message] = message if message
|
|
1239
|
+
data[:scheduled_at] = StreamChat.normalize_timestamp(scheduled_at) if scheduled_at
|
|
1240
|
+
patch("scheduled_messages/#{id}", data: data)
|
|
1241
|
+
end
|
|
1242
|
+
|
|
1243
|
+
# Deletes a scheduled message: cancels it so it is never sent, or removes a failed one.
|
|
1244
|
+
#
|
|
1245
|
+
# @param id [String] The ID of the scheduled message
|
|
1246
|
+
# @return [StreamChat::StreamResponse] API response with scheduled_message
|
|
1247
|
+
sig { params(id: String).returns(StreamChat::StreamResponse) }
|
|
1248
|
+
def delete_scheduled_message(id)
|
|
1249
|
+
delete("scheduled_messages/#{id}")
|
|
1250
|
+
end
|
|
1251
|
+
|
|
1252
|
+
# Sends a scheduled message right away.
|
|
1253
|
+
#
|
|
1254
|
+
# @param id [String] The ID of the scheduled message
|
|
1255
|
+
# @return [StreamChat::StreamResponse] API response with scheduled_message
|
|
1256
|
+
sig { params(id: String).returns(StreamChat::StreamResponse) }
|
|
1257
|
+
def send_scheduled_message_now(id)
|
|
1258
|
+
post("scheduled_messages/#{id}/send_now")
|
|
1259
|
+
end
|
|
1260
|
+
|
|
1261
|
+
# Queries the scheduled messages of a user across channels: pending ones
|
|
1262
|
+
# first, then failed ones, each by scheduled_at.
|
|
1263
|
+
#
|
|
1264
|
+
# @param user_id [String] The ID of the user whose scheduled messages to query
|
|
1265
|
+
# @param filter [StringKeyHash, nil] Optional filter, e.g. { cid: 'messaging:general', status: ['failed'] }
|
|
1266
|
+
# @param sort [Array<Hash>, nil] Optional sort; only [{ field: 'scheduled_at', direction: 1 }] is supported
|
|
1267
|
+
# @param options [Hash] Additional query options: limit (1 to 100, default 20) and next
|
|
1268
|
+
# @return [StreamChat::StreamResponse] API response with scheduled_messages and next
|
|
1269
|
+
sig { params(user_id: String, filter: T.nilable(StringKeyHash), sort: T.nilable(T::Array[StringKeyHash]), options: T.untyped).returns(StreamChat::StreamResponse) }
|
|
1270
|
+
def query_scheduled_messages(user_id, filter: nil, sort: nil, **options)
|
|
1271
|
+
data = options.merge({ user_id: user_id })
|
|
1272
|
+
data[:filter] = filter if filter
|
|
1273
|
+
data[:sort] = sort if sort
|
|
1274
|
+
post('scheduled_messages/query', data: data)
|
|
1275
|
+
end
|
|
1276
|
+
|
|
1225
1277
|
# Send the mark delivered event for this user, only works if the `delivery_receipts` setting is enabled
|
|
1226
1278
|
#
|
|
1227
1279
|
# @param [StringKeyHash, nil] data The delivery confirmation data
|
|
@@ -1267,6 +1319,43 @@ module StreamChat
|
|
|
1267
1319
|
post('stats/team_usage', data: options)
|
|
1268
1320
|
end
|
|
1269
1321
|
|
|
1322
|
+
# Gives teams full history (the paid tier of the history window).
|
|
1323
|
+
#
|
|
1324
|
+
# Teams without full history keep the app's history window. This endpoint is
|
|
1325
|
+
# server-side only and only for apps with the history window enabled; other
|
|
1326
|
+
# apps get a StreamAPIException with code 17 (HTTP 403).
|
|
1327
|
+
#
|
|
1328
|
+
# @param teams [Array<String>] 1 to 10 teams, each listed once
|
|
1329
|
+
# @return [StreamChat::StreamResponse] Response with the marked teams
|
|
1330
|
+
sig { params(teams: T::Array[String]).returns(StreamChat::StreamResponse) }
|
|
1331
|
+
def set_history_window_teams(teams)
|
|
1332
|
+
post('history_window/teams', data: { teams: teams })
|
|
1333
|
+
end
|
|
1334
|
+
|
|
1335
|
+
# Puts teams back on the app's default history window.
|
|
1336
|
+
#
|
|
1337
|
+
# A team without full history is ignored. This endpoint is server-side only
|
|
1338
|
+
# and only for apps with the history window enabled; other apps get a
|
|
1339
|
+
# StreamAPIException with code 17 (HTTP 403).
|
|
1340
|
+
#
|
|
1341
|
+
# @param teams [Array<String>] 1 to 10 teams, each listed once
|
|
1342
|
+
# @return [StreamChat::StreamResponse] Response with the teams that had full history
|
|
1343
|
+
sig { params(teams: T::Array[String]).returns(StreamChat::StreamResponse) }
|
|
1344
|
+
def delete_history_window_teams(teams)
|
|
1345
|
+
post('history_window/teams/delete', data: { teams: teams })
|
|
1346
|
+
end
|
|
1347
|
+
|
|
1348
|
+
# Returns the app's default history window and the teams with full history.
|
|
1349
|
+
#
|
|
1350
|
+
# This endpoint is server-side only and only for apps with the history window
|
|
1351
|
+
# enabled; other apps get a StreamAPIException with code 17 (HTTP 403).
|
|
1352
|
+
#
|
|
1353
|
+
# @return [StreamChat::StreamResponse] Response with default_window_hours and teams
|
|
1354
|
+
sig { returns(StreamChat::StreamResponse) }
|
|
1355
|
+
def get_history_window_teams
|
|
1356
|
+
get('history_window/teams')
|
|
1357
|
+
end
|
|
1358
|
+
|
|
1270
1359
|
private
|
|
1271
1360
|
|
|
1272
1361
|
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.27.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: 2026-
|
|
11
|
+
date: 2026-10-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|