files.com 1.1.621 → 1.1.622

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.
@@ -0,0 +1,123 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class EventDeliveryAttempt
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # int64 - Event Delivery Attempt ID
13
+ def id
14
+ @attributes[:id]
15
+ end
16
+
17
+ # int64 - Event Record ID
18
+ def event_record_id
19
+ @attributes[:event_record_id]
20
+ end
21
+
22
+ # int64 - Event Subscription ID
23
+ def event_subscription_id
24
+ @attributes[:event_subscription_id]
25
+ end
26
+
27
+ # int64 - Event Target ID
28
+ def event_target_id
29
+ @attributes[:event_target_id]
30
+ end
31
+
32
+ # int64 - Workspace ID. 0 means the default workspace or site-wide.
33
+ def workspace_id
34
+ @attributes[:workspace_id]
35
+ end
36
+
37
+ # string - Delivery status.
38
+ def status
39
+ @attributes[:status]
40
+ end
41
+
42
+ # int64 - Number of delivery attempts made.
43
+ def attempt_number
44
+ @attributes[:attempt_number]
45
+ end
46
+
47
+ # int64 - HTTP response code, if applicable.
48
+ def response_code
49
+ @attributes[:response_code]
50
+ end
51
+
52
+ # string - Delivery error message, if applicable.
53
+ def error_message
54
+ @attributes[:error_message]
55
+ end
56
+
57
+ # string - Delivery response body, if applicable.
58
+ def response_body
59
+ @attributes[:response_body]
60
+ end
61
+
62
+ # int64 - Delivery latency in milliseconds.
63
+ def latency_ms
64
+ @attributes[:latency_ms]
65
+ end
66
+
67
+ # date-time - Successful delivery date/time.
68
+ def delivered_at
69
+ @attributes[:delivered_at]
70
+ end
71
+
72
+ # date-time - Most recent attempt date/time.
73
+ def last_attempted_at
74
+ @attributes[:last_attempted_at]
75
+ end
76
+
77
+ # date-time - Next scheduled attempt date/time.
78
+ def next_attempt_at
79
+ @attributes[:next_attempt_at]
80
+ end
81
+
82
+ # date-time - Delivery Attempt create date/time.
83
+ def created_at
84
+ @attributes[:created_at]
85
+ end
86
+
87
+ # Parameters:
88
+ # cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
89
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
90
+ # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `status`, `event_record_id`, `event_target_id` or `workspace_id`.
91
+ # filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `status`, `workspace_id`, `event_record_id` or `event_target_id`. Valid field combinations are `[ workspace_id, status ]`, `[ workspace_id, event_record_id ]` or `[ workspace_id, event_target_id ]`.
92
+ def self.list(params = {}, options = {})
93
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String)
94
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer)
95
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
96
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)
97
+
98
+ List.new(EventDeliveryAttempt, params) do
99
+ Api.send_request("/event_delivery_attempts", :get, params, options)
100
+ end
101
+ end
102
+
103
+ def self.all(params = {}, options = {})
104
+ list(params, options)
105
+ end
106
+
107
+ # Parameters:
108
+ # id (required) - int64 - Event Delivery Attempt ID.
109
+ def self.find(id, params = {}, options = {})
110
+ params ||= {}
111
+ params[:id] = id
112
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
113
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
114
+
115
+ response, options = Api.send_request("/event_delivery_attempts/#{params[:id]}", :get, params, options)
116
+ EventDeliveryAttempt.new(response.data, options)
117
+ end
118
+
119
+ def self.get(id, params = {}, options = {})
120
+ find(id, params, options)
121
+ end
122
+ end
123
+ end
@@ -0,0 +1,133 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class EventRecord
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # int64 - Event Record ID
13
+ def id
14
+ @attributes[:id]
15
+ end
16
+
17
+ # int64 - Workspace ID. 0 means the default workspace or site-wide.
18
+ def workspace_id
19
+ @attributes[:workspace_id]
20
+ end
21
+
22
+ # string - Stable event UUID.
23
+ def event_uuid
24
+ @attributes[:event_uuid]
25
+ end
26
+
27
+ # string - Versioned event type string.
28
+ def event_type
29
+ @attributes[:event_type]
30
+ end
31
+
32
+ # string - Event severity.
33
+ def severity
34
+ @attributes[:severity]
35
+ end
36
+
37
+ # string - Source record type.
38
+ def source_type
39
+ @attributes[:source_type]
40
+ end
41
+
42
+ # int64 - Source record ID.
43
+ def source_id
44
+ @attributes[:source_id]
45
+ end
46
+
47
+ # date-time - Event occurrence date/time.
48
+ def occurred_at
49
+ @attributes[:occurred_at]
50
+ end
51
+
52
+ # string - Human-readable event title.
53
+ def human_title
54
+ @attributes[:human_title]
55
+ end
56
+
57
+ # string - Human-readable event summary.
58
+ def human_summary
59
+ @attributes[:human_summary]
60
+ end
61
+
62
+ # array(object) - Human-readable event detail fields.
63
+ def human_fields
64
+ @attributes[:human_fields]
65
+ end
66
+
67
+ # object - Actor associated with the event.
68
+ def actor
69
+ @attributes[:actor]
70
+ end
71
+
72
+ # array(object) - Resources associated with the event.
73
+ def resources
74
+ @attributes[:resources]
75
+ end
76
+
77
+ # object - Event payload.
78
+ def payload
79
+ @attributes[:payload]
80
+ end
81
+
82
+ # date-time - Event Record create date/time.
83
+ def created_at
84
+ @attributes[:created_at]
85
+ end
86
+
87
+ # Parameters:
88
+ # cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
89
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
90
+ # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `event_type`, `created_at` or `workspace_id`.
91
+ # filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `created_at`, `event_type` or `workspace_id`. Valid field combinations are `[ event_type, created_at ]`, `[ workspace_id, created_at ]`, `[ workspace_id, event_type ]` or `[ workspace_id, event_type, created_at ]`.
92
+ # filter_gt - object - If set, return records where the specified field is greater than the supplied value. Valid fields are `created_at`.
93
+ # filter_gteq - object - If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `created_at`.
94
+ # filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `event_type`.
95
+ # filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `created_at`.
96
+ # filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `created_at`.
97
+ def self.list(params = {}, options = {})
98
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String)
99
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer)
100
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
101
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)
102
+ raise InvalidParameterError.new("Bad parameter: filter_gt must be an Hash") if params[:filter_gt] and !params[:filter_gt].is_a?(Hash)
103
+ raise InvalidParameterError.new("Bad parameter: filter_gteq must be an Hash") if params[:filter_gteq] and !params[:filter_gteq].is_a?(Hash)
104
+ raise InvalidParameterError.new("Bad parameter: filter_prefix must be an Hash") if params[:filter_prefix] and !params[:filter_prefix].is_a?(Hash)
105
+ raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params[:filter_lt] and !params[:filter_lt].is_a?(Hash)
106
+ raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params[:filter_lteq] and !params[:filter_lteq].is_a?(Hash)
107
+
108
+ List.new(EventRecord, params) do
109
+ Api.send_request("/event_records", :get, params, options)
110
+ end
111
+ end
112
+
113
+ def self.all(params = {}, options = {})
114
+ list(params, options)
115
+ end
116
+
117
+ # Parameters:
118
+ # id (required) - int64 - Event Record ID.
119
+ def self.find(id, params = {}, options = {})
120
+ params ||= {}
121
+ params[:id] = id
122
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
123
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
124
+
125
+ response, options = Api.send_request("/event_records/#{params[:id]}", :get, params, options)
126
+ EventRecord.new(response.data, options)
127
+ end
128
+
129
+ def self.get(id, params = {}, options = {})
130
+ find(id, params, options)
131
+ end
132
+ end
133
+ end
@@ -0,0 +1,265 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class EventSubscription
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # int64 - Event Subscription ID
13
+ def id
14
+ @attributes[:id]
15
+ end
16
+
17
+ def id=(value)
18
+ @attributes[:id] = value
19
+ end
20
+
21
+ # int64 - Event Channel ID
22
+ def event_channel_id
23
+ @attributes[:event_channel_id]
24
+ end
25
+
26
+ def event_channel_id=(value)
27
+ @attributes[:event_channel_id] = value
28
+ end
29
+
30
+ # int64 - Workspace ID. 0 means the default workspace or site-wide.
31
+ def workspace_id
32
+ @attributes[:workspace_id]
33
+ end
34
+
35
+ def workspace_id=(value)
36
+ @attributes[:workspace_id] = value
37
+ end
38
+
39
+ # boolean - If true, this default-workspace subscription applies to events from all workspaces.
40
+ def apply_to_all_workspaces
41
+ @attributes[:apply_to_all_workspaces]
42
+ end
43
+
44
+ def apply_to_all_workspaces=(value)
45
+ @attributes[:apply_to_all_workspaces] = value
46
+ end
47
+
48
+ # string - Event Subscription name.
49
+ def name
50
+ @attributes[:name]
51
+ end
52
+
53
+ def name=(value)
54
+ @attributes[:name] = value
55
+ end
56
+
57
+ # boolean - Whether this Event Subscription can dispatch events.
58
+ def enabled
59
+ @attributes[:enabled]
60
+ end
61
+
62
+ def enabled=(value)
63
+ @attributes[:enabled] = value
64
+ end
65
+
66
+ # array(string) - Event type strings matched by this subscription. Blank means all event types.
67
+ def event_types
68
+ @attributes[:event_types]
69
+ end
70
+
71
+ def event_types=(value)
72
+ @attributes[:event_types] = value
73
+ end
74
+
75
+ # object - Structured event payload filter.
76
+ def filter
77
+ @attributes[:filter]
78
+ end
79
+
80
+ def filter=(value)
81
+ @attributes[:filter] = value
82
+ end
83
+
84
+ # object - Event Subscription delivery policy.
85
+ def delivery_policy
86
+ @attributes[:delivery_policy]
87
+ end
88
+
89
+ def delivery_policy=(value)
90
+ @attributes[:delivery_policy] = value
91
+ end
92
+
93
+ # array(int64) - Event Target IDs this subscription sends to.
94
+ def event_target_ids
95
+ @attributes[:event_target_ids]
96
+ end
97
+
98
+ def event_target_ids=(value)
99
+ @attributes[:event_target_ids] = value
100
+ end
101
+
102
+ # date-time - Event Subscription create date/time.
103
+ def created_at
104
+ @attributes[:created_at]
105
+ end
106
+
107
+ # date-time - Event Subscription update date/time.
108
+ def updated_at
109
+ @attributes[:updated_at]
110
+ end
111
+
112
+ # Parameters:
113
+ # event_channel_id - int64 - Event Channel ID
114
+ # workspace_id - int64 - Workspace ID. 0 means the default workspace or site-wide.
115
+ # apply_to_all_workspaces - boolean - If true, this default-workspace subscription applies to events from all workspaces.
116
+ # name - string - Event Subscription name.
117
+ # enabled - boolean - Whether this Event Subscription can dispatch events.
118
+ # event_types - array(string) - Event type strings matched by this subscription. Blank means all event types.
119
+ # filter - object - Structured event payload filter.
120
+ # delivery_policy - object - Event Subscription delivery policy.
121
+ # event_target_ids - array(int64) - Event Target IDs this subscription sends to.
122
+ def update(params = {})
123
+ params ||= {}
124
+ params[:id] = @attributes[:id]
125
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
126
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
127
+ raise InvalidParameterError.new("Bad parameter: event_channel_id must be an Integer") if params[:event_channel_id] and !params[:event_channel_id].is_a?(Integer)
128
+ raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
129
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
130
+ raise InvalidParameterError.new("Bad parameter: event_types must be an Array") if params[:event_types] and !params[:event_types].is_a?(Array)
131
+ raise InvalidParameterError.new("Bad parameter: event_target_ids must be an Array") if params[:event_target_ids] and !params[:event_target_ids].is_a?(Array)
132
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
133
+
134
+ Api.send_request("/event_subscriptions/#{@attributes[:id]}", :patch, params, @options)
135
+ end
136
+
137
+ def delete(params = {})
138
+ params ||= {}
139
+ params[:id] = @attributes[:id]
140
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
141
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
142
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
143
+
144
+ Api.send_request("/event_subscriptions/#{@attributes[:id]}", :delete, params, @options)
145
+ end
146
+
147
+ def destroy(params = {})
148
+ delete(params)
149
+ nil
150
+ end
151
+
152
+ def save
153
+ if @attributes[:id]
154
+ new_obj = update(@attributes)
155
+ else
156
+ new_obj = EventSubscription.create(@attributes, @options)
157
+ end
158
+
159
+ @attributes = new_obj.attributes
160
+ true
161
+ end
162
+
163
+ # Parameters:
164
+ # cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
165
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
166
+ # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `enabled`, `event_channel_id` or `workspace_id`.
167
+ # filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `enabled`, `event_channel_id` or `workspace_id`. Valid field combinations are `[ enabled, event_channel_id ]`, `[ workspace_id, enabled ]` or `[ workspace_id, enabled, event_channel_id ]`.
168
+ def self.list(params = {}, options = {})
169
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String)
170
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer)
171
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
172
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)
173
+
174
+ List.new(EventSubscription, params) do
175
+ Api.send_request("/event_subscriptions", :get, params, options)
176
+ end
177
+ end
178
+
179
+ def self.all(params = {}, options = {})
180
+ list(params, options)
181
+ end
182
+
183
+ # Parameters:
184
+ # id (required) - int64 - Event Subscription ID.
185
+ def self.find(id, params = {}, options = {})
186
+ params ||= {}
187
+ params[:id] = id
188
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
189
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
190
+
191
+ response, options = Api.send_request("/event_subscriptions/#{params[:id]}", :get, params, options)
192
+ EventSubscription.new(response.data, options)
193
+ end
194
+
195
+ def self.get(id, params = {}, options = {})
196
+ find(id, params, options)
197
+ end
198
+
199
+ # Parameters:
200
+ # event_channel_id - int64 - Event Channel ID
201
+ # workspace_id - int64 - Workspace ID. 0 means the default workspace or site-wide.
202
+ # apply_to_all_workspaces - boolean - If true, this default-workspace subscription applies to events from all workspaces.
203
+ # name (required) - string - Event Subscription name.
204
+ # enabled - boolean - Whether this Event Subscription can dispatch events.
205
+ # event_types - array(string) - Event type strings matched by this subscription. Blank means all event types.
206
+ # filter - object - Structured event payload filter.
207
+ # delivery_policy - object - Event Subscription delivery policy.
208
+ # event_target_ids - array(int64) - Event Target IDs this subscription sends to.
209
+ def self.create(params = {}, options = {})
210
+ raise InvalidParameterError.new("Bad parameter: event_channel_id must be an Integer") if params[:event_channel_id] and !params[:event_channel_id].is_a?(Integer)
211
+ raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
212
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
213
+ raise InvalidParameterError.new("Bad parameter: event_types must be an Array") if params[:event_types] and !params[:event_types].is_a?(Array)
214
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)
215
+ raise InvalidParameterError.new("Bad parameter: delivery_policy must be an Hash") if params[:delivery_policy] and !params[:delivery_policy].is_a?(Hash)
216
+ raise InvalidParameterError.new("Bad parameter: event_target_ids must be an Array") if params[:event_target_ids] and !params[:event_target_ids].is_a?(Array)
217
+ raise MissingParameterError.new("Parameter missing: name") unless params[:name]
218
+
219
+ response, options = Api.send_request("/event_subscriptions", :post, params, options)
220
+ EventSubscription.new(response.data, options)
221
+ end
222
+
223
+ # Parameters:
224
+ # event_channel_id - int64 - Event Channel ID
225
+ # workspace_id - int64 - Workspace ID. 0 means the default workspace or site-wide.
226
+ # apply_to_all_workspaces - boolean - If true, this default-workspace subscription applies to events from all workspaces.
227
+ # name - string - Event Subscription name.
228
+ # enabled - boolean - Whether this Event Subscription can dispatch events.
229
+ # event_types - array(string) - Event type strings matched by this subscription. Blank means all event types.
230
+ # filter - object - Structured event payload filter.
231
+ # delivery_policy - object - Event Subscription delivery policy.
232
+ # event_target_ids - array(int64) - Event Target IDs this subscription sends to.
233
+ def self.update(id, params = {}, options = {})
234
+ params ||= {}
235
+ params[:id] = id
236
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
237
+ raise InvalidParameterError.new("Bad parameter: event_channel_id must be an Integer") if params[:event_channel_id] and !params[:event_channel_id].is_a?(Integer)
238
+ raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
239
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
240
+ raise InvalidParameterError.new("Bad parameter: event_types must be an Array") if params[:event_types] and !params[:event_types].is_a?(Array)
241
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)
242
+ raise InvalidParameterError.new("Bad parameter: delivery_policy must be an Hash") if params[:delivery_policy] and !params[:delivery_policy].is_a?(Hash)
243
+ raise InvalidParameterError.new("Bad parameter: event_target_ids must be an Array") if params[:event_target_ids] and !params[:event_target_ids].is_a?(Array)
244
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
245
+
246
+ response, options = Api.send_request("/event_subscriptions/#{params[:id]}", :patch, params, options)
247
+ EventSubscription.new(response.data, options)
248
+ end
249
+
250
+ def self.delete(id, params = {}, options = {})
251
+ params ||= {}
252
+ params[:id] = id
253
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
254
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
255
+
256
+ Api.send_request("/event_subscriptions/#{params[:id]}", :delete, params, options)
257
+ nil
258
+ end
259
+
260
+ def self.destroy(id, params = {}, options = {})
261
+ delete(id, params, options)
262
+ nil
263
+ end
264
+ end
265
+ end