files.com 1.1.620 → 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,192 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class EventChannel
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # int64 - Event Channel ID
13
+ def id
14
+ @attributes[:id]
15
+ end
16
+
17
+ def id=(value)
18
+ @attributes[:id] = value
19
+ end
20
+
21
+ # string - Event Channel name.
22
+ def name
23
+ @attributes[:name]
24
+ end
25
+
26
+ def name=(value)
27
+ @attributes[:name] = value
28
+ end
29
+
30
+ # string - Event Channel description.
31
+ def description
32
+ @attributes[:description]
33
+ end
34
+
35
+ def description=(value)
36
+ @attributes[:description] = value
37
+ end
38
+
39
+ # boolean - Whether this Event Channel can dispatch events.
40
+ def enabled
41
+ @attributes[:enabled]
42
+ end
43
+
44
+ def enabled=(value)
45
+ @attributes[:enabled] = value
46
+ end
47
+
48
+ # boolean - Whether this Event Channel is the default destination for newly published events.
49
+ def default_channel
50
+ @attributes[:default_channel]
51
+ end
52
+
53
+ def default_channel=(value)
54
+ @attributes[:default_channel] = value
55
+ end
56
+
57
+ # date-time - Event Channel create date/time.
58
+ def created_at
59
+ @attributes[:created_at]
60
+ end
61
+
62
+ # date-time - Event Channel update date/time.
63
+ def updated_at
64
+ @attributes[:updated_at]
65
+ end
66
+
67
+ # Parameters:
68
+ # name - string - Event Channel name.
69
+ # description - string - Event Channel description.
70
+ # enabled - boolean - Whether this Event Channel can dispatch events.
71
+ # default_channel - boolean - Whether this Event Channel is the default destination for newly published events.
72
+ def update(params = {})
73
+ params ||= {}
74
+ params[:id] = @attributes[:id]
75
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
76
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
77
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
78
+ raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String)
79
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
80
+
81
+ Api.send_request("/event_channels/#{@attributes[:id]}", :patch, params, @options)
82
+ end
83
+
84
+ def delete(params = {})
85
+ params ||= {}
86
+ params[:id] = @attributes[:id]
87
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
88
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
89
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
90
+
91
+ Api.send_request("/event_channels/#{@attributes[:id]}", :delete, params, @options)
92
+ end
93
+
94
+ def destroy(params = {})
95
+ delete(params)
96
+ nil
97
+ end
98
+
99
+ def save
100
+ if @attributes[:id]
101
+ new_obj = update(@attributes)
102
+ else
103
+ new_obj = EventChannel.create(@attributes, @options)
104
+ end
105
+
106
+ @attributes = new_obj.attributes
107
+ true
108
+ end
109
+
110
+ # Parameters:
111
+ # 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.
112
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
113
+ # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `enabled` and `default_channel`.
114
+ # filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `enabled` and `default_channel`.
115
+ def self.list(params = {}, options = {})
116
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String)
117
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer)
118
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
119
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)
120
+
121
+ List.new(EventChannel, params) do
122
+ Api.send_request("/event_channels", :get, params, options)
123
+ end
124
+ end
125
+
126
+ def self.all(params = {}, options = {})
127
+ list(params, options)
128
+ end
129
+
130
+ # Parameters:
131
+ # id (required) - int64 - Event Channel ID.
132
+ def self.find(id, params = {}, options = {})
133
+ params ||= {}
134
+ params[:id] = id
135
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
136
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
137
+
138
+ response, options = Api.send_request("/event_channels/#{params[:id]}", :get, params, options)
139
+ EventChannel.new(response.data, options)
140
+ end
141
+
142
+ def self.get(id, params = {}, options = {})
143
+ find(id, params, options)
144
+ end
145
+
146
+ # Parameters:
147
+ # name (required) - string - Event Channel name.
148
+ # description - string - Event Channel description.
149
+ # enabled - boolean - Whether this Event Channel can dispatch events.
150
+ # default_channel - boolean - Whether this Event Channel is the default destination for newly published events.
151
+ def self.create(params = {}, options = {})
152
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
153
+ raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String)
154
+ raise MissingParameterError.new("Parameter missing: name") unless params[:name]
155
+
156
+ response, options = Api.send_request("/event_channels", :post, params, options)
157
+ EventChannel.new(response.data, options)
158
+ end
159
+
160
+ # Parameters:
161
+ # name - string - Event Channel name.
162
+ # description - string - Event Channel description.
163
+ # enabled - boolean - Whether this Event Channel can dispatch events.
164
+ # default_channel - boolean - Whether this Event Channel is the default destination for newly published events.
165
+ def self.update(id, params = {}, options = {})
166
+ params ||= {}
167
+ params[:id] = id
168
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
169
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
170
+ raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String)
171
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
172
+
173
+ response, options = Api.send_request("/event_channels/#{params[:id]}", :patch, params, options)
174
+ EventChannel.new(response.data, options)
175
+ end
176
+
177
+ def self.delete(id, params = {}, options = {})
178
+ params ||= {}
179
+ params[:id] = id
180
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
181
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
182
+
183
+ Api.send_request("/event_channels/#{params[:id]}", :delete, params, options)
184
+ nil
185
+ end
186
+
187
+ def self.destroy(id, params = {}, options = {})
188
+ delete(id, params, options)
189
+ nil
190
+ end
191
+ end
192
+ end
@@ -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