getstream-ruby 6.1.1 → 7.1.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/README.md +8 -6
- data/lib/getstream_ruby/client.rb +145 -38
- data/lib/getstream_ruby/configuration.rb +110 -30
- data/lib/getstream_ruby/error_mapping.rb +144 -0
- data/lib/getstream_ruby/errors.rb +107 -3
- data/lib/getstream_ruby/generated/common_client.rb +26 -0
- data/lib/getstream_ruby/generated/feed.rb +3 -1
- data/lib/getstream_ruby/generated/feeds_client.rb +3 -1
- data/lib/getstream_ruby/generated/models/async_export_error_event.rb +1 -1
- data/lib/getstream_ruby/generated/models/delete_feeds_batch_request.rb +6 -1
- data/lib/getstream_ruby/generated/models/labels_request.rb +5 -0
- data/lib/getstream_ruby/generated/models/query_bookmarks_request.rb +11 -1
- data/lib/getstream_ruby/generated/models/search_roles_response.rb +36 -0
- data/lib/getstream_ruby/generated/webhook.rb +401 -170
- data/lib/getstream_ruby/version.rb +1 -1
- metadata +48 -4
|
@@ -2,8 +2,112 @@
|
|
|
2
2
|
|
|
3
3
|
module GetStreamRuby
|
|
4
4
|
|
|
5
|
-
class
|
|
6
|
-
class
|
|
7
|
-
|
|
5
|
+
# Base error class for the SDK. Every SDK-raised exception is a subclass.
|
|
6
|
+
class StreamError < StandardError; end
|
|
7
|
+
|
|
8
|
+
# Back-compat alias. The prior base class was `Error`; keep it usable so
|
|
9
|
+
# any existing `rescue GetStreamRuby::Error` clauses keep matching.
|
|
10
|
+
Error = StreamError
|
|
11
|
+
|
|
12
|
+
class ConfigurationError < StreamError; end
|
|
13
|
+
|
|
14
|
+
# Raised on any HTTP 4xx/5xx response. Also raised when an HTTP response is
|
|
15
|
+
# received but its body is not a parseable `APIError` envelope, with `code = 0`
|
|
16
|
+
# and `message = "failed to parse error response"`.
|
|
17
|
+
class ApiError < StreamError
|
|
18
|
+
|
|
19
|
+
attr_reader :status_code, :code, :exception_fields, :unrecoverable,
|
|
20
|
+
:raw_response_body, :more_info, :details
|
|
21
|
+
|
|
22
|
+
def initialize(message:, status_code:, code:, exception_fields: nil,
|
|
23
|
+
unrecoverable: nil, raw_response_body: nil,
|
|
24
|
+
more_info: nil, details: nil)
|
|
25
|
+
super(message)
|
|
26
|
+
@status_code = status_code
|
|
27
|
+
@code = code
|
|
28
|
+
@exception_fields = exception_fields || {}
|
|
29
|
+
@unrecoverable = unrecoverable.nil? ? false : unrecoverable
|
|
30
|
+
@raw_response_body = raw_response_body || ''
|
|
31
|
+
@more_info = more_info
|
|
32
|
+
@details = details
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Raised on HTTP 429. Adds parsed `Retry-After` as Float seconds, or nil when
|
|
38
|
+
# the header is absent or unparseable. Per RFC 7231, both integer-seconds and
|
|
39
|
+
# HTTP-date forms are supported. Past HTTP-dates clamp to 0.
|
|
40
|
+
class RateLimitError < ApiError
|
|
41
|
+
|
|
42
|
+
attr_reader :retry_after
|
|
43
|
+
|
|
44
|
+
def initialize(retry_after: nil, **kwargs)
|
|
45
|
+
super(**kwargs)
|
|
46
|
+
@retry_after = retry_after
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Allowed values for `TransportError#error_type`.
|
|
52
|
+
TRANSPORT_ERROR_TYPES = %w[
|
|
53
|
+
connection_reset
|
|
54
|
+
timeout
|
|
55
|
+
dns_failure
|
|
56
|
+
tls_handshake_failed
|
|
57
|
+
unknown
|
|
58
|
+
].freeze
|
|
59
|
+
|
|
60
|
+
# Raised when no HTTP response is received: connection reset, timeout, TLS
|
|
61
|
+
# handshake failure, DNS failure. Always raised inside the matching `rescue`
|
|
62
|
+
# block so Ruby auto-sets `Exception#cause` to the underlying Faraday error.
|
|
63
|
+
class TransportError < StreamError
|
|
64
|
+
|
|
65
|
+
attr_reader :error_type
|
|
66
|
+
|
|
67
|
+
def initialize(message = nil, error_type: 'unknown')
|
|
68
|
+
super(message)
|
|
69
|
+
@error_type = error_type
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Raised by `Client#wait_for_task` when an async task finishes with
|
|
75
|
+
# status="failed". Carries the populated `ErrorResult` fields.
|
|
76
|
+
class TaskError < StreamError
|
|
77
|
+
|
|
78
|
+
attr_reader :task_id, :error_type, :description, :stack_trace, :version
|
|
79
|
+
|
|
80
|
+
def initialize(task_id:, error_type:, description:,
|
|
81
|
+
stack_trace: nil, version: nil)
|
|
82
|
+
super(description)
|
|
83
|
+
@task_id = task_id
|
|
84
|
+
@error_type = error_type
|
|
85
|
+
@description = description
|
|
86
|
+
@stack_trace = stack_trace
|
|
87
|
+
@version = version
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Deprecated alias for ApiError. Will be removed in v9.0.
|
|
93
|
+
# Implemented via `const_missing` so the first access emits a `Kernel.warn`
|
|
94
|
+
# once-only and the constant is cached afterwards (no per-rescue noise).
|
|
95
|
+
@apierror_alias_warned = false
|
|
96
|
+
|
|
97
|
+
def self.const_missing(name)
|
|
98
|
+
if name == :APIError
|
|
99
|
+
unless @apierror_alias_warned
|
|
100
|
+
Kernel.warn(
|
|
101
|
+
'[DEPRECATION] GetStreamRuby::APIError is renamed to ' \
|
|
102
|
+
'GetStreamRuby::ApiError. The old constant will be removed in v9.0.',
|
|
103
|
+
)
|
|
104
|
+
@apierror_alias_warned = true
|
|
105
|
+
end
|
|
106
|
+
const_set(:APIError, ApiError)
|
|
107
|
+
ApiError
|
|
108
|
+
else
|
|
109
|
+
super
|
|
110
|
+
end
|
|
111
|
+
end
|
|
8
112
|
|
|
9
113
|
end
|
|
@@ -981,6 +981,32 @@ module GetStream
|
|
|
981
981
|
)
|
|
982
982
|
end
|
|
983
983
|
|
|
984
|
+
# Searches mentionable roles (user-assignable + channel-assignable, built-in and custom) by name prefix for autocomplete
|
|
985
|
+
#
|
|
986
|
+
# @param query [String]
|
|
987
|
+
# @param limit [Integer]
|
|
988
|
+
# @param name_gt [String]
|
|
989
|
+
# @param role_type [String]
|
|
990
|
+
# @param include_global_roles [Boolean]
|
|
991
|
+
# @return [Models::SearchRolesResponse]
|
|
992
|
+
def search_roles(query, limit = nil, name_gt = nil, role_type = nil, include_global_roles = nil)
|
|
993
|
+
path = '/api/v2/roles/search'
|
|
994
|
+
# Build query parameters
|
|
995
|
+
query_params = {}
|
|
996
|
+
query_params['query'] = query unless query.nil?
|
|
997
|
+
query_params['limit'] = limit unless limit.nil?
|
|
998
|
+
query_params['name_gt'] = name_gt unless name_gt.nil?
|
|
999
|
+
query_params['role_type'] = role_type unless role_type.nil?
|
|
1000
|
+
query_params['include_global_roles'] = include_global_roles unless include_global_roles.nil?
|
|
1001
|
+
|
|
1002
|
+
# Make the API request
|
|
1003
|
+
@client.make_request(
|
|
1004
|
+
:get,
|
|
1005
|
+
path,
|
|
1006
|
+
query_params: query_params
|
|
1007
|
+
)
|
|
1008
|
+
end
|
|
1009
|
+
|
|
984
1010
|
# Deletes custom role
|
|
985
1011
|
#
|
|
986
1012
|
# @param name [String]
|
|
@@ -17,11 +17,13 @@ module GetStream
|
|
|
17
17
|
# Delete a single feed by its ID
|
|
18
18
|
#
|
|
19
19
|
# @param hard_delete [Boolean]
|
|
20
|
+
# @param purge_user_activities [Boolean]
|
|
20
21
|
# @return [Models::DeleteFeedResponse]
|
|
21
|
-
def delete_feed(hard_delete = nil)
|
|
22
|
+
def delete_feed(hard_delete = nil, purge_user_activities = nil)
|
|
22
23
|
# Build query parameters
|
|
23
24
|
query_params = {}
|
|
24
25
|
query_params['hard_delete'] = hard_delete unless hard_delete.nil?
|
|
26
|
+
query_params['purge_user_activities'] = purge_user_activities unless purge_user_activities.nil?
|
|
25
27
|
|
|
26
28
|
# Delegate to the FeedsClient
|
|
27
29
|
@client.feeds.delete_feed(@feed_group_id, @feed_id, query_params)
|
|
@@ -992,8 +992,9 @@ module GetStream
|
|
|
992
992
|
# @param feed_group_id [String]
|
|
993
993
|
# @param feed_id [String]
|
|
994
994
|
# @param hard_delete [Boolean]
|
|
995
|
+
# @param purge_user_activities [Boolean]
|
|
995
996
|
# @return [Models::DeleteFeedResponse]
|
|
996
|
-
def delete_feed(feed_group_id, feed_id, hard_delete = nil)
|
|
997
|
+
def delete_feed(feed_group_id, feed_id, hard_delete = nil, purge_user_activities = nil)
|
|
997
998
|
path = '/api/v2/feeds/feed_groups/{feed_group_id}/feeds/{feed_id}'
|
|
998
999
|
# Replace path parameters
|
|
999
1000
|
path = path.gsub('{feed_group_id}', feed_group_id.to_s)
|
|
@@ -1001,6 +1002,7 @@ module GetStream
|
|
|
1001
1002
|
# Build query parameters
|
|
1002
1003
|
query_params = {}
|
|
1003
1004
|
query_params['hard_delete'] = hard_delete unless hard_delete.nil?
|
|
1005
|
+
query_params['purge_user_activities'] = purge_user_activities unless purge_user_activities.nil?
|
|
1004
1006
|
|
|
1005
1007
|
# Make the API request
|
|
1006
1008
|
@client.make_request(
|
|
@@ -43,7 +43,7 @@ module GetStream
|
|
|
43
43
|
@started_at = attributes[:started_at] || attributes['started_at']
|
|
44
44
|
@task_id = attributes[:task_id] || attributes['task_id']
|
|
45
45
|
@custom = attributes[:custom] || attributes['custom']
|
|
46
|
-
@type = attributes[:type] || attributes['type'] || "export.
|
|
46
|
+
@type = attributes[:type] || attributes['type'] || "export.bulk_image_moderation.error"
|
|
47
47
|
@received_at = attributes[:received_at] || attributes['received_at'] || nil
|
|
48
48
|
end
|
|
49
49
|
|
|
@@ -15,19 +15,24 @@ module GetStream
|
|
|
15
15
|
# @!attribute hard_delete
|
|
16
16
|
# @return [Boolean] Whether to permanently delete the feeds instead of soft delete
|
|
17
17
|
attr_accessor :hard_delete
|
|
18
|
+
# @!attribute purge_user_activities
|
|
19
|
+
# @return [Boolean] When hard-deleting, also fully delete activities authored by each feed's owner from every other feed those activities were fanned out to. Default false preserves existing fan-out. Requires 'hard_delete' to be true; the request is rejected otherwise. Feeds with no recorded owner (created_by_id is empty) are silently skipped for the purge step — owner-matching against an empty string is a safety guard, not a wildcard.
|
|
20
|
+
attr_accessor :purge_user_activities
|
|
18
21
|
|
|
19
22
|
# Initialize with attributes
|
|
20
23
|
def initialize(attributes = {})
|
|
21
24
|
super(attributes)
|
|
22
25
|
@feeds = attributes[:feeds] || attributes['feeds']
|
|
23
26
|
@hard_delete = attributes[:hard_delete] || attributes['hard_delete'] || nil
|
|
27
|
+
@purge_user_activities = attributes[:purge_user_activities] || attributes['purge_user_activities'] || nil
|
|
24
28
|
end
|
|
25
29
|
|
|
26
30
|
# Override field mappings for JSON serialization
|
|
27
31
|
def self.json_field_mappings
|
|
28
32
|
{
|
|
29
33
|
feeds: 'feeds',
|
|
30
|
-
hard_delete: 'hard_delete'
|
|
34
|
+
hard_delete: 'hard_delete',
|
|
35
|
+
purge_user_activities: 'purge_user_activities'
|
|
31
36
|
}
|
|
32
37
|
end
|
|
33
38
|
end
|
|
@@ -21,6 +21,9 @@ module GetStream
|
|
|
21
21
|
# @!attribute content_type
|
|
22
22
|
# @return [String] Type of content: 'text' (default), 'message', or 'username'. Stored as-sent; only 'username' routes to the username moderation API.
|
|
23
23
|
attr_accessor :content_type
|
|
24
|
+
# @!attribute dry_run
|
|
25
|
+
# @return [Boolean] When true, run moderation and return labels without persisting the result. Useful for one-off checks (e.g. UI testers) that should not be recorded in the stored history.
|
|
26
|
+
attr_accessor :dry_run
|
|
24
27
|
# @!attribute policy
|
|
25
28
|
# @return [String] Optional moderation policy key (max 128 chars)
|
|
26
29
|
attr_accessor :policy
|
|
@@ -35,6 +38,7 @@ module GetStream
|
|
|
35
38
|
@category = attributes[:category] || attributes['category'] || nil
|
|
36
39
|
@content_id = attributes[:content_id] || attributes['content_id'] || nil
|
|
37
40
|
@content_type = attributes[:content_type] || attributes['content_type'] || nil
|
|
41
|
+
@dry_run = attributes[:dry_run] || attributes['dry_run'] || nil
|
|
38
42
|
@policy = attributes[:policy] || attributes['policy'] || nil
|
|
39
43
|
@user_id = attributes[:user_id] || attributes['user_id'] || nil
|
|
40
44
|
end
|
|
@@ -46,6 +50,7 @@ module GetStream
|
|
|
46
50
|
category: 'category',
|
|
47
51
|
content_id: 'content_id',
|
|
48
52
|
content_type: 'content_type',
|
|
53
|
+
dry_run: 'dry_run',
|
|
49
54
|
policy: 'policy',
|
|
50
55
|
user_id: 'user_id'
|
|
51
56
|
}
|
|
@@ -21,12 +21,18 @@ module GetStream
|
|
|
21
21
|
# @!attribute prev
|
|
22
22
|
# @return [String]
|
|
23
23
|
attr_accessor :prev
|
|
24
|
+
# @!attribute user_id
|
|
25
|
+
# @return [String]
|
|
26
|
+
attr_accessor :user_id
|
|
24
27
|
# @!attribute sort
|
|
25
28
|
# @return [Array<SortParamRequest>] Sorting parameters for the query
|
|
26
29
|
attr_accessor :sort
|
|
27
30
|
# @!attribute filter
|
|
28
31
|
# @return [Object] Filters to apply to the query
|
|
29
32
|
attr_accessor :filter
|
|
33
|
+
# @!attribute user
|
|
34
|
+
# @return [UserRequest]
|
|
35
|
+
attr_accessor :user
|
|
30
36
|
|
|
31
37
|
# Initialize with attributes
|
|
32
38
|
def initialize(attributes = {})
|
|
@@ -35,8 +41,10 @@ module GetStream
|
|
|
35
41
|
@limit = attributes[:limit] || attributes['limit'] || nil
|
|
36
42
|
@next = attributes[:next] || attributes['next'] || nil
|
|
37
43
|
@prev = attributes[:prev] || attributes['prev'] || nil
|
|
44
|
+
@user_id = attributes[:user_id] || attributes['user_id'] || nil
|
|
38
45
|
@sort = attributes[:sort] || attributes['sort'] || nil
|
|
39
46
|
@filter = attributes[:filter] || attributes['filter'] || nil
|
|
47
|
+
@user = attributes[:user] || attributes['user'] || nil
|
|
40
48
|
end
|
|
41
49
|
|
|
42
50
|
# Override field mappings for JSON serialization
|
|
@@ -46,8 +54,10 @@ module GetStream
|
|
|
46
54
|
limit: 'limit',
|
|
47
55
|
next: 'next',
|
|
48
56
|
prev: 'prev',
|
|
57
|
+
user_id: 'user_id',
|
|
49
58
|
sort: 'sort',
|
|
50
|
-
filter: 'filter'
|
|
59
|
+
filter: 'filter',
|
|
60
|
+
user: 'user'
|
|
51
61
|
}
|
|
52
62
|
end
|
|
53
63
|
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Code generated by GetStream internal OpenAPI code generator. DO NOT EDIT.
|
|
4
|
+
|
|
5
|
+
module GetStream
|
|
6
|
+
module Generated
|
|
7
|
+
module Models
|
|
8
|
+
#
|
|
9
|
+
class SearchRolesResponse < GetStream::BaseModel
|
|
10
|
+
|
|
11
|
+
# Model attributes
|
|
12
|
+
# @!attribute duration
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :duration
|
|
15
|
+
# @!attribute roles
|
|
16
|
+
# @return [Array<Role>] Matching roles, sorted ascending by name
|
|
17
|
+
attr_accessor :roles
|
|
18
|
+
|
|
19
|
+
# Initialize with attributes
|
|
20
|
+
def initialize(attributes = {})
|
|
21
|
+
super(attributes)
|
|
22
|
+
@duration = attributes[:duration] || attributes['duration']
|
|
23
|
+
@roles = attributes[:roles] || attributes['roles']
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Override field mappings for JSON serialization
|
|
27
|
+
def self.json_field_mappings
|
|
28
|
+
{
|
|
29
|
+
duration: 'duration',
|
|
30
|
+
roles: 'roles'
|
|
31
|
+
}
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|