stream-chat-ruby 2.21.0 → 2.22.2
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 +23 -0
- data/Gemfile +1 -0
- data/README.md +2 -2
- data/lib/stream-chat/channel.rb +93 -41
- data/lib/stream-chat/client.rb +323 -101
- data/lib/stream-chat/errors.rb +7 -8
- data/lib/stream-chat/stream_rate_limits.rb +4 -5
- data/lib/stream-chat/stream_response.rb +4 -5
- data/lib/stream-chat/types.rb +0 -1
- data/lib/stream-chat/util.rb +1 -2
- data/lib/stream-chat/version.rb +1 -1
- data/stream-chat.gemspec +1 -0
- metadata +16 -2
data/lib/stream-chat/client.rb
CHANGED
@@ -22,7 +22,6 @@ module StreamChat
|
|
22
22
|
|
23
23
|
class Client
|
24
24
|
extend T::Sig
|
25
|
-
T::Configuration.default_checked_level = :never
|
26
25
|
# For now we disable runtime type checks.
|
27
26
|
# We will enable it with a major bump in the future,
|
28
27
|
# but for now, let's just run a static type check.
|
@@ -30,13 +29,13 @@ module StreamChat
|
|
30
29
|
DEFAULT_BASE_URL = 'https://chat.stream-io-api.com'
|
31
30
|
DEFAULT_TIMEOUT = 6.0
|
32
31
|
|
33
|
-
sig { returns(String) }
|
32
|
+
T::Sig::WithoutRuntime.sig { returns(String) }
|
34
33
|
attr_reader :api_key
|
35
34
|
|
36
|
-
sig { returns(String) }
|
35
|
+
T::Sig::WithoutRuntime.sig { returns(String) }
|
37
36
|
attr_reader :api_secret
|
38
37
|
|
39
|
-
sig { returns(Faraday::Connection) }
|
38
|
+
T::Sig::WithoutRuntime.sig { returns(Faraday::Connection) }
|
40
39
|
attr_reader :conn
|
41
40
|
|
42
41
|
# initializes a Stream Chat API Client
|
@@ -49,7 +48,7 @@ module StreamChat
|
|
49
48
|
# @example initialized the client with a timeout setting
|
50
49
|
# StreamChat::Client.new('my_key', 'my_secret', 3.0)
|
51
50
|
#
|
52
|
-
sig { params(api_key: String, api_secret: String, timeout: T.nilable(T.any(Float, String)), options: T.untyped).void }
|
51
|
+
T::Sig::WithoutRuntime.sig { params(api_key: String, api_secret: String, timeout: T.nilable(T.any(Float, String)), options: T.untyped).void }
|
53
52
|
def initialize(api_key, api_secret, timeout = nil, **options)
|
54
53
|
raise ArgumentError, 'api_key and api_secret are required' if api_key.to_s.empty? || api_secret.to_s.empty?
|
55
54
|
|
@@ -74,23 +73,29 @@ module StreamChat
|
|
74
73
|
# environmental variables. STREAM_CHAT_TIMEOUT and STREAM_CHAT_URL
|
75
74
|
# variables are optional.
|
76
75
|
# @param [StringKeyHash] options extra options
|
77
|
-
sig { params(options: T.untyped).returns(Client) }
|
76
|
+
T::Sig::WithoutRuntime.sig { params(options: T.untyped).returns(Client) }
|
78
77
|
def self.from_env(**options)
|
79
|
-
Client.new(
|
80
|
-
|
81
|
-
ENV
|
82
|
-
**{ base_url: ENV
|
78
|
+
Client.new(ENV.fetch('STREAM_KEY'),
|
79
|
+
ENV.fetch('STREAM_SECRET'),
|
80
|
+
ENV.fetch('STREAM_CHAT_TIMEOUT', DEFAULT_TIMEOUT),
|
81
|
+
**{ base_url: ENV.fetch('STREAM_CHAT_URL', DEFAULT_BASE_URL) }.merge(options))
|
83
82
|
end
|
84
83
|
|
85
84
|
# Sets the underlying Faraday http client.
|
86
85
|
#
|
87
86
|
# @param [client] an instance of Faraday::Connection
|
88
|
-
sig { params(client: Faraday::Connection).void }
|
87
|
+
T::Sig::WithoutRuntime.sig { params(client: Faraday::Connection).void }
|
89
88
|
def set_http_client(client)
|
90
89
|
@conn = client
|
91
90
|
end
|
92
91
|
|
93
|
-
|
92
|
+
# Creates a JWT for a user.
|
93
|
+
#
|
94
|
+
# Stream uses JWT (JSON Web Tokens) to authenticate chat users, enabling them to login.
|
95
|
+
# Knowing whether a user is authorized to perform certain actions is managed
|
96
|
+
# separately via a role based permissions system.
|
97
|
+
# You can set an `exp` (expires at) or `iat` (issued at) claim as well.
|
98
|
+
T::Sig::WithoutRuntime.sig { params(user_id: String, exp: T.nilable(Integer), iat: T.nilable(Integer)).returns(String) }
|
94
99
|
def create_token(user_id, exp = nil, iat = nil)
|
95
100
|
payload = { user_id: user_id }
|
96
101
|
payload['exp'] = exp unless exp.nil?
|
@@ -98,29 +103,42 @@ module StreamChat
|
|
98
103
|
JWT.encode(payload, @api_secret, 'HS256')
|
99
104
|
end
|
100
105
|
|
101
|
-
|
106
|
+
# Updates application settings.
|
107
|
+
T::Sig::WithoutRuntime.sig { params(settings: T.untyped).returns(StreamChat::StreamResponse) }
|
102
108
|
def update_app_settings(**settings)
|
103
109
|
patch('app', data: settings)
|
104
110
|
end
|
105
111
|
|
106
|
-
|
112
|
+
# Returns application settings.
|
113
|
+
T::Sig::WithoutRuntime.sig { returns(StreamChat::StreamResponse) }
|
107
114
|
def get_app_settings
|
108
115
|
get('app')
|
109
116
|
end
|
110
117
|
|
111
|
-
|
118
|
+
# Flags a message.
|
119
|
+
#
|
120
|
+
# Any user is allowed to flag a message. This triggers the message.flagged
|
121
|
+
# webhook event and adds the message to the inbox of your
|
122
|
+
# Stream Dashboard Chat Moderation view.
|
123
|
+
T::Sig::WithoutRuntime.sig { params(id: String, options: T.untyped).returns(StreamChat::StreamResponse) }
|
112
124
|
def flag_message(id, **options)
|
113
125
|
payload = { target_message_id: id }.merge(options)
|
114
126
|
post('moderation/flag', data: payload)
|
115
127
|
end
|
116
128
|
|
117
|
-
|
129
|
+
# Unflags a message.
|
130
|
+
T::Sig::WithoutRuntime.sig { params(id: String, options: T.untyped).returns(StreamChat::StreamResponse) }
|
118
131
|
def unflag_message(id, **options)
|
119
132
|
payload = { target_message_id: id }.merge(options)
|
120
133
|
post('moderation/unflag', data: payload)
|
121
134
|
end
|
122
135
|
|
123
|
-
|
136
|
+
# Queries message flags.
|
137
|
+
#
|
138
|
+
# If you prefer to build your own in app moderation dashboard, rather than use the Stream
|
139
|
+
# dashboard, then the query message flags endpoint lets you get flagged messages. Similar
|
140
|
+
# to other queries in Stream Chat, you can filter the flags using query operators.
|
141
|
+
T::Sig::WithoutRuntime.sig { params(filter_conditions: StringKeyHash, options: T.untyped).returns(StreamChat::StreamResponse) }
|
124
142
|
def query_message_flags(filter_conditions, **options)
|
125
143
|
params = options.merge({
|
126
144
|
filter_conditions: filter_conditions
|
@@ -128,24 +146,49 @@ module StreamChat
|
|
128
146
|
get('moderation/flags/message', params: { payload: params.to_json })
|
129
147
|
end
|
130
148
|
|
131
|
-
|
149
|
+
# Flags a user.
|
150
|
+
T::Sig::WithoutRuntime.sig { params(id: String, options: T.untyped).returns(StreamChat::StreamResponse) }
|
132
151
|
def flag_user(id, **options)
|
133
152
|
payload = { target_user_id: id }.merge(options)
|
134
153
|
post('moderation/flag', data: payload)
|
135
154
|
end
|
136
155
|
|
137
|
-
|
156
|
+
# Unflags a user.
|
157
|
+
T::Sig::WithoutRuntime.sig { params(id: String, options: T.untyped).returns(StreamChat::StreamResponse) }
|
138
158
|
def unflag_user(id, **options)
|
139
159
|
payload = { target_user_id: id }.merge(options)
|
140
160
|
post('moderation/unflag', data: payload)
|
141
161
|
end
|
142
162
|
|
143
|
-
|
163
|
+
# Queries flag reports.
|
164
|
+
T::Sig::WithoutRuntime.sig { params(options: T.untyped).returns(StreamChat::StreamResponse) }
|
165
|
+
def query_flag_reports(**options)
|
166
|
+
data = { filter_conditions: options }
|
167
|
+
post('moderation/reports', data: data)
|
168
|
+
end
|
169
|
+
|
170
|
+
# Sends a flag report review.
|
171
|
+
T::Sig::WithoutRuntime.sig { params(report_id: String, review_result: String, user_id: String, details: T.untyped).returns(StreamChat::StreamResponse) }
|
172
|
+
def review_flag_report(report_id, review_result, user_id, **details)
|
173
|
+
data = {
|
174
|
+
review_result: review_result,
|
175
|
+
user_id: user_id,
|
176
|
+
review_details: details
|
177
|
+
}
|
178
|
+
patch("moderation/reports/#{report_id}", data: data)
|
179
|
+
end
|
180
|
+
|
181
|
+
# Returns a message.
|
182
|
+
T::Sig::WithoutRuntime.sig { params(id: String).returns(StreamChat::StreamResponse) }
|
144
183
|
def get_message(id)
|
145
184
|
get("messages/#{id}")
|
146
185
|
end
|
147
186
|
|
148
|
-
|
187
|
+
# Searches for messages.
|
188
|
+
#
|
189
|
+
# You can enable and/or disable the search indexing on a per channel basis
|
190
|
+
# type through the Stream Dashboard.
|
191
|
+
T::Sig::WithoutRuntime.sig { params(filter_conditions: StringKeyHash, query: T.any(String, StringKeyHash), sort: T.nilable(T::Hash[String, Integer]), options: T.untyped).returns(StreamChat::StreamResponse) }
|
149
192
|
def search(filter_conditions, query, sort: nil, **options)
|
150
193
|
offset = T.cast(options[:offset], T.nilable(Integer))
|
151
194
|
next_value = options[:next]
|
@@ -163,8 +206,23 @@ module StreamChat
|
|
163
206
|
get('search', params: { payload: options.merge(to_merge).to_json })
|
164
207
|
end
|
165
208
|
|
166
|
-
|
209
|
+
# <b>DEPRECATED:</b> Please use <tt>upsert_users</tt> instead.
|
210
|
+
T::Sig::WithoutRuntime.sig { params(users: T::Array[StringKeyHash]).returns(StreamChat::StreamResponse) }
|
167
211
|
def update_users(users)
|
212
|
+
warn '[DEPRECATION] `update_users` is deprecated. Please use `upsert_users` instead.'
|
213
|
+
upsert_users(users)
|
214
|
+
end
|
215
|
+
|
216
|
+
# <b>DEPRECATED:</b> Please use <tt>upsert_user</tt> instead.
|
217
|
+
T::Sig::WithoutRuntime.sig { params(user: StringKeyHash).returns(StreamChat::StreamResponse) }
|
218
|
+
def update_user(user)
|
219
|
+
warn '[DEPRECATION] `update_user` is deprecated. Please use `upsert_user` instead.'
|
220
|
+
upsert_user(user)
|
221
|
+
end
|
222
|
+
|
223
|
+
# Creates or updates users.
|
224
|
+
T::Sig::WithoutRuntime.sig { params(users: T::Array[StringKeyHash]).returns(StreamChat::StreamResponse) }
|
225
|
+
def upsert_users(users)
|
168
226
|
payload = {}
|
169
227
|
users.each do |user|
|
170
228
|
id = user[:id] || user['id']
|
@@ -175,84 +233,116 @@ module StreamChat
|
|
175
233
|
post('users', data: { users: payload })
|
176
234
|
end
|
177
235
|
|
178
|
-
|
179
|
-
|
180
|
-
|
236
|
+
# Creates or updates a user.
|
237
|
+
T::Sig::WithoutRuntime.sig { params(user: StringKeyHash).returns(StreamChat::StreamResponse) }
|
238
|
+
def upsert_user(user)
|
239
|
+
upsert_users([user])
|
181
240
|
end
|
182
241
|
|
183
|
-
|
242
|
+
# Updates multiple users partially.
|
243
|
+
T::Sig::WithoutRuntime.sig { params(updates: T::Array[StringKeyHash]).returns(StreamChat::StreamResponse) }
|
184
244
|
def update_users_partial(updates)
|
185
245
|
patch('users', data: { users: updates })
|
186
246
|
end
|
187
247
|
|
188
|
-
|
248
|
+
# Updates a single user partially.
|
249
|
+
T::Sig::WithoutRuntime.sig { params(update: StringKeyHash).returns(StreamChat::StreamResponse) }
|
189
250
|
def update_user_partial(update)
|
190
251
|
update_users_partial([update])
|
191
252
|
end
|
192
253
|
|
193
|
-
|
254
|
+
# Deletes a user synchronously.
|
255
|
+
T::Sig::WithoutRuntime.sig { params(user_id: String, options: T.untyped).returns(StreamChat::StreamResponse) }
|
194
256
|
def delete_user(user_id, **options)
|
195
257
|
delete("users/#{user_id}", params: options)
|
196
258
|
end
|
197
259
|
|
198
|
-
|
260
|
+
# Deactivates a user.
|
261
|
+
# Deactivated users cannot connect to Stream Chat, and can't send or receive messages.
|
262
|
+
# To reactivate a user, use `reactivate_user` method.
|
263
|
+
T::Sig::WithoutRuntime.sig { params(user_id: String, options: T.untyped).returns(StreamChat::StreamResponse) }
|
199
264
|
def deactivate_user(user_id, **options)
|
200
265
|
post("users/#{user_id}/deactivate", params: options)
|
201
266
|
end
|
202
267
|
|
203
|
-
|
268
|
+
# Reactivates a deactivated user. Use deactivate_user to deactivate a user.
|
269
|
+
T::Sig::WithoutRuntime.sig { params(user_id: String, options: T.untyped).returns(StreamChat::StreamResponse) }
|
204
270
|
def reactivate_user(user_id, **options)
|
205
271
|
post("users/#{user_id}/reactivate", params: options)
|
206
272
|
end
|
207
273
|
|
208
|
-
|
274
|
+
# Exports a user. It exports a user and returns an object
|
275
|
+
# containing all of it's data.
|
276
|
+
T::Sig::WithoutRuntime.sig { params(user_id: String, options: T.untyped).returns(StreamChat::StreamResponse) }
|
209
277
|
def export_user(user_id, **options)
|
210
278
|
get("users/#{user_id}/export", params: options)
|
211
279
|
end
|
212
280
|
|
213
|
-
|
281
|
+
# Bans a user. Users can be banned from an app entirely or from a channel.
|
282
|
+
# When a user is banned, they will not be allowed to post messages until the
|
283
|
+
# ban is removed or expired but will be able to connect to Chat and to channels as before.
|
284
|
+
# To unban a user, use `unban_user` method.
|
285
|
+
T::Sig::WithoutRuntime.sig { params(target_id: String, options: T.untyped).returns(StreamChat::StreamResponse) }
|
214
286
|
def ban_user(target_id, **options)
|
215
287
|
payload = { target_user_id: target_id }.merge(options)
|
216
288
|
post('moderation/ban', data: payload)
|
217
289
|
end
|
218
290
|
|
219
|
-
|
291
|
+
# Unbans a user.
|
292
|
+
# To ban a user, use `ban_user` method.
|
293
|
+
T::Sig::WithoutRuntime.sig { params(target_id: String, options: T.untyped).returns(StreamChat::StreamResponse) }
|
220
294
|
def unban_user(target_id, **options)
|
221
295
|
params = { target_user_id: target_id }.merge(options)
|
222
296
|
delete('moderation/ban', params: params)
|
223
297
|
end
|
224
298
|
|
225
|
-
|
299
|
+
# Shadow ban a user.
|
300
|
+
# When a user is shadow banned, they will still be allowed to post messages,
|
301
|
+
# but any message sent during the will only be visible to the messages author
|
302
|
+
# and invisible to other users of the App.
|
303
|
+
# To remove a shadow ban, use `remove_shadow_ban` method.
|
304
|
+
T::Sig::WithoutRuntime.sig { params(target_id: String, options: T.untyped).returns(StreamChat::StreamResponse) }
|
226
305
|
def shadow_ban(target_id, **options)
|
227
306
|
payload = { target_user_id: target_id, shadow: true }.merge(options)
|
228
307
|
post('moderation/ban', data: payload)
|
229
308
|
end
|
230
309
|
|
231
|
-
|
310
|
+
# Removes a shadow ban of a user.
|
311
|
+
# To shadow ban a user, use `shadow_ban` method.
|
312
|
+
T::Sig::WithoutRuntime.sig { params(target_id: String, options: T.untyped).returns(StreamChat::StreamResponse) }
|
232
313
|
def remove_shadow_ban(target_id, **options)
|
233
314
|
params = { target_user_id: target_id, shadow: true }.merge(options)
|
234
315
|
delete('moderation/ban', params: params)
|
235
316
|
end
|
236
317
|
|
237
|
-
|
318
|
+
# Mutes a user.
|
319
|
+
T::Sig::WithoutRuntime.sig { params(target_id: String, user_id: String).returns(StreamChat::StreamResponse) }
|
238
320
|
def mute_user(target_id, user_id)
|
239
321
|
payload = { target_id: target_id, user_id: user_id }
|
240
322
|
post('moderation/mute', data: payload)
|
241
323
|
end
|
242
324
|
|
243
|
-
|
325
|
+
# Unmutes a user.
|
326
|
+
T::Sig::WithoutRuntime.sig { params(target_id: String, user_id: String).returns(StreamChat::StreamResponse) }
|
244
327
|
def unmute_user(target_id, user_id)
|
245
328
|
payload = { target_id: target_id, user_id: user_id }
|
246
329
|
post('moderation/unmute', data: payload)
|
247
330
|
end
|
248
331
|
|
249
|
-
|
332
|
+
# Marks all messages as read for a user.
|
333
|
+
T::Sig::WithoutRuntime.sig { params(user_id: String).returns(StreamChat::StreamResponse) }
|
250
334
|
def mark_all_read(user_id)
|
251
335
|
payload = { user: { id: user_id } }
|
252
336
|
post('channels/read', data: payload)
|
253
337
|
end
|
254
338
|
|
255
|
-
|
339
|
+
# Pins a message.
|
340
|
+
#
|
341
|
+
# Pinned messages allow users to highlight important messages, make announcements, or temporarily
|
342
|
+
# promote content. Pinning a message is, by default, restricted to certain user roles,
|
343
|
+
# but this is flexible. Each channel can have multiple pinned messages and these can be created
|
344
|
+
# or updated with or without an expiration.
|
345
|
+
T::Sig::WithoutRuntime.sig { params(message_id: String, user_id: String, expiration: T.nilable(String)).returns(StreamChat::StreamResponse) }
|
256
346
|
def pin_message(message_id, user_id, expiration: nil)
|
257
347
|
updates = {
|
258
348
|
set: {
|
@@ -263,7 +353,8 @@ module StreamChat
|
|
263
353
|
update_message_partial(message_id, updates, user_id: user_id)
|
264
354
|
end
|
265
355
|
|
266
|
-
|
356
|
+
# Unpins a message.
|
357
|
+
T::Sig::WithoutRuntime.sig { params(message_id: String, user_id: String).returns(StreamChat::StreamResponse) }
|
267
358
|
def unpin_message(message_id, user_id)
|
268
359
|
updates = {
|
269
360
|
set: {
|
@@ -273,26 +364,39 @@ module StreamChat
|
|
273
364
|
update_message_partial(message_id, updates, user_id: user_id)
|
274
365
|
end
|
275
366
|
|
276
|
-
|
367
|
+
# Updates a message. Fully overwrites a message.
|
368
|
+
# For partial update, use `update_message_partial` method.
|
369
|
+
T::Sig::WithoutRuntime.sig { params(message: StringKeyHash).returns(StreamChat::StreamResponse) }
|
277
370
|
def update_message(message)
|
278
371
|
raise ArgumentError, 'message must have an id' unless message.key? 'id'
|
279
372
|
|
280
373
|
post("messages/#{message['id']}", data: { message: message })
|
281
374
|
end
|
282
375
|
|
283
|
-
|
376
|
+
# Updates a message partially.
|
377
|
+
# A partial update can be used to set and unset specific fields when
|
378
|
+
# it is necessary to retain additional data fields on the object. AKA a patch style update.
|
379
|
+
T::Sig::WithoutRuntime.sig { params(message_id: String, updates: StringKeyHash, user_id: T.nilable(String), options: T.untyped).returns(StreamChat::StreamResponse) }
|
284
380
|
def update_message_partial(message_id, updates, user_id: nil, **options)
|
285
381
|
params = updates.merge(options)
|
286
382
|
params['user'] = { id: user_id } if user_id
|
287
383
|
put("messages/#{message_id}", data: params)
|
288
384
|
end
|
289
385
|
|
290
|
-
|
386
|
+
# Deletes a message.
|
387
|
+
T::Sig::WithoutRuntime.sig { params(message_id: String, options: T.untyped).returns(StreamChat::StreamResponse) }
|
291
388
|
def delete_message(message_id, **options)
|
292
389
|
delete("messages/#{message_id}", params: options)
|
293
390
|
end
|
294
391
|
|
295
|
-
|
392
|
+
# Queries banned users.
|
393
|
+
#
|
394
|
+
# Banned users can be retrieved in different ways:
|
395
|
+
# 1) Using the dedicated query bans endpoint
|
396
|
+
# 2) User Search: you can add the banned:true condition to your search. Please note that
|
397
|
+
# this will only return users that were banned at the app-level and not the ones
|
398
|
+
# that were banned only on channels.
|
399
|
+
T::Sig::WithoutRuntime.sig { params(filter_conditions: StringKeyHash, sort: T.nilable(T::Hash[String, Integer]), options: T.untyped).returns(StreamChat::StreamResponse) }
|
296
400
|
def query_banned_users(filter_conditions, sort: nil, **options)
|
297
401
|
params = options.merge({
|
298
402
|
filter_conditions: filter_conditions,
|
@@ -301,7 +405,9 @@ module StreamChat
|
|
301
405
|
get('query_banned_users', params: { payload: params.to_json })
|
302
406
|
end
|
303
407
|
|
304
|
-
|
408
|
+
# Allows you to search for users and see if they are online/offline.
|
409
|
+
# You can filter and sort on the custom fields you've set for your user, the user id, and when the user was last active.
|
410
|
+
T::Sig::WithoutRuntime.sig { params(filter_conditions: StringKeyHash, sort: T.nilable(T::Hash[String, Integer]), options: T.untyped).returns(StreamChat::StreamResponse) }
|
305
411
|
def query_users(filter_conditions, sort: nil, **options)
|
306
412
|
params = options.merge({
|
307
413
|
filter_conditions: filter_conditions,
|
@@ -310,7 +416,13 @@ module StreamChat
|
|
310
416
|
get('users', params: { payload: params.to_json })
|
311
417
|
end
|
312
418
|
|
313
|
-
|
419
|
+
# Queries channels.
|
420
|
+
#
|
421
|
+
# You can query channels based on built-in fields as well as any custom field you add to channels.
|
422
|
+
# Multiple filters can be combined using AND, OR logical operators, each filter can use its
|
423
|
+
# comparison (equality, inequality, greater than, greater or equal, etc.).
|
424
|
+
# You can find the complete list of supported operators in the query syntax section of the docs.
|
425
|
+
T::Sig::WithoutRuntime.sig { params(filter_conditions: StringKeyHash, sort: T.nilable(T::Hash[String, Integer]), options: T.untyped).returns(StreamChat::StreamResponse) }
|
314
426
|
def query_channels(filter_conditions, sort: nil, **options)
|
315
427
|
data = { state: true, watch: false, presence: false }
|
316
428
|
data = data.merge(options).merge({
|
@@ -320,28 +432,33 @@ module StreamChat
|
|
320
432
|
post('channels', data: data)
|
321
433
|
end
|
322
434
|
|
323
|
-
|
435
|
+
# Creates a new channel type.
|
436
|
+
T::Sig::WithoutRuntime.sig { params(data: StringKeyHash).returns(StreamChat::StreamResponse) }
|
324
437
|
def create_channel_type(data)
|
325
438
|
data['commands'] = ['all'] unless data.key?('commands') || data['commands'].nil? || data['commands'].empty?
|
326
439
|
post('channeltypes', data: data)
|
327
440
|
end
|
328
441
|
|
329
|
-
|
442
|
+
# Returns a channel types.
|
443
|
+
T::Sig::WithoutRuntime.sig { params(channel_type: String).returns(StreamChat::StreamResponse) }
|
330
444
|
def get_channel_type(channel_type)
|
331
445
|
get("channeltypes/#{channel_type}")
|
332
446
|
end
|
333
447
|
|
334
|
-
|
448
|
+
# Returns a list of channel types.
|
449
|
+
T::Sig::WithoutRuntime.sig { returns(StreamChat::StreamResponse) }
|
335
450
|
def list_channel_types
|
336
451
|
get('channeltypes')
|
337
452
|
end
|
338
453
|
|
339
|
-
|
454
|
+
# Updates a channel type.
|
455
|
+
T::Sig::WithoutRuntime.sig { params(channel_type: String, options: T.untyped).returns(StreamChat::StreamResponse) }
|
340
456
|
def update_channel_type(channel_type, **options)
|
341
457
|
put("channeltypes/#{channel_type}", data: options)
|
342
458
|
end
|
343
459
|
|
344
|
-
|
460
|
+
# Deletes a channel type.
|
461
|
+
T::Sig::WithoutRuntime.sig { params(channel_type: String).returns(StreamChat::StreamResponse) }
|
345
462
|
def delete_channel_type(channel_type)
|
346
463
|
delete("channeltypes/#{channel_type}")
|
347
464
|
end
|
@@ -354,31 +471,37 @@ module StreamChat
|
|
354
471
|
#
|
355
472
|
# @return [StreamChat::Channel]
|
356
473
|
#
|
357
|
-
sig { params(channel_type: String, channel_id: T.nilable(String), data: T.nilable(StringKeyHash)).returns(StreamChat::Channel) }
|
474
|
+
T::Sig::WithoutRuntime.sig { params(channel_type: String, channel_id: T.nilable(String), data: T.nilable(StringKeyHash)).returns(StreamChat::Channel) }
|
358
475
|
def channel(channel_type, channel_id: nil, data: nil)
|
359
476
|
StreamChat::Channel.new(self, channel_type, channel_id, data)
|
360
477
|
end
|
361
478
|
|
362
|
-
|
363
|
-
|
479
|
+
# Adds a device to a user.
|
480
|
+
T::Sig::WithoutRuntime.sig { params(device_id: String, push_provider: String, user_id: String, push_provider_name: T.nilable(String)).returns(StreamChat::StreamResponse) }
|
481
|
+
def add_device(device_id, push_provider, user_id, push_provider_name = nil)
|
364
482
|
post('devices', data: {
|
365
483
|
id: device_id,
|
366
484
|
push_provider: push_provider,
|
485
|
+
push_provider_name: push_provider_name,
|
367
486
|
user_id: user_id
|
368
487
|
})
|
369
488
|
end
|
370
489
|
|
371
|
-
|
490
|
+
# Delete a device.
|
491
|
+
T::Sig::WithoutRuntime.sig { params(device_id: String, user_id: String).returns(StreamChat::StreamResponse) }
|
372
492
|
def delete_device(device_id, user_id)
|
373
493
|
delete('devices', params: { id: device_id, user_id: user_id })
|
374
494
|
end
|
375
495
|
|
376
|
-
|
496
|
+
# Returns a list of devices.
|
497
|
+
T::Sig::WithoutRuntime.sig { params(user_id: String).returns(StreamChat::StreamResponse) }
|
377
498
|
def get_devices(user_id)
|
378
499
|
get('devices', params: { user_id: user_id })
|
379
500
|
end
|
380
501
|
|
381
|
-
|
502
|
+
# Get rate limit quotas and usage.
|
503
|
+
# If no params are toggled, all limits for all endpoints are returned.
|
504
|
+
T::Sig::WithoutRuntime.sig { params(server_side: T::Boolean, android: T::Boolean, ios: T::Boolean, web: T::Boolean, endpoints: T::Array[String]).returns(StreamChat::StreamResponse) }
|
382
505
|
def get_rate_limits(server_side: false, android: false, ios: false, web: false, endpoints: [])
|
383
506
|
params = {}
|
384
507
|
params['server_side'] = server_side if server_side
|
@@ -390,94 +513,154 @@ module StreamChat
|
|
390
513
|
get('rate_limits', params: params)
|
391
514
|
end
|
392
515
|
|
393
|
-
|
516
|
+
# Verify the signature added to a webhook event.
|
517
|
+
T::Sig::WithoutRuntime.sig { params(request_body: String, x_signature: String).returns(T::Boolean) }
|
394
518
|
def verify_webhook(request_body, x_signature)
|
395
519
|
signature = OpenSSL::HMAC.hexdigest('SHA256', @api_secret, request_body)
|
396
520
|
signature == x_signature
|
397
521
|
end
|
398
522
|
|
399
|
-
|
523
|
+
# Allows you to send custom events to a connected user.
|
524
|
+
T::Sig::WithoutRuntime.sig { params(user_id: String, event: StringKeyHash).returns(StreamChat::StreamResponse) }
|
400
525
|
def send_user_event(user_id, event)
|
401
526
|
post("users/#{user_id}/event", data: event)
|
402
527
|
end
|
403
528
|
|
404
|
-
|
529
|
+
# Translates an existing message to another language. The source language
|
530
|
+
# is inferred from the user language or detected automatically by analyzing its text.
|
531
|
+
# If possible it is recommended to store the user language. See the documentation.
|
532
|
+
T::Sig::WithoutRuntime.sig { params(message_id: String, language: String).returns(StreamChat::StreamResponse) }
|
405
533
|
def translate_message(message_id, language)
|
406
534
|
post("messages/#{message_id}/translate", data: { language: language })
|
407
535
|
end
|
408
536
|
|
409
|
-
|
537
|
+
# Runs a message command action.
|
538
|
+
T::Sig::WithoutRuntime.sig { params(message_id: String, data: StringKeyHash).returns(StreamChat::StreamResponse) }
|
410
539
|
def run_message_action(message_id, data)
|
411
540
|
post("messages/#{message_id}/action", data: data)
|
412
541
|
end
|
413
542
|
|
414
|
-
|
543
|
+
# Creates a guest user.
|
544
|
+
#
|
545
|
+
# Guest sessions can be created client-side and do not require any server-side authentication.
|
546
|
+
# Support and livestreams are common use cases for guests users because really
|
547
|
+
# often you want a visitor to be able to use chat on your application without (or before)
|
548
|
+
# they have a regular user account.
|
549
|
+
T::Sig::WithoutRuntime.sig { params(user: StringKeyHash).returns(StreamChat::StreamResponse) }
|
415
550
|
def create_guest(user)
|
416
551
|
post('guests', data: user)
|
417
552
|
end
|
418
553
|
|
419
|
-
|
554
|
+
# Returns all blocklists.
|
555
|
+
#
|
556
|
+
# A Block List is a list of words that you can use to moderate chat messages. Stream Chat
|
557
|
+
# comes with a built-in Block List called profanity_en_2020_v1 which contains over a thousand
|
558
|
+
# of the most common profane words.
|
559
|
+
# You can manage your own block lists via the Stream dashboard or APIs to a manage
|
560
|
+
# blocklists and configure your channel types to use them.
|
561
|
+
T::Sig::WithoutRuntime.sig { returns(StreamChat::StreamResponse) }
|
420
562
|
def list_blocklists
|
421
563
|
get('blocklists')
|
422
564
|
end
|
423
565
|
|
424
|
-
|
566
|
+
# Returns a blocklist.
|
567
|
+
#
|
568
|
+
# A Block List is a list of words that you can use to moderate chat messages. Stream Chat
|
569
|
+
# comes with a built-in Block List called profanity_en_2020_v1 which contains over a thousand
|
570
|
+
# of the most common profane words.
|
571
|
+
# You can manage your own block lists via the Stream dashboard or APIs to a manage
|
572
|
+
# blocklists and configure your channel types to use them.
|
573
|
+
T::Sig::WithoutRuntime.sig { params(name: String).returns(StreamChat::StreamResponse) }
|
425
574
|
def get_blocklist(name)
|
426
575
|
get("blocklists/#{name}")
|
427
576
|
end
|
428
577
|
|
429
|
-
|
578
|
+
# Creates a blocklist.
|
579
|
+
#
|
580
|
+
# A Block List is a list of words that you can use to moderate chat messages. Stream Chat
|
581
|
+
# comes with a built-in Block List called profanity_en_2020_v1 which contains over a thousand
|
582
|
+
# of the most common profane words.
|
583
|
+
# You can manage your own block lists via the Stream dashboard or APIs to a manage
|
584
|
+
# blocklists and configure your channel types to use them.
|
585
|
+
T::Sig::WithoutRuntime.sig { params(name: String, words: StringKeyHash).returns(StreamChat::StreamResponse) }
|
430
586
|
def create_blocklist(name, words)
|
431
587
|
post('blocklists', data: { name: name, words: words })
|
432
588
|
end
|
433
589
|
|
434
|
-
|
590
|
+
# Updates a blocklist.
|
591
|
+
#
|
592
|
+
# A Block List is a list of words that you can use to moderate chat messages. Stream Chat
|
593
|
+
# comes with a built-in Block List called profanity_en_2020_v1 which contains over a thousand
|
594
|
+
# of the most common profane words.
|
595
|
+
# You can manage your own block lists via the Stream dashboard or APIs to a manage
|
596
|
+
# blocklists and configure your channel types to use them.
|
597
|
+
T::Sig::WithoutRuntime.sig { params(name: String, words: StringKeyHash).returns(StreamChat::StreamResponse) }
|
435
598
|
def update_blocklist(name, words)
|
436
599
|
put("blocklists/#{name}", data: { words: words })
|
437
600
|
end
|
438
601
|
|
439
|
-
|
602
|
+
# Deletes a blocklist.
|
603
|
+
#
|
604
|
+
# A Block List is a list of words that you can use to moderate chat messages. Stream Chat
|
605
|
+
# comes with a built-in Block List called profanity_en_2020_v1 which contains over a thousand
|
606
|
+
# of the most common profane words.
|
607
|
+
# You can manage your own block lists via the Stream dashboard or APIs to a manage
|
608
|
+
# blocklists and configure your channel types to use them.
|
609
|
+
T::Sig::WithoutRuntime.sig { params(name: String).returns(StreamChat::StreamResponse) }
|
440
610
|
def delete_blocklist(name)
|
441
611
|
delete("blocklists/#{name}")
|
442
612
|
end
|
443
613
|
|
444
|
-
|
614
|
+
# Requests a channel export.
|
615
|
+
#
|
616
|
+
# Channel exports are created asynchronously, you can use the Task ID returned by
|
617
|
+
# the APIs to keep track of the status and to download the final result when it is ready.
|
618
|
+
# Use `get_task` to check the status of the export.
|
619
|
+
T::Sig::WithoutRuntime.sig { params(channels: StringKeyHash, options: T.untyped).returns(StreamChat::StreamResponse) }
|
445
620
|
def export_channels(*channels, **options)
|
446
621
|
post('export_channels', data: { channels: channels, **options })
|
447
622
|
end
|
448
623
|
|
449
|
-
|
624
|
+
# Returns the status of a channel export. It contains the URL to the JSON file.
|
625
|
+
T::Sig::WithoutRuntime.sig { params(task_id: String).returns(StreamChat::StreamResponse) }
|
450
626
|
def get_export_channel_status(task_id)
|
451
627
|
get("export_channels/#{task_id}")
|
452
628
|
end
|
453
629
|
|
454
|
-
|
630
|
+
# Returns the status of a task.
|
631
|
+
T::Sig::WithoutRuntime.sig { params(task_id: String).returns(StreamChat::StreamResponse) }
|
455
632
|
def get_task(task_id)
|
456
633
|
get("tasks/#{task_id}")
|
457
634
|
end
|
458
635
|
|
459
|
-
|
636
|
+
# Delete users asynchronously. Use `get_task` to check the status of the task.
|
637
|
+
T::Sig::WithoutRuntime.sig { params(user_ids: T::Array[String], user: String, messages: T.nilable(StringKeyHash), conversations: T.nilable(String)).returns(StreamChat::StreamResponse) }
|
460
638
|
def delete_users(user_ids, user: SOFT_DELETE, messages: nil, conversations: nil)
|
461
639
|
post('users/delete', data: { user_ids: user_ids, user: user, messages: messages, conversations: conversations })
|
462
640
|
end
|
463
641
|
|
464
|
-
|
642
|
+
# Deletes multiple channels. This is an asynchronous operation and the returned value is a task Id.
|
643
|
+
# You can use `get_task` method to check the status of the task.
|
644
|
+
T::Sig::WithoutRuntime.sig { params(cids: T::Array[String], hard_delete: T::Boolean).returns(StreamChat::StreamResponse) }
|
465
645
|
def delete_channels(cids, hard_delete: false)
|
466
646
|
post('channels/delete', data: { cids: cids, hard_delete: hard_delete })
|
467
647
|
end
|
468
648
|
|
469
|
-
|
649
|
+
# Revoke tokens for an application issued since the given date.
|
650
|
+
T::Sig::WithoutRuntime.sig { params(before: T.any(DateTime, String)).returns(StreamChat::StreamResponse) }
|
470
651
|
def revoke_tokens(before)
|
471
652
|
before = T.cast(before, DateTime).rfc3339 if before.instance_of?(DateTime)
|
472
653
|
update_app_settings({ 'revoke_tokens_issued_before' => before })
|
473
654
|
end
|
474
655
|
|
475
|
-
|
656
|
+
# Revoke tokens for a user issued since the given date.
|
657
|
+
T::Sig::WithoutRuntime.sig { params(user_id: String, before: T.any(DateTime, String)).returns(StreamChat::StreamResponse) }
|
476
658
|
def revoke_user_token(user_id, before)
|
477
659
|
revoke_users_token([user_id], before)
|
478
660
|
end
|
479
661
|
|
480
|
-
|
662
|
+
# Revoke tokens for users issued since.
|
663
|
+
T::Sig::WithoutRuntime.sig { params(user_ids: T::Array[String], before: T.any(DateTime, String)).returns(StreamChat::StreamResponse) }
|
481
664
|
def revoke_users_token(user_ids, before)
|
482
665
|
before = T.cast(before, DateTime).rfc3339 if before.instance_of?(DateTime)
|
483
666
|
|
@@ -493,32 +676,36 @@ module StreamChat
|
|
493
676
|
update_users_partial(updates)
|
494
677
|
end
|
495
678
|
|
496
|
-
sig { params(relative_url: String, params: T.nilable(StringKeyHash), data: T.nilable(StringKeyHash)).returns(StreamChat::StreamResponse) }
|
679
|
+
T::Sig::WithoutRuntime.sig { params(relative_url: String, params: T.nilable(StringKeyHash), data: T.nilable(StringKeyHash)).returns(StreamChat::StreamResponse) }
|
497
680
|
def put(relative_url, params: nil, data: nil)
|
498
681
|
make_http_request(:put, relative_url, params: params, data: data)
|
499
682
|
end
|
500
683
|
|
501
|
-
sig { params(relative_url: String, params: T.nilable(StringKeyHash), data: T.nilable(StringKeyHash)).returns(StreamChat::StreamResponse) }
|
684
|
+
T::Sig::WithoutRuntime.sig { params(relative_url: String, params: T.nilable(StringKeyHash), data: T.nilable(StringKeyHash)).returns(StreamChat::StreamResponse) }
|
502
685
|
def post(relative_url, params: nil, data: nil)
|
503
686
|
make_http_request(:post, relative_url, params: params, data: data)
|
504
687
|
end
|
505
688
|
|
506
|
-
sig { params(relative_url: String, params: T.nilable(StringKeyHash)).returns(StreamChat::StreamResponse) }
|
689
|
+
T::Sig::WithoutRuntime.sig { params(relative_url: String, params: T.nilable(StringKeyHash)).returns(StreamChat::StreamResponse) }
|
507
690
|
def get(relative_url, params: nil)
|
508
691
|
make_http_request(:get, relative_url, params: params)
|
509
692
|
end
|
510
693
|
|
511
|
-
sig { params(relative_url: String, params: T.nilable(StringKeyHash)).returns(StreamChat::StreamResponse) }
|
694
|
+
T::Sig::WithoutRuntime.sig { params(relative_url: String, params: T.nilable(StringKeyHash)).returns(StreamChat::StreamResponse) }
|
512
695
|
def delete(relative_url, params: nil)
|
513
696
|
make_http_request(:delete, relative_url, params: params)
|
514
697
|
end
|
515
698
|
|
516
|
-
sig { params(relative_url: String, params: T.nilable(StringKeyHash), data: T.nilable(StringKeyHash)).returns(StreamChat::StreamResponse) }
|
699
|
+
T::Sig::WithoutRuntime.sig { params(relative_url: String, params: T.nilable(StringKeyHash), data: T.nilable(StringKeyHash)).returns(StreamChat::StreamResponse) }
|
517
700
|
def patch(relative_url, params: nil, data: nil)
|
518
701
|
make_http_request(:patch, relative_url, params: params, data: data)
|
519
702
|
end
|
520
703
|
|
521
|
-
|
704
|
+
# Uploads a file.
|
705
|
+
#
|
706
|
+
# This functionality defaults to using the Stream CDN. If you would like, you can
|
707
|
+
# easily change the logic to upload to your own CDN of choice.
|
708
|
+
T::Sig::WithoutRuntime.sig { params(relative_url: String, file_url: String, user: StringKeyHash, content_type: T.nilable(String)).returns(StreamChat::StreamResponse) }
|
522
709
|
def send_file(relative_url, file_url, user, content_type = nil)
|
523
710
|
url = [@base_url, relative_url].join('/')
|
524
711
|
|
@@ -537,94 +724,129 @@ module StreamChat
|
|
537
724
|
parse_response(response)
|
538
725
|
end
|
539
726
|
|
540
|
-
|
727
|
+
# Check push notification settings.
|
728
|
+
T::Sig::WithoutRuntime.sig { params(push_data: StringKeyHash).returns(StreamChat::StreamResponse) }
|
541
729
|
def check_push(push_data)
|
542
730
|
post('check_push', data: push_data)
|
543
731
|
end
|
544
732
|
|
545
|
-
|
733
|
+
# Check SQS Push settings
|
734
|
+
#
|
735
|
+
# When no parameters are given, the current SQS app settings are used.
|
736
|
+
T::Sig::WithoutRuntime.sig { params(sqs_key: T.nilable(String), sqs_secret: T.nilable(String), sqs_url: T.nilable(String)).returns(StreamChat::StreamResponse) }
|
546
737
|
def check_sqs(sqs_key = nil, sqs_secret = nil, sqs_url = nil)
|
547
738
|
post('check_sqs', data: { sqs_key: sqs_key, sqs_secret: sqs_secret, sqs_url: sqs_url })
|
548
739
|
end
|
549
740
|
|
550
|
-
|
741
|
+
# Creates a new command.
|
742
|
+
T::Sig::WithoutRuntime.sig { params(command: StringKeyHash).returns(StreamChat::StreamResponse) }
|
551
743
|
def create_command(command)
|
552
744
|
post('commands', data: command)
|
553
745
|
end
|
554
746
|
|
555
|
-
|
747
|
+
# Gets a comamnd.
|
748
|
+
T::Sig::WithoutRuntime.sig { params(name: String).returns(StreamChat::StreamResponse) }
|
556
749
|
def get_command(name)
|
557
750
|
get("commands/#{name}")
|
558
751
|
end
|
559
752
|
|
560
|
-
|
753
|
+
# Updates a command.
|
754
|
+
T::Sig::WithoutRuntime.sig { params(name: String, command: StringKeyHash).returns(StreamChat::StreamResponse) }
|
561
755
|
def update_command(name, command)
|
562
756
|
put("commands/#{name}", data: command)
|
563
757
|
end
|
564
758
|
|
565
|
-
|
759
|
+
# Deletes a command.
|
760
|
+
T::Sig::WithoutRuntime.sig { params(name: String).returns(StreamChat::StreamResponse) }
|
566
761
|
def delete_command(name)
|
567
762
|
delete("commands/#{name}")
|
568
763
|
end
|
569
764
|
|
570
|
-
|
765
|
+
# Lists all commands.
|
766
|
+
T::Sig::WithoutRuntime.sig { returns(StreamChat::StreamResponse) }
|
571
767
|
def list_commands
|
572
768
|
get('commands')
|
573
769
|
end
|
574
770
|
|
575
|
-
|
771
|
+
# Lists all permissions.
|
772
|
+
T::Sig::WithoutRuntime.sig { returns(StreamChat::StreamResponse) }
|
576
773
|
def list_permissions
|
577
774
|
get('permissions')
|
578
775
|
end
|
579
776
|
|
580
|
-
|
777
|
+
# Gets a permission.
|
778
|
+
T::Sig::WithoutRuntime.sig { params(id: String).returns(StreamChat::StreamResponse) }
|
581
779
|
def get_permission(id)
|
582
780
|
get("permissions/#{id}")
|
583
781
|
end
|
584
782
|
|
585
|
-
|
783
|
+
# Creates a new permission.
|
784
|
+
T::Sig::WithoutRuntime.sig { params(permission: StringKeyHash).returns(StreamChat::StreamResponse) }
|
586
785
|
def create_permission(permission)
|
587
786
|
post('permissions', data: permission)
|
588
787
|
end
|
589
788
|
|
590
|
-
|
789
|
+
# Updates a permission.
|
790
|
+
T::Sig::WithoutRuntime.sig { params(id: String, permission: StringKeyHash).returns(StreamChat::StreamResponse) }
|
591
791
|
def update_permission(id, permission)
|
592
792
|
put("permissions/#{id}", data: permission)
|
593
793
|
end
|
594
794
|
|
595
|
-
|
795
|
+
# Deletes a permission by id.
|
796
|
+
T::Sig::WithoutRuntime.sig { params(id: String).returns(StreamChat::StreamResponse) }
|
596
797
|
def delete_permission(id)
|
597
798
|
delete("permissions/#{id}")
|
598
799
|
end
|
599
800
|
|
600
|
-
|
801
|
+
# Create a new role.
|
802
|
+
T::Sig::WithoutRuntime.sig { params(name: String).returns(StreamChat::StreamResponse) }
|
601
803
|
def create_role(name)
|
602
804
|
post('roles', data: { name: name })
|
603
805
|
end
|
604
806
|
|
605
|
-
|
807
|
+
# Delete a role by name.
|
808
|
+
T::Sig::WithoutRuntime.sig { params(name: String).returns(StreamChat::StreamResponse) }
|
606
809
|
def delete_role(name)
|
607
810
|
delete("roles/#{name}")
|
608
811
|
end
|
609
812
|
|
610
|
-
|
813
|
+
# List all roles.
|
814
|
+
T::Sig::WithoutRuntime.sig { returns(StreamChat::StreamResponse) }
|
611
815
|
def list_roles
|
612
816
|
get('roles')
|
613
817
|
end
|
614
818
|
|
819
|
+
# Create or update a push provider.
|
820
|
+
T::Sig::WithoutRuntime.sig { params(push_provider: StringKeyHash).returns(StreamChat::StreamResponse) }
|
821
|
+
def upsert_push_provider(push_provider)
|
822
|
+
post('push_providers', data: { push_provider: push_provider })
|
823
|
+
end
|
824
|
+
|
825
|
+
# Delete a push provider by type and name.
|
826
|
+
T::Sig::WithoutRuntime.sig { params(type: String, name: String).returns(StreamChat::StreamResponse) }
|
827
|
+
def delete_push_provider(type, name)
|
828
|
+
delete("push_providers/#{type}/#{name}")
|
829
|
+
end
|
830
|
+
|
831
|
+
# Lists all push providers.
|
832
|
+
T::Sig::WithoutRuntime.sig { returns(StreamChat::StreamResponse) }
|
833
|
+
def list_push_providers
|
834
|
+
get('push_providers')
|
835
|
+
end
|
836
|
+
|
615
837
|
private
|
616
838
|
|
617
|
-
sig { returns(T::Hash[String, String]) }
|
839
|
+
T::Sig::WithoutRuntime.sig { returns(T::Hash[String, String]) }
|
618
840
|
def get_default_params
|
619
841
|
{ api_key: @api_key }
|
620
842
|
end
|
621
843
|
|
622
|
-
sig { returns(String) }
|
844
|
+
T::Sig::WithoutRuntime.sig { returns(String) }
|
623
845
|
def get_user_agent
|
624
846
|
"stream-ruby-client-#{StreamChat::VERSION}"
|
625
847
|
end
|
626
848
|
|
627
|
-
sig { returns(T::Hash[String, String]) }
|
849
|
+
T::Sig::WithoutRuntime.sig { returns(T::Hash[String, String]) }
|
628
850
|
def get_default_headers
|
629
851
|
{
|
630
852
|
'Content-Type': 'application/json',
|
@@ -632,7 +854,7 @@ module StreamChat
|
|
632
854
|
}
|
633
855
|
end
|
634
856
|
|
635
|
-
sig { params(response: Faraday::Response).returns(StreamChat::StreamResponse) }
|
857
|
+
T::Sig::WithoutRuntime.sig { params(response: Faraday::Response).returns(StreamChat::StreamResponse) }
|
636
858
|
def parse_response(response)
|
637
859
|
begin
|
638
860
|
parsed_result = JSON.parse(response.body)
|
@@ -644,7 +866,7 @@ module StreamChat
|
|
644
866
|
StreamResponse.new(parsed_result, response)
|
645
867
|
end
|
646
868
|
|
647
|
-
sig { params(method: Symbol, relative_url: String, params: T.nilable(StringKeyHash), data: T.nilable(StringKeyHash)).returns(StreamChat::StreamResponse) }
|
869
|
+
T::Sig::WithoutRuntime.sig { params(method: Symbol, relative_url: String, params: T.nilable(StringKeyHash), data: T.nilable(StringKeyHash)).returns(StreamChat::StreamResponse) }
|
648
870
|
def make_http_request(method, relative_url, params: nil, data: nil)
|
649
871
|
headers = get_default_headers
|
650
872
|
headers['Authorization'] = @auth_token
|